[dev] Kronolith patch - color + category

Joel Vandal jvandal@subi.to
Thu, 5 Sep 2002 19:03:38 -0400


Hi,

I have make some modification to the category management preference to merge
it with the color selection.

I have some idea for a new application category system for Horde :

 - A new class for category management for each application (like :
lib/CategoryUser.php)
 - Create sub-category (parent/child)
 - Automaticaly change the color of the category when choose a new color
(but only save when user click on save button)

A lot of Horde application (Kronolith, Mnemo, Nag, Trean(?)) have category
support.

--
Joel Vandal
Infoteck Internet

===================================================================
RCS file: /repository/kronolith/prefs.php,v
retrieving revision 1.19
diff -r1.19 prefs.php
11,26d10
< function handle_choose_event_colors($updated)
< {
<     global $prefs;
<
<     $newcolors = Horde::getFormData('newColors');
<     $event_colors = '';
<     foreach ($newcolors as $key => $color) {
<         $event_colors .= (empty($event_colors)) ? "$key:$color" :
"|$key:$color";
<     }
<
<     $prefs->setValue('event_colors', $event_colors);
<     $update = true;
<
<     return true;
< }
<
28a13,14
>     global $prefs;
>
31a18
>     $newcolors = Horde::getFormData('newColors');
32a20,21
>
>
43c32
<             Kronolith::addCategory($categoryName);
---
>     Kronolith::addCategory($categoryName);
45c34
<
---
>
47a37,44
>
>     $event_colors = '';
>     foreach ($newcolors as $key => $color) {
> $event_colors .= (empty($event_colors)) ? "$key:$color" : "|$key:$color";
>     }
>
>     $prefs->setValue('event_colors', $event_colors);
>
Index: config/prefs.php.dist
===================================================================
RCS file: /repository/kronolith/config/prefs.php.dist,v
retrieving revision 1.26
diff -r1.26 prefs.php.dist
47,52d46
< $prefGroups['categories'] = array(
<     'column'  => _("Other Options"),
<     'label'   => _("Category Colors"),
<     'desc'    => _("Choose the event colors for each category."),
<     'members' => array('choose_event_colors'));
<
218,225d211
<
< // category highlight colors
< $_prefs['choose_event_colors'] = array(
<     'value' => '',
<     'locked' => false,
<     'shared' => false,
<     'type' => 'special',
<     'desc' => _("Choose Color"));
Index: lib/Kronolith.php
===================================================================
RCS file: /repository/kronolith/lib/Kronolith.php,v
retrieving revision 1.60
diff -r1.60 Kronolith.php
47a48
> define('KRONOLITH_COLOR_CATEGORY', 109);
Index: shares/prefs.php
===================================================================
RCS file: /repository/kronolith/shares/prefs.php,v
retrieving revision 1.10
diff -r1.10 prefs.php
93c93
<         $notification->push(sprintf(_("The calendar \"%s\" has been
deleted."), $share->getShareName()), 'horde.success');
---
>         $notification->push(sprintf(_("The calendar \"%s\" has been
deleted."), $id), 'horde.success');
Index: templates/prefs/category_management.inc
===================================================================
RCS file: /repository/kronolith/templates/prefs/category_management.inc,v
retrieving revision 1.1
diff -r1.1 category_management.inc
33d32
<
55a55
>     $url = $registry->getParam('webroot', 'horde') .
'/util/colorpicker.php?target=newColors[' . $key . ']';
58c58,59
<   <td style="background-color:<?php echo $color ?>"><b><?php echo $name
?></b></td>
---
>   <td style="background-color:<?php echo $color ?>">
>   <b><?php echo $name ?></b></td>
61a63,68
>
>     <a href="#" onclick="window.open('<?php echo $url ?>', 'colorpicker',
'toolbar=no,location=no,status=no,scrollbars=no,resizable=no,width=100,heigh
t=230,left=100,top=100'); return false;" onmouseout="window.status='';"
onmouseover="window.status='<?php echo _('Color Picker') ?>'; return true;"
class="widget" target="colorpicker">
>       <?php Horde::pimg('colorpicker.gif', _('Color Picker'),
'height="16"', $registry->getParam('graphics', 'horde')) ?></a>
>
>     <input type="hidden" name="newColors[<?php echo $key ?>]" value="<?php
echo (array_key_exists($key, $colors)) ? $colors[$key] : '#ffffff' ?>" />
>