Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################################################################
- # Serveur Helene - A digital library management system.
- #
- # Copyright (C) 2001-2009 by The Serveur Helene Developers (see AUTHORS file).
- #
- # Serveur Helene comes with ABSOLUTELY NO WARRANTY.
- #
- # This is free software, placed under the terms of the
- # GNU General Public License, as published by the Free Software
- # Foundation; either version 2 of the License, or (at your option) any
- # later version. Please see the file LICENSE for details.
- #
- # Web Page: http://www.serveur-helene.org/
- ###############################################################################
- #! /usr/local/bin/perl
- =pod
- =head1 COPYRIGHT
- This file is part of Serveur Helene (helene_webserver package)
- Copyright (c) BrailleNet 2004 - All rights reserved
- Author: Benoit Guillon <benoit.guillon@snv.jussieu.fr>
- This program is NOT a free software. It CANNOT be redistributed
- or modified without the agreement of BrailleNet.
- This program comes with ABSOLUTELY NO WARRANTY
- $Id: website.pm 552 2009-09-04 13:54:13Z abernier $
- =cut
- ###############################################################################################
- ## Helene::website
- ## 2002-08-01
- ##
- ## Provides functions to create the HTML pages dynamically.
- ## Output information depends on the group of the current user
- package Helene::website;
- use strict;
- use CGI;
- use Helene::session;
- use Helene::param qw(:DEFAULT);
- use Helene::menu;
- use Helene::lang qw(:DEFAULT);
- use Helene::errors qw(:DEFAULT);
- sub maintainance_mode
- {
- return 0;
- }
- #################################################################
- # language_form
- # in : -
- # out : -
- # Displays the formular to switch the language
- sub language_form {
- my %languages = ('fr_FR', "Français",
- 'en_US'=>"English",
- 'it_IT'=>"Italiano");
- print "<div class='lang_choose'><form method='post' action=''><label for='ln_lang'>".i18n("langue").":</label> <select class='select_lang_choose' name='ln_lang' id='ln_lang'>";
- while(my($id, $label) = each(%languages)){
- print "<option value=\"$id\" lang=\"$id\">$label</option>";
- }
- print "</select><input class='submit_lang_choose' type='submit' value='ok'/></form></div>";
- }
- ################################################################################################
- ## top
- ## displays the top of the HTML page. (logo, title, session information, quick search form, menu
- ## in: $session (Helene::session, the current session)
- ## $title (the title of the HTML page
- ## out:
- sub top{
- my ($title, $isdocument, $querystring) = @_;
- if($main::g_Session->is_library_mode()){
- &top_library($title, $isdocument, $querystring);
- }
- else{
- &top_normal($title, $isdocument, $querystring);
- }
- }
- sub top_library{
- my ($title, $isdocument, $querystring) = @_;
- my $cgi = new CGI;
- my $lang = substr($main::g_Session->{'lang'}, 0, 2);
- print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- print "<!DOCTYPE html\n";
- print "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
- print "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
- print "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"".$lang."\" xml:lang=\"".$lang."\"><head>\n";
- print "<title>Bibliothèque Hélène - $title</title>\n";
- print "<link rev=\"made\" href=\"mailto:helene%40snv.jussieu.fr\" />";
- print "<link rel=\"stylesheet\" type=\"text/css\" href=\"".LN_HTML_WEB_DIR."/css/library.css\"/>";
- print "</head>\n";
- print "<body>\n";
- print Helene::html_shortcuts::html_invisible(i18n("Acces direct au contenu"), "#content");
- print "<a id='top' name='top'/>\n";
- if($main::g_Session->{'user'}->{'usRights'}){
- if($main::g_Session->{'user'}->is_admin()){ # If the current user is an administrator, display the admin tool bar
- &admintoolbar();
- }
- }
- else{
- &bordertop(); # layout
- }
- print "<table border='0' cellpadding='10' width='100%' class='top'>\n";
- print "<tr><td width='200'>\n";
- print "<a href='http://www.braillenet.org'><img border='0' src='".LN_HTML_WEB_DIR."/images/logo_braillenet.gif' alt=\"".i18n("Logo BrailleNet - page d'accueil du site BrailleNet")."\"/></a></td>\n";
- print "<td align='center'>\n";
- print $cgi->h1("Bibliothèque Hélène");
- print "</td><td align='right' width='200'>\n";
- $main::g_Session->html_display($cgi);
- print "</td></tr></table>\n";
- print "<form action='".LN_CGI_WEB_DIR."/books/quick.pl' method='post'>\n";
- &maintoolbar($querystring);
- print "</form>\n";
- if(!$isdocument){
- print "<div class='maindiv'>\n";
- print "<a id='content' name='content'/>\n";
- print Helene::html_shortcuts::html_invisible(i18n("Acces direct au menu"), "#menu0");
- print Helene::html_shortcuts::html_invisible(i18n("Haut de page"), "#top");
- }
- $main::g_Session->check_auth();
- $main::g_Session->{'html_headers_sent'} = 1;
- }
- sub top_normal{
- my ($title, $isdocument, $querystring) = @_;
- my $cgi = new CGI;
- my $lang = substr($main::g_Session->{'lang'}, 0, 2);
- print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- print "<!DOCTYPE html\n";
- print "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
- print "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
- print "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"".$lang."\" xml:lang=\"".$lang."\"><head>\n";
- print "<title>Serveur Hélène - $title</title>\n";
- print "<link rev=\"made\" href=\"mailto:helene%40snv.jussieu.fr\" />";
- print "<link rel=\"stylesheet\" type=\"text/css\" href=\"".LN_HTML_WEB_DIR."/css/helene.css\"/>";
- print "";
- print "</head>\n";
- print "<body>\n";
- print Helene::html_shortcuts::html_invisible(i18n("Acces direct au contenu"), "#content");
- print "<a id='top' name='top'/>\n";
- if($main::g_Session->{'user'}->{'usRights'}){
- if($main::g_Session->{'user'}->is_admin()){ # If the current user is an administrator, display the admin tool bar
- &admintoolbar();
- }
- elsif($main::g_Session->{'user'}->is_pub()){ # If the current user is a publisher
- &pubtoolbar();
- }
- elsif($main::g_Session->{'user'}->is_cts()){ # If the current user is a transcriptor, display the CTS tool bar
- &ctstoolbar();
- }
- }
- else{
- &bordertop(); # layout
- }
- print "<table border='0' cellpadding='10' width='100%' class='top'>\n";
- print "<tr><td width='200'>\n";
- print "<a href='http://www.braillenet.org'><img border='0' src='".LN_HTML_WEB_DIR."/images/logo_braillenet.gif' alt=\"".i18n("Logo BrailleNet - page d'accueil du site BrailleNet")."\"/></a></td>\n";
- print "<td align='center'>\n";
- print $cgi->h1("Serveur Hélène");
- print "</td><td align='right' width='200'>\n";
- $main::g_Session->html_display($cgi);
- print "</td></tr></table>\n";
- print "<form action='".LN_CGI_WEB_DIR."/books/quick.pl' method='post'>\n";
- &maintoolbar($querystring);
- print "</form>\n";
- if(!$isdocument){
- print "<div class='maindiv'>\n";
- print "<a id='content' name='content'/>\n";
- print Helene::html_shortcuts::html_invisible(i18n("Acces direct au menu"), "#menu0");
- print Helene::html_shortcuts::html_invisible(i18n("Haut de page"), "#top");
- }
- $main::g_Session->check_auth();
- $main::g_Session->{'html_headers_sent'} = 1;
- }
- ############################################################################################
- # printable_top
- #
- # in = title
- # out = -
- sub printable_top{
- my ($title) = @_;
- my $cgi = new CGI;
- print $cgi->start_html(-title=>"Serveur Helene - $title",
- -author=>"braillenet\@snv.jussieu.fr",
- -lang=>"fr",
- -style=>{'src'=>LN_HTML_WEB_DIR."/css/printable.css"});
- print "<h1>Association BrailleNet</h1>";
- print "<p class='subtitle'>Internet pour l'integration scolaire, professionnelle et sociale des personnes handicapees valuelles</p>";
- print "<p class='Address'>Adresse: UPMC, 9 quai St Bernard, boite 23, F-75252 Paris Cedex05<br/>Tel 01 44 27 34 35 - Fax 01 44 27 34 38<br/>Adresse e-mail: braillenet\@snv.jussieu.fr</p>";
- print "<p class='Date'>Paris, le ".Helene::tools::date_fr(Helene::tools::get_mysql_today_date())."</p>";
- }
- ##############################################################################################
- ## bordertop
- ## layout - when the user is not logged
- ## in:
- ## out:
- sub bordertop{
- print "<table border='0' cellpadding='0' cellspacing='0' width='100%' class='toolbar'>\n";
- print "<tr><td>\n";
- if(LN_MULTILANG){
- &language_form();
- }
- else{
- print "<br/>\n";
- }
- print "</td></tr>\n";
- print "</table>\n";
- }
- #############################################################################################
- ## maintoolbar
- ## displays the main tool bar, in the top of the HTML page
- ## in:
- ## out:
- sub maintoolbar{
- my ($querystring) = @_;
- print "<table border='0' cellpadding='4' cellspacing='0' width='100%' class='toolbar'>\n";
- print "<tr><td class='menu' align='left'>\n";
- print "<label for='quicksearch'>".i18n("Recherche").":</label> <input type='text' size='20' name='query' id='quicksearch' value=\"$querystring\"/> <input type='submit' value='".i18n("Rechercher")."' class='submit'/>\n";
- print "</td>\n";
- print "<td class='menu' align='right'>";
- print "<a href='".LN_CGI_WEB_DIR."/index.pl' class='menu' title=\"".i18n("Page d'accueil")."\">".i18n("accueil")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/books/catalog.pl' class='menu' title=\"".i18n("Liste de tous les ouvrages presents sur le Serveur Helene")."\">".i18n("catalogue")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/books/adsearch.pl' class='menu' title=\"".i18n("Rechercher un ouvrage dans le catalogue selon differents criteres")."\">".i18n("recherche avancee")."</a> | ";
- if ( ! $main::g_Session->is_library_mode() ) {
- print "<a href='".LN_CGI_WEB_DIR."/partners/index.pl"."' class='menu' title=\"".i18n("Liste des centres de transcription partenaires")."\">".i18n("partenaires")."</a> | <a href='".LN_ABOUT_URL."' class='menu' title=\"".i18n("Description du projet Serveur Helene")."\">".i18n("a propos")."</a> | <a href='".LN_HELP_URL."' class='menu' title=\"".i18n("obtenir de l'aide sur l'utilisation du Serveur Helene")."\">".i18n("aide")."</a>\n";
- }
- # if(Helene::users::is_admin()){
- # print " | <a href='".LN_CGI_WEB_DIR."/index.pl?switch_mode=1' class='menu' title=\"".i18n("acceder a la bibliotheque pour les personnes handicapees visuelles")."\">".i18n("bibliotheque")."</a>";
- # }
- print "</td>\n";
- print "</tr>\n";
- print "</table>\n";
- }
- #############################################################################################
- ## maintoolbar
- ## displays the main tool bar, in the top of the HTML page
- ## in:
- ## out:
- # sub maintoolbar_library{
- # my ($querystring) = @_;
- #
- # print "<table border='0' cellpadding='4' cellspacing='0' width='100%' class='toolbar'>\n";
- # print "<tr><td class='menu' align='left'>\n";
- # print "<label for='quicksearch'>".i18n("Recherche").":</label> <input type='text' size='20' name='query' id='quicksearch' value=\"$querystring\"/> <input type='submit' value='".i18n("Rechercher")."' class='submit'/>\n";
- # print "</td>\n";
- # print "<td class='menu' align='right'>";
- # print "<a href='".LN_CGI_WEB_DIR."/index.pl' class='menu' title=\"".i18n("Page d'accueil")."\">".i18n("accueil")."</a> | ";
- # print "<a href='".LN_CGI_WEB_DIR."/users/reader_registration.pl' class='menu' title=\"".i18n("Inscription a la bibliotheque")."\">".i18n("inscription")."</a> | ";
- # print "<a href='".LN_CGI_WEB_DIR."/books/catalog.pl' class='menu' title=\"".i18n("Liste de tous les ouvrages presents sur le Serveur Helene")."\">".i18n("catalogue")."</a> | ";
- # print "<a href='".LN_CGI_WEB_DIR."/books/adsearch.pl' class='menu' title=\"".i18n("Rechercher un ouvrage dans le catalogue selon differents criteres")."\">".i18n("recherche avancee")."</a> | ";
- # print "<a href='".LN_ABOUT_URL."' class='menu' title=\"".i18n("Description du projet Serveur Helene")."\">".i18n("a propos")."</a> | <a href='".LN_HELP_URL."' class='menu' title=\"".i18n("obtenir de l'aide sur l'utilisation du Serveur Helene")."\">".i18n("aide")."</a> | \n";
- # print "<a href='".LN_CGI_WEB_DIR."/index.pl?switch_mode=2' class='menu' title=\"".i18n("acceder au serveur Helene pour l'edition adaptee")."\">".i18n("serveur")."</a>";
- # print "</td>\n";
- # print "</tr>\n";
- # print "</table>\n";
- #}
- ###############################################################################################
- ## admintoolbar
- ## displays the administration tool bar, in the top of the HTML page
- ## in:
- ## out:
- sub admintoolbar{
- print "<table border='0' cellpadding='4' cellspacing='0' width='100%' class='admintoolbar'>\n";
- print "<tr><td class='menu' align='left'><span class='bold'>".i18n("Administration").":</span></td>\n";
- print "<td align='right' class='menu'><a href='".LN_CGI_WEB_DIR."/auth/list.pl' class='menu'>".i18n("autorisations")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/books/add.pl' class='menu' title=\"".i18n("ajouter une nouvelle notice")."\">".i18n("nouvelle notice")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/validation/list.pl' class='menu' title=\"".i18n("liste des notices entrees par les centres partenaires")."\">".i18n("base temporaire")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/users/index.pl' class='menu' title=\"".i18n("gestion des utilisateurs")."\">".i18n("utilisateurs")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/publishers/index.pl' class='menu' title=\"".i18n("gestion des editeurs")."\">".i18n("editeurs")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/stats/index.pl' class='menu' title=\"".i18n("statistiques de telechargements et de depôts de fichiers")."\">".i18n("statistiques")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/news/index.pl' class='menu' title=\"".i18n("gestion des informations presentes sur la page d'accueil")."\">".i18n("breves")."</a> | ";
- print "<a class='menu' title=\"".i18n("envoi des messages electroniques aux utilisateurs")."\" href='".LN_CGI_WEB_DIR."/email/index.pl'>".i18n("e-mails")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/trash/list.pl' class='menu' title=\"".i18n("liste des elements supprimes")."\">".i18n("corbeille")."</a>\n";
- print "</td>\n";
- print "</tr>\n";
- print "</table>\n";
- }
- ###############################################################################################
- ## pubtoolbar
- ## displays the pub tool bar, in the top of the HTML page
- ## in:
- ## out:
- sub pubtoolbar{
- print "<table border='0' cellpadding='4' cellspacing='0' width='100%' class='admintoolbar'>\n";
- print "<tr><td class='menu' align='left'><span class='bold'>".i18n("Transcription et autorisations").":</span></td>\n";
- print "<td align='right' class='menu'><a href='".LN_CGI_WEB_DIR."/auth/list.pl' class='menu' title=\"".i18n("gestion des autorisations")."\">".i18n("autorisation")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/stats/formats_rates.pl' class='menu' title=\"".i18n("repartition des formats")."\">".i18n("formats")."</a> | ";
- print "<a href='".LN_CGI_WEB_DIR."/books/add.pl' class='menu' title=\"".i18n("ajouter une nouvelle notice")."\">".i18n("nouvelle notice")."</a>\n";
- print "</td>\n";
- print "</tr>\n";
- print "</table>\n";
- }
- ##############################################################################################
- ## ctstoolbar
- ## displays the cts tool bar, in the top of the HTML page
- ## in:
- ## out:
- sub ctstoolbar{
- print "<table border='0' cellpadding='4' cellspacing='0' width='100%' class='admintoolbar'>\n";
- print "<tr><td class='menu' align='left'><span class='bold'>".i18n("Centres de transcription").":</span></td>\n";
- print "<td align='right' class='menu'><a href='".LN_CGI_WEB_DIR."/stats/formats_rates.pl' class='menu' title=\"".i18n("repartition des formats")."\">".i18n("formats")."</a> | <a href='".LN_CGI_WEB_DIR."/books/add.pl' class='menu' title=\"".i18n("ajouter une nouvelle notice")."\">".i18n("nouvelle notice")."</a>\n";
- print "</td>\n";
- print "</tr>\n";
- print "</table>\n";
- }
- ###############################################################################################
- ## bottom
- ## displays the bottom of the HTML page (hr, back to the top of the page, contact, link, copyright
- ## in:
- ## out:
- sub bottom{
- my ($isdocument) = @_;
- Helene::menu::check_menus();
- if(!$isdocument){
- print "</div>\n";
- }
- print "<hr width='100%'/>\n";
- print "<p><a href='http://validator.w3.org/check/referer'><img border='0' align='right' src='http://www.w3.org/Icons/valid-xhtml10' alt='Valid XHTML 1.0!' height='31' width='88' /></a></p>";
- print "<p class='bottom'><a href='#top'>".i18n("Haut de page")."</a> | <a href='mailto:helene\@snv.jussieu.fr'>".i18n("Contactez-nous")."</a> | <a href='http://www.braillenet.org'>Braillenet</a><br/>©BrailleNet, 2007<br/>version: ".LN_VERSION."</p>\n";
- print "</body></html>\n";
- $main::g_Session->{'html_bottom_sent'} = 1;
- }
- ##############################################################################################
- ## auth_form
- ## in: $cgi_query (CGI.pm, a CGI object to re-post information after authentication
- ## out:
- sub auth_form{
- my $cgi_query = new CGI;
- print "<form method='post' action=''>";
- Helene::tools::cgi_to_hidden($cgi_query);
- print "<table border='1' align='center' cellspacing='0'>";
- print "<tr><th class='auth'>".i18n("Authentification")."</th></tr><tr><td>";
- print "<table border='0' align='center'>";
- print "<tr><td>";
- print "<input type='hidden' name='authquery' value='1'/>";
- print "<label for='login'>".i18n("Login").":</label></td><td><input id='login' type='text' size='20' name='login'/></td></tr>";
- print "<tr><td><label for='mdp'>".i18n("Mot de passe").":</label></td><td><input id='mdp' type='password' size='20' name='password'/></td></tr>";
- print "<tr><td colspan='2' align='center'><input type='submit' value='".i18n("Enregistrement")."' class='submit'/></td></tr></table>";
- print "</td></tr></table>";
- print "</form>";
- }
- sub non_admin_error{
- print "<h2 class='error'>".i18n("Erreur d'authentification")."</h2>";
- print "<p class='error'>".i18n("Vous voulez acceder a une page reservee aux administrateurs, sans en avoir le droit.")."<br/>";
- print i18n("Pour ouvrir une nouvelle session, remplissez le formulaire ci-dessous").":</p>";
- &auth_form();
- }
- sub non_auth_error{
- print "<h2 class='error'>".i18n("Erreur d'authentification")."</h2>";
- print "<p class='error'>".i18n("Vous voulez acceder a une page necessitant une identification sur le serveur.")."<br/>";
- print i18n("Pour ouvrir une nouvelle session, remplissez le formulaire ci-dessous").":</p>";
- &auth_form();
- }
- sub dont_use_this_site{
- my $serverHost = LN_SERVERHOSTNAME;
- print "<h2 class='error'>".i18n("Erreur d'authentification")."</h2>";
- print "<p class='error'>Merci d'utiliser $serverHost pour vos telechargements.<br/>";
- }
- sub non_cts_error{
- print "<h2 class='error'>".i18n("Erreur d'authentification")."</h2>";
- print "<p class='error'>".i18n("Vous voulez acceder a une page reservee aux centres de transcription ou aux administrateurs, sans en avoir le droit.")."<br/>";
- print i18n("Pour ouvrir une nouvelle session, remplissez le formulaire ci-dessous").":</p>";
- &auth_form();
- }
- sub non_partner_error{
- print "<h2 class='error'>".i18n("Erreur d'authentification")."</h2>";
- print "<p class='error'>".i18n("Vous voulez acceder a une page reservee aux centres partenaires, sans en avoir le droit.")."<br/>";
- print i18n("Pour ouvrir une nouvelle session, remplissez le formulaire ci-dessous").":</p>";
- &auth_form();
- }
- sub incompleteRequest
- {
- # print "<h2 class='error'>".i18n("Requete incomplete")."</h2>";
- # print "<p class='error'>".i18n("Certains parametres obligatoires n'ont pas ete specifies.")."<br/>";
- throw_error(1, 1, 1);
- }
- #############################################################################################
- 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement