diff --git a/INSTALL b/INSTALL index d02762110..8a8c87eaf 100644 --- a/INSTALL +++ b/INSTALL @@ -1,619 +1,619 @@ CDS Invenio INSTALLATION ======================== Revision: $Id$ About ===== This document specifies how to build, customize, and install CDS Invenio for the first time. See RELEASE-NOTES if you are upgrading from a previous CDS Invenio release. Contents ======== 0. Prerequisites 1. Quick instructions for the impatient CDS Invenio admin 2. Detailed instructions for the patient CDS Invenio admin 0. Prerequisites ================ Here is the software you need to have around before you start installing CDS Invenio: a) Unix-like operating system. The main development and production platform for CDS Invenio at CERN is Debian GNU/Linux, but we actively develop also on FreeBSD and Mac OS X. Basically any Unix system supporting the software listed below should do. Note that if you are using Debian "Sarge" GNU/Linux, you can install most of the below-mentioned prerequisites and recommendations by running: $ sudo apt-get install libapache2-mod-python2.3 \ apache2-mpm-prefork mysql-server-4.1 mysql-client-4.1 \ python2.3-mysqldb python2.3-pyrex python2.3-4suite \ python2.3-xml python2.3-libxml2 python2.3-libxslt1 \ rxp wml gnuplot xpdf-utils gs-common antiword catdoc \ wv html2text ppthtml xlhtml clisp gettext You can also install the following packages: $ sudo apt-get install python2.3-psyco sbcl cmucl The last three packages are not available on all Debian "Sarge" GNU/Linux architectures (e.g. not on AMD64), but they are only recommended so you can safely continue without them. Note that the web application server should run a Message Transfer Agent (MTA) such as Postfix so that CDS Invenio can email notification alerts or registration information to the end users, contact moderators and reviewers of submitted documents, inform administrators about various runtime system information, etc. b) MySQL server (may be on a remote machine), and MySQL client (must be available locally too). MySQL versions 4.1 or 5.0. Please set the variable ``max_allowed_packet'' in your ``my.cnf'' init file to at least 4M. c) Apache 2 server, with support for loading DSO modules, and optionally with SSL support for HTTPS-secure user authentication. Tested mainly with version 2.0.43 and above. Apache 2.x is required for the mod_python module (see below). d) Python v2.3 or above: as well as the following Python modules: - (mandatory) MySQLdb (do *not* use 1.2.1*; see below) - (mandatory) Pyrex or Cython (versions above 0.9.3): - (recommended) PyXML, for XML processing: - (recommended) PyRXP, for very fast XML MARC processing: - (recommended) libxml2-python, for XML/XLST processing: - (recommended) Gnuplot.Py, for producing graphs: - (optional) 4suite, slower alternative to PyRXP and libxml2-python: - (optional) Psyco, to speed up the code at places: - (optional) RDFLib, to use RDF ontologies and thesauri: - (optional) mechanize, to run regression web test suite: Note: If you happen to use MySQLdb 1.2.1* and get into problems with character encoding, please apply the following patch: "[1521274] uncorrect handling of encoded strings in cursors.py" or, alternatively, use MySQLdb 1.2.0. e) mod_python Apache module. Tested mainly with versions 3.0BETA4 and above. mod_python 3.x is required for Apache 2. Previous versions (as well as Apache 1 ones) exhibited some problems with MySQL connectivity in our experience. f) WML - Website META Language. Tested mainly with versions 2.0.8 and 2.0.9. Note that on Red Hat Linux 9 the WML 2.0.9 compiled with Perl 5.8.0 exhibits problems, so you better use downgraded/upgraded Perl for compiling WML on that platform. g) If you want to be able to extract references from PDF fulltext files, then you need to install pdftotext version 3 at least. h) If you want to be able to search for words in the fulltext files (i.e. to have fulltext indexing), then you need as well to install some of the following tools: - for PDF files: pdftotext or pstotext - for PostScript files: pstotext or ps2ascii - for MS Word files: antiword, catdoc, or wvText - for MS PowerPoint files: pptHtml and html2text - for MS Excel files: xlhtml and html2text i) If you have chosen to install fast XML MARC Python processors in the step d) above, then you have to install the parsers themselves: - (optional) RXP: - (optional) 4suite: j) (recommended) Gnuplot, the command-line driven interactive plotting program. It is used to display download and citation history graphs on the Detailed record pages on the web interface. Note that Gnuplot is not required, only recommended. k) (recommended) A Common Lisp implementation, such as CLISP, SBCL or CMUCL. It is used for the web server log analysing tool and the metadata checking program. Note that any of the three implementations CLISP, SBCL, or CMUCL will do. CMUCL produces fastest machine code, but it does not support UTF-8 yet. Pick up CLISP if you don't know what to do. Note that a Common Lisp implementation is not required, only recommended. l) GNU Gettext, a set of tools that makes it possible to translate the application in multiple languages. This is available by default on many systems. Note that the configure script checks whether you have all the prerequisite software installed and that it won't let you continue unless everything is in order. It also warns you if it cannot find some optional but recommended software. 1. Quick instructions for the impatient CDS Invenio admin ========================================================= $ cd /usr/local/src/ $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz.md5 $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz.sig $ md5sum -v -c cds-invenio-0.92.1.tar.gz.md5 $ gpg --verify cds-invenio-0.92.1.tar.gz.sig cds-invenio-0.92.1.tar.gz $ tar xvfz cds-invenio-0.92.1.tar.gz $ cd cds-invenio-0.92.1 $ ./configure --prefix=/opt/cds-invenio \ --with-weburl=http://webserver.domain.com \ --with-sweburl=https://webserver.domain.com \ --with-dbhost=sqlserver.domain.com \ --with-dbname=cdsinvenio \ --with-dbuser=cdsinvenio \ --with-dbpass=my123pass \ --with-python=/opt/python/bin/python2.3 - $ vi ./config/config.wml ## optional, but strongly recommended + $ vi ./config/config.wml ## optional, but strongly recommended $ make - $ make check-local-templates ## optional, only when upgrading + $ make check-custom-templates ## optional, only when upgrading $ make install $ sudo vi /path/to/apache/conf/httpd.conf ## see below in part 2 $ sudo /path/to/apache/bin/apachectl graceful $ sudo chgrp -R www-data /opt/cds-invenio $ sudo chmod -R g+r /opt/cds-invenio $ sudo chmod -R g+rw /opt/cds-invenio/var $ sudo find /opt/cds-invenio -type d -exec chmod g+rxw {} \; - $ make create-demo-site ## optional - $ make load-demo-records ## optional - $ make test ## optional - $ make regression-test ## optional - $ make remove-demo-records ## optional - $ make drop-demo-site ## optional + $ make create-demo-site ## optional + $ make load-demo-records ## optional + $ make test ## optional + $ make regression-test ## optional + $ make remove-demo-records ## optional + $ make drop-demo-site ## optional $ firefox http://webserver.domain.com/admin/ ## optional 2. Detailed instructions for the patient CDS Invenio admin ========================================================== The CDS Invenio uses standard GNU autoconf method to build and install its files. This means that you proceed as follows: $ cd /usr/local/src/ Change to a directory where we will configure and build the CDS Invenio. (The built files will be installed into different "target" directories later.) $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz.md5 $ wget http://cdsware.cern.ch/download/cds-invenio-0.92.1.tar.gz.sig Fetch CDS Invenio source tarball from the CDS Software Consortium distribution server, together with MD5 checksum and GnuPG cryptographic signature files useful for verifying the integrity of the tarball. $ md5sum -v -c cds-invenio-0.92.1.tar.gz.md5 Verify MD5 checksum. $ gpg --verify cds-invenio-0.92.1.tar.gz.sig cds-invenio-0.92.1.tar.gz Verify GnuPG cryptographic signature. Note that you may first have to import my public key into your keyring, if you haven't done that already: $ gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 0xBA5A2B67 The output of the gpg --verify command should then read: Good signature from "Tibor Simko " You can safely ignore any trusted signature certification warning that may follow after the signature has been successfully verified. $ tar xvfz cds-invenio-0.92.1.tar.gz Untar the distribution tarball. $ cd cds-invenio-0.92.1 Go to the source directory. $ ./configure --prefix=/opt/cds-invenio \ --with-weburl=http://webserver.domain.com \ --with-sweburl=https://webserver.domain.com \ --with-dbhost=sqlserver.domain.com \ --with-dbname=cdsinvenio \ --with-dbuser=cdsinvenio \ --with-dbpass=myp1ss \ --with-python=/opt/python/bin/python2.3 Configure essential CDS Invenio parameters, with the following signification: --prefix=/opt/cds-invenio CDS Invenio general installation directory, used to hold command-line binaries and program libraries containing the core CDS Invenio functionality, but also to store web pages, runtime log and cache information, etc. Several subdirs like `bin', `lib', and `var' will be created inside the --prefix directory to this effect. Note that the --prefix directory should be chosen outside of the Apache htdocs tree, since only one its subdirectory (prefix/var/www) is to be accessible directly via the Web (see below). --with-weburl=http://webserver.domain.com The URL denoting the home URL of your CDS Invenio installation. The files served by this URL will be located in `prefix/var/www', so later on in your Apache config file you would map `weburl' to `prefix/var/www' (see below). --with-sweburl=https://webserver.domain.com The URL denoting the HTTPS-secure equivalent of the home URL. The secure home URL will be used for personalization pages, such as user login and registration page. You must run SSL-enabled Apache in order to use this feature. If you don't run SSL-enabled Apache, then the user authentication will be done via standard HTTP protocol, user credentials travelling in clear text across the net. The --with-sweburl option is optional. --with-dbhost=sqlserver.domain.com --with-dbname=cdsinvenio --with-dbuser=cdsinvenio --with-dbpass=myp1ss The database server host, the database name, and the database user credentials. --with-python=/opt/python/bin/python2.3 Optionally, specify a path to some specific Python binary. This is useful if you have more than one Python installation on your system. If you don't set this option, then the first Python that will be found in your PATH will be chosen for running CDS Invenio. CDS Invenio won't install to any other directory but to the one mentioned in this configuration line. Do not use trailing slashes when specifying any of the above values. This configuration step is mandatory. Usually, you do this step only once. (Note that if you prefer to build CDS Invenio out of its source tree, you may run the above configure command like this: mkdir build && cd build && ../configure --prefix=... FIXME: this is not working right now as per the introduction of intbitset_setup.py.) $ vi ./config/config.wml ## optional, but strongly recommended Optionally, customize your CDS Invenio installation. We strongly recommend you to edit at least the top of this file where you can define some very essential CDS Invenio parameters like the name of your CDS Invenio document server (look for CDSNAME and CDSNAMEINTL) or the email address of the local CDS Invenio administrator (look for SUPPORTEMAIL and ADMINEMAIL). The latter is needed if you want to use administration modules, and you will certainly do. The rest of the "config.wml" file enables you to change the CDS Invenio web page look and feel, and otherwise to influence its behaviour and default parameters. CDS Invenio HTML pages will be pre-generated using the values set in the config.wml file. This configuration step is optional, but strongly recommended. If you change some values in config.wml, you should restart the installation from here. $ make Launch the CDS Invenio build. Since many messages are printed during the build process, you may want to run it in a fast-scrolling terminal such as rxvt or in a detached screen session. During this step all the pages and scripts will be pre-created and customized based on the config you have edited in the previous step. Note that on systems such as FreeBSD or Mac OS X you have to use GNU make ("gmake") instead of "make". - $ make check-local-templates ## Optional, only when upgrading + $ make check-custom-templates ## Optional, only when upgrading Check if your customized page templates (see WebStyle Admin guide) still conform to the default templates. This gives you a chance to fix your templates before running 'make install', by providing a list of incompatibilities of your custom templates with the new versions of the templates. This step is only useful if you are upgrading and you have previously customized page templates. $ make install Install the web pages, scripts, utilities and everything needed for runtime into the respective directories, as specified earlier by the configure command. Note that the "make install" step checks for potential problems such as the database connection rights and may ask you to perform some more administrative steps in case it detects a problem. Notably, it may ask you to: a) Set up database access permissions, e.g.: $ mysql -h sqlserver.domain.com -u root -p mysql mysql> CREATE DATABASE cdsinvenio; mysql> GRANT ALL PRIVILEGES ON cdsinvenio.* \ TO cdsinvenio@webserver.domain.com \ IDENTIFIED BY 'myp1ss'; If you are installing CDS Invenio for the first time, you have to create a dedicated database on your MySQL server that the CDS Invenio can use for its purposes. Please contact your MySQL administrator and ask him to execute the above commands that create the "cdsinvenio" database, a user called "cdsinvenio" with password "myp1ss", and that will grant all rights on the "cdsinvenio" database to the "cdsinvenio" user. The credential values should be the ones you have chosen during the configure command executed before. Note that the "make install" process will hint you at the exact command to use based on the values you have used in the configure line. b) Set up database tables: $ make create-tables If you are installing CDS Invenio for the first time, you have to create the database tables by launching the above command. c) Set up symbolic Python "invenio" module link: $ sudo ln -s /opt/cds-invenio/lib/python/invenio \ /usr/local/lib/python2.3/site-packages/invenio If you are installing CDS Invenio for the first time, you have to create a symbolic link from Python's site-packages directory that would indicate to Python where to find CDS Invenio's Python files. Note that the exact symlink target location depends on the --prefix location (prefix/lib/python/invenio) and the exact symlink source location depends on the Python version you are using. Note that the "make install" process will hint you at the exact command to use based on the values you have used in the configure line. At this point you should now have successfully completed the "make install" process. We continue by setting up the Apache web server. $ sudo vi /path/to/apache/conf/httpd.conf Please ask your webserver administrator to put the following line in your "httpd.conf" configuration file: AddDefaultCharset UTF-8 This is to ensure that the browsers will get UTF-8 as the default page encoding. As mentioned above, the web pages will get installed into the `prefix/var/www' directory. Therefore you should specify something along the lines of: ServerSignature Off ServerTokens Prod NameVirtualHost *:80 ServerName webserver.domain.com ServerAlias webserver ServerAdmin cds.support@cern.ch DocumentRoot /opt/cds-invenio/var/www Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ErrorLog /opt/cds-invenio/var/log/apache.err LogLevel warn CustomLog /opt/cds-invenio/var/log/apache.log combined DirectoryIndex index.en.html index.html SetHandler python-program PythonHandler invenio.webinterface_layout PythonDebug On AddHandler python-program .py PythonHandler mod_python.publisher PythonDebug On This will tell Apache where to find the files, how to interpret .py files, which files to serve as indexes, etc. If you have configured the system to use secure URL for login (see above), then you have to specify secure site too, such as: ServerSignature Off ServerTokens Prod NameVirtualHost *:443 #SSLCertificateFile /etc/apache2/ssl/apache.pem SSLCertificateFile /etc/apache2/ssl/server.crt SSLCertificateKeyFile /etc/apache2/ssl/server.key ServerName webserver.domain.com ServerAlias webserver ServerAdmin cds.support@cern.ch SSLEngine on DocumentRoot /opt/cds-invenio/var/www Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ErrorLog /opt/cds-invenio/var/log/apache-ssl.err LogLevel warn CustomLog /opt/cds-invenio/var/log/apache-ssl.log combined DirectoryIndex index.en.html index.html SetHandler python-program PythonHandler invenio.webinterface_layout PythonDebug On AddHandler python-program .py PythonHandler mod_python.publisher PythonDebug On $ sudo /path/to/apache/bin/apachectl graceful Please ask your webserver administrator to restart the Apache server after the above "httpd.conf" changes. $ sudo chgrp -R www-data /opt/cds-invenio $ sudo chmod -R g+r /opt/cds-invenio $ sudo chmod -R g+rw /opt/cds-invenio/var $ sudo find /opt/cds-invenio -type d -exec chmod g+rxw {} \; One more superuser step, because we need to enable Apache server to read files from the installation place and to write some log information and to cache interesting entities inside the "var" subdirectory of our CDS Invenio installation directory. Here we assumed that your Apache server processes are run under "www-data" group. Change this appropriately for your system. Moreover, note that if you are using SELinux extensions (e.g. on Fedora Core 6), you may have to check and enable the write access of Apache user there too. After these admin-level tasks to be performed as root, let's now go back to finish the installation of the CDS Invenio. $ make create-demo-site ## optional This step is recommended to test your local CDS Invenio installation. It should give you our "Atlantis Institute of Science" demo installation, exactly as you see it at . $ make load-demo-records ## optional Optionally, load some demo records to be able to test indexing and searching of your local CDS Invenio demo installation. $ make test ## optional Optionally, you can run the unit test suite to verify the unit behaviour of your local CDS Invenio installation. Note that this command should be run only after you have installed the whole system via `make install'. $ make regression-test ## optional Optionally, you can run the full regression test suite to verify the functional behaviour of your local CDS Invenio installation. Note that this command requires to have created the demo site and loaded the demo records. Note also that running the regression test suite may alter the database content with junk data, so that rebuilding the demo site is strongly recommended afterwards. $ make remove-demo-records ## optional Optionally, remove the demo records loaded in the previous step, but keeping otherwise the demo collection, submission, format, and other configurations that you may reuse and modify for your own production purposes. $ make drop-demo-site ## optional Optionally, drop also all the demo configuration so that you'll end up with a completely blank CDS Invenio system for your own production purposes. $ firefox http://webserver.domain.com/admin/ ## optional Optionally, do further runtime configurations of CDS Invenio, like definition of data collections, document types, document formats, word file tables, etc. This configuration step is optional but you will most probably want to define specific data collections suited to your setup, or to configure submit pages for fill your collections, to define new output formats, etc. This configuration step uses MySQL configuration tables and can be done anytime during the production of your system. Good luck, and thanks for choosing CDS Invenio. - CDS Development Group diff --git a/Makefile.am b/Makefile.am index c65c754b7..7a0a64cf5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,297 +1,298 @@ + ## $Id$ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it 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. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. confignicedir = $(sysconfdir)/build confignice_SCRIPTS=config.nice SUBDIRS = po config modules EXTRA_DIST = UNINSTALL CREDITS RELEASE-NOTES configure-tests.py config.nice.in ## submit stuff for demo data link creation sbmdir = $(localstatedir)/www/submit/access/protected sbmdat = SBITEXT MBITEXT FTTTEXT SRVTEXT TFUTEXT \ SBIRTEXT MBIRTEXT FTTRTEXT SRVRTEXT TFURTEXT APPRTEXT \ SBIPICT MBIPICT FTTPICT \ SBIRPICT MBIRPICT FTTRPICT APPRPICT all: @echo "**************************************************************" @echo "** CDS Invenio has been successfully built. **" @echo "** **" @echo "** If you are upgrading and you have previously customized **" @echo "** page templates (see WebStyle Admin guide), please **" - @echo "** run now 'make check-local-templates' in order to ensure **" + @echo "** run now 'make check-custom-templates' in order to ensure **" @echo "** that they are still valid. **" @echo "** **" @echo "** Otherwise you can proceed to do 'make install' now. **" @echo "**************************************************************" test: @if [ -e @prefix@/bin/testsuite ]; then \ @prefix@/bin/testsuite ; \ else \ echo "Hmm, testsuite does not seem to be installed. Please do 'make install' first."; \ fi regression-test: @if [ -e @prefix@/bin/regressiontestsuite ]; then \ @prefix@/bin/regressiontestsuite ; \ else \ echo "Hmm, regressiontestsuite does not seem to be installed. Please do 'make install' first."; \ fi -check-local-templates: - $(PYTHON) $(top_srcdir)/modules/webstyle/lib/template.py --check-local-templates $(top_srcdir) +check-custom-templates: + $(PYTHON) $(top_srcdir)/modules/webstyle/lib/template.py --check-custom-templates $(top_srcdir) kwalitee-check: $(PYTHON) $(top_srcdir)/modules/miscutil/lib/kwalitee.py $(top_srcdir) kwalitee-check-errors-only: find $(top_srcdir) -name '*.py' -exec pylint -e {} \; 2> /dev/null etags: \rm -f $(top_srcdir)/TAGS (cd $(top_srcdir) && find $(top_srcdir) -name "*.py" -print | xargs etags) install-data-local: for d in / /cache /log /tmp /data /run ; do \ mkdir -p $(localstatedir)$$d && \ chmod ug=rwx $(localstatedir)$$d ; \ done @echo "************************************************************" @echo "** CDS Invenio has been successfully installed! **" @echo "** **" @echo "** If you are installing CDS Invenio for the first time, **" @echo "** please continue with the Apache httpd configuration **" @echo "** step, as described in the INSTALL file. **" @echo "** Afterwards you may want to run 'make create-demo-site' **" @echo "** to test your new installation. **" @echo "** **" @echo "** If you are reinstalling CDS Invenio because you have **" @echo "** edited CDS Invenio sources or its WML configuration, **" @echo "** you may want to restart your Apache server now by **" @echo "** running 'sudo apachectl restart'. **" @echo "************************************************************" create-tables: local-dbexec local-tabfill ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql ./modules/miscutil/bin/dbexec < ./modules/miscutil/sql/tabfill.sql update-v0.3.0-tables update-v0.3.1-tables: local-dbexec echo "ALTER TABLE idxINDEXNAME CHANGE id_idxINDEX id_idxINDEX mediumint(9) unsigned NOT NULL FIRST;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE rnkMETHODNAME CHANGE id_rnkMETHOD id_rnkMETHOD mediumint(9) unsigned NOT NULL FIRST;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE collectionname CHANGE id_collection id_collection mediumint(9) unsigned NOT NULL FIRST;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE formatname CHANGE id_format id_format mediumint(9) unsigned NOT NULL FIRST;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE fieldname CHANGE id_field id_field mediumint(9) unsigned NOT NULL FIRST;" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'runbibrank','run BibRank','','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'cfgbibrank','configure BibRank','','no');" | ./modules/miscutil/bin/dbexec update-v0.3.2-tables: local-dbexec echo "ALTER TABLE sbmCOLLECTION_sbmDOCTYPE CHANGE id_son id_son char(10) NOT NULL default '0';" | ./modules/miscutil/bin/dbexec update-v0.3.3-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "ALTER TABLE flxLINKTYPEPARAMS CHANGE pname pname varchar(78) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE rnkMETHOD DROP star_category_ranges;" | ./modules/miscutil/bin/dbexec echo "DROP TABLE rnkSET;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE schTASK CHANGE arguments arguments LONGTEXT;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE schTASK CHANGE status status varchar(50);" | ./modules/miscutil/bin/dbexec update-v0.5.0-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "ALTER TABLE session ADD INDEX uid (uid);" | ./modules/miscutil/bin/dbexec echo "UPDATE idxINDEXNAME SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE rnkMETHODNAME SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE collectionname SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE collection_portalbox SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE formatname SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE fieldname SET ln='cs' WHERE ln='cz';" | ./modules/miscutil/bin/dbexec echo "UPDATE idxINDEXNAME SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec echo "UPDATE rnkMETHODNAME SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec echo "UPDATE collectionname SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec echo "UPDATE collection_portalbox SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec echo "UPDATE formatname SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec echo "UPDATE fieldname SET ln='sv' WHERE ln='se';" | ./modules/miscutil/bin/dbexec update-v0.7.1-tables: local-dbexec echo "DROP TABLE oaiHARVEST;" | ./modules/miscutil/bin/dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'cfgbibharvest','configure BibHarvest','','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'runoaiharvest','run BibHarvest oaiharvest','','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'cfgwebcomment','configure WebComment','','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'runoaiarchive','run BibHarvest oaiarchive','','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION (id,name,description,allowedkeywords,optional) VALUES (NULL,'runbibedit','run BibEdit','','no');" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user ADD nickname varchar(255) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user ADD last_login datetime NOT NULL default '0000-00-00 00:00:00';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user ADD INDEX nickname (nickname);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE sbmFIELD CHANGE subname subname varchar(13) default NULL;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user_query_basket CHANGE alert_name alert_name varchar(30) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "TRUNCATE TABLE session;" | ./modules/miscutil/bin/dbexec @echo "**********************************************************" @echo "** Do not forget to run the basket migration now: **" @echo "** @PYTHON@ modules/webbasket/lib/webbasket_migration_kit.py " @echo "** Please see the RELEASE-NOTES for details. **" @echo "**********************************************************" @echo "INSERT INTO oaiARCHIVE (id, setName, setSpec, setDescription, setDefinition, setRecList) SELECT id, setName, setSpec, CONCAT_WS('', setDescription), setDefinition, setRecList FROM oaiSET;" update-v0.90.0-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "ALTER TABLE format ADD COLUMN (description varchar(255) default '');" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE format ADD COLUMN (content_type varchar(255) default '');" | ./modules/miscutil/bin/dbexec update-v0.90.1-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "ALTER TABLE schTASK ADD INDEX status (status);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE schTASK ADD INDEX runtime (runtime);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE sbmCATEGORIES ADD COLUMN score TINYINT UNSIGNED NOT NULL DEFAULT 0;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE sbmCATEGORIES ADD PRIMARY KEY (doctype, sname);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE sbmCATEGORIES ADD KEY doctype (doctype);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiHARVEST ADD COLUMN setspecs TEXT NOT NULL DEFAULT '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE setDescription setDescription text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE p1 p1 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE f1 f1 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE m1 m1 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE p2 p2 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE f2 f2 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE m2 m2 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE p3 p3 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE f3 f3 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiARCHIVE CHANGE m3 m3 text NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "UPDATE bibdoc SET status=0 WHERE status='';" | ./modules/miscutil/bin/dbexec echo "UPDATE bibdoc SET status=1 WHERE status='deleted';" | ./modules/miscutil/bin/dbexec update-v0.92.0-tables: local-dbexec echo "UPDATE bibdoc SET status=0 WHERE status='';" | ./modules/miscutil/bin/dbexec echo "UPDATE bibdoc SET status=1 WHERE status='deleted';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE schTASK CHANGE arguments arguments mediumblob;" | ./modules/miscutil/bin/dbexec echo "UPDATE user SET note=1 WHERE nickname='admin' AND note IS NULL;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE usergroup CHANGE name name varchar(255) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE usergroup ADD login_method varchar(255) NOT NULL default 'INTERNAL';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE usergroup ADD UNIQUE KEY login_method_name (login_method(70), name);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user CHANGE settings settings blob default NULL;" | ./modules/miscutil/bin/dbexec echo "INSERT INTO sbmALLFUNCDESCR VALUES ('Get_Recid', 'This function gets the recid for a document with a given report-number (as stored in the global variable rn).');" | ./modules/miscutil/bin/dbexec update-v0.92.1-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(top_srcdir)/modules/miscutil/sql/tabcreate.sql echo "UPDATE bibdoc SET status=0 WHERE status='';" | ./modules/miscutil/bin/dbexec echo "UPDATE bibdoc SET status=1 WHERE status='deleted';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiHARVEST CHANGE postprocess postprocess varchar(20) NOT NULL default 'h';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE oaiHARVEST ADD COLUMN bibfilterprogram varchar(255) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE idxINDEXNAME CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE rnkMETHODNAME CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE collectionname CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE collection_portalbox CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE formatname CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE fieldname CHANGE ln ln char(5) NOT NULL default '';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE accROLE ADD COLUMN firerole_def_ser tinyblob NULL;" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE accROLE ADD COLUMN firerole_def_src tinytext NULL;" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION VALUES (22,'accrestrcoll','view restricted collection','collection','no');" | ./modules/miscutil/bin/dbexec echo "INSERT INTO accACTION VALUES (23,'runsessiongc','run SessionGC','','no');" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user_accROLE ADD COLUMN expiration datetime NOT NULL default '9999-12-31 23:59:59';" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE user DROP INDEX id, ADD PRIMARY KEY id (id);" | ./modules/miscutil/bin/dbexec echo "ALTER TABLE format ADD COLUMN visibility TINYINT NOT NULL default 1;" | ./modules/miscutil/bin/dbexec drop-tables: local-dbexec ./modules/miscutil/bin/dbexec < $(srcdir)/modules/miscutil/sql/tabdrop.sql local-dbexec: (cd ./modules/miscutil/bin; make) local-tabfill: $(srcdir)/modules/miscutil/sql/tabfill.sql.wml (cd ./modules/miscutil/sql; make) create-demo-site: # for f in $(sbmdat); do \ # if [ ! -e $(sbmdir)/$$f.shtml ]; then \ # ln -s $(sbmdir)/go.shtml $(sbmdir)/$$f.shtml ; \ # else \ # echo "link $(sbmdir)/$$f.shtml already exists"; \ # fi \ # done ./modules/miscutil/bin/dbexec < ./modules/miscutil/demo/democfgdata.sql ./modules/webaccess/bin/webaccessadmin -u admin -c echo "TRUNCATE schTASK;" | ${prefix}/bin/dbexec ${prefix}/bin/webcoll -uadmin ${prefix}/bin/webcoll 1 @echo "***********************************************************************" @echo "** The demo site has been successfully created. **" @echo "** **" @echo "** Please point your browser to @WEBURL@ " @echo "** It should ressemble our 'Atlantis Institute of Fictive Science' **" @echo "** demo site that is available at , **" @echo "** with the exception that no demo records have been loaded yet. **" @echo "** **" @echo "** To load demo records, you can run 'make load-demo-records'. **" @echo "** To drop the demo site, you can run 'make drop-demo-site'. **" @echo "***********************************************************************" load-demo-records: echo "TRUNCATE schTASK;" | ${prefix}/bin/dbexec ${prefix}/bin/bibupload -i $(srcdir)/modules/miscutil/demo/demobibdata.xml ${prefix}/bin/bibupload 1 ${prefix}/bin/bibindex -uadmin ${prefix}/bin/bibindex 2 ${prefix}/bin/bibreformat -uadmin -oHB ${prefix}/bin/bibreformat 3 ${prefix}/bin/bibupload 4 ${prefix}/bin/webcoll -uadmin ${prefix}/bin/webcoll 5 ${prefix}/bin/bibrank -uadmin ${prefix}/bin/bibrank 6 @echo "***********************************************************************" @echo "** The demo records have been successfully loaded. **" @echo "** **" @echo "** Please point your browser to @WEBURL@ " @echo "** It should ressemble our 'Atlantis Institute of Fictive Science' **" @echo "** demo site that is available at . **" @echo "** **" @echo "** To remove demo records, you can run 'make remove-demo-records'. **" @echo "** To drop also the demo site collection etc configurations, **" @echo "** you can run 'make drop-demo-site'. **" @echo "***********************************************************************" drop-demo-site: ./modules/miscutil/bin/dbexec < $(srcdir)/modules/miscutil/sql/tabdrop.sql ./modules/miscutil/bin/dbexec < $(srcdir)/modules/miscutil/sql/tabcreate.sql ./modules/miscutil/bin/dbexec < ./modules/miscutil/sql/tabfill.sql echo "TRUNCATE schTASK;" | ${prefix}/bin/dbexec ${prefix}/bin/webcoll -uadmin ${prefix}/bin/webcoll 1 # for f in $(sbmdat); do rm -f $(sbmdir)/$$f.shtml ; done @echo "***************************************************************" @echo "** The demo site and records have been successfully dropped. **" @echo "***************************************************************" remove-demo-records: ./modules/miscutil/bin/dbexec < $(srcdir)/modules/miscutil/sql/tabbibclean.sql echo "TRUNCATE schTASK;" | ${prefix}/bin/dbexec ${prefix}/bin/webcoll -uadmin ${prefix}/bin/webcoll 1 @echo "**********************************************************" @echo "** The demo records have been successfully removed. **" @echo "** The demo collection and submit configurations **" @echo "** have been preserved. **" @echo "** **" @echo "** Note that you can run 'make drop-demo-site' to drop **" @echo "** the demo site fully. **" @echo "**********************************************************" CLEANFILES = *~ diff --git a/modules/webstyle/doc/admin/guide.html.wml b/modules/webstyle/doc/admin/guide.html.wml index 24a95494f..836da97e6 100644 --- a/modules/webstyle/doc/admin/guide.html.wml +++ b/modules/webstyle/doc/admin/guide.html.wml @@ -1,426 +1,426 @@ ## -*- mode: html; coding: utf-8; -*- ## $Id$ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it 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. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #include "cdspage.wml" \ title="WebStyle Admin Guide" \ navtrail_previous_links="/admin/>_(Admin Area)_ > /admin/webstyle/>WebStyle Admin" \ navbar_name="admin" \ navbar_select="webstyle-admin-guide"

