[Koha-cvs] CVS: koha/C4 Koha.pm,1.21,1.22 Search.pm,1.91,1.92

Paul POULAIN tipaul at users.sourceforge.net
Mon Aug 16 14:49:44 CEST 2004


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv558/C4

Modified Files:
	Koha.pm Search.pm 
Log Message:
moving language chooser to the main page.
moving the getalltemplates and getalllanguages subs out from Search.pm (that will be deprecated soon) to Koha.pm

moving changelanguage.pl to OPAC scope

Index: Koha.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Koha.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** Koha.pm	10 Jun 2004 08:29:01 -0000	1.21
--- Koha.pm	16 Aug 2004 12:49:42 -0000	1.22
***************
*** 61,64 ****
--- 61,65 ----
  			&getframeworks &getframeworkinfo
  			&getauthtypes &getauthtype
+ 			&getallthemes &getalllanguages 
  			$DEBUG);
  
***************
*** 460,463 ****
--- 461,575 ----
  }
  
+ =item getalllanguages
+ 
+   (@languages) = &getalllanguages($type);
+   (@languages) = &getalllanguages($type,$theme);
+ 
+ Returns an array of all available languages.
+ 
+ =cut
+ 
+ sub getalllanguages {
+     my $type=shift;
+     my $theme=shift;
+     my $htdocs;
+     my @languages;
+     if ($type eq 'opac') {
+ 	$htdocs=C4::Context->config('opachtdocs');
+ 	if ($theme and -d "$htdocs/$theme") {
+ 	    opendir D, "$htdocs/$theme";
+ 	    foreach my $language (readdir D) {
+ 		next if $language=~/^\./;
+ 		next if $language eq 'all';
+ 		push @languages, $language;
+ 	    }
+ 	    return sort @languages;
+ 	} else {
+ 	    my $lang;
+ 	    foreach my $theme (getallthemes('opac')) {
+ 		opendir D, "$htdocs/$theme";
+ 		foreach my $language (readdir D) {
+ 		    next if $language=~/^\./;
+ 		    next if $language eq 'all';
+ 		    $lang->{$language}=1;
+ 		}
+ 	    }
+ 	    @languages=keys %$lang;
+ 	    return sort @languages;
+ 	}
+     } elsif ($type eq 'intranet') {
+ 	$htdocs=C4::Context->config('intrahtdocs');
+ 	if ($theme and -d "$htdocs/$theme") {
+ 	    opendir D, "$htdocs/$theme";
+ 	    foreach my $language (readdir D) {
+ 		next if $language=~/^\./;
+ 		next if $language eq 'all';
+ 		push @languages, $language;
+ 	    }
+ 	    return sort @languages;
+ 	} else {
+ 	    my $lang;
+ 	    foreach my $theme (getallthemes('opac')) {
+ 		opendir D, "$htdocs/$theme";
+ 		foreach my $language (readdir D) {
+ 		    next if $language=~/^\./;
+ 		    next if $language eq 'all';
+ 		    $lang->{$language}=1;
+ 		}
+ 	    }
+ 	    @languages=keys %$lang;
+ 	    return sort @languages;
+ 	}
+     } else {
+ 	my $lang;
+ 	my $htdocs=C4::Context->config('intrahtdocs');
+ 	foreach my $theme (getallthemes('intranet')) {
+ 	    opendir D, "$htdocs/$theme";
+ 	    foreach my $language (readdir D) {
+ 		next if $language=~/^\./;
+ 		next if $language eq 'all';
+ 		$lang->{$language}=1;
+ 	    }
+ 	}
+ 	my $htdocs=C4::Context->config('opachtdocs');
+ 	foreach my $theme (getallthemes('opac')) {
+ 	    opendir D, "$htdocs/$theme";
+ 	    foreach my $language (readdir D) {
+ 		next if $language=~/^\./;
+ 		next if $language eq 'all';
+ 		$lang->{$language}=1;
+ 	    }
+ 	}
+ 	@languages=keys %$lang;
+ 	return sort @languages;
+     }
+ }
+ 
+ =item getallthemes
+ 
+   (@themes) = &getallthemes('opac');
+   (@themes) = &getallthemes('intranet');
+ 
+ Returns an array of all available themes.
+ 
+ =cut
+ 
+ sub getallthemes {
+     my $type=shift;
+     my $htdocs;
+     my @themes;
+     if ($type eq 'intranet') {
+ 	$htdocs=C4::Context->config('intrahtdocs');
+     } else {
+ 	$htdocs=C4::Context->config('opachtdocs');
+     }
+     opendir D, "$htdocs";
+     my @dirlist=readdir D;
+     foreach my $directory (@dirlist) {
+ 	-d "$htdocs/$directory/en" and push @themes, $directory;
+     }
+     return @themes;
+ }
+ 
  
  1;

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -r1.91 -r1.92
*** Search.pm	15 Aug 2004 01:50:24 -0000	1.91
--- Search.pm	16 Aug 2004 12:49:42 -0000	1.92
***************
*** 65,69 ****
  &addauthor &bibitems &barcodes &findguarantees &allissues
  &findguarantor &getwebsites &getwebbiblioitems &catalogsearch &itemcount2
