From d2a48f4bed07c35451b708aeee9f339082379e98 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 6 Oct 2008 20:49:31 +0000 Subject: [PATCH] Add a basic, ugly language picker to the SlimPAC (another part of #1) git-svn-id: svn://svn.open-ils.org/ILS/trunk@10765 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/Makefile.am | 2 + Open-ILS/src/extras/locale_html_options.pl | 44 ++++++ .../web/opac/extras/slimpac/advanced.html | 6 + .../web/opac/extras/slimpac/language.html | 140 ++++++++++++++++++ Open-ILS/web/opac/extras/slimpac/start.html | 6 + Open-ILS/web/opac/locale/en-US/opac.dtd | 4 +- 6 files changed, 200 insertions(+), 2 deletions(-) create mode 100755 Open-ILS/src/extras/locale_html_options.pl create mode 100644 Open-ILS/web/opac/extras/slimpac/language.html diff --git a/Open-ILS/src/Makefile.am b/Open-ILS/src/Makefile.am index 5405942252..710dbab02c 100644 --- a/Open-ILS/src/Makefile.am +++ b/Open-ILS/src/Makefile.am @@ -41,6 +41,7 @@ reportsdir = $(DESTDIR)$(WEBDIR)/reports/ # Collect files to be used by multiple targets autojsbinscripts = @srcdir@/extras/fieldmapper.pl \ + @srcdir@/extras/locale_html_options.pl \ @srcdir@/extras/org_tree_js.pl \ @srcdir@/extras/org_lasso_js.pl \ @srcdir@/extras/org_tree_html_options.pl \ @@ -240,6 +241,7 @@ webcore-install: ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/advanced.xml ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/myopac.xml ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/cnbrowse.xml + rm $(DESTDIR)$(WEBDIR)/reports/fm_IDL.xml cp $(DESTDIR)@sysconfdir@/fm_IDL.xml $(DESTDIR)$(WEBDIR)/reports/ diff --git a/Open-ILS/src/extras/locale_html_options.pl b/Open-ILS/src/extras/locale_html_options.pl new file mode 100755 index 0000000000..705ee3ed9d --- /dev/null +++ b/Open-ILS/src/extras/locale_html_options.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use strict; +use warnings; +# Turns supported locales into a static HTML option list + +use OpenSRF::AppSession; +use OpenSRF::System; +use OpenILS::Utils::Fieldmapper; +use OpenSRF::Utils::SettingsClient; +use OpenILS::Application::AppUtils; + +die "usage: perl locale_html_options.pl " unless $ARGV[1]; +OpenSRF::System->bootstrap_client(config_file => $ARGV[0]); + +open FILE, ">$ARGV[1]"; + +Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL")); + +my $ses = OpenSRF::AppSession->create("open-ils.cstore"); +my $locales = $ses->request("open-ils.cstore.direct.config.i18n_locale.search.atomic", {"code" => {"!=" => undef}}, {"order_by" => {"i18n_l" => "name"}})->gather(); + +print_option($locales); + +$ses->disconnect(); +close FILE; + + +sub print_option { + my $locales = shift; + my $count = 0; + my $class; + foreach my $locale (@$locales) { + my $code = OpenILS::Application::AppUtils->entityize($locale->code); + my $name = OpenILS::Application::AppUtils->entityize($locale->name); + if ($count % 2) { + $class = 'greenrow'; + } else { + $class = 'bluerow'; + } + print FILE "

$name

\n"; + $count++; + } +} + diff --git a/Open-ILS/web/opac/extras/slimpac/advanced.html b/Open-ILS/web/opac/extras/slimpac/advanced.html index 178fad210a..684336144c 100644 --- a/Open-ILS/web/opac/extras/slimpac/advanced.html +++ b/Open-ILS/web/opac/extras/slimpac/advanced.html @@ -184,6 +184,12 @@ | + + &slimpac.language.select; + + + | + &footer.find.library; diff --git a/Open-ILS/web/opac/extras/slimpac/language.html b/Open-ILS/web/opac/extras/slimpac/language.html new file mode 100644 index 0000000000..def9a86bd7 --- /dev/null +++ b/Open-ILS/web/opac/extras/slimpac/language.html @@ -0,0 +1,140 @@ + + + +]> + + + + &slimpac.language.select; + + + + +

&slimpac.language.select;

+
+ +
+ + + + + diff --git a/Open-ILS/web/opac/extras/slimpac/start.html b/Open-ILS/web/opac/extras/slimpac/start.html index 9cc06f500d..2e6abc6419 100644 --- a/Open-ILS/web/opac/extras/slimpac/start.html +++ b/Open-ILS/web/opac/extras/slimpac/start.html @@ -144,6 +144,12 @@ | + + &slimpac.language.select; + + + | + &footer.find.library; diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index 40f486ac14..5335f273c4 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -628,6 +628,8 @@ Ensure Caps-Lock is off and try again or contact your local library."> + + @@ -643,8 +645,6 @@ Ensure Caps-Lock is off and try again or contact your local library."> - - -- 2.43.2