koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha authorities/auth_finder.pl authorities/aut... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha authorities/auth_finder.pl authorities/aut... [rel_3_0]
Date: Wed, 24 Jan 2007 15:13:27 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      07/01/24 15:13:27

Modified files:
        authorities    : auth_finder.pl authorities.pl 
        koha-tmpl/intranet-tmpl/prog/en/authorities: authorities.tmpl 
                                                     searchresultlist-auth.tmpl 

Log message:
        Adding link between authorities when editing an authority.
        Adding page management when searching authority for cataloguing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/auth_finder.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.11.2.4&r2=1.11.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/authorities.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.15.2.7&r2=1.15.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.2&r2=1.2.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/authorities/searchresultlist-auth.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3

Patches:
Index: authorities/auth_finder.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/auth_finder.pl,v
retrieving revision 1.11.2.4
retrieving revision 1.11.2.5
diff -u -b -r1.11.2.4 -r1.11.2.5
--- authorities/auth_finder.pl  18 Dec 2006 16:35:17 -0000      1.11.2.4
+++ authorities/auth_finder.pl  24 Jan 2007 15:13:27 -0000      1.11.2.5
@@ -21,12 +21,10 @@
 use strict;
 require Exporter;
 use CGI;
+use C4::Interface::CGI::Output;
 use C4::Auth;
 
 use C4::Context;
-use C4::Auth;
-use C4::Output;
-use C4::Interface::CGI::Output;
 use C4::AuthoritiesMarc;
 use C4::Acquisition;
 use C4::Koha; # XXX subfield_is_koha_internal_p
@@ -70,15 +68,6 @@
                                         address@hidden, address@hidden, 
address@hidden,
                                         $startfrom*$resultsperpage, 
$resultsperpage,$authtypecode);# $orderby);
 
-    ($template, $loggedinuser, $cookie)
-        = get_template_and_user({template_name => 
"authorities/searchresultlist-auth.tmpl",
-                query => $query,
-                type => 'intranet',
-                authnotrequired => 0,
-                flagsrequired => {catalogue => 1},
-                debug => 1,
-                });
-
     # multi page display gestion
     my $displaynext=0;
     my $displayprev=$startfrom;
@@ -88,8 +77,8 @@
 
     my @field_data = ();
 
