Move prefs javascript to its own file
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 11 Aug 2010 02:44:48 +0000 (20:44 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 11 Aug 2010 02:44:48 +0000 (20:44 -0600)
framework/Core/lib/Horde/Core/Prefs/Ui.php
horde/js/prefs.js [new file with mode: 0644]
horde/templates/prefs/app.html

index 0576c5b..9b8c576 100644 (file)
@@ -386,6 +386,7 @@ class Horde_Core_Prefs_Ui
          * do things like add javascript to the page output. This should all
          * be combined and served in the page HEAD. */
         Horde::startBuffer();
+        Horde::addScriptFile('prefs.js', 'horde');
 
         if ($this->group) {
             if ($identities) {
diff --git a/horde/js/prefs.js b/horde/js/prefs.js
new file mode 100644 (file)
index 0000000..fc60897
--- /dev/null
@@ -0,0 +1,14 @@
+/**
+ * Provides the javascript for the prefs page.
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ */
+
+document.observe('dom:loaded', function() {
+    $('appsubmit').hide();
+
+    $('app').observe('change', function() {
+        $('appswitch').submit();
+    });
+});
index 0566661..094a719 100644 (file)
@@ -3,7 +3,7 @@
  <tag:forminput />
  <div class="header">
   <span class="smallheader rightFloat">
-   <select id="app" name="app" onchange="document.appswitch.submit();">
+   <select id="app" name="app">
     <option value=""><gettext>Edit Options for</gettext>:</option>
 <if:horde>
     <option value="" disabled="disabled">- - - - - - - - -</option>
@@ -14,7 +14,7 @@
     <option value="<tag:apps.v />"><tag:apps.l /></option>
 </loop:apps>
    </select>
-   <input class="button" type="submit" onclick="return document.appswitch.app.selectedIndex != 0;" value="<gettext>Go</gettext>" />
+   <input class="button" type="submit" id="appsubmit" value="<gettext>Go</gettext>" />
   </span>
   <span class="rightFloat prefsAdvanced">
 <if:advanced>