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

Finlay Thompson finlayt at users.sourceforge.net
Wed Sep 11 05:55:32 CEST 2002


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() {





More information about the Koha-cvs mailing list