koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Output.pm,1.6.2.16,1.6.2.17


From: Finlay Thompson
Subject: [Koha-cvs] CVS: koha/C4 Output.pm,1.6.2.16,1.6.2.17
Date: Tue, 10 Sep 2002 20:55:32 -0700

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv7774/C4

Modified Files:
      Tag: rel-1-2
        Output.pm 
Log Message:

added a themelanguage subroutine that searchs for templates according to the 
opacthemes and opaclanguages fields in the systempreferences table. These 
fields can be space seperated names. Templates are searched for in those 
orders, over themes first.


Index: Output.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Output.pm,v
retrieving revision 1.6.2.16
retrieving revision 1.6.2.17
diff -C2 -r1.6.2.16 -r1.6.2.17
*** Output.pm   14 Aug 2002 18:30:50 -0000      1.6.2.16
--- Output.pm   11 Sep 2002 03:55:30 -0000      1.6.2.17
***************
*** 44,48 ****
             &gotopage &mkformnotable &mkform3
             &getkeytableselectoptions
!            &picktemplate
  );
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
--- 44,48 ----
             &gotopage &mkformnotable &mkform3
             &getkeytableselectoptions
!            &picktemplate &themelanguage
  );
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
***************
*** 103,108 ****
      return 'default';
    }
-   
  }
   
  sub startpage() {
--- 103,151 ----
      return 'default';
    }
  }
+ 
+ sub themelanguage {
+   my ($htdocs, $tmpl) = @_;
+ 
+ # language preferences....
+   my $dbh=C4Connect;
+   my $sth=$dbh->prepare("SELECT value FROM systempreferences WHERE 
variable='opaclanguages'");
+   $sth->execute;
+   my ($lang) = $sth->fetchrow;
+   $sth->finish;
+   my @languages = split " ", $lang;
+   warn "Lang = @languages\n";
+ 
+ # theme preferences....
+   my $sth=$dbh->prepare("SELECT value FROM systempreferences WHERE 
variable='opacthemes'");
+   $sth->execute;
+   my ($theme) = $sth->fetchrow;
+   $sth->finish;
+   my @themes = split " ", $theme;
+   warn "Theme = @themes \n";
+ 
+   $dbh->disconnect;
+ 
+   my ($theme, $lang);
+ # searches through the themes and languages. First template it find it 
returns.
+ # Priority is for getting the theme right.
+   THEME: 
+   foreach my $th (@themes) {
+     foreach my $la (@languages) {
+       warn "File = $htdocs/$th/$la/$tmpl\n";
+       if (-e "$htdocs/$th/$la/$tmpl") {
+           $theme = $th;
+           $lang = $la;
+           last THEME;
+       }
+     }
+   }
+   if ($theme and $lang) {
+     return ($theme, $lang);
+   } else {
+     return ('default', 'en');
+   }  
+ }
+ 
   
  sub startpage() {




reply via email to

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