Give option to disable up/down movement in source select widget
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 16 Sep 2010 21:07:20 +0000 (15:07 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Sep 2010 21:14:51 +0000 (15:14 -0600)
framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php
horde/templates/prefs/source.html

index f8f98c1..3ce0cf9 100644 (file)
@@ -30,6 +30,8 @@ class Horde_Core_Prefs_Ui_Widgets
      * @param array $data  Data items:
      * <pre>
      * 'mainlabel' - (string) Main label.
+     * 'no_up' - (boolean) [OPTIONAL] Disable movement of selected items
+     *           up/down.
      * 'selectlabel' - (array) Selected label.
      * 'sourcelabel' - (string) [OPTIONAL] Source selection label.
      * 'sources' - (array) List of sources - keys are source names. Each
@@ -90,8 +92,10 @@ class Horde_Core_Prefs_Ui_Widgets
         $t->set('addimg', Horde::img(isset($GLOBALS['registry']->nlsconfig['rtl'][$GLOBALS['language']]) ? 'lhand.png' : 'rhand.png', _("Add source")));
         $t->set('removeimg', Horde::img(isset($GLOBALS['registry']->nlsconfig['rtl'][$GLOBALS['language']]) ? 'rhand.png' : 'lhand.png', _("Remove source")));
 
-        $t->set('upimg', Horde::img('nav/up.png', _("Move up")));
-        $t->set('downimg', Horde::img('nav/down.png', _("Move down")));
+        if (empty($data['no_up'])) {
+            $t->set('upimg', Horde::img('nav/up.png', _("Move up")));
+            $t->set('downimg', Horde::img('nav/down.png', _("Move down")));
+        }
 
         return $t->fetch(HORDE_TEMPLATES . '/prefs/source.html');
     }
index 4a958a4..cf9ff88 100644 (file)
 </if:selected>
     </select>
    </td>
+<if:upimg>
    <td>
     <a href="#" id="moveup"><tag:upimg /></a>
     <br />
     <a href="#" id="movedown"><tag:downimg /></a>
    </td>
+</if:upimg>
   </tr>
  </table>
 </div>