[dev] Patch for kronolith categories

Jason Rust jrust at rustyparts.com
Fri May 9 16:16:52 PDT 2003


Below is a patch that doesn't show the color picker for kronolith
categories if the pref is locked (since it won't be saved anyway).  The
patch also uses the default_share pref for getting the appropriate
colors.  Otherwise, if the default share is something other than
Auth::getAuth() the categories for the default share show up without the
correct colors.

-Jason

Index: category_management.inc
===================================================================
RCS file: /repository/kronolith/templates/prefs/category_management.inc,v
retrieving revision 1.6
diff -u -r1.6 category_management.inc
--- category_management.inc     4 Dec 2002 18:15:30 -0000       1.6
+++ category_management.inc     9 May 2003 20:07:34 -0000
@@ -51,7 +51,8 @@
 <?php
 $categories = Kronolith::listCategories();
 $_colors = Kronolith::categoryColors();
-$colors = isset($_colors[Auth::getAuth()]) ? $_colors[Auth::getAuth()] : array();
+$calendar_id = $prefs->getValue('default_share');
+$colors = isset($_colors[$calendar_id]) ? $_colors[$calendar_id] : array();
 foreach ($categories as $key => $name):
     $color = isset($colors[$key]) ? $colors[$key] : '#ffffff';
     $url = $registry->getParam('webroot', 'horde') . Horde::addParameter('/util/colorpicker.php?target=newColors[' . $key . ']',
@@ -62,9 +63,11 @@
   <td>
     <a href='#' onclick="deleteCategory('<?php echo $key ?>'); return false;"><?php echo _("Delete") ?></a>&nbsp;|&nbsp;
     <a href='#' onclick="renameCategory('<?php echo $key ?>'); return false;"><?php echo _("Rename") ?></a>&nbsp;|&nbsp;
+    <?php if (!$prefs->isLocked('event_colors')): ?>
     <a href="<?php echo $url ?>" onclick="window.open('<?php echo $url ?>', 'colorpicker', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=no,width=120,height=250,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 style="background-color:<?php echo $color ?>" name="newColors[<?php echo $key ?>]" value="<?php echo $color ?>" />
+    <?php endif; ?>
   </td>
 </tr>
 <?php endforeach; ?>



More information about the dev mailing list