koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha koha-tmpl/opac-tmpl/css/en/opac-search.tmp... [rel_2_2]


From: Antoine Farnault
Subject: [Koha-cvs] koha koha-tmpl/opac-tmpl/css/en/opac-search.tmp... [rel_2_2]
Date: Wed, 11 Oct 2006 16:08:55 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Antoine Farnault <toins>        06/10/11 16:08:55

Modified files:
        koha-tmpl/opac-tmpl/css/en: opac-search.tmpl 
        opac           : opac-main.pl 

Log message:
        Branch for the user logged is selected by default now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/opac-search.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.11.2.14&r2=1.11.2.15
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-main.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.16.2.13&r2=1.16.2.14

Patches:
Index: koha-tmpl/opac-tmpl/css/en/opac-search.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/opac-tmpl/css/en/opac-search.tmpl,v
retrieving revision 1.11.2.14
retrieving revision 1.11.2.15
diff -u -b -r1.11.2.14 -r1.11.2.15
--- koha-tmpl/opac-tmpl/css/en/opac-search.tmpl 6 Oct 2006 15:33:37 -0000       
1.11.2.14
+++ koha-tmpl/opac-tmpl/css/en/opac-search.tmpl 11 Oct 2006 16:08:55 -0000      
1.11.2.15
@@ -86,8 +86,7 @@
                 <select name="value">
                     <option value="">Any Branch</option>
                         <!-- TMPL_LOOP name="branchloop" -->
-                                <option value="<!-- TMPL_VAR name="value" -->" 
<!--TMPL_IF Name="selected"-->selected<!--/TMPL_IF-->> <!-- TMPL_VAR 
name="branchname" -->
-                                </option>
+                    <option value="<!-- TMPL_VAR name="value" -->" <!--TMPL_IF 
Name="selected"-->selected<!--/TMPL_IF-->> <!-- TMPL_VAR name="branchname" -->  
</option>
                         <!-- /TMPL_LOOP -->
                 </select>
                </p>

Index: opac/opac-main.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-main.pl,v
retrieving revision 1.16.2.13
retrieving revision 1.16.2.14
diff -u -b -r1.16.2.13 -r1.16.2.14
--- opac/opac-main.pl   11 Oct 2006 13:14:46 -0000      1.16.2.13
+++ opac/opac-main.pl   11 Oct 2006 16:08:55 -0000      1.16.2.14
@@ -9,6 +9,7 @@
 use C4::BookShelves;
 use C4::Koha;
 use C4::Members;
+use C4::Acquisition;
 
 my $input = new CGI;
 my $dbh = C4::Context->dbh;
@@ -25,19 +26,6 @@
 }
 $sth->finish;
 
-my @branches;
-my @select_branch;
-my %select_branches;
-my $branches = getallbranches();
-my @branchloop;
-foreach my $thisbranch (keys %$branches) {
-        my $selected = 1 if (C4::Context->userenv && ($thisbranch eq 
C4::Context->userenv->{branch}));
-        my %row =(value => $thisbranch,
-                                selected => $selected,
-                                branchname => 
$branches->{$thisbranch}->{'branchname'},
-                        );
-        push @branchloop, \%row;
-}
 
 my ($template, $borrowernumber, $cookie)
     = get_template_and_user({template_name => "opac-main.tmpl",
@@ -63,25 +51,44 @@
 if($languages_count > 1){
                $template->param(languages => address@hidden);
 }
+my @branchloop;
 if (C4::Context->preference("SearchMyLibraryFirst")){
   if (C4::Context->userenv){
+               my @oldbranches;
+       my @oldselect_branch;
+       my %oldselect_branches;
+       my ($oldcount2,@oldbranches)=branches();
+       push @oldselect_branch, "";
+       $oldselect_branches{''} = "";
+       for (my $i=0;$i<$oldcount2;$i++){
+               push @oldselect_branch, $oldbranches[$i]->{'branchcode'};#
+               $oldselect_branches{$oldbranches[$i]->{'branchcode'}} = 
$oldbranches[$i]->{'branchname'};
+       }
+       my $CGIbranch=CGI::scrolling_list( -name     => 'value',
+                               -values   => address@hidden,
+                               -labels   => \%oldselect_branches,
+                               -size     => 1,
+                               -multiple => 0 );
+       $sth->finish;
+
        my @branches;
        my @select_branch;
        my %select_branches;
        my $branches = getallbranches();
-       my @branchloop;
+       
        foreach my $thisbranch (keys %$branches) {
-        warn "branch".C4::Context->userenv->{branch}. 'mabranche : 
'.$thisbranch." egalite :".($thisbranch eq C4::Context->userenv->{branch});
-        my %row =('value' => $thisbranch,
-                                'branchname' => 
$branches->{$thisbranch}->{'branchname'},
+        my $selected = 1 if (C4::Context->userenv && ($thisbranch eq 
C4::Context->userenv->{branch}));
+        warn $thisbranch;
+        warn C4::Context->userenv;
+        warn C4::Context->userenv->{branch};
+        warn " => ".C4::Context->userenv && ($thisbranch eq 
C4::Context->userenv->{branch});
+        my %row =(value => $thisbranch,
+                                selected => $selected,
+                                branchname => 
$branches->{$thisbranch}->{'branchname'},
                         );
-        $row{'selected'} = C4::Context->userenv->{branch} if ($thisbranch eq 
C4::Context->userenv->{branch});
-        foreach (keys %row){
-            warn "$_ : $row{$_}";
-        }
         push @branchloop, \%row;
        }
-    $template->param("mylibraryfirst"=>1,"branchloop"=>address@hidden);
+    $template->param("mylibraryfirst"=>1);
   } else {
     $template->param("mylibraryfirst"=>0)
    }




reply via email to

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