Bug 18019: [QA Follow-up] Also catch the delete from authorities detail
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / detail.tt
index 41384c5..e150232 100644 (file)
@@ -1,54 +1,48 @@
+[% PROCESS 'authorities.inc' %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Authorities &rsaquo;
     [% IF ( unknownauthid ) %]
       Unknown authority record
     [% ELSE %]
-      Details for Authority #[% authid %] ([% authtypetext %])
+      Details for authority #[% authid %] ([% authtypetext %])
     [% END %]
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
+[% IF ( displayhierarchy ) %]
+<script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.jstree.js"></script>
+[% END %]
 <script type="text/javascript">
 
 //<![CDATA[
 
         $(document).ready(function() {
-               $('#authoritiestabs>ul').tabs();
+    $('#authoritiestabs').tabs();
+    [% IF ( displayhierarchy ) %]
+        var current_nodes = [];
+        $('.currentauth').each(function() {
+            current_nodes.push('#' + $(this).parent().parents('li:first').attr('id'));
+            });
+        $('#hierarchies').jstree({
+                "plugins": [ "themes", "html_data"],
+                "themes": { "theme": "classic",
+                            "icons": false },
+                "core": { "initially_open": current_nodes }
+            });
+    [% END %]
         });
 
 function confirm_deletion() {
-       var is_confirmed = confirm('Are you sure you want to delete this authority?');
-       if (is_confirmed) {
-               window.location="authorities-home.pl?op=delete&amp;authid=[% authid %]";
-       }
+    var is_confirmed = confirm(_("Are you sure you want to delete this authority?"));
+    if (is_confirmed) {
+        window.location="authorities-home.pl?op=delete&authid=[% authid %]&csrf_token=[% csrf_token %]";
+    }
 }
 function Dopop(link) {
        newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
 }
 //]]>
 </script>
-[% IF ( displayhierarchy ) %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/hierarchy.css" />
 <script type="text/javascript">
-function showParents(mynumber) {
-  var parents=document.getElementsByName(mynumber+'p')
-  for(i=0;i<parents.length;i++){
-    if (parents[i].style.display == "none") {
-      parents[i].style.display ="block";
-    } else {
-      parents[i].style.display ="none";
-    }
-  } 
-}
-function showChildren(mynumber) {
-  var children=document.getElementsByName(mynumber+'c')
-  for(i=0;i<children.length;i++){
-    if (children[i].style.display == "none") {
-      children[i].style.display = "block";
-    } else {
-      children[i].style.display = "none";
-    }
-  }
-}
 function Help() {
     newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
 }
@@ -63,7 +57,6 @@ function searchauthority() {
     window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
 }
 </script>
- [% END %]
 </head>
 <body id="auth_detail" class="auth">
 [% INCLUDE 'header.inc' %]
@@ -72,7 +65,7 @@ function searchauthority() {
     [% IF ( unknownauthid ) %]
       Unknown authority record
     [% ELSE %]
-      Details for Authority #[% authid %] ([% authtypetext %])
+      Details for authority #[% authid %] ([% authtypetext %])
     [% END %]
 </div>
 
@@ -85,33 +78,8 @@ function searchauthority() {
     [% INCLUDE 'authorities-toolbar.inc' %]
        
 [% IF ( displayhierarchy ) %]
-
-<div class="hierarchies">
-[% FOREACH loophierarchie IN loophierarchies %]
-  <div class="hierarchy">
-  [% FOREACH loopelemen IN loophierarchie.loopelement %]
-    <div id="[% loopelemen.loopauthid %]" class="[% loopelemen.class %]">
-    [% IF ( loopelemen.ifparents ) %]
-      [% FOREACH loopparent IN loopelemen.loopparents %]
-        <div name="[% loopparent.loopauthid %]p" class="parent"> <a href="detail.pl?authid=[% loopparent.parentauthid %]">[% loopparent.parentvalue %]</a></div>
-      [% END %]
-    [% END %]
-    [% IF ( loopelemen.current_value ) %]
-        [% loopelemen.value %]
-    [% ELSE %]
-        <a href="detail.pl?authid=[% loopelemen.loopauthid %]" title="Term">[% loopelemen.value %]</a>
-    [% END %]
-    [% IF ( loopelemen.ifchildren ) %]
-      <sub><a class="parents" title="Narrower terms" href="JavaScript:showChildren('[% loopelemen.loopauthid %]');">+</a></sub><br />
-      [% FOREACH loopchildre IN loopelemen.loopchildren %]
-        <div name="[% loopchildre.loopauthid %]c" class="child"> <a href="detail.pl?authid=[% loopchildre.childauthid %]">[% loopchildre.childvalue %]</a></div>
-      [% END %]
-    [% END %]
-    </div>
-  [% END %]
-    
-  </div>
-[% END %]
+<div id="hierarchies">
+[% PROCESS showhierarchy trees = loophierarchies %]
 </div>
 [% END %]
 
@@ -122,16 +90,18 @@ function searchauthority() {
 <h1>Authority #[% authid %] ([% authtypetext %])</h1>
 
 <div id="action">
-    
-    
-    Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=[% authid %]">[% count %] record(s)</a>
+    [% IF count > 0 %]
+        Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=[% authid %]">[% count %] record(s)</a>
+    [% ELSE %]
+        This authority is not used in any records.
+    [% END %]
 </div>
 
 <div id="authoritiestabs" class="toptabs numbered">
     <ul>
         [% FOREACH BIG_LOO IN BIG_LOOP %]
             <li>
-                <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
+                <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
             </li>
         [% END %]
     </ul>
@@ -155,7 +125,7 @@ function searchauthority() {
                 [% subfiel.marc_value %]
                 [% IF ( subfiel.link ) %]
                     <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;marclist=[% subfiel.link %]&amp;operator==&amp;type=intranet&amp;value=[% subfiel.marc_value |url %]">
-                        <img border="0" src="[% interface %]/[% theme %]/images/filefind.png" height="15" title="Search on [% subfiel.marc_value %]">
+                        <img src="[% interface %]/[% theme %]/images/filefind.png" height="15" title="Search on [% subfiel.marc_value %]">
                     </a>
                 [% END %]
                 [% IF ( subfiel.authority ) %]