Version <: print generate_pretty_revision_date_string('$Id$'); :>

Contents

1. Overview

This document describes how to change the look and feel of your CDS Invenio installation.

1.1 CSS Style Sheet and Images

The most obvious modification you may want to do is the modification of CSS style sheet. You may also customize default images.

1.2 HTML Page Layout

The customization of the general page look and feel is currently different depending on whether you customize HTML-like static pages (produced by WML during compile-time) or dynamic Python pages (assembled during runtime).

1.2.1 Layout of HTML Static Pages

(Note: this step will disappear in the future as we plan to release the dependency on WML in early 2007.)

During the compile time, when you edit config.wml, you may alter the default page look and feel by editing page elements such as CDSPAGEHEADER, CDSPAGEFOOTER, CDSPAGEBOXLEFTTOP, CDSPAGEBOXLEFTBOTTOM, CDSPAGEBOXRIGHTTOP, CDSPAGEBOXRIGHTBOTTOM.

This will modify the look and feel of every WML-pregenerated page, such as HTML help guides. However, this will not affect most of the pages because they are generated in a dynamic way during runtime, without using WML.

1.2.2 Layout of Python Dynamic Pages

The dynamic Python-powered pages can be customized by making use of CDS Invenio templating system that uses a notion of a template skin. How this works?

