adding YUI tabs support to authority detail
authorPaul POULAIN <paul@koha-fr.org>
Tue, 16 Oct 2007 21:02:41 +0000 (16:02 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 17 Oct 2007 12:11:44 +0000 (07:11 -0500)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
authorities/detail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tmpl

index 52df8dc..4c3b2f5 100755 (executable)
@@ -367,16 +367,19 @@ sub build_tabs ($$$$$) {
             if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) {
                 my @fields;
                 if ( $tag ne '000' ) {
-                                @fields = $record->field($tag);
+                    @fields = $record->field($tag);
                 }
                 else {
                   push @fields, $record->leader(); # if tag == 000
                 }
-    # loop through each field
+                # loop through each field
                 foreach my $field (@fields) {
-                    
                     my @subfields_data;
                     if ($field->tag()<10) {
+                        next
+                        if (
+                            $tagslib->{ $field->tag() }->{ '@' }->{tab}
+                            ne $tabloop );
                       next if ($tagslib->{$field->tag()}->{'@'}->{hidden});
                       my %subfield_data;
                       $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib};
@@ -389,7 +392,13 @@ sub build_tabs ($$$$$) {
                   # loop through each subfield
                       for my $i (0..$#subf) {
                         $subf[$i][0] = "@" unless $subf[$i][0];
-                        next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden});
+                        next
+                        if (
+                            $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{tab}
+                            ne $tabloop );
+                        next
+                        if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }
+                            ->{hidden} );
                         my %subfield_data;
                         $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
                         if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) {
@@ -410,7 +419,7 @@ sub build_tabs ($$$$$) {
                     }
                     if ($#subfields_data>=0) {
                       my %tag_data;
-                      $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib};
+                      $tag_data{tag}=$field->tag().' - '. $tagslib->{$field->tag()}->{lib};
                       $tag_data{subfield} = \@subfields_data;
                       push (@loop_data, \%tag_data);
                     }
