Bug 21526: Use the 'url' filter when needed
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / auth_tag_structure.tt
index eb1d47e..1c1ce55 100644 (file)
+[% USE raw %]
+[% USE Asset %]
+[% USE AuthorisedValues %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Administration &rsaquo; Authority MARC framework [% IF ( add_form ) %][% IF ( use_heading_flags_p ) %]
-    [% IF ( heading_modify_tag_p ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default Framework[% END %] &rsaquo; Modify tag[% END %]
-    [% IF ( heading_add_tag_p ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default Framework[% END %] &rsaquo; New tag[% END %]
-    [% ELSE %]&rsaquo; [% action %][% END %][% END %][% IF ( delete_confirm ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default Framework[% END %] &rsaquo; Confirm Deletion[% END %][% IF ( delete_confirmed ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default Framework[% END %] &rsaquo; Data Deleted[% END %]</title>
+    [% IF ( heading_modify_tag_p ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode | html %] Framework[% ELSE %]Default framework[% END %] &rsaquo; Modify tag[% END %]
+    [% IF ( heading_add_tag_p ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode | html %] Framework[% ELSE %]Default framework[% END %] &rsaquo; New tag[% END %]
+    [% ELSE %]&rsaquo; [% action | html %][% END %][% END %][% IF ( delete_confirm ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode | html %] Framework[% ELSE %]Default framework[% END %] &rsaquo; Confirm deletion[% END %][% IF ( delete_confirmed ) %]&rsaquo; [% IF ( authtypecode ) %][% authtypecode | html %] Framework[% ELSE %]Default framework[% END %] &rsaquo; Data deleted[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
-<script type="text/javascript" id="js">$(document).ready(function() {
-       $("#table_authtagstructure").tablesorter({
-               sortList: [[0,0]],
-               headers: { 5: { sorter: false},6: { sorter: false},7: { sorter: false}}
-       }).tablesorterPager({container: $("#pagertable_authtagstructure"),positionFixed: false,size: 20});
-}); </script>
-<script type="text/javascript">
-//<![CDATA[
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    function isNotNull(f,noalert) {
-        if (f.value.length ==0) {
-return false;
-        }
-        return true;
-    }
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    function toUC(f) {
-        var x=f.value.toUpperCase();
-        f.value=x;
-        return true;
-    }
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    function isNum(v,maybenull) {
-    var n = new Number(v.value);
-    if (isNaN(n)) {
-        return false;
-        }
-    if (maybenull==0 && v.value=='') {
-        return false;
-    }
-    return true;
-    }
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    function isDate(f) {
-        var t = Date.parse(f.value);
-        if (isNaN(t)) {
-            return false;
-        }
-    }
-    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    function Check(f) {
-        var ok=1;
-        var _alertString="";
-        var alertString2;
-        if (f.tagfield.value.length==0) {
-            _alertString += "\n- " + _("tag number missing");
-        }
-        if (_alertString.length==0) {
-            document.Aform.submit();
-        } else {
-            alertString2  = _("Form not submitted because of the following problem(s)");
-            alertString2 += "\n------------------------------------------------------------------------------------\n";
-            alertString2 += _alertString;
-            alert(alertString2);
-        }
-    }
-    //]]>
-</script>
+
+[% Asset.css("css/datatables.css") | $raw %]
 </head>
-<body>
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'cat-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; [% IF ( add_form ) %][% IF ( use_heading_flags_p ) %]
-    [% IF ( heading_modify_tag_p ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Authority MARC Framework</a> &rsaquo; [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode %]">[% authtypecode %] Framework</a>[% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default Framework</a>[% END %] &rsaquo; Modify tag[% END %]
-    [% IF ( heading_add_tag_p ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Authority MARC Framework</a> &rsaquo; [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode %]">[% authtypecode %] Framework</a>[% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default Framework</a>[% END %] &rsaquo; New tag[% END %]
-    [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Authority MARC Framework</a> &rsaquo; [% action %]
-    [% END %]
-    [% ELSE %]
-    [% IF ( delete_confirm ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Authority MARC Framework</a> &rsaquo;
-    [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode %]">[% authtypecode %] Framework</a>
-    [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default Framework</a>[% END %] &rsaquo; Confirm Deletion
+<body id="admin_auth_tag_structure" class="admin">
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'prefs-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/authtypes.pl">Authority types</a> &rsaquo;
+    [% IF ( add_form ) %]
+        [% IF ( use_heading_flags_p ) %]
+            [% IF ( heading_modify_tag_p ) %]
+                [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]">[% authtypecode | html %] Framework</a>
+                [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
+                [% END %] &rsaquo; Modify tag
+            [% END %]
+            [% IF ( heading_add_tag_p ) %]
+                [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]">[% authtypecode | html %] framework</a>
+                [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
+                [% END %] &rsaquo; New tag
+            [% END %]
+        [% ELSE %]
+            [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]">[% authtypecode | html %] Framework</a>
+            [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
+            [% END %] &rsaquo; [% action | html %]
+        [% END %]
     [% ELSE %]
-    [% IF ( delete_confirmed ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Authority MARC Framework</a> &rsaquo; Data Deleted
-    [% ELSE %]Authority MARC Framework: [% IF ( authtypecode ) %][% authtypecode %] Framework
-    [% ELSE %]Default Framework[% END %]
-    [% END %]
-    [% END %]
+        [% IF ( delete_confirm ) %]
+            [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]">[% authtypecode | html %] framework</a>
+            [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
+            [% END %] &rsaquo; Confirm deletion
+        [% ELSE %]
+            [% IF ( delete_confirmed ) %]
+                [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]">[% authtypecode | html %] framework</a>
+                [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
+                [% END %] &rsaquo; Data deleted
+            [% ELSE %]
+                [% IF ( authtypecode ) %][% authtypecode | html %] Framework
+                [% ELSE %]Default framework
+                [% END %]
+            [% END %]
+        [% END %]
     [% END %]
 </div>
 
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
-<h1>Authority MARC framework for [% IF ( authtypecode ) %][% authtypecode %][% ELSE %]default framework[% END %]</h1>
+<h1>Authority MARC framework for [% IF ( authtypecode ) %][% authtypecode | html %][% ELSE %]default framework[% END %]</h1>
 
 
 [% IF ( add_form ) %]
 
     <h2>
-    [% IF ( use_heading_flags_p ) %]
     [% IF ( heading_modify_tag_p ) %]Modify tag[% END %]
     [% IF ( heading_add_tag_p ) %]New tag[% END %]
-    [% ELSE %][% action %][% END %]
     </h2>
-    <form action="[% script_name %]" name="Aform" method="post">
+    <form action="[% script_name | html %]" name="Aform" method="post" class="validated">
         <input type="hidden" name="op" value="add_validate" />
         [% IF ( heading_modify_tag_p ) %]<input type="hidden" name="modif" value="1" />[% END %]
-        <input type="hidden" name="authtypecode" value="[% authtypecode %]" />
-        <fieldset class="rows"><ol>
-               <li><span class="label">Tag</span>[% searchfield %]</li>
-        <li><label for="liblibrarian">Text for librarians</label><input type="text" name="liblibrarian" id="liblibrarian" value="[% liblibrarian |html %]" size="40" maxlength="100" /></li>
-        <li><label for="libopac">Text for opac</label><input type="text" name="libopac" id="libopac" value="[% libopac |html %]" size="40" maxlength="100" /></li>
-        <li><label for="repeatable">Repeatable</label>
+        <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
+        <fieldset class="rows">
+            <ol>
+                [% IF ( heading_modify_tag_p ) %]
+                    <li>
+                        <span class="label">Tag: </span>
+                        <input type="hidden" name="tagfield" value="[% searchfield | html %]" />
+                        [% searchfield | html %]
+                    </li>
+                [% ELSE %]
+                    <li>
+                        <label for="tagfield" class="required">Tag: </label><input type="text" id="tagfield" name="tagfield" size="5" maxlength="3" required="required" class="required" />
+                        <span class="required">Required</span>
+                    </li>
+                [% END %]
+
+        <li><label for="liblibrarian">Text for librarians: </label><input type="text" name="liblibrarian" id="liblibrarian" value="[% liblibrarian | html %]" size="40" maxlength="100" /></li>
+        <li><label for="libopac">Text for opac: </label><input type="text" name="libopac" id="libopac" value="[% libopac | html %]" size="40" maxlength="100" /></li>
+        <li><label for="repeatable">Repeatable: </label>
             [% IF ( repeatable ) %]
                 <input type="checkbox" name="repeatable" id="repeatable" value="1" checked="checked" />
             [% ELSE %]
                 <input type="checkbox" name="repeatable" id="repeatable" value="1" />
             [% END %]
         </li>
-        <li><label for="mandatory">Mandatory</label>
+        <li><label for="mandatory">Mandatory</label>
             [% IF ( mandatory ) %]
                 <input type="checkbox" name="mandatory" id="mandatory" value="1" checked="checked" />
             [% ELSE %]
                 <input type="checkbox" name="mandatory" id="mandatory" value="1" />
             [% END %]
-            </li>
-        <li><label for="authorised_value">Authorized value</label>[% authorised_value %] (if you select a value here, the indicators will be limited to the authorized value list)</li>
-</ol></fieldset>
-        <p><input type="button" value="Submit" class="button" onclick="Check(this.form)" /></p>
+        </li>
+        <li><label for="authorised_value">Authorized value: </label>
+            <select name="authorised_value" id="authorised_value" size="1">
+                <option value=""></option>
+                [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
+            </select>
+            (if you select a value here, the indicators will be limited to the authorized value list)
+        </li>
+        </ol>
+        </fieldset>
+        <fieldset class="action">
+            <input type="submit" value="Submit" />
+            <a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri %]" class="cancel">Cancel</a>
+        </fieldset>
     </form>
 [% END %]
 
 
 [% IF ( delete_confirm ) %]
-               <div class="dialog alert">
-               <h3>Confirm Deletion</h3>
-               <form action="[% script_name %]" method="post">
-               <table>
-                       <tr><th scope="row">Tag: </th><td>[% searchfield %] [% liblibrarian %]</td></tr>
-               </table>
-        <input type="hidden" name="op" value="delete_confirmed" />
-        <input type="hidden" name="authtypecode" value="[% authtypecode %]" />
-        <input type="hidden" name="searchfield" value="[% searchfield %]" />
-               <input type="submit" value="Yes, Delete" class="approve"></form>
-               <form action="[% script_name %]" method="get"><input type="submit" class="deny" value="No, Do Not Delete" /></form>
-               </div>
+    <div class="dialog alert">
+        <h3>Confirm deletion</h3>
+        <form action="[% script_name | html %]" method="post">
+            <table>
+                <tr><th scope="row">Tag: </th><td>[% searchfield | html %] [% liblibrarian | html %]</td></tr>
+            </table>
+            <input type="hidden" name="op" value="delete_confirmed" />
+            <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
+            <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
+            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
+        </form>
+        <form action="[% script_name | html %]" method="get">
+            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
+        </form>
+    </div>
 [% END %]
 
 [% IF ( delete_confirmed ) %]
 
   <div class="dialog message">  <h3>Data deleted</h3>
-    <form action="[% script_name %]" method="post">
-    <input type="hidden" name="authtypecode" value="[% authtypecode %]" />
-    <input type="hidden" name="searchfield" value="[% searchfield %]" />
+    <form action="[% script_name | html %]" method="post">
+    <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
+    <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
     <input type="submit" value="OK" class="submit" />
     </form></div>
 [% END %]
 [% IF ( authtype_create ) %]
 
-    <form action="[% script_name %]" method="post">
+    <form action="[% script_name | html %]" method="post">
         <input type="hidden" name="op" value="authtype_create_confirm" />
-        <input type="hidden" name="authtypecode" value="[% authtypecode %]" />
-        Create authority framework for [% authtypecode %] using
+        <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
+        Create authority framework for [% authtypecode | html %] using
         <select name="existingauthtypecode">
-            <option value="">Default</option>
         [% FOREACH existingauthtypeloo IN existingauthtypeloop %]
-            <option value="[% existingauthtypeloo.value %]">[% existingauthtypeloo.authtypetext %]</option>
+            [% IF existingauthtypeloo.value == "" %]
+              <option value="" selected="selected">[% existingauthtypeloo.authtypetext | html %]</option>
+            [% ELSE %]
+              <option value="[% existingauthtypeloo.value | html %]">[% existingauthtypeloo.authtypetext | html %]</option>
+            [% END %]
         [% END %]
         </select>
         <input type="submit" value="OK" class="submit" />
@@ -176,91 +169,85 @@ return false;
 
 [% IF ( else ) %]
 
-<div id="toolbar">
-       <script type="text/javascript">
-       //<![CDATA[
-       // prepare DOM for YUI Toolbar
-        $(document).ready(function() {
-           yuiToolbar();
-        });
-       // YUI Toolbar Functions
-       function yuiToolbar() {
-           new YAHOO.widget.Button("newtag");
-       }       //]]>
-       </script>
-       <ul class="toolbar">
-       <li><a id="newtag" href="/cgi-bin/koha/admin/auth_tag_structure.pl?op=add_form&amp;authtypecode=[% authtypecode %]">New Tag</a></li>
-</ul></div>
+<div id="toolbar" class="btn-toolbar">
+    <div class="btn-group"><a class="btn btn-default btn-sm" id="newtag" href="/cgi-bin/koha/admin/auth_tag_structure.pl?op=add_form&amp;authtypecode=[% authtypecode | html %]"><i class="fa fa-plus"></i> New tag</a></div>
+</div>
 
 <h2>Select an authority framework</h2>
-<form action="[% script_name %]" method="post">
+<form action="[% script_name | html %]" method="post">
     <select name="authtypecode">
-        <option value="">Default</option>
-    [% FOREACH authtypeloo IN authtypeloop %]
-               [% IF ( authtypeloo.selected ) %]
-        <option value="[% authtypeloo.value %]" selected="selected">[% authtypeloo.authtypetext %]</option>
-               [% ELSE %]
-        <option value="[% authtypeloo.value %]">[% authtypeloo.authtypetext %]</option>
-               [% END %]
-            
+    [% FOREACH authority_type IN authority_types%]
+        [% IF authority_type.authtypecode == authtypecode%]
+        <option value="[% authority_type.authtypecode | html %]" selected="selected">[% authority_type.authtypetext | html %]</option>
+        [% ELSE %]
+        <option value="[% authority_type.authtypecode | html %]">[% authority_type.authtypetext | html %]</option>
+        [% END %]
     [% END %]
     </select>
-    <input type="text" name="searchfield" value="[% searchfield %]" />
+    <input type="text" name="searchfield" value="[% searchfield | html %]" />
     <input type="submit" value="OK" class="submit" />
 </form><br />
-<span id="pagertable_authtagstructure" class="pager">
-       <form class="formpager">&nbsp;<strong>page(s)</strong>&nbsp;:
-               <img src="[% interface %]/prog/img/first.png" class="first"/>
-               <img src="[% interface %]/prog/img/prev.png" class="prev"/>
-               <input type="text" size="5" class="pagedisplay"/>
-               <img src="[% interface %]/prog/img/next.png" class="next"/>
-               <img src="[% interface %]/prog/img/last.png" class="last"/>
-               , entries/page : 
-               <select class="pagesize">
-               <option value="10">10</option>
-                       <option selected="selected" value="20">20</option>
-                       <option value="30">30</option>
-                       <option value="40">40</option>
-                       <option value="50">50</option>
-                       <option value="100">100</option>
-               </select>
-</form>
-</span>
+<div id="pagertable_authtagstructure">
+</div>
 <table id="table_authtagstructure">
     <thead>
-        <th>Tag</th>
-        <th>Lib</th>
-        <th>Repeatable</th>
-        <th>Mandatory</th>
-        <th>Authorized<br />value</th>
-        <th>Subfields</th>
-        <th>Edit</th>
-        <th>Delete</th>
-       </thead>
-    [% FOREACH loo IN loop %]
-       [% UNLESS ( loop.odd ) %]
-       <tr class="highlight">
-       [% ELSE %]
-       <tr>
-       [% END %]
-        <td><b>[% loo.tagfield %]</b></td>
-        <td>[% loo.liblibrarian %]</td>
-        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
-        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
-        <td>[% loo.authorised_value %]</td>
-        <td><a href="[% loo.subfield_link %]" class="button">subfields</a></td>
-        <td><a href="[% loo.edit %]">Edit</a></td>
-        <td><a href="[% loo.delete %]">Delete</a></td>
-    </tr>
-    [% END %]
+        <tr>
+            <th>Tag</th>
+            <th>Lib</th>
+            <th>Repeatable</th>
+            <th>Mandatory</th>
+            <th>Authorized<br />value</th>
+            <th>&nbsp;</th>
+        </tr>
+    </thead>
+    <tbody>
+        [% FOREACH loo IN loop %]
+        <tr>
+            <td><b>[% loo.tagfield | html %]</b></td>
+            <td>[% loo.liblibrarian | html %]</td>
+            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
+            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
+            <td>[% loo.authorised_value | html %]</td>
+            <td>
+                <div class="dropdown">
+                    <a class="btn btn-default btn-xs dropdown-toggle" id="authtagactions[% loo.tagfield | html %]" role="button" data-toggle="dropdown" href="#">
+                        Actions <b class="caret"></b></a>
+                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtagactions[% loo.tagfield | html %]">
+                        <li><a href="[% loo.subfield_link | url %]"><i class="fa fa-eye"></i> Subfields</a></li>
+                        <li><a href="[% loo.edit | url %]"><i class="fa fa-pencil"></i> Edit</a></li>
+                        <li><a href="[% loo.delete | url %]"><i class="fa fa-trash"></i> Delete</a></li>
+                    </ul>
+                </div>
+            </td>
+        </tr>
+        [% END %]
+    </tbody>
     </table>
 
 [% END %]
 
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'admin-menu.inc' %]
-</div>
-</div>
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'admin-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    [% Asset.js("js/admin-menu.js") | $raw %]
+    <script>
+        $(document).ready(function() {
+            $("#table_authtagstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                ],
+                "sPaginationType": "four_button"
+            }));
+        });
+    </script>
+[% END %]
 [% INCLUDE 'intranet-bottom.inc' %]