During the compile time, when you edit config.wml, you may choose to use your own templates instead of the provided default ones by editing CFG_TEMPLATE_SKIN variable. Let us say you put ithaca there in order to use your own ithaca style. Now, when you start Apache, then instead of CDS Invenio's usual template files such as webbasket_templates.py the system will look for file named webbasket_templates_ithaca.py and will load the template functions from there instead, provided that they exist. (Otherwise it would fall back to the default ones.)

How do you create such an ithaca style templates file? We do not use one of many existing templating frameworks in Python but a very simple programmer-friendly templating system that enables you to use the full power of Python to inherit from the default templates the output generating functions you want to reuse and to write anew only the functions you would like to modify.

Let's show an example of how to modify the page footer. Create a file named webstyle_templates_ithaca.py with the following content:

 from invenio.config import cdslang
 from invenio.webstyle_templates import Template as DefaultTemplate
 
 class Template(DefaultTemplate):
     """Ithaca style templates."""
 
     def tmpl_pagefooter(self, req=None, ln=cdslang, lastupdated=None,
                         pagefooteradd=""):
         """
         Ithaca style page footer.  See the default function for
         the meaning of parameters.
         """
 
         return "<hr>This site has no footer."
 

After the file was created, restart Apache and lo, your new ithaca style footer will be seen in action.