@@ -418,6 +427,7 @@ sub build_tabs ($$$$$) {
               }
             }
             if ( $#loop_data >= 0 ) {
+                warn "pushing : $tabloop = ".Data::Dumper::Dumper(@loop_data);
                 push @BIG_LOOP, {
                     number    => $tabloop,
                     innerloop => \@loop_data,
index 355e8a8..27d8be0 100644 (file)
@@ -3,6 +3,12 @@
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <script type="text/javascript">
 
+//<![CDATA[
+
+        $(document).ready(function() {
+               $('#authoritiestabs').tabs();
+        });
+
 function confirm_deletion() {
        var is_confirmed = confirm('Are you sure you want to delete this authority?');
        if (is_confirmed) {
@@ -98,97 +104,56 @@ function searchauthority() {
 <h1>Authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
 
 <div id="action">
-<a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit</a>
-
-<!-- TMPL_UNLESS name="count" -->
-<a href="javascript:confirm_deletion()">Delete</a>
-<!-- /TMPL_UNLESS -->
-
-<a href="../catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=<!--TMPL_VAR Name="authid" -->" class="button"><!-- TMPL_VAR name="count" --> biblios</a>
+    <a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit</a>
+    
+    <!-- TMPL_UNLESS name="count" -->
+    <a href="javascript:confirm_deletion()">Delete</a>
+    <!-- /TMPL_UNLESS -->
+    
+    <a href="../catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=<!--TMPL_VAR Name="authid" -->" class="button"><!-- TMPL_VAR name="count" --> biblios</a>
 </div>
 
-<div id="authorities_detail_details">
-
-<!--TMPL_UNLESS Name="singletab"-->
-    <div id="tabs">
-        <!-- TMPL_IF NAME="0XX" -->
-            <a href="javascript:active(0)" class="tab_active" id="link0">0</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="1XX" -->
-            <a href="javascript:active(1)" class="tab_inactive" id="link1">1</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="2XX" -->
-            <a href="javascript:active(2)" class="tab_inactive" id="link2">2</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="3XX" -->
-            <a href="javascript:active(3)" class="tab_inactive" id="link3">3</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="4XX" -->
-            <a href="javascript:active(4)" class="tab_inactive" id="link4">4</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="5XX" -->
-            <a href="javascript:active(5)" class="tab_inactive" id="link5">5</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="6XX" -->
-            <a href="javascript:active(6)" class="tab_inactive" id="link6">6</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="7XX" -->
-            <a href="javascript:active(7)" class="tab_inactive" id="link7">7</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="8XX" -->
-            <a href="javascript:active(8)" class="tab_inactive" id="link8">8</a>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="9XX" -->
-            <a href="javascript:active(9)" class="tab_inactive" id="link9">9</a>
-        <!-- /TMPL_IF -->
-    </div>
-<!--/TMPL_UNLESS-->
+<div id="authoritiestabs" class="toptabs numbered">
+    <ul>
+        <!-- TMPL_LOOP name="BIG_LOOP" -->
+            <li>
+                <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
+            </li>
+        <!-- /TMPL_LOOP -->
+    </ul>
 
 <!-- TMPL_LOOP name="BIG_LOOP" -->
-<!-- hide every tab except the 1st -->
-<!--TMPL_UNLESS Name="singletab"-->
-  <!-- TMPL_IF name="number" -->
-    <div id="<!-- TMPL_VAR name="number" -->XX" class="content_hidden">
-  <!-- TMPL_ELSE -->
-    <div id="0XX" class="content_visible">
-  <!-- /TMPL_IF -->
-<!-- /TMPL_UNLESS -->
-    
+    <div id="tab<!-- TMPL_VAR name="number" -->XX">
     <!-- TMPL_LOOP NAME="innerloop" -->
-                <!-- TMPL_IF name="tag" -->
-                    <div class="tag">
-                    <div class="tag_title">
-                        <!-- TMPL_VAR NAME="tag" -->
-                    </div>
-                <!-- TMPL_ELSE -->
-                    <div class="tag">
-                <!-- /TMPL_IF -->
-            <!-- TMPL_LOOP NAME="subfield" -->
-                <p>
-                    <label class="labelsubfield">&nbsp;
-                    <!-- TMPL_UNLESS name="hide_marc" --><b><!-- TMPL_VAR NAME="marc_subfield" --></b><!-- /TMPL_UNLESS -->
-                    <span title="<!-- TMPL_VAR name="long_desc" -->"><!-- TMPL_VAR NAME="short_desc" --></span></label>
-                    <!-- TMPL_VAR NAME="marc_value" -->
-                    <!-- TMPL_IF name="link" -->
-                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE="URL" -->">
-                            <img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
-                        </a>
-                    <!-- /TMPL_IF -->
-                    <!-- TMPL_IF NAME="authority" -->
-                        <a href="/cgi-bin/koha/authorities/detail.pl?authid=<!-- TMPL_VAR name="authority" -->" class="button">Auth</a>
-                    <!-- /TMPL_IF -->
-                </p>
-            <!-- /TMPL_LOOP -->
+        <!-- TMPL_IF name="tag" -->
+            <div class="tag">
+            <div class="tag_title">
+                <!-- TMPL_VAR NAME="tag" -->
             </div>
-  
+        <!-- TMPL_ELSE -->
+            <div class="tag">
+        <!-- /TMPL_IF -->
+        <!-- TMPL_LOOP NAME="subfield" -->
+            <p>
+                <label class="labelsubfield">&nbsp;
+                <!-- TMPL_UNLESS name="hide_marc" --><b><!-- TMPL_VAR NAME="marc_subfield" --></b><!-- /TMPL_UNLESS -->
+                <span title="<!-- TMPL_VAR name="long_desc" -->"><!-- TMPL_VAR NAME="short_desc" --></span></label>
+                <!-- TMPL_VAR NAME="marc_value" -->
+                <!-- TMPL_IF name="link" -->
+                    <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE="URL" -->">
+                        <img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
+                    </a>
+                <!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="authority" -->
+                    <a href="/cgi-bin/koha/authorities/detail.pl?authid=<!-- TMPL_VAR name="authority" -->" class="button">Auth</a>
+                <!-- /TMPL_IF -->
+            </p>
+        <!-- /TMPL_LOOP -->
+        </div>
     <!-- /TMPL_LOOP -->
     </div>
 <!-- /TMPL_LOOP -->
-    
 </div>
-       
-
-
 </div>
 </div>
 </div>