[dev] Patch: No need to display calendar is default_share is locked

David U. davidu@everydns.net
Sat, 7 Sep 2002 01:16:28 -0500


 Hi,

Here's a small patch to remove the "calendar" dropdown in the event edit
page in case default_share is locked. (always one calendar)

I didn't know how to get the name of the default calendar's value but I
think it is just their username...so this patch might not be done right.
I'm also not sure if other people find it worthwhile either.  I just had
someone mention that they didn't see the point of the drop down if they
couldn't add calendars anyways.

ymmv,
davidu

Index: edit/edit.inc
===================================================================
RCS file: /repository/kronolith/templates/edit/edit.inc,v
retrieving revision 1.68
diff -p -u -r1.68 edit.inc
--- edit/edit.inc       6 Sep 2002 00:32:31 -0000       1.68
+++ edit/edit.inc       7 Sep 2002 06:12:08 -0000
@@ -77,20 +77,26 @@ $share = $_shares->getShare($_SESSION['k
 </tr>

 <!-- calendar -->
-<tr>
- <td align="right" class="light"><b><?php echo _("Calendar")
?>&nbsp;&nbsp;</b></td>
- <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="3">
-    <select name="targetcalendar">
-    <?php
-    foreach (Kronolith::listCalendars() as $id => $cal) {
-      if ($cal->hasPermission(Auth::getAuth(), _PERMS_EDIT)) {
-          $sel = ($id == $_SESSION['kronolith']['share']) ? '
selected="selected"' : '';
-          echo sprintf('<option value="%s"%s>%s</option>',
-                $id, $sel, $cal->getShareName());
-      }
-    } ?>
- </td>
-</tr>
+<?php if (!$prefs->isLocked('default_share')) { ?>
+    <tr>
+     <td align="right" class="light"><b><?php echo _("Calendar")
?>&nbsp;&nbsp;</b></td>
+     <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="3">
+        <select name="targetcalendar">
+        <?php
+        foreach (Kronolith::listCalendars() as $id => $cal) {
+          if ($cal->hasPermission(Auth::getAuth(), _PERMS_EDIT)) {
+              $sel = ($id == $_SESSION['kronolith']['share']) ? '
selected="selected"' : '';
+              echo sprintf('<option value="%s"%s>%s</option>',
+                    $id, $sel, $cal->getShareName());
+          }
+        }
+        ?>
+
+     </td>
+    </tr>
+<?php } else { ?>
+    <input type="hidden" name="targetcalendar" value="<?php echo
Auth::getAuth(); ?>">
+<?php } ?>

 <!-- category -->
 <tr>

--
"Never doubt that a small group of thoughtful citizens can change the
world. Indeed, it is the only thing that ever has." --Margaret Mead