Some further remarks on this templating system:

  • We have observed that in practice the HTML page designers were ofter Python programmers, therefore we have adopted a programmer-friendly templating system.
  • You have to know a bit of Python in order to use it. If you don't know Python, do not worry, because you can basically copy and paste the original tmpl_foo() function definition "as is" into the above-cited example and then you would only modify its HTML snippets. The important thing is to preserve the imports (from invenio.config import cdslang) as in the original webstyle_templates.py file and to preserve the leading whitespace Pythonic indentation.
    (Moreover, in the future, when we shall remove the WML dependency, we shall provide an easy way to modify at least the most commonly wanted things such as page header and footer.)
  • You do not have to learn "yet another templating language", you can use the full power of Python. The tmpl_foo() functions do not contain any business logic in them, their only purpose is to make the HTML presentation of data supplied to them. But, should you need to carry out a little data transformation, you can do it within the tmpl_foo() function itself, thanks to the full Python power.
  • If you feel like doing so, you can modify all the tmpl_foo() functions across all CDS Invenio modules in a way that will completely change the presentation of elements including their content, position and order on the screen.
  • We expect to provide possibly more than one skin with the default distribution, so if you have modified CDS Invenio look and feel in an interesting way, please consider donating us your templates.
  • When upgrading from one CDS Invenio release to another, you may find out that the default templates have changed in a way that requires changes to your templates (such as an addition of parameters to cover the new functionality). This is inevitable in any templating system; unless you introduce new parameters, you would not see them being printed. Therefore, if you have modified tmpl_foo() and tmpl_bar(), and you are ugrading to a new release, you may at least briefly check whether the function arguments are the same. A quick check of the body would be helpful too, in case the new release fixed some display-related problems in these functions.

    In order to help you in this task, we provide a tool to check incompatibilities between your customized templates and the default templates.
    This tool can be run before doing a 'make install', therefore giving you a chance to fix your templates before - upgrading. Just run 'make check-local-templates' to + upgrading. Just run 'make check-custom-templates' to get the list of problems found with your templates.

    You can also run this tool any time after the new default templates have been installed, in order to ensure that modifications you have done to your templates are valid. To do so move to your CDS Invenio installation directory, and run:
    $python lib/python/invenio/templates.py - --check-local-templates + --check-custom-templates

