Hi everyone, Steve, Chris and I have just had a little discuss about the design of the theme and language setting process. This is the resulting proposal: There are three levels where the theme can be found: 1) on the borrowers table. Each user can set there prefered theme and language. 2) on a new workstation table. This table will store an IP address for a machine and various settings will be possible. At the moment only theme and language. Perhaps also a list of admissible themes and languages? 3) in the systempreferences table. Each script shouild have the following template selecting line: my $template = gettemplate("opac-main.tmpl", "opac"); for example where the template is opac-main.tmpl The gettemplate subroutine is in Output.pm. The individual scripts dont need to "use HTML::Template;" only Output.pm The gettemplate sub goes and looks in the above three places in the order specified. All of these settings will can be space seperated (maybe they should be comma seperated?) lists: like "sp fr en" for language. And it will search in that order. There will be no cookies! This is the first approx. If people have some special requests we can add an options hash to the gettemplate argument to control special behaiviour but I wont do that until we need it. Progress: The gettemplate routine is written! But I need to do some more stuff to get the user and IP preferences settup..... All feedback welcomed. Finlay Katipo Communications.
Finlay Thompson schrieb:
This is the first approx. If people have some special requests we can add an options hash to the gettemplate argument to control special behaiviour but I wont do that until we need it.
Progress: The gettemplate routine is written! But I need to do some more stuff to get the user and IP preferences settup.....
All feedback welcomed.
You mean something like: $userip = %ENV{'REMOTE_ADDR'}; # ;-) Did you have a look on my getpathtotemplate funktion? for getting the language it calls the getlanguage-function (also in C4::Output). i suppose this to be quite elegant, it uses the settings in your browser first. the getpathtotemplate returns what it is supposed to return plus a few infos about success. in my opinion it is better to call HTML::Template::new in the script, so you have more control over your template without having to pass parameters unnessesarily through. maybe it's a good idea to let gettemplate call getpathttotemplate. this function can also still be adjusted if paths change. Did i get you right: the templates should mix up with html and images...? Dorian
On Wed, Sep 18, 2002 at 09:48:25AM +0200, Dorian Meid wrote:
You mean something like: $userip = %ENV{'REMOTE_ADDR'}; # ;-)
This should be written: $userip = $ENV{'REMOTE_ADDR'}; # :-) ^ If the user is coming from a proxy or firewall, this would be the proxy/firewall's IP. If the proxy is squid, there will be some more stuff inside $ENV{"HTTP_X_FORWARDED_FOR"}. -- Ambrose Li <a.c.li@ieee.org> http://trends.ca/~acli/ http://www.cccgt.org/ DRM is theft - We are the stakeholders
Finlay Thompson wrote:
Hi everyone,
Steve, Chris and I have just had a little discuss about the design of the theme and language setting process.
This is the resulting proposal:
There are three levels where the theme can be found:
1) on the borrowers table. Each user can set there prefered theme and language.
2) on a new workstation table. This table will store an IP address for a machine and various settings will be possible. At the moment only theme and language. Perhaps also a list of admissible themes and languages?
3) in the systempreferences table.
Each script shouild have the following template selecting line:
my $template = gettemplate("opac-main.tmpl", "opac");
for example where the template is opac-main.tmpl
The gettemplate subroutine is in Output.pm. The individual scripts dont need to "use HTML::Template;" only Output.pm
The gettemplate sub goes and looks in the above three places in the order specified.
All of these settings will can be space seperated (maybe they should be comma seperated?) lists: like "sp fr en" for language. And it will search in that order.
There will be no cookies!
This is the first approx. If people have some special requests we can add an options hash to the gettemplate argument to control special behaiviour but I wont do that until we need it.
Progress: The gettemplate routine is written! But I need to do some more stuff to get the user and IP preferences settup.....
The idea 2) won't work well with DHCP'ed networks ;-\\\ -- Paul
On Wed, Sep 18, 2002 at 04:46:34PM +1200, Finlay Thompson wrote:
Each script shouild have the following template selecting line:
my $template = gettemplate("opac-main.tmpl", "opac");
for example where the template is opac-main.tmpl
Could this be abstracted? That is, hide it in a module somewhere, and just have each script use use Koha::CGI; or some such. Then the line above can just go in Koha/CGI.pm. Then there's less code to maintain in each individual script. In addition, if the template name is just the name of the script with "pl" replaced by "tmpl", it can make an educated guess as to the template name.
All of these settings will can be space seperated (maybe they should be comma seperated?) lists: like "sp fr en" for language. And it will search in that order.
A word of caution: one thing that I learned on another project is that translations are never up to date. I suspect this is especially true of images. Hence, anything that involves i18n will need to fail gracefully. If you show the original English text to a French speaker, that's not good, but it's better than showing nothing at all (or even a misleading French message). Hence, the code that picks the appropriate language-specific files ought to pick the English file if it can't find the correct one. Now that I think about it, I suspect the same thing applies to themes: if the selected theme isn't complete, the file-picker should probably default to using the appropriate file from the default theme.
There will be no cookies!
Yay! -- Andrew Arensburger This message *does* represent the arensb@ooblick.com views of ooblick.com When in Rome... romance!
participants (5)
-
Ambrose Li -
Andrew Arensburger -
Dorian Meid -
Finlay Thompson -
paul POULAIN