! &isbnsearch &breedingsearch &getallthemes &getalllanguages &getbranchname &getborrowercategory);
  # make all your functions, whether exported or not;
  
--- 65,69 ----
  &addauthor &bibitems &barcodes &findguarantees &allissues
  &findguarantor &getwebsites &getwebbiblioitems &catalogsearch &itemcount2
! &isbnsearch &breedingsearch &getbranchname &getborrowercategory);
  # make all your functions, whether exported or not;
  
***************
*** 2569,2682 ****
  
  
- =item getalllanguages
- 
-   (@languages) = &getalllanguages($type);
-   (@languages) = &getalllanguages($type,$theme);
- 
- Returns an array of all available languages.
- 
- =cut
- 
- sub getalllanguages {
-     my $type=shift;
-     my $theme=shift;
-     my $htdocs;
-     my @languages;
-     if ($type eq 'opac') {
- 	$htdocs=C4::Context->config('opachtdocs');
- 	if ($theme and -d "$htdocs/$theme") {
- 	    opendir D, "$htdocs/$theme";
- 	    foreach my $language (readdir D) {
- 		next if $language=~/^\./;
- 		next if $language eq 'all';
- 		push @languages, $language;
- 	    }
- 	    return sort @languages;
- 	} else {
- 	    my $lang;
- 	    foreach my $theme (getallthemes('opac')) {
- 		opendir D, "$htdocs/$theme";
- 		foreach my $language (readdir D) {
- 		    next if $language=~/^\./;
- 		    next if $language eq 'all';
- 		    $lang->{$language}=1;
- 		}
- 	    }
- 	    @languages=keys %$lang;
- 	    return sort @languages;
- 	}
-     } elsif ($type eq 'intranet') {
- 	$htdocs=C4::Context->config('intrahtdocs');
- 	if ($theme and -d "$htdocs/$theme") {
- 	    opendir D, "$htdocs/$theme";
- 	    foreach my $language (readdir D) {
- 		next if $language=~/^\./;
- 		next if $language eq 'all';
- 		push @languages, $language;
- 	    }
- 	    return sort @languages;
- 	} else {
- 	    my $lang;
- 	    foreach my $theme (getallthemes('opac')) {
- 		opendir D, "$htdocs/$theme";
- 		foreach my $language (readdir D) {
- 		    next if $language=~/^\./;
- 		    next if $language eq 'all';
- 		    $lang->{$language}=1;
- 		}
- 	    }
- 	    @languages=keys %$lang;
- 	    return sort @languages;
- 	}
-     } else {
- 	my $lang;
- 	my $htdocs=C4::Context->config('intrahtdocs');
- 	foreach my $theme (getallthemes('intranet')) {
- 	    opendir D, "$htdocs/$theme";
- 	    foreach my $language (readdir D) {
- 		next if $language=~/^\./;
- 		next if $language eq 'all';
- 		$lang->{$language}=1;
- 	    }
- 	}
- 	my $htdocs=C4::Context->config('opachtdocs');
- 	foreach my $theme (getallthemes('opac')) {
- 	    opendir D, "$htdocs/$theme";
- 	    foreach my $language (readdir D) {
- 		next if $language=~/^\./;
- 		next if $language eq 'all';
- 		$lang->{$language}=1;
- 	    }
- 	}
- 	@languages=keys %$lang;
- 	return sort @languages;
-     }
- }
- 
- =item getallthemes
- 
-   (@themes) = &getallthemes('opac');
-   (@themes) = &getallthemes('intranet');
- 
- Returns an array of all available themes.
- 
- =cut
- 
- sub getallthemes {
-     my $type=shift;
-     my $htdocs;
-     my @themes;
-     if ($type eq 'intranet') {
- 	$htdocs=C4::Context->config('intrahtdocs');
-     } else {
- 	$htdocs=C4::Context->config('opachtdocs');
-     }
-     opendir D, "$htdocs";
-     my @dirlist=readdir D;
-     foreach my $directory (@dirlist) {
- 	-d "$htdocs/$directory/en" and push @themes, $directory;
-     }
-     return @themes;
- }
  
  
--- 2569,2572 ----





More information about the Koha-cvs mailing list