1.3 Look of Bibliographic References

Bibliographic metadata is formatted using BibFormat. Read the BibFormat documentation for more information.

1.4 Specific Configurations

Note that the search interface pages may be modified to a large extent in the WebSearch Admin Interface by adding HTML portalboxes on various places on the page (right top, before/after page title, before/after narrow by collection boxes, etc).

2. Detailed Record Pages

The web pages displaying the details of a record (such as /record/1) do not only show metadata, but also users' comments and reviews, statistics, etc. This information is organized into tabs.

The content of these tabs can be customized on a collection basis. It is also possible to show/hide tabs depending on the displayed collection.

The detailed record pages also feature a mini panel at the bottom of the page that links to popular functions (The mini panel is only displayed when Information tab is selected).

 
   +--------------Detailed record page-------------+
   |                    header                     |
   |nav. breadcrumb                                |
   |                                               |
   |   .--------------------------------------.    |
   | .-|Info.|Ref.|Discussion.|Stats.|Fulltext|-.  |
   | | '--------------------------------------' |  |
   | |                                          |  |
   | |                  content                 |  |
   | |                                          |  |
   | '------------------------------------------'  |
   |                                               |
   | .---------------(Mini Panel)---------------.  |
   | |   Mini    |      Mini     |    Mini      |  |
   | |   File    |     Review    |   Actions    |  |
   | '------------------------------------------'  |
   +-----------------------------------------------+
 