-    # get marclist again, as the previous one has been modified by 
catalogsearch
-    my @marclist_ini = $query->param('marclist');
+
+       my @marclist_ini = $query->param('marclist'); # get marclist again, as 
the previous one has been modified by catalogsearch (mainentry replaced by 
field name
     for(my $i = 0 ; $i <= $#marclist ; $i++) {
         push @field_data, { term => "marclist", val=>$marclist_ini[$i] };
         push @field_data, { term => "and_or", val=>$and_or[$i] };
@@ -121,6 +110,15 @@
     } else {
         $to = (($startfrom+1)*$resultsperpage);
     }
+   ($template, $loggedinuser, $cookie)
+        = get_template_and_user({template_name => 
"authorities/searchresultlist-auth.tmpl",
+                query => $query,
+                type => 'intranet',
+                authnotrequired => 0,
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
+
     $template->param(result => $results) if $results;
     $template->param(index => $query->param('index')."");
     $template->param(startfrom=> $startfrom,

Index: authorities/authorities.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/authorities.pl,v
retrieving revision 1.15.2.7
retrieving revision 1.15.2.8
diff -u -b -r1.15.2.7 -r1.15.2.8
--- authorities/authorities.pl  24 Jan 2007 10:20:12 -0000      1.15.2.7
+++ authorities/authorities.pl  24 Jan 2007 15:13:27 -0000      1.15.2.8
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: authorities.pl,v 1.15.2.7 2007/01/24 10:20:12 hdl Exp $
+# $Id: authorities.pl,v 1.15.2.8 2007/01/24 15:13:27 hdl Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -154,6 +154,8 @@
        if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
                $subfield_data{marc_value}= build_authorized_values_list($tag, 
$subfield, $value, $dbh,$authorised_values_sth);
        # it's a thesaurus / authority field
+       } elsif ($tagslib->{$tag}->{$subfield}->{authtypecode}) {
+               $subfield_data{marc_value}="<input type=\"text\" 
name=\"field_value\" value=\"$value\" size=\"67\" maxlength=\"255\" DISABLE 
READONLY> <a 
href=\"javascript:Dopop('../authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$i',$i)\">...</a>";
        } elsif ($tagslib->{$tag}->{$subfield}->{link}) {
                $subfield_data{marc_value}="<input 
onblur=\"this.style.backgroundColor='#ffffff';\" 
onfocus=\"this.style.backgroundColor='#ffffff;'\" tabindex=\"1\" type=\"text\" 
name=\"field_value\" value=\"$value\" size=\"40\" maxlength=\"255\" DISABLE 
READONLY> <a  style=\"cursor: help;\" 
href=\"javascript:Dopop('../authorities/auth_linker.pl?index=$i',$i)\">...</a>";
        

Index: koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -b -r1.2.2.2 -r1.2.2.3
--- koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl        17 Nov 
2006 13:18:59 -0000      1.2.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl        24 Jan 
2007 15:13:27 -0000      1.2.2.3
@@ -13,6 +13,8 @@
 <!-- /TMPL_IF -->  
   <form method="post" name="f">
     <input type="hidden" name="op" value="add">
+    <input type="hidden" name="addfield_field" value="">
+    <input type="hidden" name="repeat_field" value="">
     <input type="hidden" name="authtypecode" value="<!-- TMPL_VAR 
NAME="authtypecode" -->">
     <input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->">
 
@@ -44,7 +46,7 @@
 <!-- TMPL_ELSE -->
 <input tabindex="1" type="hidden" <!-- TMPL_IF NAME="fixedfield" --> 
style="display:none;" <!-- /TMPL_IF --> name="indicator" value="<!-- TMPL_VAR 
NAME="indicator" -->"><!-- /TMPL_UNLESS -->
        <!-- TMPL_UNLESS NAME="advancedMARCEditor" --><!-- TMPL_VAR 
NAME="tag_lib" --><!-- /TMPL_UNLESS -->
-       <!-- TMPL_IF name="repeatable" --><a href="javascript:AddField('<!-- 
TMPL_VAR NAME="tag" -->')">+</a><!-- /TMPL_IF -->
+    <!-- TMPL_IF name="repeatable" --><a href="#<!-- TMPL_VAR NAME="tag" -->" 
onclick="javascript:this.nextSibling.type='text';this.nextSibling.focus()">+</a><input
 type="hidden"  value="" size="2" onchange="AddField('<!-- TMPL_VAR NAME="tag" 
-->',this.value)" ><!-- /TMPL_IF -->
 </p>
 <!-- /TMPL_IF -->
 <div><!-- TMPL_LOOP NAME="subfield_loop" -->
@@ -178,25 +180,69 @@
        newin=window.open("../z3950/search.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" 
-->"+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes');
 }
 
-function AddField(field) {
-       document.forms[1].op.value = "addfield";
-       document.forms[1].addfield_field.value=field;
+function AddField(field,cntrepeatfield) {
+       document.forms['f'].op.value = "addfield";
+       document.forms['f'].addfield_field.value=field;
+       document.forms['f'].repeat_field.value=cntrepeatfield;
        document.f.submit();
 }
 
+function cloneSubfield(index) {
+    var original = document.getElementById(index); //original <div>
+    var clone = original.cloneNode(true);
+
+    // set the attribute for the new 'div' subfields
+    clone.setAttribute('id',index + index);//set another id.
+    var NumTabIndex;
+    NumTabIndex = parseInt(original.getAttribute('tabindex'));
+    if(isNaN(NumTabIndex)) NumTabIndex = 0;
+    clone.setAttribute('tabindex',NumTabIndex+1);
+    
+    var CloneButtonPlus;
+    try{
+        CloneButtonPlus = clone.getElementsByTagName('a')[0];
+        CloneButtonPlus.setAttribute('onclick',"cloneSubfield('" + index + 
index + "')");
+    }
+    catch(e){
+        // do nothing if ButtonPlus & CloneButtonPlus don't exist.
+    }
+
+    // insert this line on the page
+    original.parentNode.insertBefore(clone,original.nextSibling);
+}
+
 function upSubfield(index) {
-       temp = document.forms['f'].field_value[index-1].value;
-       
document.forms['f'].field_value[index-1].value=document.forms['f'].field_value[index].value;
-       document.forms['f'].field_value[index].value= temp;
-       temp = document.forms['f'].subfield[index-1].value;
-       
document.forms['f'].subfield[index-1].value=document.forms['f'].subfield[index].value;
-       document.forms['f'].subfield[index].value = temp;
-       temp = document.forms['f'].mandatory[index-1].value;
-       
document.forms['f'].mandatory[index-1].value=document.forms['f'].mandatory[index].value;
-       document.forms['f'].mandatory[index].value = temp;
-       temp = document.forms['f'].kohafield[index-1].value;
-       
document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value;
-       document.forms['f'].kohafield[index].value = temp;
+       try{
+               var line = document.getElementById(index); // get the line 
where the user has clicked.
+       } catch(e) {
+               return;
+       }
+       var tag = line.parentNode; // get the dad of this line. (should be 
"<div tag=XXX>")
+       
+       // getting all subfields for this tag
+       var subfields = tag.getElementsByTagName('div');
+       var subfieldsLength = subfields.length;
+       if(subfieldsLength<=1) return; // nothing to do if there is just one 
subfield.
+       // among all subfields 
+       for(var i=0;i<subfieldsLength;i++){ 
+               if(subfields[i].getAttribute('id') == index){ //looking for the 
subfield which is clicked :
+                       if(i==0){ // if the clicked subfield is on the top
+                               tag.appendChild(subfields[0]);
+                               return;
+                       }else{
+                               var lineAbove = subfields[i-1];
+                               tag.insertBefore(line,lineAbove);
+                               return;
+                       }
+               }
+       }
+}
+
+function unHideSubfield(index,labelindex) {
+       subfield = document.getElementById(index);
+       subfield.style.display = 'block';
+       label = document.getElementById(labelindex);
+       label.style.display='none';     
 }
 
 </script>

Index: koha-tmpl/intranet-tmpl/prog/en/authorities/searchresultlist-auth.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/authorities/searchresultlist-auth.tmpl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- koha-tmpl/intranet-tmpl/prog/en/authorities/searchresultlist-auth.tmpl      
24 Nov 2006 13:27:42 -0000      1.1.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/authorities/searchresultlist-auth.tmpl      
24 Jan 2007 15:13:27 -0000      1.1.2.3
@@ -47,21 +47,21 @@
                <div id="resultnumber">
                        <p>
                                <!-- TMPL_IF name="displayprev" -->
-                                       <a href="auth_finder.pl?startfrom=<!-- 
TMPL_VAR NAME="startfromprev" -->&amp;&amp;authtypecode=<!-- TMPL_VAR 
name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&<!-- TMPL_VAR 
name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP 
-->&op=do_search&type=intranet&index=<!-- TMPL_VAR name="index" -->">
-                                               <img 
src="/intranet-tmpl/default/images/numbers/prev.gif" border="0">
+                                       <a href="auth_finder.pl?startfrom=<!-- 
TMPL_VAR NAME="startfromprev" -->&amp;&amp;authtypecode=<!-- TMPL_VAR 
name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&<!-- TMPL_VAR 
name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP 
-->&op=do_search&type=intranet&index=<!-- TMPL_VAR name="index" -->&tagid=<!-- 
TMPL_VAR name="tagid" -->">
+                                               <<
                                        </a>
                                <!-- /TMPL_IF -->
                                <!-- TMPL_LOOP NAME="numbers" -->
                                        <!-- TMPL_IF name="highlight" -->
-                                               <img 
src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" 
-->-highlight.gif">
+                                               <!-- TMPL_VAR NAME="number" -->
                                        <!-- TMPL_ELSE -->
-                                               <a 
href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" 
-->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP 
name="searchdata"-->&<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR 
name="val"--><!-- /TMPL_LOOP -->&op=do_search&type=intranet&index=<!-- TMPL_VAR 
name="index" -->">
-                                                       <img 
src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->.gif" 
border="0"></a>
+                                               <a 
href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" 
-->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP 
name="searchdata"-->&<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR 
name="val"--><!-- /TMPL_LOOP -->&op=do_search&type=intranet&index=<!-- TMPL_VAR 
name="index" -->&tagid=<!-- TMPL_VAR name="tagid" -->">
+                                                       <!-- TMPL_VAR 
NAME="number" --></a>
                                        <!-- /TMPL_IF -->
                                <!-- /TMPL_LOOP -->
                                <!-- TMPL_IF name="displaynext" -->
-                                       <a href="auth_finder.pl?startfrom=<!-- 
TMPL_VAR NAME="startfromnext" -->&amp;&amp;authtypecode=<!-- TMPL_VAR 
name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&<!-- TMPL_VAR 
name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP 
-->&op=do_search&type=intranet&index=<!-- TMPL_VAR name="index" -->">
-                                               <img 
src="/intranet-tmpl/default/images/numbers/next.gif" border="0"></a>
+                                       <a href="auth_finder.pl?startfrom=<!-- 
TMPL_VAR NAME="startfromnext" -->&amp;&amp;authtypecode=<!-- TMPL_VAR 
name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&<!-- TMPL_VAR 
name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP 
-->&op=do_search&type=intranet&index=<!-- TMPL_VAR name="index" -->&tagid=<!-- 
TMPL_VAR name="tagid" -->">
+                                               >></a>
                                <!-- /TMPL_IF -->
                        </p>
                        <p>
@@ -92,7 +92,7 @@
                                                <td><!-- TMPL_VAR 
NAME="summary" --></td>
                                                <td><!-- TMPL_VAR NAME="used" 
--> times</td>
                                                <td>
-                                                       <a 
href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR 
NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')"><img src="<!-- 
TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" 
width="32" alt="choose" hspace="0" vspace="0" border="0"></a>
+                                                       <a 
href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR 
NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')">choose</a>
                                                </td>
                                        </tr>
                                <!-- /TMPL_LOOP -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]