Only show map link if the is a location.
authorJan Schneider <jan@horde.org>
Fri, 12 Feb 2010 14:33:00 +0000 (15:33 +0100)
committerJan Schneider <jan@horde.org>
Fri, 12 Feb 2010 14:33:00 +0000 (15:33 +0100)
Tweak edit form.

kronolith/js/kronolith.js
kronolith/templates/index/edit.inc

index 6d3c0a5..12cfb4f 100644 (file)
@@ -2483,10 +2483,16 @@ KronolithCore = {
 
     keyupHandler: function(e)
     {
-        /*
-        if (e.element().readAttribute('id') == 'foo') {
+        switch (e.element().readAttribute('id')) {
+        case 'kronolithEventLocation':
+            if ($F('kronolithEventLocation')) {
+                $('kronolithEventMapLink').show();
+            } else {
+                $('kronolithEventMapLink').hide();
+            }
+            return;
         }
-        */
+
     },
 
     clickHandler: function(e, dblclick)
@@ -3238,6 +3244,7 @@ KronolithCore = {
         this.toggleAllDay(false);
         $('kronolithEventForm').enable();
         $('kronolithEventForm').reset();
+        $('kronolithEventMapLink').hide();
         $('kronolithEventSave').show();
         $('kronolithEventDelete').show();
         $('kronolithEventForm').down('.kronolithFormActions').down('.kronolithSep').show();
@@ -3370,6 +3377,9 @@ KronolithCore = {
         $('kronolithEventTarget').setValue(ev.ty + '|' + ev.c);
         $('kronolithEventTitle').setValue(ev.t);
         $('kronolithEventLocation').setValue(ev.l);
+        if (ev.l) {
+            $('kronolithEventMapLink').show();
+        }
         $('kronolithEventUrl').setValue(ev.u);
         $('kronolithEventAllday').setValue(ev.al);
         this.toggleAllDay(ev.al);
index 69f0a28..785aa31 100644 (file)
 </div>
 
 <div>
-<table cellspacing="0" cellpadding="0" border="0"><tbody><tr>
+<table id="kronolithEventBasics" cellspacing="0" cellpadding="0" border="0"><tbody><tr>
   <td>
-    <label for="kronolithEventCalendar"><?php echo _("Calendar") ?>:</label>
-    <select name="targetcalendar" id="kronolithEventTarget">
-    </select>
+    <label for="kronolithEventCalendar"><?php echo _("Calendar") ?>:<br />
+      <select name="targetcalendar" id="kronolithEventTarget"></select>
+    </label>
   </td>
   <td>
-    <label for="kronolithEventLocation"><?php echo _("Location") ?>:</label>
-    <input type="text" name="location" id="kronolithEventLocation" size="40" />
-    <?php if ($GLOBALS['conf']['maps']['driver']):?>
-    &middot; <span><a class="kronolithEventGeo" href="#"><?php echo _("Find in Maps") ?></a></span>
+    <label for="kronolithEventLocation"><?php echo _("Location") ?>:<br />
+      <input type="text" name="location" id="kronolithEventLocation" size="40" />
+    </label>
+    <?php if ($GLOBALS['conf']['maps']['driver']): ?>
+    <span id="kronolithEventMapLink" style="display:none">
+      &middot; <span><a class="kronolithEventGeo" href="#"><?php echo _("Find in Maps") ?></a></span>
+    </span>
     <?php endif; ?>
   </td>
 </tr></tbody></table>
@@ -31,7 +34,7 @@
 <table id="kronolithEventDates" cellspacing="0" cellpadding="0" border="0"><tbody>
   <tr>
     <td>
-      <label for="kronolithEventStartDate">
+      <label>
         <?php echo _("From") ?>:<br />
         <input type="text" name="start_date" id="kronolithEventStartDate" size="10" />
         <?php echo Horde::img('picker.png', _("Set start date"), 'id="kronolithEventStartPicker"') ?>
@@ -42,7 +45,7 @@
       </label>
     </td>
     <td>
-      <label for="kronolithEventEndDate"><?php echo _("To") ?>:<br />
+      <label><?php echo _("To") ?>:<br />
         <input type="text" name="end_date" id="kronolithEventEndDate" size="10" />
         <?php echo Horde::img('picker.png', _("Set end date"), 'id="kronolithEventEndPicker"') ?>
       </label>