Bug 11764 - Move repeatedly redefined function toUC() into staff-global.js
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / currency.tt
index f9f2cb9..def9a02 100644 (file)
@@ -1,17 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange Rates &rsaquo;
-[% IF ( add_form ) %][% IF ( searchfield ) %]Modify Currency '[% searchfield %]'[% ELSE %]New Currency[% END %][% END %]
-[% IF ( delete_confirm ) %]Confirm Deletion of Currency '[% searchfield %]'[% END %]
-[% IF ( delete_confirmed ) %]Currency Deleted[% END %]
+<title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
+[% IF ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
+[% IF ( delete_confirm ) %]Confirm deletion of currency '[% searchfield %]'[% END %]
+[% IF ( delete_confirmed ) %]Currency deleted[% END %]
 [% IF ( else ) %]Currencies[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <script type="text/javascript">
 //<![CDATA[
-    function toUC(f) {
-        var x=f.value.toUpperCase();
-        f.value=x;
-        return true;
-    }
     function Check(f) {
         var _alertString="";
         var alertString2;
         }
     }
 
-    $(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>
 </head>
-<body>
+<body id="admin_currency" class="admin">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'currencies-admin-search.inc' %]
 
 
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange Rates</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %]Modify Currency '[% searchfield %]'[% ELSE %]New Currency[% END %][% END %]
-[% IF ( delete_confirm ) %]Confirm Deletion of Currency '<span class="ex">[% searchfield %]</span>'[% END %]
-[% IF ( delete_confirmed ) %]Currency Deleted[% END %]
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange rates</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
+[% IF ( delete_confirm ) %]Confirm deletion of currency '<span class="ex">[% searchfield %]</span>'[% END %]
+[% IF ( delete_confirmed ) %]Currency deleted[% END %]
 [% IF ( else ) %]Currencies[% END %]
 </div>
 
     <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 ) %]
         </li>
 
         <li>
-            <span class="label">Last Updated: </span>[% timestamp %]
+            <span class="label">Last updated: </span>[% timestamp %]
         </li>
         <li>
             <label for="active">Active: </label>
             [% 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>
 [% IF ( delete_confirm ) %]
     [% IF ( totalgtzero ) %]
     <div class="dialog message">
-        <h3>Cannot Delete Currency <span class="ex">'[% searchfield %]'</span></h3>
+        <h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
         <p>This currency is used [% total %] times. Deletion not possible</p>
         <form action="[% script_name %]" method="post">
             <input type="submit" value="OK" class="approve" />
     </div>
     [% ELSE %]
     <div class="dialog alert">
-        <h3>Confirm Deletion of Currency <span class="ex">'[% searchfield %]'</span></h3>
+        <h3>Confirm deletion of currency <span class="ex">'[% searchfield %]'</span></h3>
         <table>
             <tr><th>Currency</th>
                 <td>[% searchfield %]</td>
 [% END %]
 
 [% IF ( delete_confirmed ) %]
-<div class="dialog message"><h3>Currency Deleted</h3>
+<div class="dialog message"><h3>Currency deleted</h3>
 <form action="[% script_name %]" method="post">
     <input type="submit" class="approve" value="OK" />
 </form></div>
 
 [% IF ( else ) %]
 
-<h2>Currencies and Exchange Rates</h2>
+<h2>Currencies and exchange rates</h2>
 
 [% IF ( loop ) %][% UNLESS ( activecurrency ) %]<div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div>[% END %][% END %]
 
             <th>Currency</th>
             <th>Rate</th>
             <th>Symbol</th>
-            <th>Last Updated</th>
+            <th>Last updated</th>
             <th>Active</th>
             <th colspan="2">Actions&nbsp;</th>
         </tr>