# HG changeset patch # User Thomas Arendsen Hein # Date 1348827318 -7200 # Node ID f030acb8d9999805028a5a61af323686de02563c # Parent f576fc74ee808d6f2a8149d7892d0044818d9243# Parent 465e70422e664d796c77c11e46ce9ed7d9c47036 dummy merge for repo head diff -r 465e70422e66 -r f030acb8d999 doc/ChangeLog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/ChangeLog Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,546 @@ +2012-07-05 Felix Wolfsteller + + * README: New file with minimal instructions how to build the + documentation. + +2010-08-13 Tim Englich + + * admin-manual/installation-artifact-server.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex: + Added corrections and wishes of the training on the installation + which was given to the BSH. + +2010-06-30 Ingo Weinzierl + + * admin-manual/installation-base.tex: Some refactoring of the proxy + installation. + +2010-06-30 Ingo Weinzierl + + * config-manual/general_settings.tex: Removed section 'Adding new + Languages'. This section should be placed in an own file. + + * config-manual/adding_new_languages.tex: New file for section 'Adding new + Languages'. + + * config-manual/config-manual.tex: Include section 'Adding new Languages'. + +2010-06-29 Tim Englich + + * admin-manual/installation-base.tex: + Added Section which explains how to install the proxy-script + which is required for the OpenLayers-Client which is integrated in the + GNV-Web-Client. + +2010-06-29 Tim Englich + + * config-manual/general_settings.tex: + Added section with the description how to add a new + language to the system into the config-manual. + +2010-06-25 Ingo Weinzierl + + * licenses/overview.txt: Overview of external libs and its licenses. + +2010-05-12 Hans Plum + + Tagging as Version 1.0 + +2010-05-12 Hans Plum + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex, + config-manual/title.tex, + config-manual/generating_maps.tex, + config-manual/general_settings.tex, + config-manual/miscellanea.tex, + config-manual/Makefile, + config-manual/administering_artifact-server.tex: + Adapted titlepage to admin manual. Replaced with public Makefile + according to admin manual. (XXX) Added some workaround linebreaks with + typewriter sections + +2010-05-12 Hans Plum + + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex, + config-manual/generating_maps.tex, + config-manual/overview.tex, + config-manual/generating_charts.tex, + config-manual/general_settings.tex, + config-manual/administering_artifact-server.tex: + Final QS of all chapters. Cleanup FIXMEs and typos mainly. + +2010-05-10 Hans Plum + + * config-manual/generating_maps.tex: + Added content about generating maps with extensive background + information about the interaction between artifact-server and + mapserver. + +2010-05-10 Hans Plum + + * config-manual/model_of_transitions.tex, + config-manual/generating_charts.tex, + config-manual/general_settings.tex: + Added content about generating charts. + +2010-05-10 Tim Englich + + * config-manual/general_settings.tex, + config-manual/config-manual.txt: + Added short documentation for the file timegap_definition.xml. The + usage and the definition of the values stored in the file are + explained in the file itself. + +2010-05-10 Tim Englich + + * config-manual/model_of_transitions.tex: + Done some litte changes in the introduction of the + Section Model of Transitions. + +2010-05-10 Tim Englich + + * config-manual/model_of_transitions.tex, + config-manual/general_settings.tex: + Moved section Query-configuration to Section Model of Transitions. + +2010-05-10 Tim Englich + + * config-manual/model_of_transitions.tex: + Do some Documentstyling. Added Typewriter-Style + to mark XML-Elements and other technical Items. + +2010-05-10 Tim Englich + + * config-manual/model_of_transitions.tex: + Fixed some mistakes. + +2010-05-09 Hans Plum + + * config-manual/config-manual.txt: + fragment missed in last commit + + * admin-manual/overview.tex: + fix some copy&paste mistakes + +2010-05-09 Hans Plum + + * config-manual/config-manual.tex: + referenced new documents + + * config-manual/overview.tex (added): + introduction/overview of the GNV-server consisting of + artifact- and mapserver + + * config-manual/general_settings.tex: + overview of the entire configuration + + * config-manual/generating_maps.tex (added), + config-manual/generating_charts.tex (added), + config-manual/administering_artifact-server.tex (added): + split up in typical tasks: + - administration and installation + - generating charts (TODO: Fill me) + - generating maps (TODO: Fill me) + - configuring fis, products, etc. (TODO: Integrate me) + + * config-manual/config-manual.txt: + Added some hints + +2010-05-07 Tim Englich + + * general_settings.tex: + Document following Sections: + artifact-factories, artifacts, mapserver, velocity, ehcache, + geo-backend + Description of geo-backend/Backend-Configuration is missing. + +2010-05-07 Tim Englich + + * general_settings.tex: + Added first Structure and XML-Structure for the documentation + of the File conf.xml. + Added the Documentation for the System-Properties. + +2010-05-07 Tim Englich + + * general_settings.tex: + Added separat LaTex-File for the Documentation of the general + settings. + * config-manual.tex: + Include the File general_settings.tex into the main Document. + +2010-05-07 Tim Englich + + * model_of_transitions.tex: + Answerd Questions and increase some Sections of the Documentation. + +2010-05-07 Hans Plum + + * config-manual/config-manual.txt: Added some more FIXMEs for internal + DB interface + +2010-05-07 Hans Plum + + * config-manual/config-manual.txt, + config-manual/model_of_transitions.tex: + Commit before and now: Added some FIXMEs for getting a better + understanding + +2010-05-06 Hans Plum + + * admin-manual/figures/bsh_logo.gif: + converted to .png because of compile error + +2010-05-06 Hans Plum + + * tex/*, src/*, README: + Deleted stubs of documentation. + + * test-guideline/README: Added a README to give user more orientation. + +2010-05-06 Hans Plum + + * admin-manual/installation-artifact-server.tex, + admin-manual/installation-base.tex: + Renamed gnv-wrapper to gnv-wms to clearify function + +2010-05-06 Hans Plum + + * admin-manual/installation-admin-manual.txt: + Clean up; all content moved tp *.tex + + * admin-manual/installation-admin-manual.tex: + Adapted a file name after renaming + +2010-05-06 Hans Plum + + * admin-manual/installation-artifact-server.tex: renamed from + admin-manual/installation-artefact-server.tex in order to unify use of + naming + +2010-05-06 Hans Plum + + * admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-artefact-server.tex: + Unified naming of artefact to artifact + +2010-05-06 Hans Plum + + * admin-manual/title.tex, + admin-manual/installation-admin-manual.tex, + admin-manual/figures/bsh_logo.gif, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Finalized documentation with references, unifying tools, adding logos. + TODO: Unify the use of artifact. Checking against implementation. + +2010-05-06 Hans Plum + + * admin-manual/Makefile: + Replaced selfmade Makefile through a specialized one from + http://www.bouncingchairs.net/oss (GPL) + +2010-05-05 Hans Plum + + * admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Removed sections about deinstallation and monitoring because they were + not tested. + +2010-05-05 Hans Plum + + * admin-manual/installation-admin-manual.tex, + admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Improving artifact, webclient and operation section. Added hyperref + package. + +2010-05-04 Tim Englich + * config-manual/model_of_transitions.tex: + Fixed some typos. Do some document-styling. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Sample calls for creating an FIS and also getting + the Products which it contains. + * config-manual/sample-documents/create-artifact.xml: + Added XMl-Document which contains the XML-Request-Body for + the http-post call for creating an Artifact. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Example for adding a new Product to a FIS. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Example for adding a new Artifact for the FIS with no + Products to the REST-Server. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Example for adding a new FIS to the REST-Server. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added listing of all supported OutputStates. + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added MarineFeatures as Subtype of ESRI ArcMarineBSH + +2010-05-04 Tim Englich + + * config-manual/model_of_transitions.tex: + Added description for Configuration of InputValue of states and short + examples of the usage in SQL-statements to the Documentation. + +2010-05-04 Hans Plum + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex: + Fixed compilation error and revert temporary change for graphix + package + +2010-05-04 Hans Plum + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex: + Added an overview of the subject-specific part of the configuration + introducing the dependencies of the relevant files + +2010-05-03 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Mapping between the Configuration an the shown Objects in the + System into the Documentation. + +2010-05-03 Tim Englich + + * config-manual/model_of_transitions.tex: + Added Description of Configuration for OutputStates and OutputModes. + +2010-05-03 Tim Englich + + * config-manual/model_of_transitions.tex: + Added description of Configuration of States and Transitions. + Also added description for the Configuration of an product. + Added enumerations. + +2010-04-30 Tim Englich + + * config-manual/model_of_transitions.tex: + Added the first descriptions of the Configuration of + Artifact-Factories, Artifacts representing a FIS and the Products + which can be configured to the different FIS. + +2010-04-30 Tim Englich + + * config-manual/config-manual.tex: + Added Include for File model_of_transitions.tex into the main + Document. + * config-manual/model_of_transitions.tex: + Added File for the Documentation of the FIS, Products and the + required Transitionmodels of a Product. + Added Howto for configuring a new FIS, configuring a new product and + adding a additional Product to a FIS. + +2010-04-30 Tim Englich + + * config-manual/config-manual.tex: + Added the main LaTex-Document. + * config-manual/title.tex: + Added the LaTex-IncludeDocument which will include + the Title-Page of this document + * config-manual/figures: + Added folder for figures which should be integrated in this Document. + * config-manual/Makefile: + Adding Makefile for generating e.g. an PDF-Document + * config-manual/figures/intevation-logo.eps: + Added Intevation Logo. + +2010-04-30 Hans Plum + + * config-manual/config-manual.txt: + Added a first draft for a configuration manual for the + artifact server + +2010-04-28 Hans Plum + + * test-guideline/gnv-horizontalprofile.txt, + test-guideline/gnv-verticalprofile.txt, + test-guideline/gnv-timerseries.txt, test-guideline/gnv-layer.txt, + test-guideline/gnv-framework.txt, + test-guideline/gnv-horizontal-cross-section.txt, + test-guideline/gnv-vertical-cross-section.txt, + test-guideline/gnv-test-guideline.txt, + test-guideline/gnv-horizontales-schnittprofil.txt: + Added a test-guideline for the matrix of products to database + schemata. Look into test-guideline/gnv-test-guideline.txt for further + information. + +2010-04-28 Hans Plum + + * Renamed admin-manual/abbildungen in admin-manual/figures + + * admin-manual/title.tex: Adapted file path after renaming + + * admin-manual/installation-artefact-server.tex: + Added 2 FIXMEs + +2010-04-28 Hans Plum + + * admin-manual, admin-manual/installation-admin-manual.txt, + admin-manual/title.tex, admin-manual/installation-admin-manual.tex, + admin-manual/overview.tex, admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, admin-manual/abbildungen, + admin-manual/installation-artefact-server.tex, admin-manual/Makefile: + Moved all admin-manual specific files in new directory admin-manual + +2010-04-28 Hans Plum + + * installation-admin-manual.txt, title.tex, + tex/*, installation-admin-manual.tex, overview.tex, ChangeLog, + operating-the-system.tex, src/*, installation-base.tex, abbildungen, + installation-webclient.tex, installation-artefact-server.tex, + Makefile, README: + Moved content to trunk. + +2010-04-28 Hans Plum + + * trunk/, tags/, branches/: + Added standard SVN structure for this module + +2010-04-28 Hans Plum + + * installation-admin-manual.txt: + Moved content into LaTeX documents + + * New: title.tex + installation-admin-manual.tex + overview.tex + operating-the-system.tex + installation-base.tex + installation-webclient.tex + installation-artefact-server.tex: + Formatting of content and updating content. + +2010-04-27 Tim Englich + + * installation-admin-manual.tex: + First Documentstructure for LaTex-Document + * abbildungen: + Added Folder for images. + * MakeFile: + File to generate PDF. + +2010-04-27 Tim Englich + + * installation-admin-manual.txt: + Added description which Version of Operatin System has + to be installed. + +2010-04-27 Tim Englich + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall the + GNV-Client into the Tomcat Application Server. + +2010-04-27 Tim Englich + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall the + UMN-Mapserver Version 5.6.3 using Gispatcher-Resources on + the Operation System. + +2010-04-27 Tim Englich + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Apache + Webserver Version 2.2 including Mod-JK on the Operation System. + +2010-04-27 Hans Plum + + * installation-admin-manual.txt: + Added overview of the system, installation of + artefact-server and operation of the GNV system. + +2010-04-26 Tim Englich + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Apache + Tomcat Applicationserver Version 5.5 on the Operation System. + Added all relevant commands which have to be executed + from the Systemadministrator. Also put Snippets of the Configuration + Files to the Content of this File. + + +2010-04-26 Tim Englich + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Java 1.6 on + the Operation System. + Added all relevant commands which have to be executed from the + Systemadministrator. + +2010-04-20 Hans Plum + + * installation-admin-manual.txt: + Added relevant installation notices of an installation of a vanilla + Debian Lenny System with Tomcat 5.5 and UMN MapServer (Debian Package) + preinstalled + +2010-04-20 Hans Plum + + * installation-admin-manual.txt: + Added UMN Mapserver as component; added responsibility for chapters; + removed extensive numbering in order to avoid manual updating. A word + processor can do this later on. + +2010-04-20 Hans Plum + + * installation-admin-manual.txt: + Renamed handbook.txt to installation-admin-manual.txt to make the task + clearer. + +2010-04-20 Hans Plum + + * handbook.txt: + Restructered the draft a bit and added Integration of Apache WebServer + and Apache Tomcat explicitly. + +2010-04-19 Tim Englich + + * handbook.txt: + Initial Checkin of installation and administration manual. + This document contains a first draft of an outline of the contents. + +2010-04-11 Sascha L. Teichmann + + * tex/Makefile, tex/tech-doku.tex: Initialer Checkin der + technischen Dokumentarion. + +2010-02-16 Sascha L. Teichmann + + * src: Quellen der Dokumentation + * ChangeLog, README: Angelegt diff -r 465e70422e66 -r f030acb8d999 doc/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/README Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,11 @@ +To build pdf documentation, call `make` with the documents name without the +".tex" extension, e.g. + + cd admin-manual + make installation-admin-manual + +will result in + + installation-admin-manual.pdf + +. diff -r 465e70422e66 -r f030acb8d999 doc/admin-manual/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/Makefile Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,3492 @@ +# Copyright 2004 Chris Monson (shiblon@gmail.com) +# Latest version available at http://www.bouncingchairs.net/oss +# +# This file is part of ``Chris Monson's Free Software''. +# +# ``Chris Monson's Free Software'' 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, Version 2. +# +# ``Chris Monson's Free Software'' 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 ``Chris Monson's Free Software''; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# It is also available on the web at http://www.gnu.org/copyleft/gpl.html +# +# Note that using this makefile to build your documents does NOT place them +# under the GPL unless you, the author, specifically do so. In other words, +# I, Chris Monson, the copyright holder and author of this makefile, +# consider it impossible to ``link'' to this makefile in any way covered by +# the GPL. +# +# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN: +# make help +# +fileinfo := LaTeX Makefile +author := Chris Monson +version := 2.2.0-rc1 +# +# Note that the user-global version is imported *after* the source directory, +# so that you can use stuff like ?= to get proper override behavior. +.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini +-include Makefile.ini +-include $(HOME)/.latex-makefile/Makefile.ini +# +# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini: +# BUILD_STRATEGY := latex +BUILD_STRATEGY ?= pdflatex +# +# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be +# # immune to changes to the locale in the user environment. +export LC_ALL ?= C +# +# +# If you specify sources here, all other files with the same suffix +# will be treated as if they were _include_ files. +#onlysources.tex ?= main.tex +#onlysources.tex.sh ?= +#onlysources.tex.pl ?= +#onlysources.tex.py ?= +#onlysources.rst ?= +#onlysources.fig ?= +#onlysources.gpi ?= +#onlysources.dot ?= +#onlysources.xvg ?= +#onlysources.svg ?= +#onlysources.eps.gz ?= +#onlysources.eps ?= +# +# If you list files here, they will be treated as _include_ files +#includes.tex ?= file1.tex file2.tex +#includes.tex.sh ?= +#includes.tex.pl ?= +#includes.tex.py ?= +#includes.rst ?= +#includes.fig ?= +#includes.gpi ?= +#includes.dot ?= +#includes.xvg ?= +#includes.svg ?= +#includes.eps.gz ?= +#includes.eps ?= +# +# If you list files or wildcards here, they will *not* be cleaned - default is +# to allow everything to be cleaned. +#neverclean ?= *.pdf +# +# Alternatively (recommended), you can add those lines to a Makefile.ini file +# and it will get picked up automatically without your having to edit this +# Makefile. +# +# KNOWN ISSUES: +# * The following occurs: +# file with: \usepackage{named}\bibliographystyle{named} +# Compile +# change to: \usepackage{apalike}\bibliographystyle{apalike} +# Compile again -- BARF! +# +# The workaround: make clean-nographics; make +# +# Note that we may not be able to fix this. LaTeX itself barfs +# on this, not the makefile. The very first invocation of LaTeX +# (when something like this has happened) reads the existing .aux +# file and discovers invalid commands like \citeauthoryear that +# are only valid in the package that was just removed. It then +# tries to parse them and explodes. It's not at all clear to me +# how to fix this. I tried removing the .aux files on the first +# run of LaTeX, but that necessarily requires more subsequent +# rebuilds on common edits. There does not appear to be a +# graceful solution to this issue. +# +# CHANGES: +# Chris Monson (2010-04-08): +# * Bumped version to 2.2.0-rc1 +# * Added back in the rst_style_file stuff that got broken when switching +# rst -> tex to use the script mechanism +# Chris Monson (2010-03-23): +# * Bumped version to 2.2.0-beta8 +# * Work on issue 76: bad backtick escape for some sed versions, failure +# to clear out the hold buffer when outputting MISSING comment. +# - Backed out 2>&1 to &> (doesn't work in sh) +# - Backed out using . to source variables +# Chris Monson (2010-03-22): +# * Bumped version to 2.2.0-beta7 +# * Issue 72: Fix latex/bibtex invocation order for annotated bib styles +# * Fixed informational output to reflect which LaTeX run we're on +# * Fixed graphic detection to include graphics that are already there in +# .d files +# * Tightened up the .d file output to only make .d depend on graphic +# *source* files. This means that building foo.d no longer +# builds all of the graphics files on which foo.tex depends. +# Had to use .SECONDEXPANSION trickery to make it work. +# * Changed get-graphics to only accept a stem. +# * Fixed build-once logic for scripted .tex to work better +# * Made get-inputs sed script more maintainable. +# * Moved Makefile.ini import up higher. +# * Changed bare stems to not recursively invoke make +# * Updated diff output to be more silent everywhere +# * Added a MISSING comment to the .d file if stuff isn't found - forces +# removal of .1st.make file, which often forces it to try again. +# * Fixed broken graphics-target function +# * Added sleep to .d file generation when stuff is missing - if it +# builds too fast, make doesn't realize it needs to be reloaded, +# and thus never discovers some deeper dependencies (especially +# evident when graphics are included from scripted include +# files). +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta6 +# * Fixed bareword builds to actually work (requires static patterns) +# * Fixed colorization to work with new paragraph stuff +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta5 +# * Fixed graphic detection to be much more focused - splits log file +# into paragraphs before doing pattern matching. +# * Fixed make foo to work properly (recursively calls make foo.pdf) +# * Fixed gpi -> pdf generation to not waste time building .eps *after* +# the pdf already exists. +# * Changed log copies to include MAKE_RESTARTS as part of the name. +# * Fixed missing include file detection (also makes use of the paragraph +# stuff) to detect missing scripted include files. +# Chris Monson (2010-03-16): +# * Bumped version to 2.2.0-beta4 +# * issue 70: .pdf not moved out of the way properly on first +# compilation, resulting in early error detection failure. +# * issue 74: fixed broken error on missing .aux files: the +# implementation was masking real errors. +# Chris Monson (2010-03-15): +# * Bumped version to 2.2.0-beta3 +# * issue 71: Made the tput dependency optional +# * issue 73: Made .tex targets not pull in .d files (building them from +# scripts should not require a .d) +# * issue 74: Output a much saner error when a .aux file is not produced +# (e.g., when you are typing "make" without arguments in a +# directory with included .tex files that are not named with +# ._include_.) +# Chris Monson (2010-03-11): +# * Bumped version to 2.2.0-beta2 +# * Fixed clean-graphics to get rid of intermediate .eps files that may +# be hanging around +# * Added an automatic setting to use eps terminals in pdflatex mode for +# gnuplot if it doesn't understand pdf. +# * issue 66: Removed grayscale generation via magic suffix. Grayscale +# generation is now only available via GRAY=1 +# * issue 68: Added explicit handling of LC_ALL for locale-aware tools +# like "sort" +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-beta1 +# * Fixed success message to handle output message in different places +# * Added name of produced file to success message +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-alpha3 +# * Added meaningful error message for wrong hyperref options +# * Added meaningful error message for incorrect graphics extensions +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha2 +# * Updated graphics handling (gnuplot and fig generate pdf natively) +# * Changed xmgrace to output monochrome natively +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha1 - major change! +# * Support pdflatex natively and by default (issue 6 - a long time coming) +# * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for +# all invocations +# * Reworked graphic inclusion detection so that extensions need not be +# specified for either build strategy (e.g., +# \includegraphics{test1.eps} -> \includegrahpics{test1}) +# * Changed log format to include filenames and line numbers +# Chris Monson (2010-02-04): +# * Bumped version to 2.1.43 +# * All of the following are for issue 63 (thanks to mojoh81): +# * Added documentation about fixing Makefile.ini default target +# * Added perl and python script targets +# * Fixed run logic to allow included .tex files to be scripted (the +# run-again logic now detects missing .tex files, and the MV +# command has been switched out for a command that only invokes +# MV if the files exist) +# * Changed scripted generation to only run once per make invocation +# * Added dependency on expr +# Chris Monson (2010-01-19): +# * Bumped version to 2.1.42 +# * issue 62: Added .brf extension to cleanable files (backrefs) +# Chris Monson (2010-01-07): +# * Bumped version to 2.1.41 +# * issue 60: bad makeindex runs now error out on subsequent tries +# Chris Monson (2009-12-01): +# * Bumped version to 2.1.40 +# * issue 36: build all indices (for e.g., splitidx usage) +# * issue 59: clean up all generated files (including indices) +# Chris Monson (2009-11-23): +# * Bumped version to 2.1.39 +# * issue 57: change ps2pdf invocations to just use gs directly +# Chris Monson (2009-11-19): +# * Bumped version to 2.1.38 +# * issue 57: Added some limited support for Cygwin (spaces in filenames) +# Chris Monson (2009-11-15): +# * Bumped version to 2.1.37 +# * Removed svninfo, since this is now managed by mercurial +# * Fixed typo in changelist +# * Issue 52: added jpg->eps conversion (thanks to brubakee) +# * Issue 54: fix missing Overfull colorization due to lack of a blank +# line preceding the first error. +# * Issue 51: remove head.tmp and body.tmp in make clean invocation +# * Issue 56: maintain multiple versions of log files (for debugging) +# Chris Monson (2009-11-14): +# * Bumped version to 2.1.36 +# * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables +# Chris Monson (2009-11-05): +# * Bumped version to 2.1.35 +# * Added nomenclature support (see issue 48) +# Chris Monson (2009-10-29): +# * Bumped version to 2.1.34 +# * Fixed _out_ creation bug introduced in 2.1.33 (it was always created) +# * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR +# * Changed contact email address - bring on the spam! +# Chris Monson (2009-10-21): +# * Bumped version to 2.1.33 +# * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay) +# * Made all_files.* settable in Makefile.ini (using ?= instead of :=) +# * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy +# dvi, pdf, and ps if it exists +# Chris Monson (2009-09-25): +# * Bumped version to 2.1.32 +# * Fixed so that a changed lol file will cause a rebuild +# * Added .lol files to the cleanable list +# Chris Monson (2009-09-08): +# * Bumped version to 2.1.31 +# * Closed issue 43: evince doesn't notice pdf change w/out touch +# Chris Monson (2009-08-28): +# * Bumped version to 2.1.30 +# * Closed issue 39: Capture multi-line log warnings/errors to output +# Chris Monson (2009-08-26): +# * Bumped version to 2.1.29 +# * Closed issue 42: add svg support using inkscape +# Chris Monson (2009-08-17): +# * Bumped version to 2.1.28 +# * Patch from paul.biggar for issue 38: package warnings are overlooked +# Chris Monson (2009-08-07): +# * Bumped version to 2.1.27 +# * Included patch for issue 37 - removes pdf/ps files before copying, +# allowing some broken viewers to see changes properly. +# Chris Monson (2009-05-15): +# * Bumped version to 2.1.26 +# * Included patch for issue 9 from favonia - detects .fig changes for +# pstex files during regular compilation, so long as the pstex +# has been built at least once with make all-pstex. +# Chris Monson (2009-03-27): +# * Bumped version to 2.1.25 +# * Cleaned up a bunch of variable setting stuff - more stuff is now +# settable from Makefile.ini +# * Cleaned up documentation for various features, especially settable +# variables. +# * issue 28: support for png -> eps conversion (it even looks good!) +# * issue 29: support for "neverclean" files in Makefile.ini +# * issue 30: make ps2pdf14 the default - fall back when not there +# Chris Monson (2009-03-09): +# * Bumped version to 2.1.24 +# * issue 27: xmgrace support (thanks to rolandschulzhd) +# Chris Monson (2008-10-23): +# * Bumped version to 2.1.23 +# * issue 23: fixed _check_programs to not use bash string subs +# Chris Monson (2008-09-02): +# * Bumped version to 2.1.22 +# * Appled patch from Holger to add include +# sources and some documentation updates. +# * Updated backup_patterns to be a bit more aggressive (also thanks to +# Holger) +# Chris Monson (2008-08-30): +# * Bumped version to 2.1.21 +# * Added ability to specify onlysources.* variables to indicate the only +# files that should *not* be considered includes. Thanks to Holger +# for this patch. +# * Added an automatic include of Makefile.ini if it exists. Allows +# settings to be made outside of this makefile. +# Chris Monson (2008-05-21): +# * Bumped version to 2.1.20 +# * Added manual pstex compilation support (run make all-pstex first) +# * Removed all automatic pstex support. It was totally breaking +# everything and is very hard to incorporate into the makefile +# concept because it requires LaTeX to *fail* before it can +# determine that it needs the files. +# Chris Monson (2008-04-17): +# * Bumped version to 2.1.19 +# * Changed the pstex build hack to be on by default +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.18 +# * issue 16: fixed pstex build problems, seems nondeterministic. Added +# gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1. +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.17 +# * issue 20: fixed accumulation of *.make files - wildcard was +# refusing to work on files that are very recently created. +# Chris Monson (2008-04-02): +# * Bumped version to 2.1.16 +# * issue 19: Removed the use of "type" to fix broken "echo" settings +# Chris Monson (2008-03-27): +# * Bumped version to 2.1.15 +# * issue 18: Favors binary echo over builtin, as binary understands -n +# * issue 16: Fixed handling of missing pstex_t files in the log +# * issue 9: Added .SECONDARY target for .pstex files +# Chris Monson (2008-03-21): +# * Bumped version to 2.1.14 +# * Fixed broken aux file flattening, which caused included bibs to be +# missed. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.13 +# * Changed error output colorization to show errors for missing files +# that are not graphics files. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.12 +# * Fixed a regression introduced in r28 that makes bibtex fail when +# there is no index file present +# Chris Monson (2008-03-03): +# * Bumped version to 2.1.11 +# * Fixed issue 11 (handle index files, reported by abachn) +# * Cleaned up some comments and help text +# Chris Monson (2008-01-24): +# * Bumped version to 2.1.10 +# * Fixed to work when 'sh' is a POSIX shell like 'dash' +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.9 +# * Fixed documentation and dependency graph for pstex files +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.8 +# * Added basic pstex_t support for fig files (Issue 9 by favonia) +# I still suggest that psfrag be used instead. +# Chris Monson (2007-10-16): +# * Bumped version to 2.1.7 +# * Removed todo item: allow other comment directives for rst conversion +# * Added ability to use global rst style file _rststyle_._include_.tex +# * Added help text to that effect +# Chris Monson (2007-05-20): +# * Bumped version to 2.1.6 +# * Changed default paper size for rst files +# * Added todo item: fix paper size for rst files +# * Added todo item: allow other comment directives for rst conversion +# Chris Monson (2007-04-02): +# * Bumped version to 2.1.5 +# * Addressed Issue 7, incorrect .gpi.d generation in subdirectories +# Chris Monson (2007-03-28): +# * Bumped version to 2.1.4 +# * Fixed syntax error in dot output +# Chris Monson (2007-03-01): +# * Bumped version to 2.1.3 +# * Added reST to the included documentation +# * Fixed graphics and script generation to be settable in the +# environment. +# Chris Monson (2007-02-23): +# * Bumped version to 2.1.2 +# * Added the ability to generate .tex files from .rst files +# Chris Monson (2006-10-17): +# * Bumped version to 2.1.1 +# * Fixed includes from subdirectories (sed-to-sed slash escape problem) +# Chris Monson (2006-10-05): +# * Bumped version to 2.1.0 (pretty serious new feature added) +# * New feature: bib files can now be anywhere on the BIBINPUTS path +# * New programs: kpsewhich (with tetex) and xargs (BSD) +# Chris Monson (2006-09-28): +# * Bumped version to 2.0.9 +# * Added ability to parse more than one bibliography +# Chris Monson (2006-06-01): +# * Bumped version to 2.0.8 +# * Added .vrb to the list of cleaned files +# Chris Monson (2006-04-26): +# * Bumped version to 2.0.7 +# * Fixed so that clean-nographics does not remove .gpi.d files +# * Removed jpg -> eps hack (not working properly -- just pre-convert) +# * Fixed so that postscript grayscale can be done with BSD sed +# Chris Monson (2006-04-25): +# * Bumped version to 2.0.6 +# * Fixed so that changed toc, lot, lof, or out causes a rebuild +# Chris Monson (2006-04-17): +# * Bumped version to 2.0.5 +# * Added jpg -> eps conversion target +# Chris Monson (2006-04-12): +# * Bumped version to 2.0.4 +# * Fixed BSD sed invocation to not use \| as a branch delimiter +# * Added a comment section on what is and is not allowed in BSD sed +# * Made paper size handling more robust while I was at it +# * Fixed postscript RGB grayscale to use a weighted average +# * Fixed postscript HSB grayscale to convert to RGB first +# * Fixed a problem with rebuilding .bbl files +# Chris Monson (2006-04-11): +# * Bumped version to 2.0.3 +# * Fixed some BSD sed problems: can't use \n in substitutions +# Chris Monson (2006-04-10): +# * Bumped version to 2.0.2 +# * Once again removed ability to create .tex files from scripts +# * \includeonly works again +# Chris Monson (2006-04-09): +# * Bumped version to 2.0.1 +# * Fixed grayscale postscript handling to be more robust +# * Added ability to generate ._gray_. files from eps and eps.gz +# * Added ability to clean ._gray_.eps files created from .eps files +# Chris Monson (2006-04-07): +# * Bumped version to 2.0.0 +# * Removed clunky ability to create included .tex files from scripts +# * Added note in the help about included tex scripting not working +# * Fixed the .eps generation to delete %.gpihead.make when finished +# * Abandoned designs to use shell variables to create sed scripts +# * Abandoned __default__.tex.sh idea: it causes recursion with %: . +# * Removed web page to-do. All items are now complete. +# * Added better grayscale conversion for dot figures (direct ps fixup). +# * Include files can now be scripted (at the expense of \includeonly). +# * Updated dependency graph to contain better node names. +# Chris Monson (2006-04-06): +# * Bumped version to 2.0b3 +# * Top level includes now fail if there is no rule to build them +# * A helpful message is printed when they do fail +# * Grayscale has been changed to be ._gray_, other phonies use _ now, too +# * Grayscale handling has been completed +# * Changed _include_stems target to _includes target. +# * Fixed _includes target to be useful by itself. +# * Removed the ability to specify clean and build targets at once +# * Verified that epsfig works fine with current code +# * Fixed included scripts so that they are added to the dep files +# * Fixed so that graphics includes don't happen if they aren't for gpi +# * Fixed dot output to allow grayscale. +# Chris Monson (2006-04-05): +# * Bumped version to 2.0b2 +# * Removed automatic -gray output. It needs fixing in a bad way. +# * Revamped dependency creation completely. +# * Fixed conditional inclusion to actually work (test.nobuild.d, test.d). +# * Fixed clean target to remove log targets +# * Added the 'monochrome' word for gray gpi output +# * Added a _check_gpi_files target that checks for common problems +# * Changed the _version target into the version target (no _) +# * Added better handling of grayscale files. Use the .gray.pdf target. +# * Fixed testing for rebuilds +# Chris Monson (2006-04-04): +# * Bumped version to 2.0b1 +# * Changed colorization of output +# * Made .auxbbl and .auxtex .make files secondary targets +# * Shortened and simplified the final latex invocation loop +# * Added version-specific output ($$i vs. $$$$i) in latex loop +# * Added a build message for the first .dvi run (Building .dvi (0)) +# * Removed some build messages that most people don't care about. +# * Simplified procedure for user-set colors -- simple text specification +# * Fixed diff output to...not output. +# * Fixed rerun bug -- detect not only when preceded with LaTeX Warning +# * Sped up gpi plotting +# * Added error handling and colorized output for gpi failure +# * Documented color changing stuff. +# * Now sort the flattened aux file to avoid false recompilation needs +# * Added clean-nographics target +# * Don't remove self.dvi file if self.aux is missing in the log +# * Clarified some code. Did some very minor adjusting. +# Chris Monson (2006-04-03): +# * Bumped version to 2.0a7 +# * Added .dvi and .ps files as secondary files. +# * Fixed handling of multiple run detection when includeonly is in use. +# * Added code to flatten .aux files. +# * Added more files as .SECONDARY prerequisites to avoid recompilation. +# * Fixed the inputs generation to be much simpler and to use pipes. +# * Added the dependency graph directly into the makefile. +# * Changed flatten-aux to remove \@writefile \relax \newlabel, etc. +# * Undid pipe changes with sed usage (BSD sed doesn't know -f-). +# * Added a _check_programs target that tells you what your system has. +# * Fixed an error in colorization that made unnecessary errors appear +# * Added view targets. +# * Updated help text. +# * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds +# * Added more informative error handling for dvips and ps2pdf +# Chris Monson (2006-04-02): +# * Bumped version to 2.0a6 +# * Added indirection to .bbl dependencies to avoid rebuilding .bbl files +# * Streamlined the diff invocation to eliminate an existence test +# * Removed special shell quote escape variables +# * Moved includes to a more prominent location +# * Fixed .inputs.make to not contain .aux files +# * Fixed embedding to use a file instead of always grepping. +# * Added *.make.temp to the list of cleanable files +# * Fixed Ruby. It should now be supported properly. +# * Now differentiate between all, default, and buildable files. +# * Fixed to bail out on serious errors. +# * Revised the handling of includable files. Still working on it. +# Chris Monson (2006-03-31): +# * Bumped version to 2.0a5 +# * Fixed a bug with LaTeX error detection (there can be spaces) +# * Added .bbl support, simplifying everything and making it more correct +# * Refactored some tests that muddy the code +# * Did a little cleanup of some shell loops that can safely be make loops +# * Added support for graphviz .dot files +# * Made _all_programs output easier to read +# * Added the ruby support that has long been advertised +# * Font embedding was screwed up for PostScript -- now implicit +# * Changed the generation of -gray.gpi files to a single command +# * Changed any make-generated file that is not included from .d to .make +# Chris Monson (2006-03-30): +# * Bumped version to 2.0a4 +# * Fixed a bug with very long graphics file names +# * Added a todo entry for epsfig support +# * Fixed a bug paper size bug: sometimes more than one entry appears +# * Fixed DVI build echoing to display the number instead of process ID +# * DVI files are now removed on first invocation if ANY file is missing +# * Added a simple grayscale approach: if a file ends with -gray.gpi, it +# is created from the corresponding .gpi file with a special +# comment ##GRAY in its header, which causes coloring to be +# turned off. +# * Fixed a bug in the handling of .tex.sh files. For some reason I had +# neglected to define file stems for scripted output. +# * Removed a trailing ; from the %.graphics dependencies +# * Added dvips embedding (I think it works, anyway) +# Chris Monson (2006-03-29): +# * Bumped version to 2.0a3 +# * Fixed error in make 3.79 with MAKEFILE_LIST usage +# * Added the presumed filename to the _version output +# * Added a vim macro for converting sed scripts to make commands +# * Added gpi dependency support (plotting external files and loading gpi) +# * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi +# * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}. +# Chris Monson (2006-03-28): +# * Bumped version to 2.0a2 +# * Added SHELL_DEBUG and VERBOSE options +# * Changed the default shell back to /bin/sh (unset, in other words) +# * Moved .PHONY declarations closer to their targets +# * Moved help text into its own define block to obtain better formatting +# * Removed need for double-entry when adding a new program invocation +# * Moved .SECONDARY declaration closer to its relevant occurrence +# * Commented things more heavily +# * Added help text about setting terminal and output in gnuplot +# * Created more fine-grained clean targets +# * Added a %.graphics target that generates all of %'s graphics +# * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps) +# * For now, we're just GPL 2, not 3. Maybe it will change later +# * Made the version and svninfo into variables +# Chris Monson (2006-03-27): +# * Bumped version to 2.0a1 +# * Huge, sweeping changes -- automatic dependencies + +# IMPORTANT! +# +# When adding to the following list, do not introduce any blank lines. The +# list is extracted for documentation using sed and is terminated by a blank +# line. +# +# EXTERNAL PROGRAMS: +# = ESSENTIAL PROGRAMS = +# == Basic Shell Utilities == +CAT ?= cat +CP ?= cp -f +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +ENV ?= env +EXPR ?= expr +MV ?= mv -f +SED ?= sed +SORT ?= sort +TOUCH ?= touch +UNIQ ?= uniq +WHICH ?= which +XARGS ?= xargs +SLEEP ?= sleep +# == LaTeX (tetex-provided) == +BIBTEX ?= bibtex +DVIPS ?= dvips +LATEX ?= latex +PDFLATEX ?= pdflatex +EPSTOPDF ?= epstopdf +MAKEINDEX ?= makeindex +KPSEWHICH ?= kpsewhich +GS ?= gs +# = OPTIONAL PROGRAMS = +# == Makefile Color Output == +TPUT ?= tput +# == TeX Generation == +PERL ?= perl +PYTHON ?= python +RST2LATEX ?= rst2latex.py +# == EPS Generation == +CONVERT ?= convert # ImageMagick +DOT ?= dot # GraphViz +DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed +FIG2DEV ?= fig2dev # XFig +GNUPLOT ?= gnuplot # GNUplot +INKSCAPE ?= inkscape # Inkscape (svg support) +XMGRACE ?= xmgrace # XMgrace +PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps +PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps +PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps +GUNZIP ?= gunzip # GZipped EPS +# == Beamer Enlarged Output == +PSNUP ?= psnup +# == Viewing Stuff == +VIEW_POSTSCRIPT ?= gv +VIEW_PDF ?= xpdf +VIEW_GRAPHICS ?= display + +# Command options for embedding fonts and postscript->pdf conversion +PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100 +PS_COMPATIBILITY ?= 1.4 + +# Defaults for GPI +DEFAULT_GPI_EPS_FONTSIZE ?= 22 +DEFAULT_GPI_PDF_FONTSIZE ?= 12 + +# Style file for ReST +RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex) + +# This ensures that even when echo is a shell builtin, we still use the binary +# (the builtin doesn't always understand -n) +FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO)) +ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO)) + +define determine-gnuplot-output-extension +$(if $(shell $(WHICH) $(GNUPLOT)), + $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)), + eps, pdf), + none) +endef + +GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension)) + +# Directory into which we place "binaries" if it exists. +# Note that this can be changed on the commandline or in Makefile.ini: +# +# Command line: +# make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf +# +# Also, you can specify a relative directory (relative to the Makefile): +# make BINARY_TARGET_DIR=pdfs myfile.pdf +# +# Or, you can use Makefile.ini: +# +# BINARY_TARGET_DIR := $(HOME)/bin_out +# +BINARY_TARGET_DIR ?= _out_ + +RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0) +# SH NOTES +# +# On some systems, /bin/sh, which is the default shell, is not linked to +# /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it +# just isn't. This section details some of the things you have to stay away +# from to remain sh-compatible. +# +# * File pattern expansion does not work for {} +# * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ] +# * &> for stderr redirection doesn't work, use 2>&1 instead +# +# BSD SED NOTES +# +# BSD SED is not very nice compared to GNU sed, but it is the most +# commonly-invoked sed on Macs (being based on BSD), so we have to cater to +# it or require people to install GNU sed. It seems like the GNU +# requirement isn't too bad since this makefile is really a GNU makefile, +# but apparently GNU sed is much less common than GNU make in general, so +# I'm supporting it here. +# +# Sad experience has taught me the following about BSD sed: +# +# * \+ is not understood to mean \{1,\} +# * \| is meaningless (does not branch) +# * \n cannot be used as a substitution character +# * ? does not mean \{0,1\}, but is literal +# * a\ works, but only reliably for a single line if subsequent lines +# have forward slashes in them (as is the case in postscript) +# +# For more info (on the Mac) you can consult +# +# man -M /usr/share/man re_format +# +# And look for the word "Obsolete" near the bottom. + +# +# EXTERNAL PROGRAM DOCUMENTATION SCRIPT +# + +# $(call output-all-programs,[]) +define output-all-programs + [ -f '$(this_file)' ] && \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \ + -e '/EXTERNAL PROGRAMS/d' \ + -e '/^$$/d' \ + -e '/^[[:space:]]*#/i\ '\ + -e 's/^[[:space:]]*#[[:space:]][^=]*//' \ + $(this_file) $(if $1,> '$1',) || \ + $(ECHO) "Cannot determine the name of this makefile." +endef + +# If they misspell gray, it should still work. +GRAY ?= $(call get-default,$(GREY),) + +# +# Utility Functions and Definitions +# + +# While not exactly a make function, this vim macro is useful. It takes a +# verbatim sed script and converts each line to something suitable in a command +# context. Just paste the script's contents into the editor, yank this into a +# register (starting at '0') and run the macro once for each line of the +# original script: +# +# 0i -e :s/\$/$$/eg :s/'/'"'"'/eg ^Ela'A' \:noh j + +# don't call this directly - it is here to avoid calling wildcard more than +# once in remove-files. +remove-files-helper = $(if $1,$(RM) $1,$(sh_true)) + +# $(call remove-files,file1 file2) +remove-files = $(call remove-files-helper,$(wildcard $1)) + +# Removes all cleanable files in the given list +# $(call clean-files,file1 file2 file3 ...) +# Works exactly like remove-files, but filters out files in $(neverclean) +clean-files = \ + $(call remove-files-helper,$(call cleanable-files,$(wildcard $1))) + +# Outputs all generated files to STDOUT, along with some others that are +# created by these (e.g., .idx files end up producing .ilg and .ind files). +# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind +# filenames as needed. +# +# $(call get-generated-names,) +define get-generated-names +[ -f '$1' ] && \ +$(SED) \ + -e '/^OUTPUT /{' \ + -e ' s///' \ + -e ' p' \ + -e ' s/\.idx/\.ind/p' \ + -e ' s/\.ind/\.ilg/p' \ + -e '}' \ + -e 'd' \ + '$1' \ +| $(SORT) | $(UNIQ) +endef + +# This removes files without checking whether they are there or not. This +# sometimes has to be used when the file is created by a series of shell +# commands, but there ends up being a race condition: make doesn't know about +# the file generation as quickly as the system does, so $(wildcard ...) doesn't +# work right. Blech. +# $(call remove-temporary-files,filenames) +remove-temporary-files = $(if $1,$(RM) $1,:) + +# Create an identifier from a file name +# $(call cleanse-filename,filename) +cleanse-filename = $(subst .,_,$(subst /,__,$1)) + +# Escape dots +# $(call escape-dots,str) +escape-dots = $(subst .,\\.,$1) + +# Test that a file exists +# $(call test-exists,file) +test-exists = [ -e '$1' ] + +# $(call move-files,source,destination) +move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2' + +# Copy file1 to file2 only if file2 doesn't exist or they are different +# $(call copy-if-different,sfile,dfile) +copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2' +copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2' +move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2' +replace-if-different-and-remove = \ + $(call test-different,$1,$2) \ + && $(MV) '$1' '$2' \ + || $(call remove-files,'$1') + +# Note that $(DIFF) returns success when the files are the SAME.... +# $(call test-different,sfile,dfile) +test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1 +test-exists-and-different = \ + $(call test-exists,$2) && $(call test-different,$1,$2) + +# Return value 1, or value 2 if value 1 is empty +# $(call get-default,,) +get-default = $(if $1,$1,$2) + +# Copy a file and log what's going on +# $(call copy-with-logging,,) +define copy-with-logging +if [ -d '$2/' ]; then \ + if $(CP) '$1' '$2/'; then \ + $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \ + else \ + $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \ + fi; \ +fi +endef + +# Gives a reassuring message about the failure to find include files +# $(call include-message,) +define include-message +$(strip \ +$(if $(filter-out $(wildcard $1),$1),\ + $(shell $(ECHO) \ + "$(C_INFO)NOTE: You may ignore warnings about the"\ + "following files:" >&2;\ + $(ECHO) >&2; \ + $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\ + $(ECHO) "$(C_RESET)" >&2) +)) +endef +# Characters that are hard to specify in certain places +space := $(empty) $(empty) +colon := \: +comma := , + +# Useful shell definitions +sh_true := : +sh_false := ! : + +# Clear out the standard interfering make suffixes +.SUFFIXES: + +# Turn off forceful rm (RM is usually mapped to rm -f) +ifdef SAFE_RM +RM := rm +endif + +# Turn command echoing back on with VERBOSE=1 +ifndef VERBOSE +QUIET := @ +endif + +# Turn on shell debugging with SHELL_DEBUG=1 +# (EVERYTHING is echoed, even $(shell ...) invocations) +ifdef SHELL_DEBUG +SHELL += -x +endif + +# Get the name of this makefile (always right in 3.80, often right in 3.79) +# This is only really used for documentation, so it isn't too serious. +ifdef MAKEFILE_LIST +this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +else +this_file := $(wildcard GNUmakefile makefile Makefile) +endif + +# Terminal color definitions + +REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT))) + +# $(call get-term-code,codeinfo) +# e.g., +# $(call get-term-code,setaf 0) +get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),) + +black := $(call get-term-code,setaf 0) +red := $(call get-term-code,setaf 1) +green := $(call get-term-code,setaf 2) +yellow := $(call get-term-code,setaf 3) +blue := $(call get-term-code,setaf 4) +magenta := $(call get-term-code,setaf 5) +cyan := $(call get-term-code,setaf 6) +white := $(call get-term-code,setaf 7) +bold := $(call get-term-code,bold) +uline := $(call get-term-code,smul) +reset := $(call get-term-code,sgr0) + +# +# User-settable definitions +# +LATEX_COLOR_WARNING ?= magenta +LATEX_COLOR_ERROR ?= red +LATEX_COLOR_INFO ?= green +LATEX_COLOR_UNDERFULL ?= magenta +LATEX_COLOR_OVERFULL ?= red bold +LATEX_COLOR_PAGES ?= bold +LATEX_COLOR_BUILD ?= cyan +LATEX_COLOR_GRAPHIC ?= yellow +LATEX_COLOR_DEP ?= green +LATEX_COLOR_SUCCESS ?= green bold +LATEX_COLOR_FAILURE ?= red bold + +# Gets the real color from a simple textual definition like those above +# $(call get-color,ALL_CAPS_COLOR_NAME) +# e.g., $(call get-color,WARNING) +get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c))) + +# +# STANDARD COLORS +# +C_WARNING := $(call get-color,WARNING) +C_ERROR := $(call get-color,ERROR) +C_INFO := $(call get-color,INFO) +C_UNDERFULL := $(call get-color,UNDERFULL) +C_OVERFULL := $(call get-color,OVERFULL) +C_PAGES := $(call get-color,PAGES) +C_BUILD := $(call get-color,BUILD) +C_GRAPHIC := $(call get-color,GRAPHIC) +C_DEP := $(call get-color,DEP) +C_SUCCESS := $(call get-color,SUCCESS) +C_FAILURE := $(call get-color,FAILURE) +C_RESET := $(reset) + +# +# PRE-BUILD TESTS +# + +# Check that clean targets are not combined with other targets (weird things +# happen, and it's not easy to fix them) +hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1) +hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1) +ifneq "$(hasbuildgoals)" "" +ifneq "$(hascleangoals)" "" +$(error $(C_ERROR)Clean and build targets specified together$(C_RESET))) +endif +endif + +# +# VARIABLE DECLARATIONS +# + +# Names of sed scripts that morph gnuplot files -- only the first found is used +GNUPLOT_SED := global-gpi.sed gnuplot.sed +GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_graphic_extension ?= eps +latex_build_program ?= $(LATEX) +build_target_extension ?= dvi +hyperref_driver_pattern ?= hdvips +hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options. +else +default_graphic_extension ?= pdf +latex_build_program ?= $(PDFLATEX) +build_target_extension ?= pdf +hyperref_driver_pattern ?= hpdf.* +hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). +endif + +# Files of interest +all_files.tex ?= $(wildcard *.tex) +all_files.tex.sh ?= $(wildcard *.tex.sh) +all_files.tex.pl ?= $(wildcard *.tex.pl) +all_files.tex.py ?= $(wildcard *.tex.py) +all_files.rst ?= $(wildcard *.rst) +all_files.fig ?= $(wildcard *.fig) +all_files.gpi ?= $(wildcard *.gpi) +all_files.dot ?= $(wildcard *.dot) +all_files.xvg ?= $(wildcard *.xvg) +all_files.svg ?= $(wildcard *.svg) +all_files.png ?= $(wildcard *.png) +all_files.jpg ?= $(wildcard *.jpg) +all_files.eps.gz ?= $(wildcard *.eps.gz) +all_files.eps ?= $(wildcard *.eps) + +# Utility function for obtaining all files not specified in $(neverclean) +# $(call cleanable-files,file1 file2 file3 ...) +# Returns the list of files that is not in $(wildcard $(neverclean)) +cleanable-files = $(filter-out $(wildcard $(neverclean)), $1) + +# Utility function for getting all .$1 files that are to be ignored +# * files listed in $(includes.$1) +# * files not listed in $(onlysources.$1) if it is defined +ignore_files = \ + $(includes.$1) \ + $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1))) + +# Patterns to never be allowed as source targets +ignore_patterns := %._include_ + +# Patterns allowed as source targets but not included in 'all' builds +nodefault_patterns := %._nobuild_ $(ignore_patterns) + +# Utility function for getting targets suitable building +# $(call filter-buildable,suffix) +filter-buildable = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1)) + +# Utility function for getting targets suitable for 'all' builds +# $(call filter-default,suffix) +filter-default = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1)) + +# Top level sources that can be built even when they are not by default +files.tex := $(call filter-buildable,tex) +files.tex.sh := $(call filter-buildable,tex.sh) +files.tex.pl := $(call filter-buildable,tex.pl) +files.tex.py := $(call filter-buildable,tex.py) +files.rst := $(call filter-buildable,rst) +files.gpi := $(call filter-buildable,gpi) +files.dot := $(call filter-buildable,dot) +files.fig := $(call filter-buildable,fig) +files.xvg := $(call filter-buildable,xvg) +files.svg := $(call filter-buildable,svg) +files.png := $(call filter-buildable,png) +files.jpg := $(call filter-buildable,jpg) +files.eps.gz := $(call filter-buildable,eps.gz) + +# Make all pstex targets secondary. The pstex_t target requires the pstex +# target, and nothing else really depends on it, so it often gets deleted. +# This avoids that by allowing *all* fig files to be pstex targets, which is +# perfectly valid and causes no problems even if they're going to become eps +# files in the end. +.SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig)) + +# Top level sources that are built by default targets +default_files.tex := $(call filter-default,tex) +default_files.tex.sh := $(call filter-default,tex.sh) +default_files.tex.pl := $(call filter-default,tex.pl) +default_files.tex.py := $(call filter-default,tex.py) +default_files.rst := $(call filter-default,rst) +default_files.gpi := $(call filter-default,gpi) +default_files.dot := $(call filter-default,dot) +default_files.fig := $(call filter-default,fig) +default_files.xvg := $(call filter-default,xvg) +default_files.svg := $(call filter-default,svg) +default_files.png := $(call filter-default,png) +default_files.jpg := $(call filter-default,jpg) +default_files.eps.gz := $(call filter-default,eps.gz) + +# Utility function for creating larger lists of files +# $(call concat-files,suffixes,[prefix]) +concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s)) + +# Useful file groupings +all_files_source := $(call concat-files,tex,all) +all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all) + +.PHONY: $(all_files_scripts) + +default_files_source := $(call concat-files,tex,default) +default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default) + +files_source := $(call concat-files,tex) +files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst) + +# Utility function for obtaining stems +# $(call get-stems,suffix,[prefix]) +get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%)) + +# List of all stems (including ._include_ and ._nobuild_ file stems) +all_stems.tex := $(call get-stems,tex,all) +all_stems.tex.sh := $(call get-stems,tex.sh,all) +all_stems.tex.pl := $(call get-stems,tex.pl,all) +all_stems.tex.py := $(call get-stems,tex.py,all) +all_stems.rst := $(call get-stems,rst,all) +all_stems.fig := $(call get-stems,fig,all) +all_stems.gpi := $(call get-stems,gpi,all) +all_stems.dot := $(call get-stems,dot,all) +all_stems.xvg := $(call get-stems,xvg,all) +all_stems.svg := $(call get-stems,svg,all) +all_stems.png := $(call get-stems,png,all) +all_stems.jpg := $(call get-stems,jpg,all) +all_stems.eps.gz := $(call get-stems,eps.gz,all) +all_stems.eps := $(call get-stems,eps,all) + +# List of all default stems (all default PDF targets): +default_stems.tex := $(call get-stems,tex,default) +default_stems.tex.sh := $(call get-stems,tex.sh,default) +default_stems.tex.pl := $(call get-stems,tex.pl,default) +default_stems.tex.py := $(call get-stems,tex.py,default) +default_stems.rst := $(call get-stems,rst,default) +default_stems.fig := $(call get-stems,fig,default) +default_stems.gpi := $(call get-stems,gpi,default) +default_stems.dot := $(call get-stems,dot,default) +default_stems.xvg := $(call get-stems,xvg,default) +default_stems.svg := $(call get-stems,svg,default) +default_stems.png := $(call get-stems,png,default) +default_stems.jpg := $(call get-stems,jpg,default) +default_stems.eps.gz := $(call get-stems,eps.gz,default) + +# List of all stems (all possible bare PDF targets created here): +stems.tex := $(call get-stems,tex) +stems.tex.sh := $(call get-stems,tex.sh) +stems.tex.pl := $(call get-stems,tex.pl) +stems.tex.py := $(call get-stems,tex.py) +stems.rst := $(call get-stems,rst) +stems.fig := $(call get-stems,fig) +stems.gpi := $(call get-stems,gpi) +stems.dot := $(call get-stems,dot) +stems.xvg := $(call get-stems,xvg) +stems.svg := $(call get-stems,svg) +stems.png := $(call get-stems,png) +stems.jpg := $(call get-stems,jpg) +stems.eps.gz := $(call get-stems,eps.gz) + +# Utility function for creating larger lists of stems +# $(call concat-stems,suffixes,[prefix]) +concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s))) + +# The most likely to be source but not finished product go first +graphic_source_extensions := fig \ + gpi \ + xvg \ + svg \ + dot \ + eps.gz + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +graphic_source_extensions += png jpg +graphic_target_extensions := eps ps +else +graphic_source_extensions += eps +graphic_target_extensions := pdf png jpg mps tif +endif + +all_stems_source := $(call concat-stems,tex,all) +all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all) +all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all) +all_stems_ss := $(sort $(all_stems_source) $(all_stems_script)) +all_stems_sg := $(sort $(all_stems_script)) +all_stems_ssg := $(sort $(all_stems_ss)) + +default_stems_source := $(call concat-stems,tex,default) +default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default) +default_stems_ss := $(sort $(default_stems_source) $(default_stems_script)) +default_stems_sg := $(sort $(default_stems_script)) +default_stems_ssg := $(sort $(default_stems_ss)) + +stems_source := $(call concat-stems,tex) +stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst) +stems_graphic := $(call concat-stems,$(graphic_source_extensions)) +stems_gg := $(sort $(stems_graphic)) +stems_ss := $(sort $(stems_source) $(stems_script)) +stems_sg := $(sort $(stems_script)) +stems_ssg := $(sort $(stems_ss)) + +# Calculate names that can generate the need for an include file. We can't +# really do this with patterns because it's too easy to screw up, so we create +# an exhaustive list. +allowed_source_suffixes := \ + pdf \ + ps \ + dvi \ + ind \ + nls \ + bbl \ + aux \ + aux.make \ + d \ + auxbbl.make \ + _graphics \ + _show +allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes)) + +allowed_graphic_suffixes := \ + pdf \ + eps \ + gpihead.make \ + gpi.d +allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes)) + +# All targets allowed to build documents +allowed_source_targets := \ + $(foreach suff,$(allowed_source_suffixes),\ + $(addsuffix .$(suff),$(stems_ssg))) + +# All targets allowed to build graphics +allowed_graphic_targets := \ + $(foreach suff,$(allowed_graphic_suffixes),\ + $(addsuffix .$(suff),$(stems_gg))) + +# All targets that build multiple documents (like 'all') +allowed_batch_source_targets := \ + all \ + all-pdf \ + all-ps \ + all-dvi \ + all-bbl \ + all-ind \ + all-gls \ + all-nls \ + show + +# All targets that build multiple graphics (independent of document) +allowed_batch_graphic_targets := \ + all-graphics \ + all-pstex \ + all-dot2tex \ + show-graphics + +# Now we figure out which stuff is available as a make target for THIS RUN. +real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\ + all) + +specified_source_targets := $(strip \ + $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \ + ) + +specified_batch_source_targets := $(strip \ + $(filter $(allowed_batch_source_targets),$(real_goals)) \ + ) + +specified_graphic_targets := $(strip \ + $(filter $(allowed_graphic_targets),$(real_goals)) \ + ) + +specified_batch_graphic_targets := $(strip \ + $(filter $(allowed_batch_graphic_targets),$(real_goals)) \ + ) + +specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\ + $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\ + $(all_files.gpi)) \ + ) + +# Determine which .d files need including from the information gained above. +# This is done by first checking whether a batch target exists. If it does, +# then all *default* stems are used to create possible includes (nobuild need +# not apply for batch status). If no batch targets exist, then the individual +# targets are considered and appropriate includes are taken from them. +source_stems_to_include := \ + $(sort\ + $(if $(specified_batch_source_targets),\ + $(default_stems_ss),\ + $(foreach t,$(specified_source_targets),\ + $(foreach p,$(allowed_source_patterns),\ + $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \ + )) \ + )) + +# Determine which .gpi.d files are needed using the above information. We +# first check whether a batch target is specified, then check individual +# graphics that may have been specified. +graphic_stems_to_include := \ + $(sort\ + $(if $(specified_batch_graphic_targets),\ + $(default_stems.gpi),\ + $(foreach t,$(specified_gpi_targets),\ + $(foreach p,$(allowed_graphic_patterns),\ + $(patsubst $p,%,$(filter $p,$t)) \ + )) \ + )) + +# All dependencies for the 'all' targets +all_pdf_targets := $(addsuffix .pdf,$(stems_ssg)) +all_ps_targets := $(addsuffix .ps,$(stems_ssg)) +all_dvi_targets := $(addsuffix .dvi,$(stems_ssg)) +all_tex_targets := $(addsuffix .tex,$(stems_sg)) +all_d_targets := $(addsuffix .d,$(stems_ssg)) +all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg)) +intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),) +all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig)) +all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot)) + +all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension))) + +default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss)) +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_ps_targets := $(addsuffix .ps,$(default_stems_ss)) +default_dvi_targets := $(addsuffix .dvi,$(default_stems_ss)) +pre_pdf_extensions := dvi ps +endif + +# Extensions generated by LaTeX invocation that can be removed when complete +rm_ext := \ + log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \ + fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf +backup_patterns := *~ *.bak *.backup body.tmp head.tmp + +graph_stem := _graph + +# All LaTeX-generated files that can be safely removed + +rm_tex := \ + $(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \ + $(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \ + $(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \ + $(addsuffix .*.log,$(stems_graphic)) + +# These are the files that will affect .gpi transformation for all .gpi files. +# +# Use only the first one found. Backward compatible values are at the end. +# Note that we use foreach, even though wildcard also returns a list, to ensure +# that the order in the uppercase variables is preserved. Directory listings +# provide no such guarantee, so we avoid relying on them. +gpi_sed := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f)))) +gpi_global := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f)))) + +# +# Functions used in generating output +# + +# Outputs all source dependencies to stdout. The first argument is the file to +# be parsed, the second is a list of files that will show up as dependencies in +# the new .d file created here. +# +# NOTE: BSD sed does not understand \|, so we have to do something more +# clunky to extract suitable extensions. +# +# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure +# that we can properly backslash-escape spaces in file names (e.g, on Cygwin +# for tex distributions that have "Program Files" in their name). +# +# $(call get-inputs,,) +define get-inputs +$(SED) \ +-e '/^INPUT/!d' \ +-e 's!^INPUT \(\./\)\{0,1\}!!' \ +-e 's/[[:space:]]/\\ /g' \ +-e 's/\(.*\)\.aux$$/\1.tex/' \ +-e '/\.tex$$/b addtargets' \ +-e '/\.cls$$/b addtargets' \ +-e '/\.sty$$/b addtargets' \ +-e '/\.pstex_t$$/b addtargets' \ +-e '/\.dot_t$$/b addtargets' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# $(call get-missing-inputs,,) +define get-missing-inputs +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/Default extension: /!d' \ +-e 's/[[:space:]]\{1,\}/ /g' \ +-e 's/\n\{1,\}/ /g' \ +-e 's/^.*File `//' \ +-e 's/'"'"' not found\..*//' \ +-e '/\.tex/!s/$$/.tex/' \ +-e 's/[[:space:]]/\\ /g' \ +-e 'h' \ +-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# Get source file for specified graphics stem. +# +# $(call graphics-source,) +define graphics-source +$(strip $(firstword \ + $(wildcard \ + $(addprefix $1.,\ + $(graphic_source_extensions))) \ + $1 \ +)) +endef + +# Get the target file for the specified graphics file/stem +# +# $(call graphics-target,) +define graphics-target +$(strip $(if $(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1, + $(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension)))) +endef + +# Outputs all of the graphical dependencies to stdout. The first argument is +# the stem of the source file being built, the second is a list of suffixes +# that will show up as dependencies in the generated .d file. +# +# Note that we try to escape spaces in filenames where possible. We have to do +# it with three backslashes so that as the name percolates through the makefile +# it eventually ends up with the proper escaping when the build rule is found. +# Ugly, but it appears to work. Note that graphicx doesn't allow filenames +# with spaces, so this could in many ways be moot unless you're using something +# like grffile. +# +# For pdflatex, we really need the missing file to be specified without an +# extension, otherwise compilation barfs on the first missing file. Truly +# annoying, but there you have it. +# +# It turns out that the graphics errors, although they have lines with empty +# space, are only made of two paragraphs. So, we just use some sed magic to +# get everything into paragraphs, detect when it's a paragraph that interests +# us, and double it up. Then we get the filename only if we're missing +# extensions (a sign that it's graphicx complaining). +# +# $(call get-graphics,) +#.log,$(addprefix $*.,d $(build_target_extension) _graphics) +define get-graphics +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File `/{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/{' \ +-e ' s/\n\{1,\}/ /g' \ +-e ' s/[[:space:]]\{1,\}/ /g' \ +-e ' s/^.*File `//' \ +-e ' s/'"'"' not found\..*//' \ +-e ' h' \ +-e ' s/.*/# MISSING stem "&" - (presence of comment affects build)/' \ +-e ' p' \ +-e ' g' \ +-e ' b addtargets' \ +-e '}' \ +-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \ +-e ' s//\1/' \ +-e ' b addtargets' \ +-e '}' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/[[:space:]]/\\\\\\&/g' \ +-e 'h' \ +-e 's/.*/-include &.gpi.d/' \ +-e 'p' \ +-e 'g' \ +-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \ +-e 'p' \ +-e 'd' \ +$*.log +endef + +# Checks for build failure due to pstex inclusion, and gives instructions. +# +# $(call die-on-pstexs,) +define die-on-pstexs +if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-pstex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for build failure due to dot2tex, and gives instructions. +# +# $(call die-on-dot2tex,) +define die-on-dot2tex +if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-dot2tex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for the existence of a .aux file, and dies with an error message if it +# isn't there. Note that we pass the file stem in, not the full filename, +# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo) +# +# $(call die-on-no-aux,) +define die-on-no-aux +if [ ! -e '$1.aux' ]; then \ + $(call colorize-latex-errors,$1.log); \ + exit 1; \ +fi +endef + +# Outputs all index files to stdout. Arg 1 is the source file stem, arg 2 is +# the list of targets for the discovered dependency. +# +# $(call get-log-index,,) +define get-log-index +$(SED) \ +-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \ +-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \ +-e 's/[[:space:]]/\\&/g' \ +-e '/^TARGETS=/{' \ +-e ' h' \ +-e ' s/^TARGETS=/$2: /p' \ +-e ' g' \ +-e ' s/^TARGETS=\(.*\)/\1: $1.tex/p' \ +-e '}' \ +-e 'd' \ +'$1.log' | $(SORT) | $(UNIQ) +endef + + +# Outputs all bibliography files to stdout. Arg 1 is the source stem, arg 2 is +# a list of targets for each dependency found. +# +# The script kills all lines that do not contain bibdata. Remaining lines have +# the \bibdata macro and delimiters removed to create a dependency list. A +# trailing comma is added, then all adjacent commas are collapsed into a single +# comma. Then commas are replaced with the string .bib[space], and the +# trailing space is killed off. Finally, all filename spaces are escaped. +# This produces a list of space-delimited .bib filenames, which is what the +# make dep file expects to see. +# +# Note that we give kpsewhich a bogus argument so that a failure of sed to +# produce output will not cause an error. +# +# $(call get-bibs,,) +define get-bibs +$(SED) \ +-e '/^\\bibdata/!d' \ +-e 's/\\bibdata{\([^}]*\)}/\1,/' \ +-e 's/,\{2,\}/,/g' \ +-e 's/[[:space:]]/\\&/g' \ +-e 's/,/.bib /g' \ +-e 's/ \{1,\}$$//' \ +$1 | $(XARGS) $(KPSEWHICH) '#######' | \ +$(SED) \ +-e 's/^/$2: /' | \ +\$(SORT) | $(UNIQ) +endef + +# Makes a an aux file that only has stuff relevant to the target in it +# $(call make-auxtarget-file,,) +define make-auxtarget-file +$(SED) \ +-e '/^\\newlabel/!d' \ +$1 > $2 +endef + +# Makes an aux file that only has stuff relevant to the bbl in it +# $(call make-auxbbl-file,,) +define make-auxbbl-file +$(SED) \ +-e '/^\\newlabel/d' \ +$1 > $2 +endef + +# Makes a .gpi.d file from a .gpi file +# $(call make-gpi-d,<.gpi>,<.gpi.d>) +define make-gpi-d +$(ECHO) '# vim: ft=make' > $2; \ +$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \ +$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \ +$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \ +$(ECHO) 'endif' >> $2; +endef + +# Parse .gpi files for data and loaded dependencies, output to stdout +# +# The sed script here tries to be clever about obtaining valid +# filenames from the gpi file. It assumes that the plot command starts its own +# line, which is not too difficult a constraint to satisfy. +# +# This command script also generates 'include' directives for every 'load' +# command in the .gpi file. The load command must appear on a line by itself +# and the file it loads must have the suffix .gpi. If you don't want it to be +# compiled when running make graphics, then give it a suffix of ._include_.gpi. +# +# $(call get-gpi-deps,,) +define get-gpi-deps +$(SED) \ +-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \ +-e ' H' \ +-e ' /[^\\]$$/{' \ +-e ' s/.*//' \ +-e ' x' \ +-e ' s/\\\{0,1\}\n//g' \ +-e ' s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \ +-e ' s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \ +-e ' s/,['\''"]-\{0,1\}['\''"]//g' \ +-e ' s/[,'\''"]\{1,\}/ /g' \ +-e ' s!.*!$2: &!' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \ +-e 'd' \ +$1 +endef + +# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with +# recompilation. +# +# Note that we only ignore file not found errors for things that we know how to +# build, like graphics files. +# +# $(call colorize-latex-errors,) +define colorize-latex-errors +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/d' \ +-e '/Missing .begin.document/{' \ +-e ' h' \ +-e ' s/.*/Are you trying to build an include file?/' \ +-e ' x' \ +-e ' G' \ +-e '}' \ +-e '/ LaTeX Error: Cannot determine size/d' \ +-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \ +-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \ +-e ' s//\1/' \ +-e ' /^$(hyperref_driver_pattern)$$/!{' \ +-e ' s/.*//' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e '/ LaTeX Error: Unknown graphics extension/{' \ +-e ' s/^/ /' \ +-e ' h' \ +-e ' s/.*/--- Graphics extension error:/' \ +-e ' G' \ +-e ' h' \ +-e ' s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \ +-e ' H' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*//' \ +-e ' h' \ +-e ' b' \ +-e '}' \ +-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \ +-e 'd' \ +$1 +endef + +# Colorize Makeindex errors +define colorize-makeindex-errors +$(SED) \ +-e '/^!! /{' \ +-e ' N' \ +-e ' s/^.*$$/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize epstopdf errors +# +# $(call colorize-epstopdf-errors,) +define colorize-epstopdf-errors +$(SED) \ +-e '/^Error:/,/^Execution stack:/{' \ +-e ' /^Execution stack:/d' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GNUplot errors +# +# $(call colorize-gnuplot-errors,) +define colorize-gnuplot-errors +$(SED) \ +-e '/, line [0-9]*:/!{' \ +-e ' H' \ +-e ' x' \ +-e ' s/.*\n\(.*\n.*\)$$/\1/' \ +-e ' x' \ +-e '}' \ +-e '/, line [0-9]*:/{' \ +-e ' H' \ +-e ' /unknown.*terminal type/{' \ +-e ' s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \ +-e ' H' \ +-e ' }' \ +-e ' /gpihead/{' \ +-e ' s/.*/--- This could be a Makefile bug - contact the maintainer./' \ +-e ' H' \ +-e ' }' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e '/^gnuplot>/,/^$$/{' \ +-e ' s/^gnuplot.*/$(C_ERROR)&/' \ +-e ' s/^$$/$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GraphViz errors +# +# $(call colorize-dot-errors,) +define colorize-dot-errors +$(SED) \ +-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \ +-e 'd' \ +'$1' +endef + +# Get all important .aux files from the top-level .aux file and merges them all +# into a single file, which it outputs to stdout. +# +# $(call flatten-aux,,) +define flatten-aux +$(SED) \ +-e '/\\@input{\(.*\)}/{' \ +-e 's//\1/' \ +-e 's![.:]!\\&!g' \ +-e 'h' \ +-e 's!.*!\\:\\\\@input{&}:{!' \ +-e 'p' \ +-e 'x' \ +-e 's/\\././g' \ +-e 's/.*/r &/p' \ +-e 's/.*/d/p' \ +-e 's/.*/}/p' \ +-e 'd' \ +-e '}' \ +-e 'd' \ +'$1' > "$1.$$$$.sed.make"; \ +$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \ +$(SED) \ +-e '/^\\relax/d' \ +-e '/^\\bibcite/d' \ +-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \ +"$1.$$$$.make" | $(SORT) > '$2'; \ +$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make) +endef + +# Generate pdf from postscript +# +# Note that we don't just call ps2pdf, since there are so many versions of that +# script on various systems. Instead, we call the postscript interpreter +# directly. +# +# $(call ps2pdf,infile,outfile,[embed fonts]) +define ps2pdf + $(GS) \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -q -dNOPAUSE -dBATCH \ + -sDEVICE=pdfwrite -sstdout=%stderr \ + '-sOutputFile=$2' \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -c .setpdfwrite \ + -f '$1' +endef + +# Colorize LaTeX output. +# This uses a neat trick from the Sed & Awk Book from O'Reilly: +# 1) If a line has a single ending paren, delete it to make a blank line (so +# that we catch the first error, which is not always preceded by a blank +# line). +# 2) Ensure that the last line of the file gets appended to the hold buffer, +# and blank it out to trigger end-of-paragraph logic below. +# 3) When encountering a blank line (LaTeX output helpfully breaks output on +# newlines) +# a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer), +# b) remove the newline at the beginning (don't ask), +# c) apply any colorizing substitutions necessary to ensure happiness. +# d) get the newline out of the hold buffer and append it +# e) profit! (print) +# 4) Anything not colorized is deleted, unless in verbose mode. +color_tex := \ + $(SED) \ + -e '$${' \ + -e ' /^$$/!{' \ + -e ' H' \ + -e ' s/.*//' \ + -e ' }' \ + -e '}' \ + -e '/^$$/!{' \ + -e ' H' \ + -e ' d' \ + -e '}' \ + -e '/^$$/{' \ + -e ' x' \ + -e ' s/^\n//' \ + -e ' /Output written on /{' \ + -e ' s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success! Wrote \2 to \1/' \ + -e ' s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \ + -e ' s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \ + -e ' s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' / *LaTeX Error:.*/{' \ + -e ' s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /.*Warning:.*/{' \ + -e ' s//$(C_WARNING)&$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Underfull.*/{' \ + -e ' s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Overfull.*/{' \ + -e ' s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + $(if $(VERBOSE),,-e ' d') \ + -e ' :end' \ + -e ' G' \ + -e '}' \ + +# Colorize BibTeX output. +color_bib := \ + $(SED) \ + -e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \ + -e '/---/,/^.[^:]/{' \ + -e ' H' \ + -e ' /^.[^:]/{' \ + -e ' x' \ + -e ' s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' p' \ + -e ' s/.*//' \ + -e ' h' \ + -e ' d' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \ + $(if $(VERBOSE),,-e 'd') + + +# Make beamer output big enough to print on a full page. Landscape doesn't +# seem to work correctly. +enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter + +# $(call test-run-again,) +test-run-again = $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log + +# This tests whether the build target commands should be run at all, from +# viewing the log file. +# $(call test-log-for-need-to-run,) +define test-log-for-need-to-run +$(SED) \ +-e '/^No file $(call escape-dots,$1)\.aux\./d' \ +$1.log \ +| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$' +endef + +# LaTeX invocations +# +# $(call latex,,[]) +run-latex = $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null + +# $(call latex-color-log,) +latex-color-log = $(color_tex) $1.log + +# $(call run-makeindex,,,,) +define run-makeindex +success=1; \ +if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \ + $(call colorize-makeindex-errors,$3); \ + $(RM) -f '$2'; \ + success=0; \ +fi; \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# This runs the given script to generate output, and it uses MAKE_RESTARTS to +# ensure that it never runs it more than once for a particular root make +# invocation. +# +# $(call run-script,,,) +define run-script +[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \ +restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \ +level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \ +if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \ + $(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \ + $1 '$2' '$3'; \ + $(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \ + $(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \ +fi +endef + +# BibTeX invocations +# +# $(call run-bibtex,) +run-bibtex = $(BIBTEX) $1 | $(color_bib) + + +# $(call convert-eps-to-pdf,,,[gray]) +# Note that we don't use the --filter flag because it has trouble with bounding boxes that way. +define convert-eps-to-pdf +$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \ +$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \ +$(call colorize-epstopdf-errors,$1.log); +endef + +# $(call convert-gpi,,,[gray]) +# +define convert-gpi +$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \ +$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \ +$(firstword \ + $(shell \ + $(SED) \ + -e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \ + -e 'd' \ + $1 $(strip $(gpi_global)) \ + ) \ +) \ +),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \ +$(strip $(if $3,monochrome,$(if \ +$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\ +,color))) > $1head.make; \ +$(ECHO) 'set output "$2"' >> $1head.make; \ +$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \ +fnames='$1head.make $1';\ +$(if $(gpi_sed),\ + $(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \ + fnames=$1.temp.make;,\ +) \ +success=1; \ +if ! $(GNUPLOT) $$fnames 2>$1.log; then \ + $(call colorize-gnuplot-errors,$1.log); \ + success=0; \ +fi; \ +$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \ +$(call remove-temporary-files,$1head.make); \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# Creation of .eps files from .png files +# +# The intermediate step of PNM (using NetPBM) produces much nicer output than +# ImageMagick's "convert" binary. I couldn't get the right combination of +# flags to make it look nice, anyway. +# +# To handle gray scale conversion, we pipe things through ppmtopgm in the +# middle. +# +# $(call convert-png,,) +define convert-png +$(PNGTOPNM) "$1" \ + $(if $3,| $(PPMTOPGM),) \ + | $(PNMTOPS) -noturn \ + > "$2" +endef + +# Creation of .eps files from .jpg files +# +# Thanks to brubakee for this solution. +# +# Uses Postscript level 2 to avoid file size bloat +# $(call convert-jpg,,) +define convert-jpg +$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2' +endef + +# Creation of .eps files from .fig files +# $(call convert-fig,,,[gray]) +convert-fig = $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2 + +# Creation of .pstex files from .fig files +# $(call convert-fig-pstex,,) +convert-fig-pstex = $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1 + +# Creation of .pstex_t files from .fig files +# $(call convert-fig-pstex-t,,,) +convert-fig-pstex-t = $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1 + +# Creation of .dot_t files from .dot files +# #(call convert-dot-tex,,) +convert-dot-tex = $(DOT2TEX) '$1' > '$2' + +# Converts svg files into .eps files +# +# $(call convert-svg,,,[gray]) +convert-svg = $(INKSCAPE) --export-eps='$2' '$1' + +# Converts xvg files into .eps files +# +# $(call convert-xvg,,,[gray]) +convert-xvg = $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2' + +# Converts .eps.gz files into .eps files +# +# $(call convert-epsgz,,,[gray]) +convert-epsgz = $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2' + +# Converts .eps files into .eps files (usually a no-op, but can make grayscale) +# +# $(call convert-eps,,,[gray]) +convert-eps = $(if $3,$(call kill-ps-color) $1 > $2) + +# The name of the file containing special postscript commands for grayscale +gray_eps_file := gray.eps.make + +# Changes sethsbcolor and setrgbcolor calls in postscript to always produce +# grayscale. In general, this is accomplished by writing new versions of those +# functions into the user dictionary space, which is looked up before the +# global or system dictionaries (userdict is one of the permanent dictionaries +# in postscript and is not read-only like systemdict). +# +# For setrgbcolor, the weighted average of the triple is computed and the +# triple is replaced with three copies of that average before the original +# procedure is called: .299R + .587G + .114B +# +# For sethsbcolor, the color is first converted to RGB, then to grayscale by +# the new setrgbcolor operator as described above. Why is this done? +# Because simply using the value component will tend to make pure colors +# white, a very undesirable thing. Pure blue should not translate to white, +# but to some level of gray. Conversion to RGB does the right thing. It's +# messy, but it works. +# +# From +# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB, +# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is +# as follows: +# +# Hi = int(floor(6 * H)) mod 6 +# f = 6 * H - Hi +# p = V(1-S) +# q = V(1-fS) +# t = V(1-(1-f)S) +# if Hi = 0: R G B <-- V t p +# if Hi = 1: R G B <-- q V p +# if Hi = 2: R G B <-- p V t +# if Hi = 3: R G B <-- p q V +# if Hi = 4: R G B <-- t p V +# if Hi = 5: R G B <-- V p q +# +# The messy stack-based implementation is below +# $(call create-gray-eps-file,filename) +define create-gray-eps-file +$(ECHO) -n -e '\ +/OLDRGB /setrgbcolor load def\n\ +/setrgbcolor {\n\ + .114 mul exch\n\ + .587 mul add exch\n\ + .299 mul add\n\ + dup dup\n\ + OLDRGB\n\ +} bind def\n\ +/OLDHSB /sethsbcolor load def\n\ +/sethsbcolor {\n\ + 2 index % H V S H\n\ + 6 mul floor cvi 6 mod % Hi V S H\n\ + 3 index % H Hi V S H\n\ + 6 mul % 6H Hi V S H\n\ + 1 index % Hi 6H Hi V S H\n\ + sub % f Hi V S H\n\ + 2 index 1 % 1 V f Hi V S H\n\ + 4 index % S 1 V f Hi V S H\n\ + sub mul % p f Hi V S H\n\ + 3 index 1 % 1 V p f Hi V S H\n\ + 6 index % S 1 V p f Hi V S H\n\ + 4 index % f S 1 V p f Hi V S H\n\ + mul sub mul % q p f Hi V S H\n\ + 4 index 1 1 % 1 1 V q p f Hi V S H\n\ + 5 index % f 1 1 V q p f Hi V S H\n\ + sub % (1-f) 1 V q p f Hi V S H\n\ + 8 index % S (1-f) 1 V q p f Hi V S H\n\ + mul sub mul % t q p f Hi V S H\n\ + 4 -1 roll pop % t q p Hi V S H\n\ + 7 -2 roll pop pop % t q p Hi V\n\ + 5 -2 roll % Hi V t q p\n\ + dup 0 eq\n\ + {1 index 3 index 6 index}\n\ + {\n\ + dup 1 eq\n\ + {3 index 2 index 6 index}\n\ + {\n\ + dup 2 eq\n\ + {4 index 2 index 4 index}\n\ + {\n\ + dup 3 eq\n\ + {4 index 4 index 3 index}\n\ + {\n\ + dup 4 eq\n\ + {2 index 5 index 3 index}\n\ + {\n\ + dup 5 eq\n\ + {1 index 5 index 5 index}\n\ + {0 0 0}\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse % B G R Hi V t q p\n\ + setrgbcolor\n\ + 5 {pop} repeat\n\ +} bind def\n'\ +> $1 +endef + +# This actually inserts the color-killing code into a postscript file +# $(call kill-ps-color) +define kill-ps-color +$(SED) -e '/%%EndComments/r $(gray_eps_file)' +endef + +# Converts graphviz .dot files into .eps files +# Grayscale is not directly supported by dot, so we pipe it through fig2dev in +# that case. +# $(call convert-dot,,,,[gray]) +define convert-dot +$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \ +$(call colorize-dot-errors,$3) +endef + +# Convert DVI to Postscript +# $(call make-ps,,,,[]) +make-ps = \ + $(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \ + $(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1 + +# Convert Postscript to PDF +# $(call make-pdf,,,,) +make-pdf = \ + $(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1 + +# Display information about what is being done +# $(call echo-build,,,[]) +echo-build = $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)" +echo-graphic = $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)" +echo-dep = $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)" + +# Display a list of something +# $(call echo-list,) +echo-list = for x in $1; do $(ECHO) "$$x"; done + +# +# DEFAULT TARGET +# + +.PHONY: all +all: $(default_pdf_targets) ; + +.PHONY: all-pdf +all-pdf: $(default_pdf_targets) ; + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-ps +all-ps: $(default_ps_targets) ; + +.PHONY: all-dvi +all-dvi: $(default_dvi_targets) ; +endif + +# +# VIEWING TARGET +# +.PHONY: show +show: all + $(QUIET)for x in $(default_pdf_targets); do \ + [ -e "$$x" ] && $(VIEW_PDF) $$x & \ + done + +# +# INCLUDES +# +source_includes := $(addsuffix .d,$(source_stems_to_include)) +graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include)) + +# Include only the dependencies used +ifneq "" "$(source_includes)" +include $(source_includes)$(call include-message,$(source_includes)) +endif +ifneq "" "$(graphic_includes)" +include $(graphic_includes)$(call include-message,$(graphic_includes)) +endif + +# +# MAIN TARGETS +# + +# Note that we don't just say %: %.pdf here - this can tend to mess up our +# includes, which detect what kind of file we are asking for. For example, +# asking to build foo.pdf is much different than asking to build foo when +# foo.gpi exists, because we look through all of the goals for *.pdf that +# matches *.gpi, then use that to determine which include files we need to +# build. +# +# Thus, we invoke make recursively with better arugments instead, restarting +# all of the appropriate machinery. +.PHONY: $(default_stems_ss) +$(default_stems_ss): %: %.pdf ; + +# This builds and displays the wanted file. +.PHONY: $(addsuffix ._show,$(stems_ssg)) +%._show: %.pdf + $(QUIET)$(VIEW_PDF) $< & + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_pdf_targets) +%.pdf: %.ps %.embed.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi + +.SECONDARY: $(all_ps_targets) +%.ps: %.dvi %.paper.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-ps,$<,$@.temp,$@.log,\ + $(firstword $(shell $(CAT) $*.paper.make))); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi +endif + +# Build the final target (dvi or pdf) file. This is a very tricky rule because +# of the way that latex runs multiple times, needs graphics after the first run +# (or maybe already has them), and relies on bibliographies or indices that may +# not exist. +# +# Check the log for fatal errors. If they exist, colorize and bail. +# +# Create the .auxtarget.cookie file. (Needed for next time if not present) +# +# If any of the following are true, we must rebuild at least one time: +# +# * the .bbl was recently rebuilt +# +# check a cookie, then delete it +# +# * any of several output files was created or changed: +# +# check $*.run.cookie, then delete it +# +# * the .aux file changed in a way that necessitates attention +# +# Note that if the .auxtarget.make file doesn't exist, this means +# that we are doing a clean build, so it doesn't figure into the +# test for running again. +# +# compare against .auxtarget.make +# +# move if different, remove if not +# +# * the .log file has errors or warnings requiring at least one more run +# +# We use a loop over a single item to simplify the process of breaking +# out when we find one of the conditions to be true. +# +# If we do NOT need to run latex here, then we move the $@.1st.make file +# over to $@ because the target file has already been built by the first +# dependency run and is valid. +# +# If we do, we delete that cookie file and do the normal multiple-runs +# routine. +# +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_dvi_targets) +endif +%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make + $(QUIET)\ + fatal=`$(call colorize-latex-errors,$*.log)`; \ + if [ x"$$fatal" != x"" ]; then \ + $(ECHO) "$$fatal"; \ + exit 1; \ + fi; \ + $(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \ + run=0; \ + for i in 1; do \ + if $(call test-exists,$*.bbl.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call test-exists,$*.run.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call \ + test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\ + then \ + run=1; \ + break; \ + fi; \ + if $(call test-log-for-need-to-run,$*); then \ + run=1; \ + break; \ + fi; \ + done; \ + $(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \ + $(MV) $*.auxtarget.cookie $*.auxtarget.make; \ + if [ x"$$run" = x"1" ]; then \ + $(call remove-files,$@.1st.make); \ + for i in 2 3 4 5; do \ + $(if $(findstring 3.79,$(MAKE_VERSION)),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\ + ); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \ + $(call test-run-again,$*) || break; \ + done; \ + else \ + $(MV) '$@.1st.make' '$@'; \ + fi; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + $(call latex-color-log,$*) + +# Build the .bbl file. When dependencies are included, this will (or will +# not!) depend on something.bib, which we detect, acting accordingly. The +# dependency creation also produces the %.auxbbl.make file. BibTeX is a bit +# finicky about what you call the actual files, but we can rest assured that if +# a .auxbbl.make file exists, then the .aux file does, as well. The +# .auxbbl.make file is a cookie indicating whether the .bbl needs to be +# rewritten. It only changes if the .aux file changes in ways relevant to .bbl +# creation. +# +# Note that we do NOT touch the .bbl file if there is no need to +# create/recreate it. We would like to leave existing files alone if they +# don't need to be changed, thus possibly avoiding a rebuild trigger. +%.bbl: %.auxbbl.make + $(QUIET)\ + $(if $(filter %.bib,$^),\ + $(call echo-build,$(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \ + $(if $(filter %.bib,$^),\ + $(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \ + $(call run-latex,$*); \ + fi + +# Create the index file - note that we do *not* depend on %.tex here, since +# that unnecessarily restricts the kinds of indices that we can build to those +# with exactly the same stem as the source file. Things like splitidx create +# idx files with other names. +# +# Therefore, we add the .tex dependency in the sourcestem.d file in the call to +# get index file dependencies from the logs. +%.ind: %.idx + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.ilg) + +# Create the glossary file +%.gls: %.glo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist) + +# Create the nomenclature file +%.nls: %.nlo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist) + +# SCRIPTED LaTeX TARGETS +# +# Keep the generated .tex files around for debugging if needed. +.SECONDARY: $(all_tex_targets) + +%.tex:: %.tex.sh + $(QUIET)$(call run-script,$(SHELL),$<,$@) + +%.tex:: %.tex.py + $(QUIET)$(call run-script,$(PYTHON),$<,$@) + +%.tex:: %.tex.pl + $(QUIET)$(call run-script,$(PERL),$<,$@) + +%.tex:: %.rst $(RST_STYLE_FILE) + $(QUIET)\ + $(call run-script,$(RST2LATEX)\ + --documentoptions=letterpaper\ + $(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@) + +# +# GRAPHICS TARGETS +# +.PHONY: all-graphics +all-graphics: $(all_graphics_targets); + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-pstex +all-pstex: $(all_pstex_targets); +endif + +.PHONY: all-dot2tex +all-dot2tex: $(all_dot2tex_targets); + +.PHONY: show-graphics +show-graphics: all-graphics + $(VIEW_GRAPHICS) $(all_known_graphics) + +$(gray_eps_file): + $(QUIET)$(call echo-build,$^,$@) + $(QUIET)$(call create-gray-eps-file,$@) + +ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" +%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) + +ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf" +%.pdf: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) +endif + +%.pdf: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +endif + +%.eps: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) + +%.eps: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +%.eps: %.dot $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY)) + +%.eps: %.xvg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-xvg,$<,$@,$(GRAY)) + +%.eps: %.svg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-svg,$<,$@,$(GRAY)) + +%.eps: %.jpg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) + +%.eps: %.png $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-png,$<,$@,$(GRAY)) + +%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-epsgz,$<,$@,$(GRAY)) + +%.pstex: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY)) + +%.pstex_t: %.fig %.pstex + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY)) + +%.dot_t: %.dot + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot-tex,$<,$@) + +# +# DEPENDENCY-RELATED TARGETS. +# + +# Generate all of the information needed to get dependencies +# As a side effect, this creates a .dvi or .pdf file (depending on the build +# strategy). We need to be sure to remove it if there are errors. Errors can +# take several forms and all of them are found within the log file: +# * There was a LaTeX error +# * A needed file was not found +# * Cross references need adjustment +# +# Behavior: +# This rule is responsible for generating the following: +# %.aux +# %.d +# %.aux.make +# %.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved) +# +# Steps: +# +# Run latex +# Move .pdf or .dvi somewhere else (make no judgements about success) +# Flatten the .aux file into another file +# Add source dependencies +# Add graphic dependencies +# Add bib dependencies +# +# Create cookies for various suffixes that may represent files that +# need to be read by LaTeX in order for it to function properly. +# +# Note that if some of the dependencies are discovered because they turn +# up missing in the log file, we really need the .d file to be reloaded. +# Adding a sleep command helps with this. Otherwise make is extremely +# nondeterministic, sometimes working, sometimes not. +# +# Usually we can force this by simply removing the generated pdf file and +# not creating a .1st.make file.. +# +%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex + $(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1) + $(QUIET)\ + $(call run-latex,$<,--recorder) || $(sh_true); \ + $(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \ + $(call die-on-dot2tex,$*.log); \ + $(call die-on-no-aux,$*); \ + $(call flatten-aux,$*.aux,$*.aux.make); \ + $(ECHO) "# vim: ft=make" > $*.d; \ + $(ECHO) ".PHONY: $*._graphics" >> $*.d; \ + $(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(ECHO) ".SECONDEXPANSION:" >> $*.d; \ + $(call get-graphics,$*) >> $*.d; \ + $(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \ + $(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \ + $(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \ + $(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \ + for s in toc out lot lof lol nav; do \ + if [ -e "$*.$$s" ]; then \ + if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \ + $(TOUCH) $*.run.cookie; \ + fi; \ + $(CP) $*.$$s $*.$$s.make; \ + fi; \ + done + +# This is a cookie that is updated if the flattened aux file has changed in a +# way that affects the bibliography generation. +.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg)) +%.auxbbl.make: %.aux.make + $(QUIET)\ + $(call make-auxbbl-file,$<,$@.temp); \ + $(call replace-if-different-and-remove,$@.temp,$@) + +# Build a dependency file for .gpi files. These often plot data files that +# also reside in the directory, so if a data file changes, it's nice to know +# about it. This also handles loaded .gpi files, whose filename should have +# _include_. in it. +%.gpi.d: %.gpi + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-gpi-d,$<,$@) + +# Store the paper size for this document -- note that if beamer is used we set +# it to the special BEAMER paper size. We only do this, however, if the +# special comment exists, in which case we enlarge the output with psnup. +# +# The paper size is extracted from a documentclass attribute. +%.paper.make: %.tex + $(QUIET)$(SED) \ + -e '/\\documentclass/,/}/{' \ + -e ' s/%.*//' \ + -e ' H' \ + -e ' /}/{' \ + -e ' s/.*//' \ + -e ' x' \ + -e ' /\\documentclass/!d' \ + -e ' s/[\n[:space:]]*//g' \ + -e ' s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/^[^%]*%-//' \ + -e ' s/-%[^%]*$$//' \ + -e ' s/-%[^%]%-/ /g' \ + -e ' p' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e 'd' \ + $< > $@; \ + $(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \ + (\ + $(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \ + $(ECHO) "BEAMER" > $@ || \ + : > $@ \ + ) || $(sh_true) + +# Store embedding instructions for this document using a special comment +%.embed.make: %.tex + $(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \ + && $(ECHO) '' > $@ \ + || $(ECHO) '1' > $@; + +# +# HELPFUL PHONY TARGETS +# + +.PHONY: _all_programs +_all_programs: + $(QUIET)$(ECHO) "== All External Programs Used ==" + $(QUIET)$(call output-all-programs) + +.PHONY: _check_programs +_check_programs: + $(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO) + $(QUIET) \ + $(ECHO) hi; \ + allprogs=`\ + ($(call output-all-programs)) | \ + $(SED) \ + -e 's/^[[:space:]]*//' \ + -e '/^#/d' \ + -e 's/[[:space:]]*#.*//' \ + -e '/^=/s/[[:space:]]/_/g' \ + -e '/^[[:space:]]*$$/d' \ + -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \ + `; \ + spaces=' '; \ + for p in $${allprogs}; do \ + case $$p in \ + =*) $(ECHO); $(ECHO) "$$p";; \ + *) \ + $(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \ + loc=`$(WHICH) $$p`; \ + if [ x"$$?" = x"0" ]; then \ + $(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \ + else \ + $(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \ + fi; \ + ;; \ + esac; \ + done + +.PHONY: _check_gpi_files +_check_gpi_files: + $(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \ + $(ECHO); \ + for f in $(files.gpi); do \ + result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \ + $(ECHO) -n "$$f: "; \ + if [ x"$$result" = x"" ]; then \ + $(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \ + else \ + $(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\ + $(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \ + fi; \ + done; \ + $(ECHO) + +.PHONY: _all_stems +_all_stems: + $(QUIET)$(ECHO) "== All Stems ==" + $(QUIET)$(call echo-list,$(sort $(default_stems_ss))) + +.PHONY: _includes +_includes: + $(QUIET)$(ECHO) "== Include Stems ==" + $(QUIET)$(ECHO) "=== Sources ===" + $(QUIET)$(call echo-list,$(sort $(source_includes))) + $(QUIET)$(ECHO) "=== Graphics ===" + $(QUIET)$(call echo-list,$(sort $(graphic_includes))) + +.PHONY: _all_sources +_all_sources: + $(QUIET)$(ECHO) "== All Sources ==" + $(QUIET)$(call echo-list,$(sort $(all_files.tex))) + +.PHONY: _dependency_graph +_dependency_graph: + $(QUIET)$(ECHO) "/* LaTeX Dependency Graph */" + $(QUIET)$(call output-dependency-graph) + +.PHONY: _show_dependency_graph +_show_dependency_graph: + $(QUIET)$(call output-dependency-graph,$(graph_stem).dot) + $(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot + $(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps + $(QUIET)$(call remove-temporary-files,$(graph_stem).*) + +.PHONY: _sources +_sources: + $(QUIET)$(ECHO) "== Sources ==" + $(QUIET)$(call echo-list,$(sort $(files.tex))) + +.PHONY: _scripts +_scripts: + $(QUIET)$(ECHO) "== Scripts ==" + $(QUIET)$(call echo-list,$(sort $(files_scripts))) + +.PHONY: _graphic_outputs +_graphic_outputs: + $(QUIET)$(ECHO) "== Graphic Outputs ==" + $(QUIET)$(call echo-list,$(sort $(all_graphics_targets))) + +.PHONY: _env +_env: +ifdef .VARIABLES + $(QUIET)$(ECHO) "== MAKE VARIABLES ==" + $(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)')) +endif + $(QUIET)$(ECHO) "== ENVIRONMENT ==" + $(QUIET)$(ENV) + +# +# CLEAN TARGETS +# +# clean-generated is somewhat unique - it relies on the .fls file being +# properly built so that it can determine which of the files was generated, and +# which was not. Expect it to silently fail if the .fls file is missing. +# +# This is used to, e.g., clean up index files that are generated by the LaTeX. +.PHONY: clean-generated +clean-generated: + $(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\ + $(shell $(call get-generated-names,$e)))) + +.PHONY: clean-deps +clean-deps: + $(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie) + +.PHONY: clean-tex +clean-tex: clean-deps + $(QUIET)$(call clean-files,$(rm_tex)) + +.PHONY: clean-graphics +# TODO: This *always* deletes pstex files, even if they were not generated by +# anything.... In other words, if you create a pstex and pstex_t pair by hand +# an drop them in here without the generating fig file, they will be deleted +# and you won't get them back. It's a hack put in here because I'm not sure we +# even want to keep pstex functionality, so my motivation is not terribly high +# for doing it right. +clean-graphics: + $(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t) + +.PHONY: clean-backups +clean-backups: + $(QUIET)$(call clean-files,$(backup_patterns) *.temp) + +.PHONY: clean-auxiliary +clean-auxiliary: + $(QUIET)$(call clean-files,$(graph_stem).*) + +.PHONY: clean-nographics +clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ; + +.PHONY: clean +clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary + +# +# HELP TARGETS +# + +.PHONY: help +help: + $(help_text) + +.PHONY: version +version: + $(QUIET)\ + $(ECHO) "$(fileinfo) Version $(version)"; \ + $(ECHO) "by $(author)"; \ + +# +# HELP TEXT +# + +define help_text +# $(fileinfo) Version $(version) +# +# by $(author) +# +# Generates a number of possible output files from a LaTeX document and its +# various dependencies. Handles .bib files, \include and \input, and .eps +# graphics. All dependencies are handled automatically by running LaTeX over +# the source. +# +# USAGE: +# +# make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] +# +# STANDARD OPTIONS: +# GRAY: +# Setting this variable forces all recompiled graphics to be grayscale. +# It is useful when creating a document for printing. The default is +# to allow colors. Note that it only changes graphics that need to be +# rebuilt! It is usually a good idea to do a 'make clean' first. +# +# VERBOSE: +# This turns off all @ prefixes for commands invoked by make. Thus, +# you get to see all of the gory details of what is going on. +# +# SHELL_DEBUG: +# This enables the -x option for sh, meaning that everything it does is +# echoed to stderr. This is particularly useful for debugging +# what is going on in $$(shell ...) invocations. One of my favorite +# debugging tricks is to do this: +# +# make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less +# +# STANDARD AUXILIARY FILES: +# +# Makefile.ini +# +# This file can contain variable declarations that override various +# aspects of the makefile. For example, one might specify +# +# neverclean := *.pdf *.ps +# onlysources.tex := main.tex +# LATEX_COLOR_WARNING := 'bold red uline' +# +# And this would override the neverclean setting to ensure that pdf +# and ps files always remain behind, set the makefile to treat all +# .tex files that are not "main.tex" as includes (and therefore not +# default targets). It also changes the LaTeX warning output to be +# red, bold, and underlined. +# +# There are numerous variables in this file that can be overridden in +# this way. Search for '?=' to find them all. +# +# Also, you can put arbitrary targets into it if, for example, you +# want your source built from something else, e.g.: +# +# generated.tex: generating_script.weird_lang depA depB +# ./generating_script.weird_lang > $$@ +# +# Note that if you are not careful, you can override the default +# target (what happens when you type "make" without arguments), so if +# you do use Makefile.ini, you probably want to start it with +# something like the following line: +# +# default: all +# +# Since the first target in any makefile is automatically the default, +# and the makefile already has a sensible "all" target, this will do +# what you want. +# +# The Makefile.ini is imported before *anything else* is done, so go +# wild with your ideas for changes to this makefile in there. It +# makes it easy to test them before submitting patches. +# +# STANDARD ENVIRONMENT VARIABLES: +# +# LATEX_COLOR_WARNING '$(LATEX_COLOR_WARNING)' +# LATEX_COLOR_ERROR '$(LATEX_COLOR_ERROR)' +# LATEX_COLOR_UNDERFULL '$(LATEX_COLOR_UNDERFULL)' +# LATEX_COLOR_OVERFULL '$(LATEX_COLOR_OVERFULL)' +# LATEX_COLOR_PAGES '$(LATEX_COLOR_PAGES)' +# LATEX_COLOR_BUILD '$(LATEX_COLOR_BUILD)' +# LATEX_COLOR_GRAPHIC '$(LATEX_COLOR_GRAPHIC)' +# LATEX_COLOR_DEP '$(LATEX_COLOR_DEP)' +# LATEX_COLOR_SUCCESS '$(LATEX_COLOR_SUCCESS)' +# LATEX_COLOR_FAILURE '$(LATEX_COLOR_FAILURE)' +# +# These may be redefined in your environment to be any of the following: +# +# black +# red +# green +# yellow +# blue +# magenta +# cyan +# white +# +# Bold or underline may be used, as well, either alone or in combination +# with colors: +# +# bold +# uline +# +# Order is not important. You may want, for example, to specify: +# +# export LATEX_COLOR_SUCCESS='bold blue uline' +# +# in your .bashrc file. I don't know why, but you may want to. +# +# STANDARD TARGETS: +# +# all: +# Make all possible documents in this directory. The documents are +# determined by scanning for .tex and .tex.sh (described in more detail +# later) and omitting any file that ends in ._include_.tex or +# ._nobuild_.tex. The output is a set of .pdf files. +# +# If you wish to omit files without naming them with the special +# underscore names, set the following near the top of the Makefile, +# or (this is recommended) within a Makefile.ini in the same directory: +# +# includes.tex := file1.tex file2.tex +# +# This will cause the files listed to be considered as include files. +# +# If you have only few source files, you can set +# +# onlysources.tex := main.tex +# +# This will cause only the source files listed to be considered in +# dependency detection. All other .tex files will be considered as +# include files. Note that these options work for *any* source type, +# so you could do something similar with includes.gpi, for example. +# Note that this works for *any valid source* target. All of the +# onlysources.* variables are commented out in the shipping version of +# this file, so it does the right thing when they simply don't exist. +# The comments are purely documentation. If you know, for example, that +# file.mycoolformat is supported by this Makefile, but don't see the +# "onlysources.mycoolformat" declared in the comments, that doesn't mean +# you can't use it. Go ahead and set "onlysources.mycoolformat" and it +# should do the right thing. +# +# show: +# Builds and displays all documents in this directory. It uses the +# environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to +# do its work. +# +# all-graphics: +# Make all of the graphics in this directory. +# +# all-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into pstex and pstex_t files. Gray DOES NOT WORK. +# +# all-gray-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into grayscale pstex and pstex_t files. +# +# all-dot2tex: +# Build all dot files into tex files. +# +# show-graphics: +# Builds and displays all graphics in this directory. Uses the +# environment-overridable value of VIEW_GRAPHICS (currently +# $(VIEW_GRAPHICS)) to do its work. +# +# clean: +# Remove ALL generated files, leaving only source intact. +# This will *always* skip files mentioned in the "neverclean" variable, +# either in this file or specified in Makefile.ini: +# +# neverclean := *.pdf *.ps +# +# The neverclean variable works on all "clean" targets below, as well. +# +# clean-graphics: +# Remove all generated graphics files. +# +# clean-backups: +# Remove all backup files: $(backup_patterns) +# (XFig and other editors have a nasty habit of leaving them around) +# Also removes Makefile-generated .temp files +# +# clean-tex: +# Remove all files generated from LaTeX invocations except dependency +# information. Leaves graphics alone. +# +# clean-deps: +# Removes all auto-generated dependency information. +# +# clean-auxiliary: +# Removes extra files created by various targets (like the dependency +# graph output). +# +# clean-nographics: +# Cleans everything *except* the graphics files. +# +# help: +# This help text. +# +# version: +# Version information about this LaTeX makefile. +# +# DEBUG TARGETS: +# +# _all_programs: +# A list of the programs used by this makefile. +# +# _check_programs: +# Checks your system for the needed software and reports what it finds. +# +# _check_gpi_files: +# Checks the .gpi files in the current directory for common errors, such +# as specification of the terminal or output file inside of the gpi file +# itself. +# +# _dependency_graph: +# Outputs a .dot file to stdout that represents a graph of LaTeX +# dependencies. To see it, use the _show_dependency_graph target or +# direct the output to a file, run dot on it, and view the output, e.g.: +# +# make _dependency_graph > graph.dot +# dot -T ps -o graph.eps graph.dot +# gv graph.eps +# +# _show_dependency_graph: +# Makes viewing the graph simple: extracts, builds and displays the +# dependency graph given in the _dependency_graph target using the value +# of the environment-overridable VIEW_POSTSCRIPT variable (currently set +# to $(VIEW_POSTSCRIPT)). The postscript viewer is used because it +# makes it easier to zoom in on the graph, a critical ability for +# something so dense and mysterious. +# +# _all_sources: +# List all .tex files in this directory. +# +# _sources: +# Print out a list of all compilable sources in this directory. This is +# useful for determining what make thinks it will be using as the +# primary source for 'make all'. +# +# _scripts: +# Print out a list of scripts that make knows can be used to generate +# .tex files (described later). +# +# _all_stems: +# Print a list of stems. These represent bare targets that can be +# executed. Listing as a bare target will produce .pdf. +# +# _includes: +# A list of .d files that would be included in this run if _includes +# weren't specified. This target may be used alone or in conjunction +# with other targets. +# +# _graphic_outputs: +# A list of all generated .eps files +# +# _env: +# A list of environment variables and their values. If supported by +# your version of make, also a list of variables known to make. +# +# FILE TARGETS: +# +# %, %.pdf: +# Build a PDF file from the corresponding %.tex file. +# +# If BUILD_STRATEGY=pdflatex, then this builds the pdf directly. +# Otherwise, it uses this old-school but effective approach: +# +# latex -> dvips -> ps2pdf +# +# The BUILD_STRATEGY can be overridden in Makefile.ini in the same +# directory. The default is pdflatex. +# +# Reasons for using latex -> dvips include the "psfrag" package, and the +# generation of postscript instead of PDF. Arguments for using pdflatex +# include "new and shiny" and "better supported." I can't argue with +# either of those, and supporting them both didn't turn out to be that +# difficult, so there you have it. Choices. +# +# %._show: +# A phony target that builds the pdf file and then displays it using the +# environment-overridable value of VIEW_PDF ($(VIEW_PDF)). +# +# %._graphics: +# A phony target that generates all graphics on which %.pdf (or %.dvi) +# depends. +# +# %.ps (only for BUILD_STRATEGY=latex): +# Build a Postscript file from the corresponding %.tex file. +# This is done using dvips. Paper size is automatically +# extracted from the declaration +# +# \documentclass[paper] +# +# or it is the system default. +# +# If using beamer (an excellent presentation class), the paper +# size is ignored. More on this later. +# +# %.dvi (only for BUILD_STRATEGY=latex): +# Build the DVI file from the corresponding %.tex file. +# +# %.ind: +# Build the index for this %.tex file. +# +# %.gls: +# Build the nomenclature glossary for this %.tex file. +# +# %.nls: +# Build the (newer) nomenclature file for this %.tex file. +# +# %.eps: +# Build an eps file from one of the following file types: +# +# .dot : graphviz +# .gpi : gnuplot +# .fig : xfig +# .xvg : xmgrace +# .svg : scalable vector graphics (goes through inkscape) +# .png : png (goes through NetPBM) +# .jpg : jpeg (goes through ImageMagick) +# .eps.gz : gzipped eps +# +# The behavior of this makefile with each type is described in +# its own section below. +# +# %.pstex{,_t} (only for BUILD_STRATEGY=latex): +# Build a .pstex_t file from a .fig file. +# +# FEATURES: +# +# Optional Binary Directory: +# If you create the _out_ directory in the same place as the makefile, +# it will automatically be used as a dumping ground for .pdf (or .dvi, +# .ps, and .pdf) output files. +# +# Alternatively, you can set the BINARY_TARGET_DIR variable, either as a +# make argument or in Makefile.ini, to point to your directory of +# choice. Note that no pathname wildcard expansion is done in the +# makefile, so make sure that the path is complete before going in +# there. E.g., if you want to specify something in your home directory, +# use $$HOME/ instead of ~/ so that the shell expands it before it gets +# to the makefile. +# +# External Program Dependencies: +# Every external program used by the makefile is represented by an +# ALLCAPS variable at the top of this file. This should allow you to +# make judgments about whether your system supports the use of this +# makefile. The list is available in the ALL_PROGRAMS variable and, +# provided that you are using GNU make 3.80 or later (or you haven't +# renamed this file to something weird like "mylatexmakefile" and like +# invoking it with make -f) can be viewed using +# +# make _all_programs +# +# Additionally, the availability of these programs can be checked +# automatically for you by running +# +# make _check_programs +# +# The programs are categorized according to how important they are and +# what function they perform to help you decide which ones you really +# need. +# +# Colorized Output: +# The output of commands is colorized to highlight things that are often +# important to developers. This includes {underfull,overfull} +# {h,v}boxes, general LaTeX Errors, each stage of document building, and +# the number of pages in the final document. The colors are obtained +# using 'tput', so colorization should work pretty well on any terminal. +# +# The colors can be customized very simply by setting any of the +# LATEX_COLOR_ variables in your environment (see above). +# +# Predecessors to TeX Files: +# Given a target , if no .tex file exists but a +# corresponding script or predecessor file exists, then appropriate +# action will be taken to generate the tex file. +# +# Currently supported script or predecessor languages are: +# +# sh: %.tex.sh +# perl: %.tex.pl +# python: %.tex.py +# +# Calls the script using the appropriate interpreter, assuming that +# its output is a .tex file. +# +# The script is called thus: +# +# + + + + + + + + + + \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/index.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -1,38 +1,180 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="java.util.Collection"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="java.util.Iterator"%> -<%Object ui = request.getAttribute("ui"); - Object staticui = request.getAttribute("staticui"); - boolean furthertargets = true; - - Object furthertargetsObject = request.getAttribute("furthertargets"); - if (furthertargetsObject != null){ - furthertargets = ((Boolean)furthertargetsObject).booleanValue(); - } +<% + String exception = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID); + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Object ui = request.getAttribute("ui"); + Object staticui = request.getAttribute("staticui"); + Object chart = request.getAttribute("chart"); + Object statistic = request.getAttribute("statistic"); + Object histogram = request.getAttribute("histogram"); + Object wms_published = request.getAttribute("wms_published"); + boolean furthertargets = true; + + if (chart == null && statistic == null && histogram == null && wms_published == null) { + boolean supportChart = sm.getOutputMode("chart") != null; + if (supportChart) { + chart = "true"; + } + } + + Object furthertargetsObject = request.getAttribute("furthertargets"); + if (furthertargetsObject != null){ + furthertargets = ((Boolean)furthertargetsObject).booleanValue(); + } + + Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID); + exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); + exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage); + + Object sessionException = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID); + sessionException = (sessionException != null ? sessionException.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); + sessionException = (sessionException != null && sessionException.toString().endsWith(".") ? sessionException.toString().substring(0,sessionException.toString().length()-1) : sessionException); + + boolean showmapviewercallBody = request.getAttribute("MAPVIEWERCALL") != null; + + String exceptionProject = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_PROJECT); + exceptionProject = exceptionProject != null ? exceptionProject.toLowerCase() : null; + exceptionProject = exceptionProject != null ? exceptionProject.replaceAll(" ", ".") : null; %> -
- - <%if (staticui != null){ %> - <%=staticui.toString()%> - <%}%> - - <%if (ui != null){%> -
-
") method="post"> -
- <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %> - - <%if(furthertargets){%> - "/> - <%}else{%> - "/> - <%}%> -
-
+ + <%-- div container for project loading/saving and error messages related to this --%> +
+ + + + + +
+ "> + | + + +
+
" method="post" enctype="multipart/form-data"> +
+
"/>
+
+
+
+ <%if (exceptionProject != null) {%> +
+ +
+ "> + + +
+ <%}%> + <%if (showmapviewercallBody){ %> + + <%}%>
- <%}%> -
- \ No newline at end of file + + + + + + +
+ <%-- the parameter panel is following --%> +
+ <%if (staticui == null){ %> + + <%} else {%> +
+
+ + <%=staticui.toString()%> +
+
+ <%}%> + + <%-- render the dynamic part to feed the state and advance to the next state --%> + <%if (ui != null){%> +
+
" method="post"> +
+ + <%-- error message, if user input was not valid --%> + <%if (exception != null) {%> +
<%=exception%>
+ <%}%> + <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %> + + <%if(furthertargets){%> +
+ "/> + <%}%> +
+
+
+ <%}%> + + <%-- render export options if existing for this state --%> + + + <%if (chart != null) {%> + + <%}%> + + + <%if (histogram != null) {%> + + <%}%> + + <%-- render wms options --%> + <%if (wms_published != null) {%> + + <%}%> +
+
+ <%if (exceptionMessage != null){ %> +
+ +

+ "> + + +

+
+ <%}%> + <%if (sessionException != null){ %> +
+ +
+ <%}%> + <%if (chart != null) {%> + <%-- render chart options if existing for this state --%> + + <%}%> + + <%-- render statistic --%> + <%if (statistic != null) {%> + + <%}%> + + <%-- render histogram --%> + <%if (histogram != null) {%> + + <%}%> + + <%-- render wms layer --%> + <%if (wms_published != null) {%> + + <%}%> +
diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/info.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/info.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,69 @@ + + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@ page import="java.util.Locale"%> + +<% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Locale locale = sm.getCurrentLocale(); +%> + + + + + <bean:message key="gnviewer.app.title"/> + + + + + +
+
+

BSH Generischer Viewer

+
+ +
+ +
+ + + + + + +
+
+ <% + if (locale.getLanguage().equals(Locale.GERMAN.getLanguage())) { + %> + + <% + } + else { + %> + + <% + } + %> +
+
+ +
+
+ + diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -1,7 +1,16 @@ + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> - + <bean:message key="gnviewer.app.title"/> @@ -13,7 +22,7 @@ <meta http-equiv="pragma" content="no-cache"/> <meta http-equiv="cache-control" content="no-cache"/> <meta name="robots" content="noindex"/> - <link href="styles/default.css" rel="stylesheet" type="text/css"/> + <link href="styles/gnv.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="scripts/gnviewer.js"></script> <script type="text/javascript"> function copy_demo_wkt_line() { @@ -28,22 +37,65 @@ "20.6250 59.0349, " + "28.1250 60.2640)"; } + function copy_demo_wkt_polygon() { + document.getElementById('mesh_polygon').value = +"POLYGON ((" + +"-1.5763 58.3616, " + +" 0.7526 53.8428, " + +" 4.2686 53.1972, " + +" 7.9217 54.1441, " + +" 7.6020 56.2959, " + +"11.5747 57.2857, " + +"10.4788 58.4908, " + +" 4.2686 58.8996, " + +" 0.0219 58.5768, " + +"-1.5763 58.3616))"; + } + + function toggleBinType(toDeactivate) { + var ele = document.getElementById(toDeactivate); + + if (ele != null) { + ele.checked = false; + } + } + +function toggle(element) { + var ele = document.getElementById(element); + var vis = ele.style.visibility; + if (vis != "visible") { + ele.style.visibility = "visible"; + } + else { + ele.style.visibility = "hidden"; + } +} + </script> </head> <body id="gnviewerbody"> <div id="overlay"></div> - <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute"> + <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;"> <div id="overlayContent"> - <p> - <bean:message key="gnviewer.productselection.overlay.title"/> + <bean:message key="gnviewer.productselection.overlay.title"/> + <p class="reload"> + <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>"> + <bean:message key="application.reload"/> + </a> </p> </div> </div> <div id="page"> - <jsp:include page="header.jsp" /> - <jsp:include page="index.jsp" /> - <jsp:include page="footer.jsp" /> + <div id="headerElement"> + <jsp:include page="header.jsp" /> + </div> + <div id="contentElement" class="contentElement"> + <jsp:include page="index.jsp" /> + </div> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> + </div> </div> </body> </html> diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/version.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/version.jsp Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/version.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -1,7 +1,16 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> -<html xhtml="true" locale="true"> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> <bean:message key="gnviewer.app.title"/> @@ -42,4 +51,4 @@ <jsp:include page="footer.jsp" /> </div> </body> -</html> \ No newline at end of file +</html> diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" /> + <body id="gnviewerbody"> + <div id="overlay"></div> + <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;"> + <div id="overlayContent"> + <p> + <bean:message key="gnviewer.productselection.overlay.title"/> + </p> + </div> + </div> + <div id="page"> + <div id="headerElement"> + <jsp:include page="header.jsp" /> + </div> + <div id="contentElement" class="contentElement"> + <jsp:include page="index.jsp" /> + </div> + <br/> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> + </div> + </div> + </body> +</html> diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,16 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" /> + <body id="gnviewerbody"> + <jsp:include page="/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp" /> + </body> +</html> diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/WEB-INF/web.xml --- a/gnv/src/main/webapp/WEB-INF/web.xml Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/web.xml Fri Sep 28 12:15:18 2012 +0200 @@ -15,13 +15,6 @@ <param-value>/WEB-INF/config/struts-config.xml</param-value> </init-param> - <!-- The Log4J Configuration, relative to the Project-Folder, - which should be used in this Project. --> - <init-param> - <param-name>de.intevation.gnv.servlet.log4j.configuration</param-name> - <param-value>WEB-INF/config/log4j.properties</param-value> - </init-param> - <!-- The Number of ArtifacDatabases which are configured in this Document. --> <init-param> <param-name>de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count</param-name> diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/arrow_refresh.png Binary file gnv/src/main/webapp/images/arrow_refresh.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/auswaehlen.png Binary file gnv/src/main/webapp/images/auswaehlen.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/back_button.png Binary file gnv/src/main/webapp/images/back_button.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/bg_fieldset.gif Binary file gnv/src/main/webapp/images/bg_fieldset.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/bg_fieldset_ie6.gif Binary file gnv/src/main/webapp/images/bg_fieldset_ie6.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/chart_bar.png Binary file gnv/src/main/webapp/images/chart_bar.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/chart_curve.png Binary file gnv/src/main/webapp/images/chart_curve.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/choose.png Binary file gnv/src/main/webapp/images/choose.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/data_export.png Binary file gnv/src/main/webapp/images/data_export.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/delete.png Binary file gnv/src/main/webapp/images/delete.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/diagram_export.png Binary file gnv/src/main/webapp/images/diagram_export.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/disk.png Binary file gnv/src/main/webapp/images/disk.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/img.gif Binary file gnv/src/main/webapp/images/img.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/laden.png Binary file gnv/src/main/webapp/images/laden.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/list-item.gif Binary file gnv/src/main/webapp/images/list-item.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/load.png Binary file gnv/src/main/webapp/images/load.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/map_go.png Binary file gnv/src/main/webapp/images/map_go.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/cloud-popup-relative.png Binary file gnv/src/main/webapp/images/ol/cloud-popup-relative.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/east-mini.png Binary file gnv/src/main/webapp/images/ol/east-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/feature_info_off.png Binary file gnv/src/main/webapp/images/ol/feature_info_off.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/feature_info_on.png Binary file gnv/src/main/webapp/images/ol/feature_info_on.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/folder-open.gif Binary file gnv/src/main/webapp/images/ol/folder-open.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/folder.gif Binary file gnv/src/main/webapp/images/ol/folder.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/leaf.gif Binary file gnv/src/main/webapp/images/ol/leaf.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/navigation_history.png Binary file gnv/src/main/webapp/images/ol/navigation_history.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/north-mini.png Binary file gnv/src/main/webapp/images/ol/north-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/pan_off.png Binary file gnv/src/main/webapp/images/ol/pan_off.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/pan_on.png Binary file gnv/src/main/webapp/images/ol/pan_on.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/slider.png Binary file gnv/src/main/webapp/images/ol/slider.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/south-mini.png Binary file gnv/src/main/webapp/images/ol/south-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/tool-sprites.gif Binary file gnv/src/main/webapp/images/ol/tool-sprites.gif has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/west-mini.png Binary file gnv/src/main/webapp/images/ol/west-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoom-minus-mini.png Binary file gnv/src/main/webapp/images/ol/zoom-minus-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoom-plus-mini.png Binary file gnv/src/main/webapp/images/ol/zoom-plus-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoom-world-mini.png Binary file gnv/src/main/webapp/images/ol/zoom-world-mini.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoom_box_off.png Binary file gnv/src/main/webapp/images/ol/zoom_box_off.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoom_box_on.png Binary file gnv/src/main/webapp/images/ol/zoom_box_on.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/ol/zoombar.png Binary file gnv/src/main/webapp/images/ol/zoombar.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/pdf.png Binary file gnv/src/main/webapp/images/pdf.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/statistics.png Binary file gnv/src/main/webapp/images/statistics.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/stock_data-save.png Binary file gnv/src/main/webapp/images/stock_data-save.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/svg.png Binary file gnv/src/main/webapp/images/svg.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/images/tick.png Binary file gnv/src/main/webapp/images/tick.png has changed diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar-de.js --- a/gnv/src/main/webapp/scripts/calendar-de.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -// ** I18N - -// Calendar DE language -// Author: Jack (tR), <jack@jtr.de> -// Encoding: any -// Distributed under the same terms as the calendar itself. - -// For translators: please use UTF-8 if possible. We strongly believe that -// Unicode is the answer to a real internationalized world. Also please -// include your contact information in the header, as can be seen above. - -// full day names -Calendar._DN = new Array -("Sonntag", - "Montag", - "Dienstag", - "Mittwoch", - "Donnerstag", - "Freitag", - "Samstag", - "Sonntag"); - -// Please note that the following array of short day names (and the same goes -// for short month names, _SMN) isn't absolutely necessary. We give it here -// for exemplification on how one can customize the short day names, but if -// they are simply the first N letters of the full name you can simply say: -// -// Calendar._SDN_len = N; // short day name length -// Calendar._SMN_len = N; // short month name length -// -// If N = 3 then this is not needed either since we assume a value of 3 if not -// present, to be compatible with translation files that were written before -// this feature. - -// short day names -Calendar._SDN = new Array -("So", - "Mo", - "Di", - "Mi", - "Do", - "Fr", - "Sa", - "So"); - - // First day of the week. "0" means display Sunday first, "1" means display -// Monday first, etc. -Calendar._FD = 0; - - -// full month names -Calendar._MN = new Array -("Januar", - "Februar", - "M\u00e4rz", - "April", - "Mai", - "Juni", - "Juli", - "August", - "September", - "Oktober", - "November", - "Dezember"); - -// short month names -Calendar._SMN = new Array -("Jan", - "Feb", - "M\u00e4r", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Okt", - "Nov", - "Dez"); - -// tooltips -Calendar._TT = {}; -Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul"; - -Calendar._TT["ABOUT"] = -"DHTML Date/Time Selector\n" + -"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-) -"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + -"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + -"\n\n" + -"Datum ausw\u00e4hlen:\n" + -"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" + -"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" + -"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest."; -Calendar._TT["ABOUT_TIME"] = "\n\n" + -"Zeit ausw\u00e4hlen:\n" + -"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" + -"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" + -"- oder klicken und festhalten f\u00fcr Schnellauswahl."; - -Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen"; -Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen"; -Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen"; -Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten"; -Calendar._TT["PART_TODAY"] = " (Heute)"; - -// the following is to inform that "%s" is to be the first day of week -// %s will be replaced with the day name. -Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s "; - -// This may be locale-dependent. It specifies the week-end days, as an array -// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 -// means Monday, etc. -Calendar._TT["WEEKEND"] = "0,6"; - -Calendar._TT["CLOSE"] = "Schlie\u00dfen"; -Calendar._TT["TODAY"] = "Heute"; -Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern"; - -// date formats -Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; -Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; - -Calendar._TT["WK"] = "wk"; -Calendar._TT["TIME"] = "Zeit:"; diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar-en.js --- a/gnv/src/main/webapp/scripts/calendar-en.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -// ** I18N - -// Calendar EN language -// Author: Mihai Bazon, <mihai_bazon@yahoo.com> -// Encoding: any -// Distributed under the same terms as the calendar itself. - -// For translators: please use UTF-8 if possible. We strongly believe that -// Unicode is the answer to a real internationalized world. Also please -// include your contact information in the header, as can be seen above. - -// full day names -Calendar._DN = new Array -("Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday"); - -// Please note that the following array of short day names (and the same goes -// for short month names, _SMN) isn't absolutely necessary. We give it here -// for exemplification on how one can customize the short day names, but if -// they are simply the first N letters of the full name you can simply say: -// -// Calendar._SDN_len = N; // short day name length -// Calendar._SMN_len = N; // short month name length -// -// If N = 3 then this is not needed either since we assume a value of 3 if not -// present, to be compatible with translation files that were written before -// this feature. - -// short day names -Calendar._SDN = new Array -("Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - "Sun"); - -// First day of the week. "0" means display Sunday first, "1" means display -// Monday first, etc. -Calendar._FD = 0; - -// full month names -Calendar._MN = new Array -("January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"); - -// short month names -Calendar._SMN = new Array -("Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec"); - -// tooltips -Calendar._TT = {}; -Calendar._TT["INFO"] = "About the calendar"; - -Calendar._TT["ABOUT"] = -"DHTML Date/Time Selector\n" + -"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) -"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + -"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + -"\n\n" + -"Date selection:\n" + -"- Use the \xab, \xbb buttons to select year\n" + -"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + -"- Hold mouse button on any of the above buttons for faster selection."; -Calendar._TT["ABOUT_TIME"] = "\n\n" + -"Time selection:\n" + -"- Click on any of the time parts to increase it\n" + -"- or Shift-click to decrease it\n" + -"- or click and drag for faster selection."; - -Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; -Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; -Calendar._TT["GO_TODAY"] = "Go Today"; -Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; -Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; -Calendar._TT["SEL_DATE"] = "Select date"; -Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; -Calendar._TT["PART_TODAY"] = " (today)"; - -// the following is to inform that "%s" is to be the first day of week -// %s will be replaced with the day name. -Calendar._TT["DAY_FIRST"] = "Display %s first"; - -// This may be locale-dependent. It specifies the week-end days, as an array -// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 -// means Monday, etc. -Calendar._TT["WEEKEND"] = "0,6"; - -Calendar._TT["CLOSE"] = "Close"; -Calendar._TT["TODAY"] = "Today"; -Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; - -// date formats -Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; -Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; - -Calendar._TT["WK"] = "wk"; -Calendar._TT["TIME"] = "Time:"; diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar-setup.js --- a/gnv/src/main/webapp/scripts/calendar-setup.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ - * --------------------------------------------------------------------------- - * - * The DHTML Calendar - * - * Details and latest version at: - * http://dynarch.com/mishoo/calendar.epl - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - * - * This file defines helper functions for setting up the calendar. They are - * intended to help non-programmers get a working calendar on their site - * quickly. This script should not be seen as part of the calendar. It just - * shows you what one can do with the calendar, while in the same time - * providing a quick and simple method for setting it up. If you need - * exhaustive customization of the calendar creation process feel free to - * modify this code to suit your needs (this is recommended and much better - * than modifying calendar.js itself). - */ - -// $Id: calendar-setup.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $ - -/** - * This function "patches" an input field (or other element) to use a calendar - * widget for date selection. - * - * The "params" is a single object that can have the following properties: - * - * prop. name | description - * ------------------------------------------------------------------------------------------------- - * inputField | the ID of an input field to store the date - * displayArea | the ID of a DIV or other element to show the date - * button | ID of a button or other element that will trigger the calendar - * eventName | event that will trigger the calendar, without the "on" prefix (default: "click") - * ifFormat | date format that will be stored in the input field - * daFormat | the date format that will be used to display the date in displayArea - * singleClick | (true/false) wether the calendar is in single click mode or not (default: true) - * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. - * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation - * range | array with 2 elements. Default: [1900, 2999] -- the range of years available - * weekNumbers | (true/false) if it's true (default) the calendar will display week numbers - * flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID - * flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) - * disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar - * onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) - * onClose | function that gets called when the calendar is closed. [default] - * onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. - * date | the date that the calendar will be initially displayed to - * showsTime | default: false; if true the calendar will include a time selector - * timeFormat | the time format; can be "12" or "24", default is "12" - * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close - * step | configures the step of the years in drop-down boxes; default: 2 - * position | configures the calendar absolute position; default: null - * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible - * showOthers | if "true" (but default: "false") it will show days from other months too - * - * None of them is required, they all have default values. However, if you - * pass none of "inputField", "displayArea" or "button" you'll get a warning - * saying "nothing to setup". - */ -Calendar.setup = function (params) { - function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; - - param_default("inputField", null); - param_default("displayArea", null); - param_default("button", null); - param_default("eventName", "click"); - param_default("ifFormat", "%Y/%m/%d"); - param_default("daFormat", "%Y/%m/%d"); - param_default("singleClick", true); - param_default("disableFunc", null); - param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined - param_default("dateText", null); - param_default("firstDay", null); - param_default("align", "Br"); - param_default("range", [1900, 2999]); - param_default("weekNumbers", true); - param_default("flat", null); - param_default("flatCallback", null); - param_default("onSelect", null); - param_default("onClose", null); - param_default("onUpdate", null); - param_default("date", null); - param_default("showsTime", false); - param_default("timeFormat", "24"); - param_default("electric", true); - param_default("step", 2); - param_default("position", null); - param_default("cache", false); - param_default("showOthers", false); - param_default("multiple", null); - - var tmp = ["inputField", "displayArea", "button"]; - for (var i in tmp) { - if (typeof params[tmp[i]] == "string") { - params[tmp[i]] = document.getElementById(params[tmp[i]]); - } - } - if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { - alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); - return false; - } - - function onSelect(cal) { - var p = cal.params; - var update = (cal.dateClicked || p.electric); - if (update && p.inputField) { - p.inputField.value = cal.date.print(p.ifFormat); - if (typeof p.inputField.onchange == "function") - p.inputField.onchange(); - } - if (update && p.displayArea) - p.displayArea.innerHTML = cal.date.print(p.daFormat); - if (update && typeof p.onUpdate == "function") - p.onUpdate(cal); - if (update && p.flat) { - if (typeof p.flatCallback == "function") - p.flatCallback(cal); - } - if (update && p.singleClick && cal.dateClicked) - cal.callCloseHandler(); - }; - - if (params.flat != null) { - if (typeof params.flat == "string") - params.flat = document.getElementById(params.flat); - if (!params.flat) { - alert("Calendar.setup:\n Flat specified but can't find parent."); - return false; - } - var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); - cal.showsOtherMonths = params.showOthers; - cal.showsTime = params.showsTime; - cal.time24 = (params.timeFormat == "24"); - cal.params = params; - cal.weekNumbers = params.weekNumbers; - cal.setRange(params.range[0], params.range[1]); - cal.setDateStatusHandler(params.dateStatusFunc); - cal.getDateText = params.dateText; - if (params.ifFormat) { - cal.setDateFormat(params.ifFormat); - } - if (params.inputField && typeof params.inputField.value == "string") { - cal.parseDate(params.inputField.value); - } - cal.create(params.flat); - cal.show(); - return false; - } - - var triggerEl = params.button || params.displayArea || params.inputField; - triggerEl["on" + params.eventName] = function() { - var dateEl = params.inputField || params.displayArea; - var dateFmt = params.inputField ? params.ifFormat : params.daFormat; - var mustCreate = false; - var cal = window.calendar; - if (dateEl) - params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); - if (!(cal && params.cache)) { - window.calendar = cal = new Calendar(params.firstDay, - params.date, - params.onSelect || onSelect, - params.onClose || function(cal) { cal.hide(); }); - cal.showsTime = params.showsTime; - cal.time24 = (params.timeFormat == "24"); - cal.weekNumbers = params.weekNumbers; - mustCreate = true; - } else { - if (params.date) - cal.setDate(params.date); - cal.hide(); - } - if (params.multiple) { - cal.multiple = {}; - for (var i = params.multiple.length; --i >= 0;) { - var d = params.multiple[i]; - var ds = d.print("%Y%m%d"); - cal.multiple[ds] = d; - } - } - cal.showsOtherMonths = params.showOthers; - cal.yearStep = params.step; - cal.setRange(params.range[0], params.range[1]); - cal.params = params; - cal.setDateStatusHandler(params.dateStatusFunc); - cal.getDateText = params.dateText; - cal.setDateFormat(dateFmt); - if (mustCreate) - cal.create(); - cal.refresh(); - if (!params.position) - cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); - else - cal.showAt(params.position[0], params.position[1]); - return false; - }; - - return cal; -}; diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar-setup_stripped.js --- a/gnv/src/main/webapp/scripts/calendar-setup_stripped.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ - * --------------------------------------------------------------------------- - * - * The DHTML Calendar - * - * Details and latest version at: - * http://dynarch.com/mishoo/calendar.epl - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - * - * This file defines helper functions for setting up the calendar. They are - * intended to help non-programmers get a working calendar on their site - * quickly. This script should not be seen as part of the calendar. It just - * shows you what one can do with the calendar, while in the same time - * providing a quick and simple method for setting it up. If you need - * exhaustive customization of the calendar creation process feel free to - * modify this code to suit your needs (this is recommended and much better - * than modifying calendar.js itself). - */ - Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;}; \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar.js --- a/gnv/src/main/webapp/scripts/calendar.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1806 +0,0 @@ -/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo - * ----------------------------------------------------------- - * - * The DHTML Calendar, version 1.0 "It is happening again" - * - * Details and latest version at: - * www.dynarch.com/projects/calendar - * - * This script is developed by Dynarch.com. Visit us at www.dynarch.com. - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - */ - -// $Id: calendar.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $ - -/** The Calendar object constructor. */ -Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { - // member variables - this.activeDiv = null; - this.currentDateEl = null; - this.getDateStatus = null; - this.getDateToolTip = null; - this.getDateText = null; - this.timeout = null; - this.onSelected = onSelected || null; - this.onClose = onClose || null; - this.dragging = false; - this.hidden = false; - this.minYear = 1970; - this.maxYear = 2050; - this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; - this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; - this.isPopup = true; - this.weekNumbers = true; - this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. - this.showsOtherMonths = false; - this.dateStr = dateStr; - this.ar_days = null; - this.showsTime = false; - this.time24 = true; - this.yearStep = 2; - this.hiliteToday = true; - this.multiple = null; - // HTML elements - this.table = null; - this.element = null; - this.tbody = null; - this.firstdayname = null; - // Combo boxes - this.monthsCombo = null; - this.yearsCombo = null; - this.hilitedMonth = null; - this.activeMonth = null; - this.hilitedYear = null; - this.activeYear = null; - // Information - this.dateClicked = false; - - // one-time initializations - if (typeof Calendar._SDN == "undefined") { - // table of short day names - if (typeof Calendar._SDN_len == "undefined") - Calendar._SDN_len = 3; - var ar = new Array(); - for (var i = 8; i > 0;) { - ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); - } - Calendar._SDN = ar; - // table of short month names - if (typeof Calendar._SMN_len == "undefined") - Calendar._SMN_len = 3; - ar = new Array(); - for (var i = 12; i > 0;) { - ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); - } - Calendar._SMN = ar; - } -}; - -// ** constants - -/// "static", needed for event handlers. -Calendar._C = null; - -/// detect a special case of "web browser" -Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && - !/opera/i.test(navigator.userAgent) ); - -Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); - -/// detect Opera browser -Calendar.is_opera = /opera/i.test(navigator.userAgent); - -/// detect KHTML-based browsers -Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); - -// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate -// library, at some point. - -Calendar.getAbsolutePos = function(el) { - var SL = 0, ST = 0; - var is_div = /^div$/i.test(el.tagName); - if (is_div && el.scrollLeft) - SL = el.scrollLeft; - if (is_div && el.scrollTop) - ST = el.scrollTop; - var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; - if (el.offsetParent) { - var tmp = this.getAbsolutePos(el.offsetParent); - r.x += tmp.x; - r.y += tmp.y; - } - return r; -}; - -Calendar.isRelated = function (el, evt) { - var related = evt.relatedTarget; - if (!related) { - var type = evt.type; - if (type == "mouseover") { - related = evt.fromElement; - } else if (type == "mouseout") { - related = evt.toElement; - } - } - while (related) { - if (related == el) { - return true; - } - related = related.parentNode; - } - return false; -}; - -Calendar.removeClass = function(el, className) { - if (!(el && el.className)) { - return; - } - var cls = el.className.split(" "); - var ar = new Array(); - for (var i = cls.length; i > 0;) { - if (cls[--i] != className) { - ar[ar.length] = cls[i]; - } - } - el.className = ar.join(" "); -}; - -Calendar.addClass = function(el, className) { - Calendar.removeClass(el, className); - el.className += " " + className; -}; - -// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. -Calendar.getElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; - while (f.nodeType != 1 || /^div$/i.test(f.tagName)) - f = f.parentNode; - return f; -}; - -Calendar.getTargetElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.target; - while (f.nodeType != 1) - f = f.parentNode; - return f; -}; - -Calendar.stopEvent = function(ev) { - ev || (ev = window.event); - if (Calendar.is_ie) { - ev.cancelBubble = true; - ev.returnValue = false; - } else { - ev.preventDefault(); - ev.stopPropagation(); - } - return false; -}; - -Calendar.addEvent = function(el, evname, func) { - if (el.attachEvent) { // IE - el.attachEvent("on" + evname, func); - } else if (el.addEventListener) { // Gecko / W3C - el.addEventListener(evname, func, true); - } else { - el["on" + evname] = func; - } -}; - -Calendar.removeEvent = function(el, evname, func) { - if (el.detachEvent) { // IE - el.detachEvent("on" + evname, func); - } else if (el.removeEventListener) { // Gecko / W3C - el.removeEventListener(evname, func, true); - } else { - el["on" + evname] = null; - } -}; - -Calendar.createElement = function(type, parent) { - var el = null; - if (document.createElementNS) { - // use the XHTML namespace; IE won't normally get here unless - // _they_ "fix" the DOM2 implementation. - el = document.createElementNS("http://www.w3.org/1999/xhtml", type); - } else { - el = document.createElement(type); - } - if (typeof parent != "undefined") { - parent.appendChild(el); - } - return el; -}; - -// END: UTILITY FUNCTIONS - -// BEGIN: CALENDAR STATIC FUNCTIONS - -/** Internal -- adds a set of events to make some element behave like a button. */ -Calendar._add_evs = function(el) { - with (Calendar) { - addEvent(el, "mouseover", dayMouseOver); - addEvent(el, "mousedown", dayMouseDown); - addEvent(el, "mouseout", dayMouseOut); - if (is_ie) { - addEvent(el, "dblclick", dayMouseDblClick); - el.setAttribute("unselectable", true); - } - } -}; - -Calendar.findMonth = function(el) { - if (typeof el.month != "undefined") { - return el; - } else if (typeof el.parentNode.month != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.findYear = function(el) { - if (typeof el.year != "undefined") { - return el; - } else if (typeof el.parentNode.year != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.showMonthsCombo = function () { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var mc = cal.monthsCombo; - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - if (cal.activeMonth) { - Calendar.removeClass(cal.activeMonth, "active"); - } - var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; - Calendar.addClass(mon, "active"); - cal.activeMonth = mon; - var s = mc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var mcw = mc.offsetWidth; - if (typeof mcw == "undefined") - // Konqueror brain-dead techniques - mcw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; -}; - -Calendar.showYearsCombo = function (fwd) { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var yc = cal.yearsCombo; - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - if (cal.activeYear) { - Calendar.removeClass(cal.activeYear, "active"); - } - cal.activeYear = null; - var Y = cal.date.getFullYear() + (fwd ? 1 : -1); - var yr = yc.firstChild; - var show = false; - for (var i = 12; i > 0; --i) { - if (Y >= cal.minYear && Y <= cal.maxYear) { - yr.innerHTML = Y; - yr.year = Y; - yr.style.display = "block"; - show = true; - } else { - yr.style.display = "none"; - } - yr = yr.nextSibling; - Y += fwd ? cal.yearStep : -cal.yearStep; - } - if (show) { - var s = yc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var ycw = yc.offsetWidth; - if (typeof ycw == "undefined") - // Konqueror brain-dead techniques - ycw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; - } -}; - -// event handlers - -Calendar.tableMouseUp = function(ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - if (cal.timeout) { - clearTimeout(cal.timeout); - } - var el = cal.activeDiv; - if (!el) { - return false; - } - var target = Calendar.getTargetElement(ev); - ev || (ev = window.event); - Calendar.removeClass(el, "active"); - if (target == el || target.parentNode == el) { - Calendar.cellClick(el, ev); - } - var mon = Calendar.findMonth(target); - var date = null; - if (mon) { - date = new Date(cal.date); - if (mon.month != date.getMonth()) { - date.setMonth(mon.month); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } else { - var year = Calendar.findYear(target); - if (year) { - date = new Date(cal.date); - if (year.year != date.getFullYear()) { - date.setFullYear(year.year); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } - } - with (Calendar) { - removeEvent(document, "mouseup", tableMouseUp); - removeEvent(document, "mouseover", tableMouseOver); - removeEvent(document, "mousemove", tableMouseOver); - cal._hideCombos(); - _C = null; - return stopEvent(ev); - } -}; - -Calendar.tableMouseOver = function (ev) { - var cal = Calendar._C; - if (!cal) { - return; - } - var el = cal.activeDiv; - var target = Calendar.getTargetElement(ev); - if (target == el || target.parentNode == el) { - Calendar.addClass(el, "hilite active"); - Calendar.addClass(el.parentNode, "rowhilite"); - } else { - if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) - Calendar.removeClass(el, "active"); - Calendar.removeClass(el, "hilite"); - Calendar.removeClass(el.parentNode, "rowhilite"); - } - ev || (ev = window.event); - if (el.navtype == 50 && target != el) { - var pos = Calendar.getAbsolutePos(el); - var w = el.offsetWidth; - var x = ev.clientX; - var dx; - var decrease = true; - if (x > pos.x + w) { - dx = x - pos.x - w; - decrease = false; - } else - dx = pos.x - x; - - if (dx < 0) dx = 0; - var range = el._range; - var current = el._current; - var count = Math.floor(dx / 10) % range.length; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - while (count-- > 0) - if (decrease) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - - cal.onUpdateTime(); - } - var mon = Calendar.findMonth(target); - if (mon) { - if (mon.month != cal.date.getMonth()) { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - Calendar.addClass(mon, "hilite"); - cal.hilitedMonth = mon; - } else if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - } else { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - var year = Calendar.findYear(target); - if (year) { - if (year.year != cal.date.getFullYear()) { - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - Calendar.addClass(year, "hilite"); - cal.hilitedYear = year; - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } - return Calendar.stopEvent(ev); -}; - -Calendar.tableMouseDown = function (ev) { - if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { - return Calendar.stopEvent(ev); - } -}; - -Calendar.calDragIt = function (ev) { - var cal = Calendar._C; - if (!(cal && cal.dragging)) { - return false; - } - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posX = ev.pageX; - posY = ev.pageY; - } - cal.hideShowCovered(); - var st = cal.element.style; - st.left = (posX - cal.xOffs) + "px"; - st.top = (posY - cal.yOffs) + "px"; - return Calendar.stopEvent(ev); -}; - -Calendar.calDragEnd = function (ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - cal.dragging = false; - with (Calendar) { - removeEvent(document, "mousemove", calDragIt); - removeEvent(document, "mouseup", calDragEnd); - tableMouseUp(ev); - } - cal.hideShowCovered(); -}; - -Calendar.dayMouseDown = function(ev) { - var el = Calendar.getElement(ev); - if (el.disabled) { - return false; - } - var cal = el.calendar; - cal.activeDiv = el; - Calendar._C = cal; - if (el.navtype != 300) with (Calendar) { - if (el.navtype == 50) { - el._current = el.innerHTML; - addEvent(document, "mousemove", tableMouseOver); - } else - addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); - addClass(el, "hilite active"); - addEvent(document, "mouseup", tableMouseUp); - } else if (cal.isPopup) { - cal._dragStart(ev); - } - if (el.navtype == -1 || el.navtype == 1) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); - } else if (el.navtype == -2 || el.navtype == 2) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); - } else { - cal.timeout = null; - } - return Calendar.stopEvent(ev); -}; - -Calendar.dayMouseDblClick = function(ev) { - Calendar.cellClick(Calendar.getElement(ev), ev || window.event); - if (Calendar.is_ie) { - document.selection.empty(); - } -}; - -Calendar.dayMouseOver = function(ev) { - var el = Calendar.getElement(ev); - if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { - return false; - } - if (el.ttip) { - if (el.ttip.substr(0, 1) == "_") { - el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); - } - el.calendar.tooltips.innerHTML = el.ttip; - } - if (el.navtype != 300) { - Calendar.addClass(el, "hilite"); - if (el.caldate) { - Calendar.addClass(el.parentNode, "rowhilite"); - } - } - return Calendar.stopEvent(ev); -}; - -Calendar.dayMouseOut = function(ev) { - with (Calendar) { - var el = getElement(ev); - if (isRelated(el, ev) || _C || el.disabled) - return false; - removeClass(el, "hilite"); - if (el.caldate) - removeClass(el.parentNode, "rowhilite"); - if (el.calendar) - el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; - return stopEvent(ev); - } -}; - -/** - * A generic "click" handler :) handles all types of buttons defined in this - * calendar. - */ -Calendar.cellClick = function(el, ev) { - var cal = el.calendar; - var closing = false; - var newdate = false; - var date = null; - if (typeof el.navtype == "undefined") { - if (cal.currentDateEl) { - Calendar.removeClass(cal.currentDateEl, "selected"); - Calendar.addClass(el, "selected"); - closing = (cal.currentDateEl == el); - if (!closing) { - cal.currentDateEl = el; - } - } - cal.date.setDateOnly(el.caldate); - date = cal.date; - var other_month = !(cal.dateClicked = !el.otherMonth); - if (!other_month && !cal.currentDateEl) - cal._toggleMultipleDate(new Date(date)); - else - newdate = !el.disabled; - // a date was clicked - if (other_month) - cal._init(cal.firstDayOfWeek, date); - } else { - if (el.navtype == 200) { - Calendar.removeClass(el, "hilite"); - cal.callCloseHandler(); - return; - } - date = new Date(cal.date); - if (el.navtype == 0) - date.setDateOnly(new Date()); // TODAY - // unless "today" was clicked, we assume no date was clicked so - // the selected handler will know not to close the calenar when - // in single-click mode. - // cal.dateClicked = (el.navtype == 0); - cal.dateClicked = false; - var year = date.getFullYear(); - var mon = date.getMonth(); - function setMonth(m) { - var day = date.getDate(); - var max = date.getMonthDays(m); - if (day > max) { - date.setDate(max); - } - date.setMonth(m); - }; - switch (el.navtype) { - case 400: - Calendar.removeClass(el, "hilite"); - var text = Calendar._TT["ABOUT"]; - if (typeof text != "undefined") { - text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; - } else { - // FIXME: this should be removed as soon as lang files get updated! - text = "Help and about box text is not translated into this language.\n" + - "If you know this language and you feel generous please update\n" + - "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + - "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n" + - "Thank you!\n" + - "http://dynarch.com/mishoo/calendar.epl\n"; - } - alert(text); - return; - case -2: - if (year > cal.minYear) { - date.setFullYear(year - 1); - } - break; - case -1: - if (mon > 0) { - setMonth(mon - 1); - } else if (year-- > cal.minYear) { - date.setFullYear(year); - setMonth(11); - } - break; - case 1: - if (mon < 11) { - setMonth(mon + 1); - } else if (year < cal.maxYear) { - date.setFullYear(year + 1); - setMonth(0); - } - break; - case 2: - if (year < cal.maxYear) { - date.setFullYear(year + 1); - } - break; - case 100: - cal.setFirstDayOfWeek(el.fdow); - return; - case 50: - var range = el._range; - var current = el.innerHTML; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - if (ev && ev.shiftKey) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - cal.onUpdateTime(); - return; - case 0: - // TODAY will bring us here - if ((typeof cal.getDateStatus == "function") && - cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { - return false; - } - break; - } - if (!date.equalsTo(cal.date)) { - cal.setDate(date); - newdate = true; - } else if (el.navtype == 0) - newdate = closing = true; - } - if (newdate) { - ev && cal.callHandler(); - } - if (closing) { - Calendar.removeClass(el, "hilite"); - ev && cal.callCloseHandler(); - } -}; - -// END: CALENDAR STATIC FUNCTIONS - -// BEGIN: CALENDAR OBJECT FUNCTIONS - -/** - * This function creates the calendar inside the given parent. If _par is - * null than it creates a popup calendar inside the BODY element. If _par is - * an element, be it BODY, then it creates a non-popup calendar (still - * hidden). Some properties need to be set before calling this function. - */ -Calendar.prototype.create = function (_par) { - var parent = null; - if (! _par) { - // default parent is the document body, in which case we create - // a popup calendar. - parent = document.getElementsByTagName("body")[0]; - this.isPopup = true; - } else { - parent = _par; - this.isPopup = false; - } - this.date = this.dateStr ? new Date(this.dateStr) : new Date(); - - var table = Calendar.createElement("table"); - this.table = table; - table.cellSpacing = 0; - table.cellPadding = 0; - table.calendar = this; - Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); - - var div = Calendar.createElement("div"); - this.element = div; - div.className = "calendar"; - if (this.isPopup) { - div.style.position = "absolute"; - div.style.display = "none"; - } - div.appendChild(table); - - var thead = Calendar.createElement("thead", table); - var cell = null; - var row = null; - - var cal = this; - var hh = function (text, cs, navtype) { - cell = Calendar.createElement("td", row); - cell.colSpan = cs; - cell.className = "button"; - if (navtype != 0 && Math.abs(navtype) <= 2) - cell.className += " nav"; - Calendar._add_evs(cell); - cell.calendar = cal; - cell.navtype = navtype; - cell.innerHTML = "<div unselectable='on'>" + text + "</div>"; - return cell; - }; - - row = Calendar.createElement("tr", thead); - var title_length = 6; - (this.isPopup) && --title_length; - (this.weekNumbers) && ++title_length; - - hh("?", 1, 400).ttip = Calendar._TT["INFO"]; - this.title = hh("", title_length, 300); - this.title.className = "title"; - if (this.isPopup) { - this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; - this.title.style.cursor = "move"; - hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; - } - - row = Calendar.createElement("tr", thead); - row.className = "headrow"; - - this._nav_py = hh("«", 1, -2); - this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; - - this._nav_pm = hh("‹", 1, -1); - this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; - - this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); - this._nav_now.ttip = Calendar._TT["GO_TODAY"]; - - this._nav_nm = hh("›", 1, 1); - this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; - - this._nav_ny = hh("»", 1, 2); - this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; - - // day names - row = Calendar.createElement("tr", thead); - row.className = "daynames"; - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - cell.className = "name wn"; - cell.innerHTML = Calendar._TT["WK"]; - } - for (var i = 7; i > 0; --i) { - cell = Calendar.createElement("td", row); - if (!i) { - cell.navtype = 100; - cell.calendar = this; - Calendar._add_evs(cell); - } - } - this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; - this._displayWeekdays(); - - var tbody = Calendar.createElement("tbody", table); - this.tbody = tbody; - - for (i = 6; i > 0; --i) { - row = Calendar.createElement("tr", tbody); - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - } - for (var j = 7; j > 0; --j) { - cell = Calendar.createElement("td", row); - cell.calendar = this; - Calendar._add_evs(cell); - } - } - - if (this.showsTime) { - row = Calendar.createElement("tr", tbody); - row.className = "time"; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - cell.innerHTML = Calendar._TT["TIME"] || " "; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = this.weekNumbers ? 4 : 3; - - (function(){ - function makeTimePart(className, init, range_start, range_end) { - var part = Calendar.createElement("span", cell); - part.className = className; - part.innerHTML = init; - part.calendar = cal; - part.ttip = Calendar._TT["TIME_PART"]; - part.navtype = 50; - part._range = []; - if (typeof range_start != "number") - part._range = range_start; - else { - for (var i = range_start; i <= range_end; ++i) { - var txt; - if (i < 10 && range_end >= 10) txt = '0' + i; - else txt = '' + i; - part._range[part._range.length] = txt; - } - } - Calendar._add_evs(part); - return part; - }; - var hrs = cal.date.getHours(); - var mins = cal.date.getMinutes(); - var t12 = !cal.time24; - var pm = (hrs > 12); - if (t12 && pm) hrs -= 12; - var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); - var span = Calendar.createElement("span", cell); - span.innerHTML = ":"; - span.className = "colon"; - var M = makeTimePart("minute", mins, 0, 59); - var AP = null; - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - if (t12) - AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); - else - cell.innerHTML = " "; - - cal.onSetTime = function() { - var pm, hrs = this.date.getHours(), - mins = this.date.getMinutes(); - if (t12) { - pm = (hrs >= 12); - if (pm) hrs -= 12; - if (hrs == 0) hrs = 12; - AP.innerHTML = pm ? "pm" : "am"; - } - H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; - M.innerHTML = (mins < 10) ? ("0" + mins) : mins; - }; - - cal.onUpdateTime = function() { - var date = this.date; - var h = parseInt(H.innerHTML, 10); - if (t12) { - if (/pm/i.test(AP.innerHTML) && h < 12) - h += 12; - else if (/am/i.test(AP.innerHTML) && h == 12) - h = 0; - } - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); - date.setHours(h); - date.setMinutes(parseInt(M.innerHTML, 10)); - date.setFullYear(y); - date.setMonth(m); - date.setDate(d); - this.dateClicked = false; - this.callHandler(); - }; - })(); - } else { - this.onSetTime = this.onUpdateTime = function() {}; - } - - var tfoot = Calendar.createElement("tfoot", table); - - row = Calendar.createElement("tr", tfoot); - row.className = "footrow"; - - cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); - cell.className = "ttip"; - if (this.isPopup) { - cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; - cell.style.cursor = "move"; - } - this.tooltips = cell; - - div = Calendar.createElement("div", this.element); - this.monthsCombo = div; - div.className = "combo"; - for (i = 0; i < Calendar._MN.length; ++i) { - var mn = Calendar.createElement("div"); - mn.className = Calendar.is_ie ? "label-IEfix" : "label"; - mn.month = i; - mn.innerHTML = Calendar._SMN[i]; - div.appendChild(mn); - } - - div = Calendar.createElement("div", this.element); - this.yearsCombo = div; - div.className = "combo"; - for (i = 12; i > 0; --i) { - var yr = Calendar.createElement("div"); - yr.className = Calendar.is_ie ? "label-IEfix" : "label"; - div.appendChild(yr); - } - - this._init(this.firstDayOfWeek, this.date); - parent.appendChild(this.element); -}; - -/** keyboard navigation, only for popup calendars */ -Calendar._keyEvent = function(ev) { - var cal = window._dynarch_popupCalendar; - if (!cal || cal.multiple) - return false; - (Calendar.is_ie) && (ev = window.event); - var act = (Calendar.is_ie || ev.type == "keypress"), - K = ev.keyCode; - if (ev.ctrlKey) { - switch (K) { - case 37: // KEY left - act && Calendar.cellClick(cal._nav_pm); - break; - case 38: // KEY up - act && Calendar.cellClick(cal._nav_py); - break; - case 39: // KEY right - act && Calendar.cellClick(cal._nav_nm); - break; - case 40: // KEY down - act && Calendar.cellClick(cal._nav_ny); - break; - default: - return false; - } - } else switch (K) { - case 32: // KEY space (now) - Calendar.cellClick(cal._nav_now); - break; - case 27: // KEY esc - act && cal.callCloseHandler(); - break; - case 37: // KEY left - case 38: // KEY up - case 39: // KEY right - case 40: // KEY down - if (act) { - var prev, x, y, ne, el, step; - prev = K == 37 || K == 38; - step = (K == 37 || K == 39) ? 1 : 7; - function setVars() { - el = cal.currentDateEl; - var p = el.pos; - x = p & 15; - y = p >> 4; - ne = cal.ar_days[y][x]; - };setVars(); - function prevMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() - step); - cal.setDate(date); - }; - function nextMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() + step); - cal.setDate(date); - }; - while (1) { - switch (K) { - case 37: // KEY left - if (--x >= 0) - ne = cal.ar_days[y][x]; - else { - x = 6; - K = 38; - continue; - } - break; - case 38: // KEY up - if (--y >= 0) - ne = cal.ar_days[y][x]; - else { - prevMonth(); - setVars(); - } - break; - case 39: // KEY right - if (++x < 7) - ne = cal.ar_days[y][x]; - else { - x = 0; - K = 40; - continue; - } - break; - case 40: // KEY down - if (++y < cal.ar_days.length) - ne = cal.ar_days[y][x]; - else { - nextMonth(); - setVars(); - } - break; - } - break; - } - if (ne) { - if (!ne.disabled) - Calendar.cellClick(ne); - else if (prev) - prevMonth(); - else - nextMonth(); - } - } - break; - case 13: // KEY enter - if (act) - Calendar.cellClick(cal.currentDateEl, ev); - break; - default: - return false; - } - return Calendar.stopEvent(ev); -}; - -/** - * (RE)Initializes the calendar to the given date and firstDayOfWeek - */ -Calendar.prototype._init = function (firstDayOfWeek, date) { - var today = new Date(), - TY = today.getFullYear(), - TM = today.getMonth(), - TD = today.getDate(); - this.table.style.visibility = "hidden"; - var year = date.getFullYear(); - if (year < this.minYear) { - year = this.minYear; - date.setFullYear(year); - } else if (year > this.maxYear) { - year = this.maxYear; - date.setFullYear(year); - } - this.firstDayOfWeek = firstDayOfWeek; - this.date = new Date(date); - var month = date.getMonth(); - var mday = date.getDate(); - var no_days = date.getMonthDays(); - - // calendar voodoo for computing the first day that would actually be - // displayed in the calendar, even if it's from the previous month. - // WARNING: this is magic. ;-) - date.setDate(1); - var day1 = (date.getDay() - this.firstDayOfWeek) % 7; - if (day1 < 0) - day1 += 7; - date.setDate(-day1); - date.setDate(date.getDate() + 1); - - var row = this.tbody.firstChild; - var MN = Calendar._SMN[month]; - var ar_days = this.ar_days = new Array(); - var weekend = Calendar._TT["WEEKEND"]; - var dates = this.multiple ? (this.datesCells = {}) : null; - for (var i = 0; i < 6; ++i, row = row.nextSibling) { - var cell = row.firstChild; - if (this.weekNumbers) { - cell.className = "day wn"; - cell.innerHTML = date.getWeekNumber(); - cell = cell.nextSibling; - } - row.className = "daysrow"; - var hasdays = false, iday, dpos = ar_days[i] = []; - for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { - iday = date.getDate(); - var wday = date.getDay(); - cell.className = "day"; - cell.pos = i << 4 | j; - dpos[j] = cell; - var current_month = (date.getMonth() == month); - if (!current_month) { - if (this.showsOtherMonths) { - cell.className += " othermonth"; - cell.otherMonth = true; - } else { - cell.className = "emptycell"; - cell.innerHTML = " "; - cell.disabled = true; - continue; - } - } else { - cell.otherMonth = false; - hasdays = true; - } - cell.disabled = false; - cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; - if (dates) - dates[date.print("%Y%m%d")] = cell; - if (this.getDateStatus) { - var status = this.getDateStatus(date, year, month, iday); - if (this.getDateToolTip) { - var toolTip = this.getDateToolTip(date, year, month, iday); - if (toolTip) - cell.title = toolTip; - } - if (status === true) { - cell.className += " disabled"; - cell.disabled = true; - } else { - if (/disabled/i.test(status)) - cell.disabled = true; - cell.className += " " + status; - } - } - if (!cell.disabled) { - cell.caldate = new Date(date); - cell.ttip = "_"; - if (!this.multiple && current_month - && iday == mday && this.hiliteToday) { - cell.className += " selected"; - this.currentDateEl = cell; - } - if (date.getFullYear() == TY && - date.getMonth() == TM && - iday == TD) { - cell.className += " today"; - cell.ttip += Calendar._TT["PART_TODAY"]; - } - if (weekend.indexOf(wday.toString()) != -1) - cell.className += cell.otherMonth ? " oweekend" : " weekend"; - } - } - if (!(hasdays || this.showsOtherMonths)) - row.className = "emptyrow"; - } - this.title.innerHTML = Calendar._MN[month] + ", " + year; - this.onSetTime(); - this.table.style.visibility = "visible"; - this._initMultipleDates(); - // PROFILE - // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; -}; - -Calendar.prototype._initMultipleDates = function() { - if (this.multiple) { - for (var i in this.multiple) { - var cell = this.datesCells[i]; - var d = this.multiple[i]; - if (!d) - continue; - if (cell) - cell.className += " selected"; - } - } -}; - -Calendar.prototype._toggleMultipleDate = function(date) { - if (this.multiple) { - var ds = date.print("%Y%m%d"); - var cell = this.datesCells[ds]; - if (cell) { - var d = this.multiple[ds]; - if (!d) { - Calendar.addClass(cell, "selected"); - this.multiple[ds] = date; - } else { - Calendar.removeClass(cell, "selected"); - delete this.multiple[ds]; - } - } - } -}; - -Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { - this.getDateToolTip = unaryFunction; -}; - -/** - * Calls _init function above for going to a certain date (but only if the - * date is different than the currently selected one). - */ -Calendar.prototype.setDate = function (date) { - if (!date.equalsTo(this.date)) { - this._init(this.firstDayOfWeek, date); - } -}; - -/** - * Refreshes the calendar. Useful if the "disabledHandler" function is - * dynamic, meaning that the list of disabled date can change at runtime. - * Just * call this function if you think that the list of disabled dates - * should * change. - */ -Calendar.prototype.refresh = function () { - this._init(this.firstDayOfWeek, this.date); -}; - -/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ -Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { - this._init(firstDayOfWeek, this.date); - this._displayWeekdays(); -}; - -/** - * Allows customization of what dates are enabled. The "unaryFunction" - * parameter must be a function object that receives the date (as a JS Date - * object) and returns a boolean value. If the returned value is true then - * the passed date will be marked as disabled. - */ -Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { - this.getDateStatus = unaryFunction; -}; - -/** Customization of allowed year range for the calendar. */ -Calendar.prototype.setRange = function (a, z) { - this.minYear = a; - this.maxYear = z; -}; - -/** Calls the first user handler (selectedHandler). */ -Calendar.prototype.callHandler = function () { - if (this.onSelected) { - this.onSelected(this, this.date.print(this.dateFormat)); - } -}; - -/** Calls the second user handler (closeHandler). */ -Calendar.prototype.callCloseHandler = function () { - if (this.onClose) { - this.onClose(this); - } - this.hideShowCovered(); -}; - -/** Removes the calendar object from the DOM tree and destroys it. */ -Calendar.prototype.destroy = function () { - var el = this.element.parentNode; - el.removeChild(this.element); - Calendar._C = null; - window._dynarch_popupCalendar = null; -}; - -/** - * Moves the calendar element to a different section in the DOM tree (changes - * its parent). - */ -Calendar.prototype.reparent = function (new_parent) { - var el = this.element; - el.parentNode.removeChild(el); - new_parent.appendChild(el); -}; - -// This gets called when the user presses a mouse button anywhere in the -// document, if the calendar is shown. If the click was outside the open -// calendar this function closes it. -Calendar._checkCalendar = function(ev) { - var calendar = window._dynarch_popupCalendar; - if (!calendar) { - return false; - } - var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); - for (; el != null && el != calendar.element; el = el.parentNode); - if (el == null) { - // calls closeHandler which should hide the calendar. - window._dynarch_popupCalendar.callCloseHandler(); - return Calendar.stopEvent(ev); - } -}; - -/** Shows the calendar. */ -Calendar.prototype.show = function () { - var rows = this.table.getElementsByTagName("tr"); - for (var i = rows.length; i > 0;) { - var row = rows[--i]; - Calendar.removeClass(row, "rowhilite"); - var cells = row.getElementsByTagName("td"); - for (var j = cells.length; j > 0;) { - var cell = cells[--j]; - Calendar.removeClass(cell, "hilite"); - Calendar.removeClass(cell, "active"); - } - } - this.element.style.display = "block"; - this.hidden = false; - if (this.isPopup) { - window._dynarch_popupCalendar = this; - Calendar.addEvent(document, "keydown", Calendar._keyEvent); - Calendar.addEvent(document, "keypress", Calendar._keyEvent); - Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); - } - this.hideShowCovered(); -}; - -/** - * Hides the calendar. Also removes any "hilite" from the class of any TD - * element. - */ -Calendar.prototype.hide = function () { - if (this.isPopup) { - Calendar.removeEvent(document, "keydown", Calendar._keyEvent); - Calendar.removeEvent(document, "keypress", Calendar._keyEvent); - Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); - } - this.element.style.display = "none"; - this.hidden = true; - this.hideShowCovered(); -}; - -/** - * Shows the calendar at a given absolute position (beware that, depending on - * the calendar element style -- position property -- this might be relative - * to the parent's containing rectangle). - */ -Calendar.prototype.showAt = function (x, y) { - var s = this.element.style; - s.left = x + "px"; - s.top = y + "px"; - this.show(); -}; - -/** Shows the calendar near a given element. */ -Calendar.prototype.showAtElement = function (el, opts) { - var self = this; - var p = Calendar.getAbsolutePos(el); - if (!opts || typeof opts != "string") { - this.showAt(p.x, p.y + el.offsetHeight); - return true; - } - function fixPosition(box) { - if (box.x < 0) - box.x = 0; - if (box.y < 0) - box.y = 0; - var cp = document.createElement("div"); - var s = cp.style; - s.position = "absolute"; - s.right = s.bottom = s.width = s.height = "0px"; - document.body.appendChild(cp); - var br = Calendar.getAbsolutePos(cp); - document.body.removeChild(cp); - if (Calendar.is_ie) { - br.y += document.body.scrollTop; - br.x += document.body.scrollLeft; - } else { - br.y += window.scrollY; - br.x += window.scrollX; - } - var tmp = box.x + box.width - br.x; - if (tmp > 0) box.x -= tmp; - tmp = box.y + box.height - br.y; - if (tmp > 0) box.y -= tmp; - }; - this.element.style.display = "block"; - Calendar.continuation_for_the_fucking_khtml_browser = function() { - var w = self.element.offsetWidth; - var h = self.element.offsetHeight; - self.element.style.display = "none"; - var valign = opts.substr(0, 1); - var halign = "l"; - if (opts.length > 1) { - halign = opts.substr(1, 1); - } - // vertical alignment - switch (valign) { - case "T": p.y -= h; break; - case "B": p.y += el.offsetHeight; break; - case "C": p.y += (el.offsetHeight - h) / 2; break; - case "t": p.y += el.offsetHeight - h; break; - case "b": break; // already there - } - // horizontal alignment - switch (halign) { - case "L": p.x -= w; break; - case "R": p.x += el.offsetWidth; break; - case "C": p.x += (el.offsetWidth - w) / 2; break; - case "l": p.x += el.offsetWidth - w; break; - case "r": break; // already there - } - p.width = w; - p.height = h + 40; - self.monthsCombo.style.display = "none"; - fixPosition(p); - self.showAt(p.x, p.y); - }; - if (Calendar.is_khtml) - setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); - else - Calendar.continuation_for_the_fucking_khtml_browser(); -}; - -/** Customizes the date format. */ -Calendar.prototype.setDateFormat = function (str) { - this.dateFormat = str; -}; - -/** Customizes the tooltip date format. */ -Calendar.prototype.setTtDateFormat = function (str) { - this.ttDateFormat = str; -}; - -/** - * Tries to identify the date represented in a string. If successful it also - * calls this.setDate which moves the calendar to the given date. - */ -Calendar.prototype.parseDate = function(str, fmt) { - if (!fmt) - fmt = this.dateFormat; - this.setDate(Date.parseDate(str, fmt)); -}; - -Calendar.prototype.hideShowCovered = function () { - if (!Calendar.is_ie && !Calendar.is_opera) - return; - function getVisib(obj){ - var value = obj.style.visibility; - if (!value) { - if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C - if (!Calendar.is_khtml) - value = document.defaultView. - getComputedStyle(obj, "").getPropertyValue("visibility"); - else - value = ''; - } else if (obj.currentStyle) { // IE - value = obj.currentStyle.visibility; - } else - value = ''; - } - return value; - }; - - var tags = new Array("applet", "iframe", "select"); - var el = this.element; - - var p = Calendar.getAbsolutePos(el); - var EX1 = p.x; - var EX2 = el.offsetWidth + EX1; - var EY1 = p.y; - var EY2 = el.offsetHeight + EY1; - - for (var k = tags.length; k > 0; ) { - var ar = document.getElementsByTagName(tags[--k]); - var cc = null; - - for (var i = ar.length; i > 0;) { - cc = ar[--i]; - - p = Calendar.getAbsolutePos(cc); - var CX1 = p.x; - var CX2 = cc.offsetWidth + CX1; - var CY1 = p.y; - var CY2 = cc.offsetHeight + CY1; - - if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = cc.__msh_save_visibility; - } else { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = "hidden"; - } - } - } -}; - -/** Internal function; it displays the bar with the names of the weekday. */ -Calendar.prototype._displayWeekdays = function () { - var fdow = this.firstDayOfWeek; - var cell = this.firstdayname; - var weekend = Calendar._TT["WEEKEND"]; - for (var i = 0; i < 7; ++i) { - cell.className = "day name"; - var realday = (i + fdow) % 7; - if (i) { - cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); - cell.navtype = 100; - cell.calendar = this; - cell.fdow = realday; - Calendar._add_evs(cell); - } - if (weekend.indexOf(realday.toString()) != -1) { - Calendar.addClass(cell, "weekend"); - } - cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; - cell = cell.nextSibling; - } -}; - -/** Internal function. Hides all combo boxes that might be displayed. */ -Calendar.prototype._hideCombos = function () { - this.monthsCombo.style.display = "none"; - this.yearsCombo.style.display = "none"; -}; - -/** Internal function. Starts dragging the element. */ -Calendar.prototype._dragStart = function (ev) { - if (this.dragging) { - return; - } - this.dragging = true; - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posY = ev.clientY + window.scrollY; - posX = ev.clientX + window.scrollX; - } - var st = this.element.style; - this.xOffs = posX - parseInt(st.left); - this.yOffs = posY - parseInt(st.top); - with (Calendar) { - addEvent(document, "mousemove", calDragIt); - addEvent(document, "mouseup", calDragEnd); - } -}; - -// BEGIN: DATE OBJECT PATCHES - -/** Adds the number of days array to the Date object. */ -Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); - -/** Constants used for time computations */ -Date.SECOND = 1000 /* milliseconds */; -Date.MINUTE = 60 * Date.SECOND; -Date.HOUR = 60 * Date.MINUTE; -Date.DAY = 24 * Date.HOUR; -Date.WEEK = 7 * Date.DAY; - -Date.parseDate = function(str, fmt) { - var today = new Date(); - var y = 0; - var m = -1; - var d = 0; - var a = str.split(/\W+/); - var b = fmt.match(/%./g); - var i = 0, j = 0; - var hr = 0; - var min = 0; - for (i = 0; i < a.length; ++i) { - if (!a[i]) - continue; - switch (b[i]) { - case "%d": - case "%e": - d = parseInt(a[i], 10); - break; - - case "%m": - m = parseInt(a[i], 10) - 1; - break; - - case "%Y": - case "%y": - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - break; - - case "%b": - case "%B": - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } - } - break; - - case "%H": - case "%I": - case "%k": - case "%l": - hr = parseInt(a[i], 10); - break; - - case "%P": - case "%p": - if (/pm/i.test(a[i]) && hr < 12) - hr += 12; - else if (/am/i.test(a[i]) && hr >= 12) - hr -= 12; - break; - - case "%M": - min = parseInt(a[i], 10); - break; - } - } - if (isNaN(y)) y = today.getFullYear(); - if (isNaN(m)) m = today.getMonth(); - if (isNaN(d)) d = today.getDate(); - if (isNaN(hr)) hr = today.getHours(); - if (isNaN(min)) min = today.getMinutes(); - if (y != 0 && m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - y = 0; m = -1; d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } - } - if (t != -1) { - if (m != -1) { - d = m+1; - } - m = t; - } - } else if (parseInt(a[i], 10) <= 12 && m == -1) { - m = a[i]-1; - } else if (parseInt(a[i], 10) > 31 && y == 0) { - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) - y = today.getFullYear(); - if (m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - return today; -}; - -/** Returns the number of days in the current month */ -Date.prototype.getMonthDays = function(month) { - var year = this.getFullYear(); - if (typeof month == "undefined") { - month = this.getMonth(); - } - if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } -}; - -/** Returns the number of day in the year. */ -Date.prototype.getDayOfYear = function() { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / Date.DAY); -}; - -/** Returns the number of the week in year, as defined in ISO 8601. */ -Date.prototype.getWeekNumber = function() { - var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var DoW = d.getDay(); - d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu - var ms = d.valueOf(); // GMT - d.setMonth(0); - d.setDate(4); // Thu in Week 1 - return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; -}; - -/** Checks date and time equality */ -Date.prototype.equalsTo = function(date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate()) && - (this.getHours() == date.getHours()) && - (this.getMinutes() == date.getMinutes())); -}; - -/** Set only the year, month, date parts (keep existing time) */ -Date.prototype.setDateOnly = function(date) { - var tmp = new Date(date); - this.setDate(1); - this.setFullYear(tmp.getFullYear()); - this.setMonth(tmp.getMonth()); - this.setDate(tmp.getDate()); -}; - -/** Prints the date in a string according to the given format. */ -Date.prototype.print = function (str) { - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var wn = this.getWeekNumber(); - var w = this.getDay(); - var s = {}; - var hr = this.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = this.getDayOfYear(); - if (ir == 0) - ir = 12; - var min = this.getMinutes(); - var sec = this.getSeconds(); - s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = Calendar._DN[w]; // full weekday name - s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = Calendar._MN[m]; // full month name - // FIXME: %c : preferred date and time representation for the current locale - s["%C"] = 1 + Math.floor(y / 100); // the century number - s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) - s["%e"] = d; // the day of the month (range 1 to 31) - // FIXME: %D : american date style: %m/%d/%y - // FIXME: %E, %F, %G, %g, %h (man strftime) - s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) - s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) - s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) - s["%k"] = hr; // hour, range 0 to 23 (24h format) - s["%l"] = ir; // hour, range 1 to 12 (12h format) - s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 - s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 - s["%n"] = "\n"; // a newline character - s["%p"] = pm ? "PM" : "AM"; - s["%P"] = pm ? "pm" : "am"; - // FIXME: %r : the time in am/pm notation %I:%M:%S %p - // FIXME: %R : the time in 24-hour notation %H:%M - s["%s"] = Math.floor(this.getTime() / 1000); - s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 - s["%t"] = "\t"; // a tab character - // FIXME: %T : the time in 24-hour notation (%H:%M:%S) - s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; - s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) - s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) - // FIXME: %x : preferred date representation for the current locale without the time - // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) - s["%Y"] = y; // year with the century - s["%%"] = "%"; // a literal '%' character - - var re = /%./g; - if (!Calendar.is_ie5 && !Calendar.is_khtml) - return str.replace(re, function (par) { return s[par] || par; }); - - var a = str.match(re); - for (var i = 0; i < a.length; i++) { - var tmp = s[a[i]]; - if (tmp) { - re = new RegExp(a[i], 'g'); - str = str.replace(re, tmp); - } - } - - return str; -}; - -Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; -Date.prototype.setFullYear = function(y) { - var d = new Date(this); - d.__msh_oldSetFullYear(y); - if (d.getMonth() != this.getMonth()) - this.setDate(28); - this.__msh_oldSetFullYear(y); -}; - -// END: DATE OBJECT PATCHES - - -// global object that remembers the calendar -window._dynarch_popupCalendar = null; diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/calendar_stripped.js --- a/gnv/src/main/webapp/scripts/calendar_stripped.js Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo - * ----------------------------------------------------------- - * - * The DHTML Calendar, version 1.0 "It is happening again" - * - * Details and latest version at: - * www.dynarch.com/projects/calendar - * - * This script is developed by Dynarch.com. Visit us at www.dynarch.com. - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - */ - Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("×",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("«",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("‹",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("›",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("»",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||" ";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML=" ";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++y<cal.ar_days.length)ne=cal.ar_days[y][x];else{nextMonth();setVars();}break;}break;}if(ne){if(!ne.disabled)Calendar.cellClick(ne);else if(prev)prevMonth();else nextMonth();}}break;case 13:if(act)Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML=" ";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&¤t_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])continue;switch(b[i]){case "%d":case "%e":d=parseInt(a[i],10);break;case "%m":m=parseInt(a[i],10)-1;break;case "%Y":case "%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}if(t!=-1){if(m!=-1){d=m+1;}m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())this.setDate(28);this.__msh_oldSetFullYear(y);};window._dynarch_popupCalendar=null; \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/ext/readme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/ext/readme Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,3 @@ +curl "http://www.extjs.com/deploy/ext-2.3.0.zip" > ext-2.3.0.zip +unzip ext-2.3.0.zip +rm ext-2.3.0.zip \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/geoext/readme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/geoext/readme Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,4 @@ +curl "http://trac.geoext.org/attachment/wiki/Download/GeoExt-release-0.6.zip?format=raw" > GeoExt-release-0.6.zip +unzip GeoExt-release-0.6.zip +mv GeoExt geoext-0.6 +rm GeoExt-release-0.6.zip \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/gnviewer.js --- a/gnv/src/main/webapp/scripts/gnviewer.js Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/scripts/gnviewer.js Fri Sep 28 12:15:18 2012 +0200 @@ -14,4 +14,4 @@ function showDiv(pName) { var el = document.getElementById(pName); el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"; -} \ No newline at end of file +} diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/layers.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/layers.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,62 @@ + +<%@page import="java.util.Iterator"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/** + * This function is called while initializing the application. You are allowed + * to change/add/remove layers. But be are of the comments inline this code! + */ +function initLayers() { + /** + * XXX This application needs a layer that is stored in a variable called + * 'layer'. So do not change the name of this variable. Just change the WMS + * layer itself. + */ + layer = new OpenLayers.Layer.WMS( + "Background1", + "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?", + { + layers: '0', + format: 'image/png', + transparent: false + }, + { + isBaseLayer: true, + singleTile: true + } + + ); + /** + * XXX This application needs an ARRAY that stores some layers (or a single + * layer). Do not change the name of the following variable 'layers'. + */ + layers = []; + layers[0] = layer; + + <% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + MapService localMapService = sm.getLocalMapService(); + Iterator<Layer> it = localMapService.getLayer().iterator(); + int i = 1; + while (it.hasNext()){ + Layer layer = it.next(); + %> + layer<%=i%> = new OpenLayers.Layer.WMS( + "<%=layer.getID() %>", + "<%=localMapService.getURL() %>", + { + layers: '<%=layer.getName()%>', + format: 'image/png', + transparent: true + }, + { + isBaseLayer: false, + singleTile: true + } + + ); + layers[<%=i%>] = layer<%=i++%>; + <%}%> + +} diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/olutils.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/olutils.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,238 @@ +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +function handleMeasurements(event) { + var geometry = event.geometry; + var units = event.units; + var order = event.order; + var measure = event.measure; + var element = document.getElementById('measurements'); + + var out = ""; + if(order == 1) { + out += "L\u00e4nge: " + measure.toFixed(3) + " " + units; + } else { + out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "<sup>2</sup>"; + } + + element.innerHTML=out; +}; + + + +function readWMC(merge) { + var layers = mapPanel.layers; + map = mapPanel.map; + + var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}}); + var text = document.getElementById("wmc").value; + + merge = true; + if(merge) { + try { + map = format.read(text, {map: map}); + } catch(err) { + document.getElementById("wmc").value = err; + } + } else { + map.destroy(); + try { + var jsonFormat = new OpenLayers.Format.JSON(); + var mapOptions = jsonFormat.read(); + map = format.read(text, {map: mapOptions}); + } catch(err) { + document.getElementById("wmc").value = err; + } + } + + // create MapPanel + mapPanel = new GeoExt.MapPanel({ + border: true, + title: "Karte", + region: "center", + map: map, + zoom: 1, + layers: map.layers + }); +} + + +function writeWMC(merge) { + var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}}); + + try { + var text = format.write(map); + document.getElementById("wmc").value = text; + } catch(err) { + document.getElementById("wmc").value = err; + } +} + + + +function toggleGetFeatureInfo(evt) { + if (infoActive) { + infoControls.click.deactivate(); + infoActive = false; + } + else { + infoControls.click.activate(); + infoActive = true; + } +} + + +function showInfo(evt) { +} + + +function addLayer() { + var records = grid.getSelectionModel().getSelections(); + for (rec in records){ + + var record = records[rec]; + // TODO: Look for something better than object + if (typeof record == "object"){ + var copy = record.copy(); + copy.set("layer", record.get("layer")); + copy.get("layer").mergeNewParams({ + format: "image/png", + transparent: true + }); + mapPanel.layers.add(copy); + } + } + +} + + +// this is just copied from OpenLayers.Util +function urlAppend(url, paramStr) { + var newUrl = url; + if(paramStr) { + var parts = (url + " ").split(/[?&]/); + newUrl += (parts.pop() === " " ? + paramStr : + parts.length ? "&" + paramStr : "?" + paramStr); + } + return newUrl; +} + +function showWarning(){ + if (store.data.length == 0){ + Ext.MessageBox.alert("<bean:message key="gnviewer.mapclient.wms.load.grid.error.title"/>", '<bean:message key="gnviewer.mapclient.wms.load.grid.error.message"/>', grid); + return; + } +} + + +function updateCapabilities() { + + var url = capfield.getValue(); + var service = "SERVICE=WMS"; + var request = "REQUEST=GetCapabilities"; + var version = "VERSION=1.1.1"; + url = urlAppend(url, service); + url = urlAppend(url, request); + url = urlAppend(url, version); + + store = new GeoExt.data.WMSCapabilitiesStore({ + url: url, + layerOptions: {singleTile: true} + }); + store.load({ + callback: showWarning + }); + + grid.destroy(); + grid = new Ext.grid.GridPanel({ + id: 'wmsgrid', + collapsible: false, + split: false, + border: true, + // TODO: autoHeight might cause trouble + autoHeight: true, + overflow: 'auto', + store: store, + cm: new Ext.grid.ColumnModel([ + { + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>', + dataIndex: 'name', + sortable: true + }, + { + id: 'title', + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>', + dataIndex: 'title', + sortable: true + }]), + renderTo: 'capgrid', + bbar: [{ + text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>', + handler: addLayer + }] + }); +} + + +function editFeature(e) { + var feature = e.feature; + + // TODO SET FEATURE ATTRIBUTES + //feature.attributes['lawa'] = 999; + //feature.attributes['lawa_id'] = 999; + //feature.attributes['w_gwk_lawa'] = 999; + //feature.attributes['w_wrrl'] = 999; + //feature.attributes['length_fee'] = 999; +} + +function updateControls() { + var controls = panel.controls; + + controls.remove(drawPointControl); + controls.remove(drawPathControl); + controls.remove(drawPolygonControl); + + panel.destroy(); + panel = new OpenLayers.Control.Panel(); + panel.addControls(controls); + + if (points.getVisibility()) + panel.addControls(drawPointControl); + if (lines.getVisibility()) + panel.addControls(drawPathControl); + if (polygons.getVisibility()) + panel.addControls(drawPolygonControl); + + map.addControl(panel); +} +function parseGetFeatureInfoData(event) { + var contentHTML = "<div>"; + var features = event.features; + var first = true; + for (feat in features){ + if (feat != 'remove'){ + var feature = features[feat]; + var attributes = feature.attributes; + if (first){ + first = false; + }else{ + contentHTML += "<br/>"; + } + contentHTML += "<table>"; + for (att in attributes){ + contentHTML += "<tr><td><b>"+att+":</b></td><td>" + attributes[att] + "</td></tr>"; + } + contentHTML += "</table>"; + } + + } + contentHTML += "</div>"; + + mapPanel.map.addPopup(new OpenLayers.Popup.FramedCloud( + "chicken", + mapPanel.map.getLonLatFromPixel(event.xy), + null, + contentHTML, + null, + true + )); +} \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/openlayers/readme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/openlayers/readme Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,3 @@ +curl "http://www.openlayers.org/download/OpenLayers-2.9.zip" > OpenLayers.zip +unzip OpenLayers.zip +rm OpenLayers.zip \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/scripts/viewport.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/viewport.jsp Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,301 @@ +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<% +boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null && +request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true"); +MapService mapService = SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService(); +%> +OpenLayers.ImgPath = "images/ol/"; +OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url="; +OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>'); +Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif"; + +/** + * XXX + * Change specific attributes for map, wfs-t, etc here. Do not change these + * settings inline the code! + */ +PROJECTION = "EPSG:4326"; +MAX_EXTENT = new OpenLayers.Bounds(-90,-180,90,180); +CURRENT_EXTENT = new OpenLayers.Bounds(<%=mapService.getBBoxValue().replace(' ',',')%>); +INITIAL_CENTER = new OpenLayers.LonLat(5, 55); +GETFEATUREINFO_URL = "<%=mapService.getURL()%>"; + +Ext.onReady(function() { + + /* this function call initialized the layers that are defined by the user. + * The variable 'layer' and 'layers' are initialized in this function as + * well, that are used in the following code! So do not remove this function + * call. + */ + initLayers(); + + var options = { + maxExtent: MAX_EXTENT, + projection: PROJECTION, + controls: [], + units: 'm' + }; + + +/* ------------------------ Create map and add controls ---------------------*/ + // create map + map = new OpenLayers.Map(options); + map.displayProjection = new OpenLayers.Projection(PROJECTION); + + // add controls + + + var nav = new OpenLayers.Control.NavigationHistory(); + nav.previous.title = "<bean:message key="gnviewer.mapclient.controls.nav.previous.title"/>"; + nav.next.title = "<bean:message key="gnviewer.mapclient.controls.nav.next.title"/>"; + map.addControl(nav); + + panel = new OpenLayers.Control.Panel(); + controls = { + previous: nav.previous, + next : nav.next, + navigate: new OpenLayers.Control.Navigation( + { + displayClass: 'olControlPan', + autoActivate: 'false', + title:'<bean:message key="gnviewer.mapclient.controls.navigate.title"/>' + } + ), + zoombox: new OpenLayers.Control.ZoomBox( + { + displayClass: 'olControlZoomBox', + title: '<bean:message key="gnviewer.mapclient.controls.zoombox.title"/>' + } + ), + info : new OpenLayers.Control.WMSGetFeatureInfo({ + displayClass: "olControlFeatureInfo", + url: GETFEATUREINFO_URL, + title: '<bean:message key="gnviewer.mapclient.controls.info.title"/>', + queryVisible: true, + infoFormat: 'application/vnd.ogc.gml', + eventListeners: { + getfeatureinfo: parseGetFeatureInfoData + } + }) + }; + + for (var key in controls) { + panel.addControls([controls[key]]); + } + + map.addControl(panel); + map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon: 'true'})); + // Displaying the mouse postion + mousePosition = new OpenLayers.Control.MousePosition(); + map.addControl(mousePosition); + +/* --------------------------------------------------------------------------- */ + + // create MapPanel + mapPanel = new GeoExt.MapPanel({ + border: true, + region: "center", + map: map, + layers: layers + }); + + //map.setCenter(INITIAL_CENTER); + + + store = new GeoExt.data.WMSCapabilitiesStore({ + }); + + grid = new Ext.grid.GridPanel({ + id: 'wmsgrid', + collapsible: false, + split: false, + border: true, + //height: 400, + autoHeight: true, + store: store, + cm: new Ext.grid.ColumnModel([ + { + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>', + dataIndex: 'name', + sortable: true + }, + { + id: 'title', + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>', + dataIndex: 'title', + sortable: true + }]), + renderTo: 'capgrid', + bbar: [{ + text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>', + handler: addLayer + }] + }); + var cap = new Ext.Panel({ + id: 'wmspanel', + border: true, + region: 'east', + title: '<bean:message key="gnviewer.mapclient.wms.load.title"/>', + collapsible: false, + split: false, + height: 400, + contentEl: 'cap' + + }); + + var capstore = new Ext.data.SimpleStore({ + fields: ['name','url'], + data : [['<bean:message key="gnviewer.mapclient.wms.local.service.name"/>','<%=mapService.getURL()%>'],<jsp:include page="/WEB-INF/config/reachable-servers.conf" />] + }); + capfield = new Ext.form.ComboBox({ + id: 'capfield', + store: capstore, + displayField:'name', + width: 245, + valueField: 'url', + mode: 'local', + triggerAction: 'all', + selectOnFocus: true, + renderTo: 'urlinput', + editable: false, + value: '<%=mapService.getURL()%>' + + }); + + + + var capbutton = new Ext.Button({ + id: 'capbutton', + region: 'west', + handler: updateCapabilities, + text: '<bean:message key="gnviewer.mapclient.wms.load.bt.text"/>', + tooltip: '<bean:message key="gnviewer.mapclient.wms.load.bt.tooltip"/>', + renderTo: 'urlbutton' + }); + + + + +/* --------------------------- Layer Tree ----------------------------------- */ + + + // LayerTree + var tree = new Ext.tree.TreePanel({ + border: true, + enableDD: true, + region: "east", + title: "<bean:message key="gnviewer.mapclient.layercontrol"/>", + width: 200, + split: true, + collapsible: false, + collapseMode: "mini", + autoScroll: true, + loader: new Ext.tree.TreeLoader({ + applyLoader: false, + }), + root: { + nodeType: "async", + children: [{ + nodeType: "gx_baselayercontainer", + text: "<bean:message key="gnviewer.mapclient.layercontrol.baselayer"/>", + expanded: true + }, { + nodeType: "gx_overlaylayercontainer", + text: "<bean:message key="gnviewer.mapclient.layercontrol.overlay"/>", + expanded: true, + loader: { + filter: function(record) { + var layer = record.get("layer"); + return layer.displayInLayerSwitcher === true && + layer.isBaseLayer === false; + } + } + }] + }, + rootVisible: false, + lines: false + }); + +/*-------------------------------- Feature grid -------------------------------*/ + + // create legend paneclass="headerLineLinksl + legendPanel = new GeoExt.LegendPanel({ + id: 'legendpanel', + dynamic: true, + border: true, + title: '<bean:message key="gnviewer.mapclient.legend"/>', + collapsible: false, + split: false, + defaults: { + labelCls: 'legend', + style: 'padding: 5px' + }, + bodyStyle: 'padding:5px', + width: 250, + autoScroll: true, + region: 'east', + }); + + +// use separate panels + // Create GUI + + var mylegend = new Ext.Panel( + { + region: "west", + title: '', + split: true, + width: 250, + minSize: 225, + maxSize: 400, + collapsible: false, + overflow: 'auto', + margins: '0 0 0 5', + layout: 'accordion', + layoutConfig: { + animate: true, + activeOnTop: false + }, + items: [ + tree, + legendPanel, + cap + ] + } + ); + <%if (!standalone){%> + // The main panel + new Ext.Panel({ + renderTo: "mapcontainer", + layout: "border", + height: 400, + items: [mapPanel, mylegend] + }); + <%}else{ %> + // Create GUI + new Ext.Viewport({ + layout: "border", + items: [ + { + region: "north", + contentEl: "headline", + cls: 'title', + height: 40 + }, + mylegend, + mapPanel + ] + }); + <%}%> + map.zoomToExtent(CURRENT_EXTENT); + + // some code for automatically resizing the map panel if the window size + // changes + window.onresize=function() { + var mapcontainer = Ext.get('mapcontainer'); + mapPanel.setSize(mapcontainer.getSize()); + } +}); diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/styles/calendar-blue.css --- a/gnv/src/main/webapp/styles/calendar-blue.css Fri Sep 28 12:13:47 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* The main calendar widget. DIV containing a table. */ - -div.calendar { position: relative; } - -.calendar, .calendar table { - border: 1px solid #556; - font-size: 11px; - color: #000; - cursor: default; - background: #eef; - font-family: tahoma,verdana,sans-serif; -} - -/* Header part -- contains navigation buttons and day names. */ - -.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ - text-align: center; /* They are the navigation buttons */ - padding: 2px; /* Make the buttons seem like they're pressing */ -} - -.calendar .nav { - background: #778 url(menuarrow.gif) no-repeat 100% 100%; -} - -.calendar thead .title { /* This holds the current "month, year" */ - font-weight: bold; /* Pressing it will take you to the current date */ - text-align: center; - background: #fff; - color: #000; - padding: 2px; -} - -.calendar thead .headrow { /* Row <TR> containing navigation buttons */ - background: #778; - color: #fff; -} - -.calendar thead .daynames { /* Row <TR> containing the day names */ - background: #bdf; -} - -.calendar thead .name { /* Cells <TD> containing the day names */ - border-bottom: 1px solid #556; - padding: 2px; - text-align: center; - color: #000; -} - -.calendar thead .weekend { /* How a weekend day name shows in header */ - color: #a66; -} - -.calendar thead .hilite { /* How do the buttons in header appear when hover */ - background-color: #aaf; - color: #000; - border: 1px solid #04f; - padding: 1px; -} - -.calendar thead .active { /* Active (pressed) buttons in header */ - background-color: #77c; - padding: 2px 0px 0px 2px; -} - -/* The body part -- contains all the days in month. */ - -.calendar tbody .day { /* Cells <TD> containing month days dates */ - width: 2em; - color: #456; - text-align: right; - padding: 2px 4px 2px 2px; -} -.calendar tbody .day.othermonth { - font-size: 80%; - color: #bbb; -} -.calendar tbody .day.othermonth.oweekend { - color: #fbb; -} - -.calendar table .wn { - padding: 2px 3px 2px 2px; - border-right: 1px solid #000; - background: #bdf; -} - -.calendar tbody .rowhilite td { - background: #def; -} - -.calendar tbody .rowhilite td.wn { - background: #eef; -} - -.calendar tbody td.hilite { /* Hovered cells <TD> */ - background: #def; - padding: 1px 3px 1px 1px; - border: 1px solid #bbb; -} - -.calendar tbody td.active { /* Active (pressed) cells <TD> */ - background: #cde; - padding: 2px 2px 0px 2px; -} - -.calendar tbody td.selected { /* Cell showing today date */ - font-weight: bold; - border: 1px solid #000; - padding: 1px 3px 1px 1px; - background: #fff; - color: #000; -} - -.calendar tbody td.weekend { /* Cells showing weekend days */ - color: #a66; -} - -.calendar tbody td.today { /* Cell showing selected date */ - font-weight: bold; - color: #00f; -} - -.calendar tbody .disabled { color: #999; } - -.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ - visibility: hidden; -} - -.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ - display: none; -} - -/* The footer part -- status bar and "Close" button */ - -.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */ - text-align: center; - background: #556; - color: #fff; -} - -.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */ - background: #fff; - color: #445; - border-top: 1px solid #556; - padding: 1px; -} - -.calendar tfoot .hilite { /* Hover style for buttons in footer */ - background: #aaf; - border: 1px solid #04f; - color: #000; - padding: 1px; -} - -.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ - background: #77c; - padding: 2px 0px 0px 2px; -} - -/* Combo boxes (menus that display months/years for direct selection) */ - -.calendar .combo { - position: absolute; - display: none; - top: 0px; - left: 0px; - width: 4em; - cursor: default; - border: 1px solid #655; - background: #def; - color: #000; - font-size: 90%; - z-index: 100; -} - -.calendar .combo .label, -.calendar .combo .label-IEfix { - text-align: center; - padding: 1px; -} - -.calendar .combo .label-IEfix { - width: 4em; -} - -.calendar .combo .hilite { - background: #acf; -} - -.calendar .combo .active { - border-top: 1px solid #46a; - border-bottom: 1px solid #46a; - background: #eef; - font-weight: bold; -} - -.calendar td.time { - border-top: 1px solid #000; - padding: 1px 0px; - text-align: center; - background-color: #f4f0e8; -} - -.calendar td.time .hour, -.calendar td.time .minute, -.calendar td.time .ampm { - padding: 0px 3px 0px 4px; - border: 1px solid #889; - font-weight: bold; - background-color: #fff; -} - -.calendar td.time .ampm { - text-align: center; -} - -.calendar td.time .colon { - padding: 0px 2px 0px 3px; - font-weight: bold; -} - -.calendar td.time span.hilite { - border-color: #000; - background-color: #667; - color: #fff; -} - -.calendar td.time span.active { - border-color: #f00; - background-color: #000; - color: #0f0; -} diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/styles/default.css --- a/gnv/src/main/webapp/styles/default.css Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/main/webapp/styles/default.css Fri Sep 28 12:15:18 2012 +0200 @@ -36,17 +36,17 @@ } a { - color: #00416B; - text-decoration: none; + color: #FF6600; + text-decoration: underline; } legend { - border: 1px solid #CCD5DE; + border: 1px solid #003A66; padding: 4px 5px; margin: 0 0 0 0; background-color: white; font-weight: bolder; - color: #00416B; + color: #003A66; clear: both; } @@ -54,22 +54,28 @@ margin: 5px 0 0 10px; padding-left: 10px; padding-right: 10px; - border: 1px solid #CCD5DE; - background-image: url( ../images/bg_fieldset_ie6.gif ); + border: 1px solid #003A66; + background-color: #F2F1F5; background-repeat: repeat-x; background-position: top left; display: block; } -html > body fieldset { - background-image: url( ../images/bg_fieldset.gif ); -} - div { margin: 0; padding: 0; } +#browseDiv { + float: left; + margin-top: 1px; +} + +#loadDiv { + float: right; + margin-left: 5px; +} + p, li, dl, input, select, address, legend, label, fieldset span { font-size: 0.7em; } @@ -82,6 +88,10 @@ width: 250px; } +textarea.mapviewer { + width: 450px; +} + input.textinput { width: 250px; } @@ -92,11 +102,145 @@ font-size: 0.7em; } +table.dynamic { + font-size: 1.2em; +} + +table.static { + margin: 0 0 0 0; + width: 293px; +} + +table.wms { + font-size: 0.8em; + margin: 0 0 0 0; +} + table, th, td { margin: 0; padding: 0; font-size: 0.8em; } + +img { + border: 0px; +} + +/* styles used in footer.jsp */ +.footerTable { + width: 100%; + background-color: white; +} + +.footerLine { + color: #003A66; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.95em; + line-height: 1.1em; + padding-left: 1px; +} + +.footerTableLinks { + width: 100%; + background-color: #003a66; +} + +.footerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 1.5em; + text-decoration:none; +} + +.headerTableLinks { + width: 100%; + background-color: #003a66; +} + +.headerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 1em; + text-decoration:none; +} + +/* styles used content */ +#contentElement { + height: 80%; + position: absolute; + top: 85px; + width: 100%; + margin: 0px 0px 10px 0px; + overflow: auto; +} + +.bgblue2 { + background-color: #F7F7F9; +} + +#footerElement { + position: absolute; + bottom: 0px; + margin-top: 10px; + width: 100%; + height: 20px; +} + +.down { + padding-top: 15px; + width: 315px; +} + +.historyback { + padding-left: 10px; + vertical-align: top; + text-align: right; +} + +#parameterPanel { + position: absolute; + float: left; + left: 0px; + top: 5%; + width: 400px; + height: 95%; +} + +td.parameter { + font-size: 0.6em; +} + +.parameter { + color: #003A66; + font-size: 0.8em; + font-weight: bold; + padding-left: 5px; + text-align: left; + vertical-align: top; + width: 110px; +} + +.matrixHeader { + padding-left: 5px; + text-align: center; +} + +.matrixSelectableHeader { + padding-left: 5px; + text-align: left; +} + +.matrixContent { + text-align: center; +} + +.wmsvalue { +} + +.value { + font-size: 1.2em; +} + .submitbutton{ cursor:pointer; border:outset 1px #ccc; @@ -111,24 +255,60 @@ color: #CD3426; font-size: 10px; font-weight: bold; - margin: 2px 2px; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; } .errormsg { - color: red; font-weight: bold; } +.chartException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.inputException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + /* ====================== Header ============================= */ -#head { - +#head { height: 25px; margin: 0; padding: 0; background-color: #103D64; } +#headline { + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + font-weight: bold; + line-height: 1.1em; + padding-left: 5px; + width: 533px; +} + +.headline { + border-top: 2px solid #CCe0f4; + border-bottom: 2px solid #CCe0f4; + color: #4C7594; + /*font-weight: bold;*/ + font-size: 1.2em; + padding: 10px; +} + #logo { float:right; background-image: url( ../images/bsh_logo.gif ); @@ -141,21 +321,48 @@ } #head a { clear:left; - } + +.reload { + margin-top: 10px; +} + #project { - position:absolute; - top:27px; - left:10px; - width: 400px; + padding: 0px; text-align: left; - + font-size: 1.2em; + background-color: #e9e8f0; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 5%; +} + +#projectload { + float: left; + padding-left: 5px; + visibility: hidden; +} + +.devide { + width: 100%; + height: 2px; +} + +.projectException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; } #load_error { position:absolute; - top:27px; - left:425px; + top:175px; + left:375px; width: 400px; text-align: left; @@ -182,6 +389,12 @@ } +div#headerElement { + height: 85px; + position: absolute; + width: 100%; +} + div#header { background-color: #143B62; margin: 0; @@ -200,7 +413,7 @@ top: 0; left: 0; width: 100%; - + height: 100%; } .showContent { @@ -218,15 +431,48 @@ } div#diagram { -/*POSITION DEFINIEREN*/ -/* border: 1px solid crimson;*/ + float: left; + position: absolute; + top: 10%; + left: 330px; +} + +div.outerMap { + position: absolute; + top: 12%; + left: 350px; + width: 555px; + height: 436px; + margin: 0 0 0 0; + padding: 0 0 0 0; +} + +div.wms { + position: absolute; + top: 10%; + left: 0px; + height: 30px; + border: 1px solid red; +} + +div#map { position: absolute; top: 65px; - left: 350px; + left: 0px; + width: 555px; + height: 381px; + border: 1px solid #CCD5DE; +} + +div.histogram { + float: left; + position: absolute; + top: 10%; + left: 330px; } div#export { - padding-left: 7px; + width: 325px; } /* this is a wrapper for diagramoptions and statistics*/ @@ -237,21 +483,20 @@ } div#diagramoptions { -/*POSITION DEFINIEREN*/ -/*border: 1px solid blue;*/ position: relative; - width: 600px; + width: 325px; } div#diagramOptionsContent { -/*display: none;*/ + width : 325px; } -div#statistics { -/*POSITION DEFINIEREN*/ -/*border: 1px solid Red;*/ - position: relative; - width: 600px; +div.statistics { + float: left; + position: absolute; + top: 10%; + left: 330px; + width : 325px; } div#statisticValues { @@ -305,7 +550,7 @@ } div#basefilter { - margin-top: 30px; + margin-top: 50px; width: 325px; } @@ -352,4 +597,4 @@ } -/* ----------------------------------- */ \ No newline at end of file +/* ----------------------------------- */ diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/styles/extjs-override.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/extjs-override.css Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,35 @@ +.x-panel-header { + background: #F2F1F5; + border:1px solid #003A66; + color:#003A66; +} + +.x-border-layout-ct { + background:#F2F1F5; +} + +.x-panel-body { + border:1px solid #003A66; +} + +.x-toolbar{ + background:#F2F1F5; +} + +.x-panel-bbar .x-toolbar { + border:1px solid #003A66; +} + +.x-tool { + background:transparent url(../images/ol/tool-sprites.gif) no-repeat; +} + +.x-tree-node-expanded .x-tree-node-icon{ + background-image:url(../images/ol/folder-open.gif); +} +.x-tree-node-leaf .x-tree-node-icon{ + background-image:url(../images/ol/leaf.gif); +} +.x-tree-node-collapsed .x-tree-node-icon{ + background-image:url(../images/ol/folder.gif); +} \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/styles/gnv.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/gnv.css Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,301 @@ +body { + background-color: #FFFFFF; + font-family: verdana, arial, Helvetica, sans-serif; + font-size: 0.7em; + height: 100%; + margin: 0; + padding: 0; +} + +fieldset { + margin: 5px 0 0 10px; + padding-left: 10px; + padding-right: 10px; + padding-bottom: 5px; + padding-top: 5px; + border: 1px solid #003A66; + background-color: #F2F1F5; + background-repeat: repeat-x; + background-position: top left; + display: block; +} + +legend { + border: 1px solid #003A66; + padding: 4px 5px; + margin: 0 0 0 0; + background-color: white; + font-weight: bolder; + color: #003A66; + clear: both; +} + +input { + font-family: verdana, arial, Helvetica, sans-serif; + font-size: 0.9em; +} + +select, textarea { + font-size: 0.9em; + width: 250px; +} + +img { + border: 0px; +} + +a { + color: #FF6600; + font-size: 1.2em; + text-decoration: underline; +} + +/* Some classes for the header */ +#headerElement { + float: left; + top: 0px; + width: 100%; +} + +#header { + background-color: #143B62; + margin: 0; + padding: 0; + height: 50px; +} + +#headline { + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + font-weight: bold; + line-height: 1.1em; + padding-left: 5px; + width: 533px; +} + +.headline { + border-top: 2px solid #CCe0f4; + border-bottom: 2px solid #CCe0f4; + color: #4C7594; + padding: 10px; +} + +.infoheadline { + border: 0; + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + padding: 0; +} + +.headerTableLinks { + width: 100%; + background-color: #003a66; +} + +.headerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.9em; + text-decoration:none; +} + +/* Some classes for the project load/save bar */ +#project { + background-color: #e9e8f0; + height: 5%; + left: 0px; + padding: 0px; + text-align: left; + top: 0px; + width: 100%; +} + +#projectload { + visibility: hidden; +} + +#browseDiv { + float: left; +} + +#loadDiv { + float: left; + margin-left: 5px; +} + +/* Some classes for the content */ +#contentElement { + float: left; + height: 90%; + width: 100%; + margin: 0px 0px 10px 0px; +} + +#contentRow { + vertical-align: top; +} + +.info-content { + padding-left : 15px; + padding-right: 15px; +} + +#parameterColumn { + width: 400px; +} + +#parameterPanel { + float: left; + width: 350px; +} + +.static { + background-color: #F2F1F5; + width: 300px; +} + +.parameter { + color: #003A66; + font-weight: bold; + padding-left: 5px; + text-align: left; + vertical-align: top; + width: 110px; +} + +.historyback { + padding-left: 10px; + vertical-align: top; + text-align: right; +} + +.statistics { + width: 350px; +} + +div.outerMap { + float: left; + width: 555px; + height: 436px; +} + +div.wms { + top: 10%; + left: 0px; + height: 30px; + border: 1px solid red; +} + +div#map { + top: 65px; + left: 0px; + width: 555px; + height: 381px; + border: 1px solid #CCD5DE; +} + + +/* Some classes for the footer */ +#footerElement { + clear: left; + bottom: 20px; + width: 100%; + height: 20px; +} + +.footerTable { + width: 100%; + background-color: white; +} + +.footerLine { + color: #003A66; + font-family: Arial,Helvetica,sans-serif; + line-height: 1.1em; + padding-left: 1px; +} + +.footerTableLinks { + width: 100%; + background-color: #003a66; +} + +.footerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.9em; + text-decoration:none; +} + + +/* ---------- OVERLAY ------------------------- */ +#overlay { + visibility: hidden; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + text-align: center; + z-index: 100; + background-color: white; + -moz-opacity: 0.5; + opacity: 0.5; +} + +#overlayContent { + visibility: hidden; + position: relative; + z-index: 101; + width: 300px; + margin: 150px auto; + background-color: #fff; + border: 1px solid #000; + padding: 75px; + text-align: right; + background-image: url( ../images/bsh_logo.gif ); + background-repeat: no-repeat; +} + + +/* warnings and errors */ +.projectException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.chartException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.inputException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.error { + color: #CD3426; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.errormsg { + color: red; + font-weight: bold; +} diff -r 465e70422e66 -r f030acb8d999 gnv/src/main/webapp/styles/ol_style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/ol_style.css Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,69 @@ +.wmcbox { + width: 100%; + height: 480px; +} + +.olControlPanel div { + background-color: white; + float: left; + display: block; + position: relative; + left: 80px; + margin: 5px; + width: 24px; + height: 24px; +} + +.olControlPanel .olControlFeatureInfoItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/feature_info_on.png"); +} +.olControlPanel .olControlFeatureInfoItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/feature_info_off.png"); +} + + +.olControlNavigationHistory { + background-image: url("../images/ol/navigation_history.png"); + background-repeat: no-repeat; + width: 22px; + height: 22px; + +} + +.olControlPanel .olControlPanItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/pan_on.png"); +} +.olControlPanel .olControlPanItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/pan_off.png"); +} + +.olControlPanel .olControlZoomBoxItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/zoom_box_on.png"); +} +.olControlPanel .olControlZoomBoxItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/zoom_box_off.png"); +} + +div.olControlMousePosition { + color:#003A66; + background-color: #F2F1F5; + filter: alpha(opacity=75); + opacity: 0.75 +} + +.olHandlerBoxZoomBox { + border: 2px solid #003A66; + background-color: #F2F1F5;; +} diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.action.mapviewer.parser; + +import de.intevation.gnv.artifactdatabase.objects.map.Layer; +import de.intevation.gnv.artifactdatabase.objects.map.MapService; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import java.util.Collection; +import java.util.Iterator; + +import junit.framework.TestCase; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; + +public class ExternalCallParserTestCase extends TestCase { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = null; + + static { + BasicConfigurator.configure(); + log = Logger.getLogger(ExternalCallParserTestCase.class); + } + + public ExternalCallParserTestCase() { + super(); + } + + public ExternalCallParserTestCase(String name) { + super(name); + } + + public void testParseExternalCall() { + log.debug("Execute testParseExternalCall"); + try { + InputStream inputStream = new FileInputStream( + new File("src/test/ressources/externalinterfacecall.xml")); + ExternalCallParser ecp = new XMLExternalCallParser(inputStream); + ecp.parse(); + String geometry = ecp.getGeometry(); + assertNotNull(geometry); + log.debug("Parsed Geometry: "+geometry); + String srs = ecp.getSRS(); + assertNotNull(srs); + log.debug("Parsed SRS: "+srs); + Collection<MapService> mapServices = ecp.getMapServices(); + assertNotNull(mapServices); + log.debug(mapServices.size()+"Mapservices parsed"); + assertEquals(2, mapServices.size()); + Iterator<MapService> it = mapServices.iterator(); + MapService mapService1 = it.next(); + MapService mapService2 = it.next(); + + log.debug("MapService 1"); + log.debug("ID: "+mapService1.getID()); + log.debug("URL: "+mapService1.getURL()); + log.debug("TYPE: "+mapService1.getType()); + Collection<Layer> layer1 = mapService1.getLayer(); + log.debug("Layer parsed: "+layer1.size()); + assertEquals(5, layer1.size()); + Iterator<Layer> layerIt1 = layer1.iterator(); + while(layerIt1.hasNext()){ + log.debug(layerIt1.next().toString()); + } + + log.debug("MapService 2"); + log.debug("ID: "+mapService2.getID()); + log.debug("URL: "+mapService2.getURL()); + log.debug("TYPE: "+mapService2.getType()); + Collection<Layer> layer2 = mapService2.getLayer(); + log.debug("Layer parsed: "+layer2.size()); + assertEquals(2, layer2.size()); + Iterator<Layer> layerIt2 = layer2.iterator(); + while(layerIt2.hasNext()){ + log.debug(layerIt2.next().toString()); + } + + } catch (Exception e) { + log.error(e,e); + fail(); + } + + } + +} diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java --- a/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java Fri Sep 28 12:15:18 2012 +0200 @@ -1,8 +1,20 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.client; +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; +import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; +import de.intevation.gnv.artifactdatabase.objects.InputParameter; + +import de.intevation.gnv.util.XSLTransformer; + import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -13,16 +25,9 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; -import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; -import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; -import de.intevation.gnv.artifactdatabase.objects.InputParameter; -import de.intevation.gnv.util.XSLTransformer; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactDatabaseClientTestCase extends TestCase { @@ -38,7 +43,7 @@ /** * Constructor - * + * * @param namemessage */ public ArtifactDatabaseClientTestCase(String name) { @@ -93,7 +98,7 @@ } } - } catch (ArtifactDatabaseClientException e) { + } catch (Exception e) { log.error(e, e); fail(); } diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java --- a/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java Fri Sep 28 12:13:47 2012 +0200 +++ b/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java Fri Sep 28 12:15:18 2012 +0200 @@ -1,8 +1,15 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.util; +import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -11,13 +18,12 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; + import org.w3c.dom.Document; -import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class XSLTransformerTestCase extends TestCase { diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/ressources/externalinterfacecall.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/test/ressources/externalinterfacecall.xml Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gnviewer> + <mapservices> + <mapservice id="foo" type="arcims" url="http://foo.bar.de"> + <layer id="layer0" name="Layer 0"/> + <layer id="layer1" name="Layer 1"> + <layer id="layer2" name="Layer 2"/> + <layer id="layer3" name="Layer 3"/> + </layer> + <layer id="layern" name="Layer N"/> + </mapservice> + <mapservice id="foo1" type="wms" url="http://foo1.bar.de"> + <layer id="layer0" name="Layer 0"/> + <layer id="layer1" name="Layer 1"/> + </mapservice> + </mapservices> + <location> + <srs>EPSG:4324</srs> + <data>POINT(8.6 56.0)</data> + </location> +</gnviewer> \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/ressources/externalinterfacecall_curl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/test/ressources/externalinterfacecall_curl.xml Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,37 @@ +<?xml version='1.0' encoding='UTF-8'?> +<gnviewer> + <mapservices> + <mapservice id='BSH_IMS_Prediction_Model_Current' type='arcims' + url='http://foo.bar.de'> + <Modeldata /> + <layer id='3' name='Speed Today 00:00 (Surface)' /> + <layer id='146' name='Surface Current Day After Tomorrow'> + <layer id='207' name='Day After Tomorrow 20:00 (Surface)'> + <layer id='208' name='Speed Day After Tomorrow 21:00 (Surface)' /> + <layer id='209' name='Speed Day After Tomorrow 20:00 (Surface)' /> + </layer> + </layer> + </mapservice> + <mapservice id='BSH_IMS_Marine_Environmental_Monitoring_Network' + type='wms' url='http://foo1.bar.de'> + <MARNET /> + <layer id='26' name='Air'> + <layer id='27' name='Temperature' /> + </layer> + <layer id='9' name='Salinity'> + <layer id='10' name='depth: (0m- -6m)' /> + </layer> + <layer id='13' name='OxygenSaturation'> + <layer id='14' name='depth: (0m- -6m)' /> + <layer id='15' name='depth: (-6m- -20m)' /> + <layer id='16' name='depth: (-20m- -50m)' /> + </layer> + </mapservice> + <mapservice id='BSH_IMS_Sea_Surface_Temperature_Analysis' + type='arcims' url='http://foo.bar.de' /> + </mapservices> + <location> + <srs>EPSG:4324</srs> + <data>POINT(8.6 56.0)</data> + </location> +</gnviewer> \ No newline at end of file diff -r 465e70422e66 -r f030acb8d999 gnv/src/test/ressources/samplecall.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/test/ressources/samplecall.txt Fri Sep 28 12:15:18 2012 +0200 @@ -0,0 +1,1 @@ +curl -v -X POST -H "Content-type: text/xml" http://localhost:8080/gnv/extcall.do -d @externalinterfacecall_curl.xml \ No newline at end of file