[nag] Re: default category

Bill Dossett bd at emtex.com
Thu Mar 13 13:52:22 PST 2003


Hi Brian,  thanks for the patch.. it mostly works.. well it works well
enough for me anway, I'm not quite at head and I applied
the patch manually.. but when I go to options under nag,
it just shows two static pieces of text

your information           other options

nothing below them.... I'm actually happy with it as
is, but I guess at some point I'd like to get this
to work....  not sure if it's cos I'm not at HEAD
that it didnt' work or what, but everything around
the patched code looked identical...

I guess I'll try and get to HEAD later today and hopefully
the patch will work all the way then I guess...

I want to try shared todo lists so I want to try nag 2
at some point anyway as well, hopefully I'll understand
this well enough so I can make my own patches soon...

thanks again

Bill


Brian Keifer wrote:
> Attached is a patch against HEAD that allows users to select a default task
> category.  If this one works out, I'll whip up a quick adaptation for mnemo,
> too.  categoryselect.inc is a new file, and lives in nag/templates/prefs.
> 
> -Brian
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: prefs.php
> ===================================================================
> RCS file: /usr/home/cvs/horde/nag/prefs.php,v
> retrieving revision 1.25
> diff -u -r1.25 prefs.php
> --- prefs.php	3 Jan 2003 12:44:45 -0000	1.25
> +++ prefs.php	12 Mar 2003 19:09:20 -0000
> @@ -45,6 +45,21 @@
>      return false;
>  }
>  
> +function handle_categoryselect($updated)
> +{
> +    global $prefs;
> +
> +    $default_task_category = Horde::getFormData('default_task_category');
> +    if (!is_null($default_task_category)) {
> +        $categories = Nag::listCategories();
> +        if (is_array($categories) && isset($categories[$default_task_category])) {
> +            $prefs->setValue('default_task_category', $default_task_category);
> +            $updated = true;
> +        }
> +    }
> +    return $updated;
> +}
> +
>  function handle_tasklistselect($updated)
>  {
>      global $prefs;
> Index: task.php
> ===================================================================
> RCS file: /usr/home/cvs/horde/nag/task.php,v
> retrieving revision 1.39
> diff -u -r1.39 task.php
> --- task.php	25 Feb 2003 21:51:31 -0000	1.39
> +++ task.php	13 Mar 2003 00:16:54 -0000
> @@ -29,7 +29,11 @@
>      $task_desc = '';
>      $task_priority = 3;
>      $task_completed = 0;
> -    $task_category = 0;
> +
> +    if (($task_category = $prefs->getValue('default_task_category')) == null) {
> +        $task_category = 0;
> +    }
> +
>      $task_alarm = 0;
>      $alarm_value = 15;
>      $alarm_unit = 'min';  
> Index: config/prefs.php.dist
> ===================================================================
> RCS file: /usr/home/cvs/horde/nag/config/prefs.php.dist,v
> retrieving revision 1.25
> diff -u -r1.25 prefs.php.dist
> --- config/prefs.php.dist	4 Mar 2003 20:47:13 -0000	1.25
> +++ config/prefs.php.dist	13 Mar 2003 00:26:34 -0000
> @@ -41,7 +41,7 @@
>      'column'  => _("Other Options"),
>      'label'   => _("Category Management"),
>      'desc'    => _("Allows categories to be added/removed/renamed."),
> -    'members' => array('category_management'));
> +    'members' => array('category_management', 'categoryselect'));
>  
>  
>  // user language
> @@ -133,6 +133,16 @@
>      'shared' => false,
>      'type' => 'special',
>      'desc' => _("Category Management"));
> +
> +// default category selection widget
> +$_prefs['categoryselect'] = array('type' => 'special');
> +
> +// default category selection
> +$_prefs['default_task_category'] = array(
> +    'value' => 0,
> +    'locked' => false,
> +    'shared' => true,
> +    'type' => 'implicit');
>  
>  // default tasklist selection widget
>  $_prefs['tasklistselect'] = array('type' => 'special');
> 
> 
> ------------------------------------------------------------------------
> 
> 





More information about the nag mailing list