2.1 Available tabs

The following tabs are available:
Name Description URL (eg. for record '10')
Information Show the formatted metadata of the record /record/10
References Displays the references (bibliography) of the record /record/10/references
Discussion Displays the users' comments and reviews /record/10/comments
/record/10/reviews
Usage Statistics Statistics data and graph about file downloads/views /record/10/statistics
Fulltext Link(s) to fulltext file(s) /record/10/files

The mini panel is only displayed when the Information tab is selected. It is divided into the following sections:

  • Files : quick access to fulltext file(s)
  • Review : quick access to reviewing feature
  • Actions: quick access to several other features

2.2 Showing/Hiding tabs

The WebSearch admin web interface lets you decide for each collection which tabs are to be displayed. Choose a collection to edit in the collection tree and go to its detailed record page options. From there you can select which tabs to show for that collection.

If you want to apply these settings to the subcollections, select Also apply to subcollections before you click on the button.

Note that these settings only affect the tabs, not the content of the tabs: even if a tab is not displayed, it is still possible to access its content using its usual url. This is useful if you decide to completely change the detailed record pages, dropping the tab-metaphor (eg. for a side bar) but still want to access the comments, reviews, etc pages.

Here are some behaviours you should expect when changing the tabs configuration:

  • Given that search results pages always link to /record/10, and given the above comment about accessibility of tabs when they are not displayed, the content of the Information will always be show when clicking on detailed record link in search results, even if the Information tab is set not to be displayed.
  • If you select only 1 tab, none of the tabs will be displayed at the top of the page. This also means that whatever tabs you have selected, you users will always see the content of the 'Information' tabs (see above behaviour).
  • If you select 0 tab, only the content of Information tab is shown. None of the tabs, nor the border that usually surrounds the content of the tabs, nor the minipanel are shown. You should choose this option if you decide to drop the tabs metaphor for the detailed record pages. You can then build your own user interface on this almost blank page (See Customizing content of tabs).
  • Note that Discussion tab will not be shown if you have disabled both the commenting and reviewing features in your installation (CFG_WEBCOMMENT_ALLOW_COMMENTS and CFG_WEBCOMMENT_ALLOW_REVIEWS variable in your config file).

2.3 Customizing content of tabs

The contents of tabs are defined in the following ways:

Information tab
The content of this tab is defined by function tmpl_detailed_record_metadata(..) in websearch_templates.py. By default tmpl_detailed_record_metadata simply returns the result of the formatting of the metadata by BibFormat using the "HD" output format. It can therefore be collection-specific.
References tab
The content of this tab is defined by function tmpl_detailed_record_references(..) in websearch_templates.py. By default tmpl_detailed_record_metadata simply returns the result of the formatting of the metadata by BibFormat using the "HDREF" output format. If the result returned by BibFormat is empty, the tab is disabled (visible, but not clickable). It can therefore be collection-specific.
Discussion tab
The content of this tab is mainly defined by function tmpl_get_comments(..) in webcomment_templates.py. Other functions in this file are also involved in the display.
Usage Statistics tab
The content of this tab is defined by function tmpl_detailed_record_statistics(..) in websearch_templates.py. If the returned content is empty, then the tabs will be disabled (visible, but cannot be clicked).
Fulltext tab
The content of this tab is defined by function tmpl_filelist(..) in websubmit_templates.py.

The content of the mini panel is defined in the following ways:

Files
The content of this section is defined by the output format 'HDFILE'. It can therefore be collection-specific.
Review
The content of this section is defined by function tmpl_mini_review(..) inside webcomment_templates.py
Actions
The content of this section is defined by the output format HDACT. It can therefore be collection-specific.

2.4 Customizing look of tabs

You can customize how tabs look like, as well change the look of the border that surrounds the content of tabs. The mini panel can similarly be customized.

Have a look at the following classes in the CDS css stylesheet:

  • tabs
  • mini-panel
  • detailed
  • top-left, top-right, bottom-left, bottom-right
  • commentHB, detailedRecordActions, star, miniReview

Note that a tab might be greyed out (disabled) when its content is empty. This is the case for the References tab (see Customizing content of tabs -> 'References tab') and the Fulltext tab (if no file could be found for the record).

For more advanced modifications (like changing the HTML code of the tabs), you can modify the detailed_record_container(..) and detailed_record_mini_panel(..) functions inside your webstyle_templates.py file.

