Bug 8015: Add MARC Modifications Templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / currency.tt
index d2d0597..99f693b 100644 (file)
         }
     }
 
-    $(document).ready(function() {
-        new YAHOO.widget.Button("newcurrency");
+    function check_currency(val) {
+        if ( val == 1.0 ) {
+            $("#active").removeAttr('disabled');
+            $("#hint").html("");
+        } else {
+            $("#active").removeAttr('checked');
+            $("#active").attr('disabled','disabled');
+            $("#hint").html(_("The active currency must have a rate of 1.0"));
+        }
+    }
 
+    $(document).ready(function() {
         // prevents users to check active with a currency != 1
         $("#rate").keyup(function() {
-            if ( $(this).val() == 1.0 ) {
-                $("#active").removeAttr('disabled');
-            } else {
-                $("#active").removeAttr('checked');
-                $("#active").attr('disabled','disabled');
-            }
+            check_currency( $(this).val() );
         });
+        check_currency( $("#rate").val() );
     });
 //]]>
 </script>
     <div class="yui-b">
 
 [% IF ( else ) %]
-<div id="toolbar">
-    <ul class="toolbar">
-    <li><a id="newcurrency" href="[% script_name %]?op=add_form">New currency</a></li>
-</ul></div>
+<div id="toolbar" class="btn-toolbar">
+    <a class="btn btn-small" id="newcurrency" href="[% script_name %]?op=add_form"><i class="icon-plus"></i> New currency</a>
+</div>
 [% END %]
 
 [% IF ( add_form ) %]
             [% ELSE %]
             <input type="checkbox" id="active" name="active" value="1" />
             [% END %]
+            <span id="hint" class="hint"></span>
         </li>
 
         </ol>
         </fieldset>
 
     <fieldset class="action">
-        <input type="submit" value="Submit" onclick="Check(this.form)" />
+        <input type="submit" value="Submit" onclick="Check(this.form); return false;" />
         <a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
     </fieldset>
     </form>