diff --git a/modules/webstyle/lib/template.py b/modules/webstyle/lib/template.py index 0104768fd..5fdad2f27 100644 --- a/modules/webstyle/lib/template.py +++ b/modules/webstyle/lib/template.py @@ -1,357 +1,359 @@ ## $Id$ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it 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. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """CDS Invenio templating framework.""" __revision__ = "$Id$" import os, sys, inspect -from invenio.config import \ - CFG_WEBSTYLE_TEMPLATE_SKIN try: # This tool can be run before Invenio is installed: - # pylibdir might then not exist. + # invenio files might then not exist. from invenio.config import \ - pylibdir + CFG_WEBSTYLE_TEMPLATE_SKIN, \ + CFG_PREFIX + CFG_WEBSTYLE_PYLIBDIR = CFG_PREFIX + os.sep + 'lib' + os.sep + 'python' except ImportError: - pylibdir = None + CFG_WEBSTYLE_PYLIBDIR = None # List of deprecated functions # Eg. {'webstyle': {'tmpl_records_format_other':"Replaced by .."}} -CFG_DEPRECATED_FUNCTIONS = {'webstyle': +CFG_WEBSTYLE_DEPRECATED_FUNCTIONS = {'webstyle': \ {'tmpl_records_format_other': "Replaced by " + \ "tmpl_detailed_record_metadata(..), " + \ "tmpl_detailed_record_references(..), " + \ "tmpl_get_comments(..), " + \ "tmpl_detailed_record_statistics(..), " + \ "tmpl_filelist(..), tmpl_mini_review(..)," + \ "HDFILE + HDACT + HDREF output formats" } } # List of deprecated parameter # Eg. {'webstyle': {'get_page':{'header': "replaced by 'title'"}}} -CFG_DEPRECATED_PARAMETERS = {} +CFG_WEBSTYLE_DEPRECATED_PARAMETERS = {} def load(module=''): """ Load and returns a template class, given a module name (like 'websearch', 'webbasket',...). The module corresponding to the currently selected template model (see config.wml, variable CFG_TEMPLATE_SKIN) is tried first. In case it does not exist, it returns the default template for that module. """ local = {} # load the right template based on the CFG_WEBSTYLE_TEMPLATE_SKIN and the specified module if CFG_WEBSTYLE_TEMPLATE_SKIN == "default": mymodule = __import__("invenio.%s_templates" % (module), local, local, ["invenio.templates.%s" % (module)]) else: try: mymodule = __import__("invenio.%s_templates_%s" % (module, CFG_WEBSTYLE_TEMPLATE_SKIN), local, local, ["invenio.templates.%s_%s" % (module, CFG_WEBSTYLE_TEMPLATE_SKIN)]) except ImportError: mymodule = __import__("invenio.%s_templates" % (module), local, local, ["invenio.templates.%s" % (module)]) return mymodule.Template() # Functions to check that customized templates functions conform to # the default templates functions ## def check(): """ Check that installed customized templates are conform to the default templates interfaces. Result of the analysis is reported back in 'messages' object (see 'messages' structure description in print_messages(..) docstring) """ messages = [] - if pylibdir is None: - # Nothing to check, since pylibdir does not exist + if CFG_WEBSTYLE_PYLIBDIR is None: + # Nothing to check, since Invenio has not been installed messages.append(('C', "Nothing to check. Run 'make install' first.", '', None, 0)) return messages # Iterage over all customized templates for (default_template_path, custom_template_path) in \ get_custom_templates(get_default_templates()): # Load the custom and default templates default_tpl_path, default_tpl_name = os.path.split(default_template_path) if default_tpl_path not in sys.path: sys.path.append(default_tpl_path) custom_tpl_path, custom_tpl_name = os.path.split(custom_template_path) if custom_tpl_path not in sys.path: sys.path.append(custom_tpl_path) default_template = __import__(default_tpl_name[:-3], globals(), locals(), ['']) custom_template = __import__(custom_tpl_name[:-3], globals(), locals(), ['']) # Check if Template class is in the file classes = inspect.getmembers(custom_template, inspect.isclass) if 'Template' not in [possible_class[0] for possible_class in classes]: messages.append(('E', "'Template' class missing", custom_template.__name__, None, 0)) continue # Check customized functions parameters for (default_function_name, default_function) in \ inspect.getmembers(default_template.Template, inspect.isroutine): if custom_template.Template.__dict__.has_key(default_function_name): # Customized function exists custom_function = custom_template.Template.__dict__[default_function_name] (deft_args, deft_varargs, deft_varkw, deft_defaults) = \ inspect.getargspec(default_function.im_func) (cust_args, cust_varargs, cust_varkw, cust_defaults) = \ inspect.getargspec(custom_function) deft_args.reverse() if deft_defaults is not None: deft_defaults_list = list(deft_defaults) deft_defaults_list.reverse() else: deft_defaults_list = [] cust_args.reverse() if cust_defaults is not None: cust_defaults_list = list(cust_defaults) cust_defaults_list.reverse() else: cust_defaults_list = [] arg_errors = False # Check for presence of missing parameters in custom template for deft_arg in deft_args: if deft_arg not in cust_args: arg_errors = True messages.append(('E', "missing '%s' parameter" % \ deft_arg, custom_tpl_name, default_function_name, inspect.getsourcelines(custom_function)[1])) # Check for presence of additional parameters in custom template for cust_arg in cust_args: if cust_arg not in deft_args: arg_errors = True messages.append(('E', "unknown parameter '%s'" % \ cust_arg, custom_tpl_name, custom_function.__name__, inspect.getsourcelines(custom_function)[1])) # If parameter is deprecated, report it module_name = default_tpl_name.split("_")[0] - if CFG_DEPRECATED_PARAMETERS.has_key(module_name) and \ - CFG_DEPRECATED_PARAMETERS[module_name].has_key(default_function_name) and \ - CFG_DEPRECATED_PARAMETERS[module_name][default_function_name].has_key(cust_arg): - messages.append(('C', CFG_DEPRECATED_PARAMETERS[module_name][default_function_name][cust_arg], + if CFG_WEBSTYLE_DEPRECATED_PARAMETERS.has_key(module_name) and \ + CFG_WEBSTYLE_DEPRECATED_PARAMETERS[module_name].has_key(default_function_name) and \ + CFG_WEBSTYLE_DEPRECATED_PARAMETERS[module_name][default_function_name].has_key(cust_arg): + messages.append(('C', CFG_WEBSTYLE_DEPRECATED_PARAMETERS[module_name][default_function_name][cust_arg], custom_tpl_name, custom_function.__name__, inspect.getsourcelines(custom_function)[1])) # Check for same ordering of parameters. # Only raise warning if previous parameter tests did # not generate errors if not arg_errors: for cust_arg, deft_arg in map(None, cust_args, deft_args): if deft_arg != cust_arg: arg_errors = True messages.append(('W', "order of parameters is not respected", custom_tpl_name, custom_function.__name__, inspect.getsourcelines(custom_function)[1])) break # Check for equality of default parameters values # Only raise warning if previous parameter tests did # not generate errors or warnings if not arg_errors: i = 0 for cust_default, deft_default in \ map(None, cust_defaults_list, deft_defaults_list): if deft_default != cust_default: messages.append(('W', "default value for parameter '%s' is not respected" % \ cust_args[i], custom_tpl_name, default_function_name, inspect.getsourcelines(custom_function)[1])) i += 1 else: # Function is not in custom template. Generate warning? pass # Check for presence of additional functions in custom template for (custom_function_name, custom_function) in \ inspect.getmembers(custom_template.Template, inspect.isroutine): if not default_template.Template.__dict__.has_key(custom_function_name): messages.append(('W', "unknown function", custom_tpl_name, custom_function_name, inspect.getsourcelines(custom_function)[1])) # If the function was deprecated, report it module_name = default_tpl_name.split("_")[0] - if CFG_DEPRECATED_FUNCTIONS.has_key(module_name) and \ - CFG_DEPRECATED_FUNCTIONS[module_name].has_key(custom_function_name): - messages.append(('C', CFG_DEPRECATED_FUNCTIONS[module_name][custom_function_name], + if CFG_WEBSTYLE_DEPRECATED_FUNCTIONS.has_key(module_name) and \ + CFG_WEBSTYLE_DEPRECATED_FUNCTIONS[module_name].has_key(custom_function_name): + messages.append(('C', CFG_WEBSTYLE_DEPRECATED_FUNCTIONS[module_name][custom_function_name], custom_tpl_name, custom_function_name, inspect.getsourcelines(custom_function)[1])) return messages # Utility functions ## def get_default_templates(base_dir=None): """ Returns the paths to all default Invenio templates. base_dir - path to where templates should be recursively searched """ # If base_dir is not specified we assume that this template.py # file is located in $INVENIO$/modules/webstyle/lib, which allows # us to guess where base $Invenio$/modules dir is. # Note that by luck it also works if file is installed # in /lib/python/invenio/ if base_dir is None: # Retrieve path to Invenio 'modules' dir this_pathname = os.path.abspath(sys.argv[0]) #this_pathname = inspect.getsourcefile(get_default_templates) this_dir, this_name = os.path.split(this_pathname) base_dir = this_dir + os.sep + os.pardir + \ os.sep + os.pardir else: base_dir = os.path.abspath(base_dir) templates_path = [] for (dirpath, dirnames, filenames) in os.walk(base_dir): for filename in filenames: if filename.endswith("_templates.py"): templates_path.append(os.path.join(dirpath, filename)) return templates_path def get_custom_templates(default_templates_paths): """ Returns the paths to customized templates among the given list of templates paths. """ return [(default, get_custom_template(default)) \ for default in default_templates_paths \ if get_custom_template(default) is not None] def get_custom_template(default_template_path): """ Returns the path to the customized template of the default template given as parameter. Returns None if customized does not exist. """ default_tpl_path, default_tpl_name = os.path.split(default_template_path) - custom_path = pylibdir + os.sep + "invenio" + os.sep + \ + + custom_path = CFG_WEBSTYLE_PYLIBDIR + \ + os.sep + "invenio" + os.sep + \ default_tpl_name[:-3] + '_' + \ CFG_WEBSTYLE_TEMPLATE_SKIN + '.py' if os.path.exists(custom_path): return custom_path else: return None def print_messages(messages, verbose=3): """ Report errors and warnings to user. messages - list of tuples (type, message, template, function, line) where: - type : One of the strings: - 'E': Error - 'W': Warning - 'C': Comment - message : The string message - template : template name where message occurred - function : function name where message occurred - line : line number where message occurred verbose - int specifying the verbosity of the output. 0 - summary only 1 - summary + errors 2 - summary + errors + warnings 3 - summary + errors + warnings + comments """ last_template = '' # Remember last considered template in order to # print separator between templates for message in messages: if message[0] == 'F' and verbose >= 0 or \ message[0] == 'E' and verbose >= 1 or \ message[0] == 'W' and verbose >= 2 or \ message[0] == 'C' and verbose >= 3: # Print separator if we have moved to another template if last_template != message[2]: print "************* Template %s" % message[2] last_template = message[2] print '%s:%s:%s%s' % \ (message[0], message[4], # message[2].endswith('.py') and message[2][:-3] or \ # message[2], message[3] and ("%s(): " % message[3]) or ' ', message[1]) # Print summary if verbose >= 0: nb_errors = len([message for message in messages \ if message[0] == 'E']) nb_warnings = len([message for message in messages \ if message[0] == 'W']) nb_comments = len([message for message in messages \ if message[0] == 'C']) if len(messages) > 0: print '\nFAILED' else: print '\nOK' print "%i error%s, %i warning%s, %i comment%s." % \ (nb_errors, nb_errors > 1 and 's' or '', nb_warnings, nb_warnings > 1 and 's' or '', nb_comments, nb_comments > 1 and 's' or '') if __name__ == "__main__" and \ - '--check-local-templates' in sys.argv: + '--check-custom-templates' in sys.argv: messages_ = check() print_messages(messages_)