diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 40243aa8eb..bce47a5ad3 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -320,6 +320,16 @@ /images/icons/new_content.gif wizard:createContent + + + + + CreateChildren + + create_xml_content_type + /images/icons/new_content.gif + wizard:createXMLContentType + @@ -539,6 +549,7 @@ + diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index a3aad002c2..d648b35119 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -144,6 +144,12 @@ description-id="create_content_step2_desc" instruction-id="default_instruction" /> + + + + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java index 4e8679ed3d..fd9bef3624 100644 --- a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java +++ b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java @@ -570,7 +570,10 @@ public class CheckinCheckoutBean // navigate to appropriate screen FacesContext fc = FacesContext.getCurrentInstance(); this.navigator.setupDispatchContext(node); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "editTextInline"); + String s = (MimetypeMap.MIMETYPE_XML.equals(mimetype) + ? "editXmlInline" + : "editTextInline"); + fc.getApplication().getNavigationHandler().handleNavigation(fc, null, s); } else { diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java index 881facb299..dc31edfa70 100644 --- a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java @@ -1,6 +1,23 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ package org.alfresco.web.bean.content; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ResourceBundle; @@ -18,6 +35,7 @@ import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; +import org.alfresco.web.templating.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,11 +47,13 @@ import org.apache.commons.logging.LogFactory; public class CreateContentWizard extends BaseContentWizard { protected String content = null; - + protected String templateType; protected List createMimeTypes; private static Log logger = LogFactory.getLog(CreateContentWizard.class); - + public static final org.alfresco.service.namespace.QName TT_QNAME = + org.alfresco.service.namespace.QName.createQName(org.alfresco.service.namespace.NamespaceService.CONTENT_MODEL_1_0_URI, "tt"); + // ------------------------------------------------------------------------------ // Wizard implementation @@ -41,8 +61,10 @@ public class CreateContentWizard extends BaseContentWizard protected String finishImpl(FacesContext context, String outcome) throws Exception { - saveContent(null, this.content); - + saveContent(null, this.content); + if (templateType != null) + this.nodeService.setProperty(createdNode, TT_QNAME, templateType); + // return the default outcome return outcome; } @@ -54,6 +76,7 @@ public class CreateContentWizard extends BaseContentWizard this.content = null; this.inlineEdit = true; + this.templateType = null; this.mimeType = MimetypeMap.MIMETYPE_HTML; } @@ -116,6 +139,19 @@ public class CreateContentWizard extends BaseContentWizard { this.content = content; } + + public List getCreateTemplateTypes() + { + List ttl = TemplatingService.getInstance().getTemplateTypes(); + List sil = new ArrayList(ttl.size()); + Iterator it = ttl.iterator(); + while (it.hasNext()) + { + TemplateType tt = (TemplateType)it.next(); + sil.add(new SelectItem(tt.getName(), tt.getName())); + } + return sil; + } /** * @return Returns a list of mime types to allow the user to select from @@ -165,6 +201,19 @@ public class CreateContentWizard extends BaseContentWizard return this.createMimeTypes; } + + public String getTemplateType() + { + return this.templateType; + } + + /** + * @param templateType Sets the currently selected template type + */ + public void setTemplateType(String templateType) + { + this.templateType = templateType; + } /** * @return Returns the summary data for the wizard. diff --git a/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java new file mode 100644 index 0000000000..52ce7f6712 --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.bean.content; + +import java.io.*; + +import java.util.Map; +import java.util.ResourceBundle; + +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.faces.model.SelectItem; +import javax.servlet.ServletContext; + +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigService; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.web.app.AlfrescoNavigationHandler; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.FileUploadBean; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.data.IDataContainer; +import org.alfresco.web.data.QuickSort; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.templating.*; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.w3c.dom.Document; + + +/** + * Bean implementation for the "Create Content Wizard" dialog + * + * @author arielb + */ +public class CreateXmlContentTypeWizard extends BaseContentWizard +{ + + private final static Log logger = LogFactory.getLog(CreateXmlContentTypeWizard.class); + private TemplateType tt; + + // ------------------------------------------------------------------------------ + // Wizard implementation + + @Override + protected String finishImpl(FacesContext context, String outcome) + throws Exception + { + + saveContent(this.getSchemaFile(), null); + final TemplatingService ts = TemplatingService.getInstance(); + ts.registerTemplateType(tt); + // return the default outcome + return outcome; + } + + @Override + public void init(Map parameters) + { + super.init(parameters); + + this.mimeType = "text/xml"; + this.clearUpload(); + } + + @Override + public String cancel() + { + this.clearUpload(); + return super.cancel(); + } + + @Override + public boolean getNextButtonDisabled() + { + // TODO: Allow the next button state to be configured so that + // wizard implementations don't have to worry about + // checking step numbers + + boolean disabled = false; + int step = Application.getWizardManager().getCurrentStep(); + switch(step) + { + case 1: + { + disabled = (this.fileName == null || this.fileName.length() == 0); + break; + } + } + + return disabled; + } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // as we were successful, go to the set properties dialog if asked + // to otherwise just return + if (this.showOtherProperties) + { + // we are going to immediately edit the properties so we need + // to setup the BrowseBean context appropriately + this.browseBean.setDocument(new Node(this.createdNode)); + + return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "dialog:setContentProperties"; + } + else + { + return outcome; + } + } + + /** + * Action handler called when the user wishes to remove an uploaded file + */ + public String removeUploadedFile() + { + clearUpload(); + + // refresh the current page + return null; + } + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + private FileUploadBean getFileUploadBean() + { + final FacesContext ctx = FacesContext.getCurrentInstance(); + final Map sessionMap = ctx.getExternalContext().getSessionMap(); + return (FileUploadBean)sessionMap.get(FileUploadBean.FILE_UPLOAD_BEAN_NAME); + } + + /** + * @return Returns the name of the file + */ + public String getFileName() + { + // try and retrieve the file and filename from the file upload bean + // representing the file we previously uploaded. + final FileUploadBean fileBean = this.getFileUploadBean(); + if (fileBean != null) + this.fileName = fileBean.getFileName(); + return this.fileName; + } + + /** + * @param fileName The name of the file + */ + public void setFileName(String fileName) + { + this.fileName = fileName; + + // we also need to keep the file upload bean in sync + final FileUploadBean fileBean = this.getFileUploadBean(); + if (fileBean != null) + fileBean.setFileName(this.fileName); + } + + /** + * @return Returns the schema file or null + */ + public File getSchemaFile() + { + // try and retrieve the file and filename from the file upload bean + // representing the file we previously uploaded. + final FileUploadBean fileBean = this.getFileUploadBean(); + return fileBean != null ? fileBean.getFile() : null; + } + + public void setSchemaFile(File f) + { + // we also need to keep the file upload bean in sync + final FileUploadBean fileBean = this.getFileUploadBean(); + if (fileBean != null) + fileBean.setFile(f); + } + /** + * @return Returns the schema file or null + */ + public String getSchemaFileName() + { + // try and retrieve the file and filename from the file upload bean + // representing the file we previously uploaded. + return getFileName(); + } + + public void setSchemaFileName(String s) + { + throw new UnsupportedOperationException(); + } + + public String getFormURL() + { + try + { + final TemplatingService ts = TemplatingService.getInstance(); + final String rootTagName = + this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1"); + final Document d = ts.parseXML(this.getSchemaFile()); + this.tt = ts.newTemplateType(rootTagName, d); + final TemplateInputMethod tim = tt.getInputMethods()[0]; + return tim.getInputURL(tt.getSampleXml(rootTagName), tt); + } + catch (Throwable t) + { + t.printStackTrace(); + return null; + } + } + + public String getSchemaFormURL() + { + try + { + final TemplatingService ts = TemplatingService.getInstance(); + final String rootTagName = + this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1"); + final Document d = ts.parseXML(this.getSchemaFile()); + this.tt = ts.newTemplateType(rootTagName, d); + final TemplateInputMethod tim = tt.getInputMethods()[0]; + return tim.getSchemaInputURL(tt); + } + catch (Throwable t) + { + t.printStackTrace(); + return null; + } + } + + /** + * @return Returns the summary data for the wizard. + */ + public String getSummary() + { + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + + // TODO: show first few lines of content here? + return buildSummary( + new String[] {bundle.getString("file_name"), + bundle.getString("type"), + bundle.getString("content_type")}, + new String[] {this.fileName, getSummaryObjectType(), + getSummaryMimeType(this.mimeType)}); + } + + // ------------------------------------------------------------------------------ + // Action event handlers + + // ------------------------------------------------------------------------------ + // Service Injection + + + // ------------------------------------------------------------------------------ + // Helper Methods + + /** + */ + protected void clearUpload() + { + // remove the file upload bean from the session + FacesContext ctx = FacesContext.getCurrentInstance(); + FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap(). + get(FileUploadBean.FILE_UPLOAD_BEAN_NAME); + if (fileBean != null) + fileBean.setFile(null); + } + +} diff --git a/source/java/org/alfresco/web/templating/TemplateInputMethod.java b/source/java/org/alfresco/web/templating/TemplateInputMethod.java new file mode 100644 index 0000000000..75c31f833d --- /dev/null +++ b/source/java/org/alfresco/web/templating/TemplateInputMethod.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating; + +import org.w3c.dom.Document; + +public interface TemplateInputMethod +{ + public String getInputURL(final Document xmlContent, + final TemplateType tt); + + public String getSchemaInputURL(final TemplateType tt); +} diff --git a/source/java/org/alfresco/web/templating/TemplateOutputMethod.java b/source/java/org/alfresco/web/templating/TemplateOutputMethod.java new file mode 100644 index 0000000000..525f5f93ba --- /dev/null +++ b/source/java/org/alfresco/web/templating/TemplateOutputMethod.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating; + +import java.io.Writer; + +import org.w3c.dom.Document; + +public interface TemplateOutputMethod +{ + + public void generate(final Document xmlContent, + final TemplateType tt, + final Writer out); +} diff --git a/source/java/org/alfresco/web/templating/TemplateType.java b/source/java/org/alfresco/web/templating/TemplateType.java new file mode 100644 index 0000000000..3c20397253 --- /dev/null +++ b/source/java/org/alfresco/web/templating/TemplateType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating; + +import org.w3c.dom.Document; + +public interface TemplateType +{ + + public String getName(); + + public Document getSchema(); + + public Document getSampleXml(final String rootTagName); + + public TemplateInputMethod[] getInputMethods(); + + public TemplateOutputMethod[] getOutputMethods(); +} diff --git a/source/java/org/alfresco/web/templating/TemplatingService.java b/source/java/org/alfresco/web/templating/TemplatingService.java new file mode 100644 index 0000000000..01fe985cb6 --- /dev/null +++ b/source/java/org/alfresco/web/templating/TemplatingService.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating; + +import java.io.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.*; + +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.alfresco.web.templating.xforms.*; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +public class TemplatingService +{ + private final static TemplatingService INSTANCE = new TemplatingService(); + + private ArrayList templateTypes = + new ArrayList(); + + private TemplatingService() + { + } + + public static TemplatingService getInstance() + { + return TemplatingService.INSTANCE; + } + + public List getTemplateTypes() + { + return this.templateTypes; + } + + public TemplateType getTemplateType(final String name) + { + final Iterator it = this.templateTypes.iterator(); + while (it.hasNext()) + { + final TemplateType tt = (TemplateType)it.next(); + if (tt.getName().equals(name)) + return tt; + } + return null; + } + + public void registerTemplateType(final TemplateType tt) + { + this.templateTypes.add(tt); + } + + public TemplateType newTemplateType(final String name, + final Document schema) + { + return new TemplateTypeImpl(name, schema); + } + + public void writeXML(final Node d, final File output) + { + try + { + System.out.println("writing out a document for " + d.getNodeName() + + " to " + output); + final TransformerFactory tf = TransformerFactory.newInstance(); + final Transformer t = tf.newTransformer(); + t.transform(new DOMSource(d), new StreamResult(output)); + } + catch (TransformerException te) + { + te.printStackTrace(); + assert false : te.getMessage(); + } + } + + public Document parseXML(final String source) + throws ParserConfigurationException, + SAXException, + IOException + { + return this.parseXML(new ByteArrayInputStream(source.getBytes())); + } + + public Document parseXML(final File source) + throws ParserConfigurationException, + SAXException, + IOException + { + return this.parseXML(new FileInputStream(source)); + } + + public Document parseXML(final InputStream source) + throws ParserConfigurationException, + SAXException, + IOException + { + final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setValidating(false); + final DocumentBuilder db = dbf.newDocumentBuilder(); + final Document result = db.parse(source); + source.close(); + return result; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/TemplateTypeImpl.java b/source/java/org/alfresco/web/templating/xforms/TemplateTypeImpl.java new file mode 100644 index 0000000000..5577b94088 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/TemplateTypeImpl.java @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms; + +import java.io.*; +import javax.xml.parsers.ParserConfigurationException; + +import org.alfresco.util.TempFileProvider; +import org.alfresco.web.templating.*; +import org.alfresco.web.templating.xforms.schemabuilder.FormBuilderException; + +import org.apache.xmlbeans.*; +import org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +public class TemplateTypeImpl + implements TemplateType +{ + + private final Document schema; + private final String name; + + public TemplateTypeImpl(final String name, + final Document schema) + { + this.name = name; + this.schema = schema; + } + + public String getName() + { + return this.name; + } + + public Document getSchema() + { + return this.schema; + } + + public Document getSampleXml(final String rootTagName) + { + XmlOptions xmlOptions = new XmlOptions(); + xmlOptions = xmlOptions.setLoadLineNumbers().setLoadMessageDigest(); + final XmlObject[] schemas = new XmlObject[1]; + try + { + final File schemaFile = TempFileProvider.createTempFile("alfresco", ".schema"); + TemplatingService.getInstance().writeXML(this.schema, schemaFile); + schemas[0] = XmlObject.Factory.parse(schemaFile, xmlOptions); + schemaFile.delete(); + } + catch (Exception e) + { + System.err.println("Can not load schema file: " + schema + ": "); + e.printStackTrace(); + } + + final XmlOptions compileOptions = new XmlOptions(); + compileOptions.setCompileDownloadUrls(); + compileOptions.setCompileNoPvrRule(); + compileOptions.setCompileNoUpaRule(); + + SchemaTypeSystem sts = null; + try + { + sts = XmlBeans.compileXsd(schemas, + XmlBeans.getBuiltinTypeSystem(), + compileOptions); + } + catch (XmlException xmle) + { + xmle.printStackTrace(); + return null; + } + + if (sts == null) + { + throw new NullPointerException("No Schemas to process."); + } + final SchemaType[] globalElems = sts.documentTypes(); + SchemaType elem = null; + for (int i = 0; i < globalElems.length; i++) + { + if (rootTagName.equals(globalElems[i].getDocumentElementName().getLocalPart())) + { + elem = globalElems[i]; + break; + } + } + + if (elem == null) + throw new NullPointerException("Could not find a global element with name \"" + rootTagName + "\""); + + final String result = SampleXmlUtil.createSampleForType(elem); + try + { + final TemplatingService ts = TemplatingService.getInstance(); + return ts.parseXML(new ByteArrayInputStream(result.getBytes())); + } + catch (ParserConfigurationException pce) + { + assert false : pce.getMessage(); + return null; + } + catch (SAXException saxe) + { + assert false : saxe.getMessage(); + return null; + } + catch (IOException ioe) + { + assert false : ioe.getMessage(); + return null; + } + } + + public TemplateInputMethod[] getInputMethods() + { + return new TemplateInputMethod[] { + new XFormsInputMethod() + }; + } + + public TemplateOutputMethod[] getOutputMethods() + { + return new TemplateOutputMethod[0]; + } +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/templating/xforms/XFormsInputMethod.java b/source/java/org/alfresco/web/templating/xforms/XFormsInputMethod.java new file mode 100644 index 0000000000..a3065c46bd --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/XFormsInputMethod.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms; + +import java.io.*; +import javax.faces.context.FacesContext; +import javax.servlet.ServletContext; + +import org.alfresco.util.TempFileProvider; +import org.alfresco.web.templating.*; +import org.alfresco.web.templating.xforms.schemabuilder.*; +import org.chiba.xml.util.DOMUtil; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +public class XFormsInputMethod + implements TemplateInputMethod +{ + + public XFormsInputMethod() + { + } + + public String getInputURL(final Document xmlContent, final TemplateType tt) + { + try + { + final Document xform = this.getXForm(xmlContent, tt); + final String id = getDocumentElementNameNoNS(xmlContent); + // this.saveInChiba(id, xform); + final File xformFile = TempFileProvider.createTempFile("alfresco", ".xform"); + final TemplatingService ts = TemplatingService.getInstance(); + ts.writeXML(xform, xformFile); + final FacesContext fc = FacesContext.getCurrentInstance(); + final String cp = + fc.getExternalContext().getRequestContextPath(); + return cp + "/XFormsServlet?form=" + xformFile.toURI().toString(); + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + } + + public String getSchemaInputURL(final TemplateType tt) + { + try + { +// final Document xform = this.getXFormForSchema(tt); +// final File xformFile = TempFileProvider.createTempFile("alfresco", ".xform"); +// final TemplatingService ts = TemplatingService.getInstance(); +// ts.writeXML(tt.getSchema(), xformFile); +// final FacesContext fc = FacesContext.getCurrentInstance(); +// final String cp = +// fc.getExternalContext().getRequestContextPath(); +// return cp + "/XFormsServlet?form=" + xformFile.toURI().toString(); + return null; + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + } + + private static String getDocumentElementNameNoNS(final Document d) + { + final Node n = d.getDocumentElement(); + String name = n.getNodeName(); + return name; +// String prefix = n.getPrefix(); +// String namespace = n.getNamespaceURI(); +// System.out.println("name " + name + " prefix " + prefix + " ns uri " + namespace); +// return name.replaceAll(".+\\:", ""); + } + +// public Document getXFormForSchema(final TemplateType tt) +// throws FormBuilderException +// { +// final TemplatingService ts = TemplatingService.getInstance(); +// +// final File schemaFile = TempFileProvider.createTempFile("alfresco", ".schema"); +// ts.writeXML(tt.getSchema(), schemaFile); +// final FacesContext fc = FacesContext.getCurrentInstance(); +// final String cp = +// fc.getExternalContext().getRequestContextPath(); +// +// final SchemaFormBuilder builder = +// new BaseSchemaFormBuilder("schema", +// schemaFile.toURI().toString(), +// cp + "/jsp/content/xforms/form/debug-instance.jsp", +// "post", +// new XHTMLWrapperElementsBuilder(), +// null, +// null, +// true); +// System.out.println("building xform for schema " + schemaFile.getPath()); +// final Document result = builder.buildForm("/Users/arielb/Documents/alfresco/xsd/XMLSchema.xsd"); +// // xmlContentFile.delete(); +// // schemaFile.delete(); +// return result; +// } + + public Document getXForm(final Document xmlContent, final TemplateType tt) + throws FormBuilderException + { + final TemplatingService ts = TemplatingService.getInstance(); + final File schemaFile = TempFileProvider.createTempFile("alfresco", ".schema"); + ts.writeXML(tt.getSchema(), schemaFile); + + final FacesContext fc = FacesContext.getCurrentInstance(); + final String cp = + fc.getExternalContext().getRequestContextPath(); + + final SchemaFormBuilder builder = + new BaseSchemaFormBuilder(getDocumentElementNameNoNS(xmlContent), + xmlContent, + "http://localhost:8080" + cp + "/jsp/content/xforms/debug-instance.jsp", + "post", + new XHTMLWrapperElementsBuilder(), + null, + null, + true); + System.out.println("building xform for schema " + schemaFile.getPath()); + final Document result = builder.buildForm(schemaFile.getPath()); + // xmlContentFile.delete(); + // schemaFile.delete(); + return result; + } + +// private void saveInChiba(final String fileName, final Document d) +// throws IOException +// { +// final ServletContext myContext = (ServletContext) +// FacesContext.getCurrentInstance().getExternalContext().getContext(); +// final ServletContext chiba = myContext.getContext("/chiba"); +// final File outputFile = new File(new File(chiba.getRealPath("/forms")), +// fileName + ".xhtml"); +// TemplatingService.getInstance().writeXML(d.getDocumentElement(), outputFile); +// } +} diff --git a/source/java/org/alfresco/web/templating/xforms/flux/EventLog.java b/source/java/org/alfresco/web/templating/xforms/flux/EventLog.java new file mode 100644 index 0000000000..43a7a1f6cc --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/flux/EventLog.java @@ -0,0 +1,127 @@ +package org.alfresco.web.templating.xforms.flux; + +import org.chiba.xml.util.DOMUtil; +import org.chiba.xml.xforms.XFormsConstants; +import org.chiba.xml.xforms.events.XFormsEvent; +import org.chiba.xml.xforms.events.XFormsEventFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * EventLog logs all events happening in XForms processor and build a DOM + * document which represent those events. + * + * @author Joern Turner + * @version $Id: EventLog.java,v 1.6 2005/12/21 22:59:27 unl Exp $ + */ +public class EventLog { + private static List HELPER_ELEMENTS = + Arrays.asList(new String[] + { + XFormsConstants.LABEL, + XFormsConstants.HELP, + XFormsConstants.HINT, + XFormsConstants.ALERT, + XFormsConstants.VALUE + }); + + private static List SELECTOR_ELEMENTS = + Arrays.asList(new String[] + { + XFormsConstants.SELECT1, + XFormsConstants.SELECT + }); + + private final Document doc; + private final Element root; + private Element selector; + + public EventLog() { + this.doc = DOMUtil.newDocument(false, false); + this.root = this.doc.createElement("eventlog"); + this.root.setAttribute("id", "eventlog"); + this.doc.appendChild(this.root); + } + + public Element getLog() { + return (Element) this.root.cloneNode(true); + } + + public void add(XFormsEvent event) { + // get target properties + String type = event.getType(); + Element target = (Element) event.getTarget(); + String targetId = target.getAttributeNS(null, "id"); + String targetName = target.getLocalName(); + + // create event element + Element element; + + if (XFormsEventFactory.CHIBA_STATE_CHANGED.equals(type) && SELECTOR_ELEMENTS.contains(targetName)) { + // selector events are always appended to the end of the log + // to ensure their items' labels and values are updated before + element = insert(null, type, targetId, targetName); + if (this.selector == null) + this.selector = element; + } + else + { + // all other events are inserted before any selector events + element = insert(this.selector, type, targetId, targetName); + } + + if (XFormsEventFactory.CHIBA_STATE_CHANGED.equals(type) && HELPER_ELEMENTS.contains(targetName)) + { + // parent id is needed for updating all helper elements cause they + // are identified by '-label' etc. rather than their own id + String parentId = ((Element) target.getParentNode()).getAttributeNS(null, "id"); + addProperty(element, "parentId", parentId); + } + + // add event params + Iterator iterator = event.getPropertyNames().iterator(); + while (iterator.hasNext()) + { + String name = (String) iterator.next(); + addProperty(element, name, event.getContextInfo(name).toString()); + } + } + + public Element add(String type, String targetId, String targetName){ + return insert(this.selector, type, targetId, targetName); + } + + public Element addProperty(Element element, String name, String value) { + Element property = this.doc.createElement("property"); + property.setAttribute("name", name); + property.appendChild(this.doc.createTextNode(value)); + element.appendChild(property); + + return element; + } + + private Element insert(Element ref, String type, String targetId, String targetName) + { + // create event element + Element element = this.doc.createElement("event"); + this.root.insertBefore(element, ref); + + // add target properties + element.setAttribute("type", type); + element.setAttribute("targetId", targetId); + element.setAttribute("targetName", targetName); + return element; + } + + + // clean the log + public void flush() + { + DOMUtil.removeAllChildren(this.root); + this.selector = null; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/flux/FluxAdapter.java b/source/java/org/alfresco/web/templating/xforms/flux/FluxAdapter.java new file mode 100644 index 0000000000..ef3e009d1e --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/flux/FluxAdapter.java @@ -0,0 +1,265 @@ +package org.alfresco.web.templating.xforms.flux; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chiba.adapter.AbstractChibaAdapter; +import org.chiba.adapter.ChibaEvent; +import org.alfresco.web.templating.xforms.servlet.HttpRequestHandler; +import org.alfresco.web.templating.xforms.servlet.ServletAdapter; +import org.alfresco.web.templating.xforms.servlet.ChibaServlet; +import org.chiba.xml.xforms.events.XFormsEvent; +import org.chiba.xml.xforms.events.XFormsEventFactory; +import org.chiba.xml.xforms.exception.XFormsException; +import org.chiba.xml.xforms.ui.Repeat; +import org.chiba.xml.util.DOMUtil; +import org.w3c.dom.events.Event; +import org.w3c.dom.events.EventListener; +import org.w3c.dom.events.EventTarget; +import org.w3c.dom.Element; + +import javax.xml.transform.TransformerException; +import javax.servlet.http.HttpSession; +import java.util.HashMap; +import java.util.Map; + +/** + * Adapter for processing DWR calls and building appropriate responses. This + * class is not exposed through DWR. Instead a Facadeclass 'FluxFacade' will be + * exposed that only allows to use the dispatch method. All other methods will + * be hidden for security. + * + * @author Joern Turner + * @version $Id: FluxAdapter.java,v 1.15 2005/12/21 22:59:27 unl Exp $ + */ +public class FluxAdapter extends AbstractChibaAdapter implements EventListener { + private static final Log LOGGER = LogFactory.getLog(FluxAdapter.class); + + private final HttpSession session; + private EventLog eventLog; + private EventTarget root; + + + public FluxAdapter(HttpSession session) { + this.chibaBean = createXFormsProcessor(); + this.context = new HashMap(); + chibaBean.setContext(this.context); + this.eventLog = new EventLog(); + this.session = session; + } + + /** + * initialize the Adapter. This is necessary cause often the using + * application will need to configure the Adapter before actually using it. + * + * @throws org.chiba.xml.xforms.exception.XFormsException + */ + public void init() throws XFormsException { + try { + // get docuent root as event target in order to capture all events + this.root = (EventTarget) this.chibaBean.getXMLContainer().getDocumentElement(); + + // interaction events my occur during init so we have to register before + this.root.addEventListener(XFormsEventFactory.CHIBA_LOAD_URI, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_RENDER_MESSAGE, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_REPLACE_ALL, this, true); + + // init processor + this.chibaBean.init(); + + // todo: add getter for event log + setContextParam("EVENT-LOG", this.eventLog); + + // register for notification events + this.root.addEventListener(XFormsEventFactory.CHIBA_STATE_CHANGED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_PROTOTYPE_CLONED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_ID_GENERATED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_ITEM_INSERTED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_ITEM_DELETED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_INDEX_CHANGED, this, true); + this.root.addEventListener(XFormsEventFactory.CHIBA_SWITCH_TOGGLED, this, true); + } + catch (Exception e) { + throw new XFormsException(e); + } + } + + /** + * Dispatch a ChibaEvent to trigger some XForms processing such as updating + * of values or execution of triggers. + * + * @param event an application specific event + * @throws org.chiba.xml.xforms.exception.XFormsException + * @see org.chiba.adapter.DefaultChibaEventImpl + */ + public void dispatch(ChibaEvent event) throws XFormsException { + LOGGER.debug("dispatching " + event); + this.eventLog.flush(); + String targetId = event.getId(); + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Event " + event.getEventName() + " dispatched"); + LOGGER.debug("Event target: " + targetId); +// try +// { +// DOMUtil.prettyPrintDOM(this.chibaBean.getXMLContainer(), System.out); +// } catch (TransformerException e) { +// throw new XFormsException(e); +// } + } + + if (event.getEventName().equals(FluxFacade.FLUX_ACTIVATE_EVENT)) + chibaBean.dispatch(targetId, XFormsEventFactory.DOM_ACTIVATE); + else if (event.getEventName().equals("SETINDEX")) { + int position = Integer.parseInt((String) event.getContextInfo()); + Repeat repeat = (Repeat) this.chibaBean.lookup(targetId); + repeat.setIndex(position); + } + else if (event.getEventName().equals("SETVALUE")) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Event contextinfo: " + event.getContextInfo()); + this.chibaBean.updateControlValue(targetId, (String) event.getContextInfo()); + } + else if (event.getEventName().equalsIgnoreCase("http-request")) { + // todo: make request handler member of web adapter + HttpRequestHandler httpRequestHandler = new HttpRequestHandler(this.chibaBean); + httpRequestHandler.execute(event); + } + else { + throw new XFormsException("Unknown or illegal event type"); + } + } + + /** + * listen to processor and add a DefaultChibaEventImpl object to the + * EventQueue. + * + * @param event the handled DOMEvent + */ + public void handleEvent(Event event) + { + LOGGER.debug("handleEvent(" + event + ")"); + try { + if (event instanceof XFormsEvent) + { + XFormsEvent xformsEvent = (XFormsEvent) event; + String type = xformsEvent.getType(); + if (XFormsEventFactory.CHIBA_REPLACE_ALL.equals(type)) + { + // get event context and store it in session + Map submissionResponse = new HashMap(); + submissionResponse.put("header", xformsEvent.getContextInfo("header")); + submissionResponse.put("body", xformsEvent.getContextInfo("body")); + this.session.setAttribute(ChibaServlet.CHIBA_SUBMISSION_RESPONSE, submissionResponse); + + // get event properties + Element target = (Element) event.getTarget(); + String targetId = target.getAttributeNS(null, "id"); + String targetName = target.getLocalName(); + + // add event properties to log + this.eventLog.add(type, targetId, targetName); + } + else + { + // add event to log + this.eventLog.add(xformsEvent); + } + } + } + catch (Exception e) { + System.out.println("**** " + e.getMessage()); + LOGGER.debug("error " + e.getMessage() + " while handling event " + event); + try { + this.chibaBean.getContainer().handleEventException(e); + } + catch (XFormsException xfe) { + xfe.printStackTrace(); + } + } + } + + + /** + * terminates the XForms processing. right place to do cleanup of + * resources. + * + * @throws org.chiba.xml.xforms.exception.XFormsException + */ + public void shutdown() throws XFormsException { + try { + // deregister for notification events + this.root.removeEventListener(XFormsEventFactory.CHIBA_STATE_CHANGED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_PROTOTYPE_CLONED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_ID_GENERATED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_ITEM_INSERTED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_ITEM_DELETED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_INDEX_CHANGED, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_SWITCH_TOGGLED, this, true); + + // shutdown processor + this.chibaBean.shutdown(); + this.chibaBean = null; + + // deregister for interaction events + this.root.removeEventListener(XFormsEventFactory.CHIBA_LOAD_URI, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_RENDER_MESSAGE, this, true); + this.root.removeEventListener(XFormsEventFactory.CHIBA_REPLACE_ALL, this, true); + + this.root = null; + + System.gc(); + } + catch (Exception e) { + throw new XFormsException(e); + } + } + + /** + * set the upload location. This string represents the destination + * (data-sink) for uploads. + * + * @param destination a String representing the location where to store + * uploaded files/data. + */ + public void setUploadDestination(String destination) { + this.uploadDestination = destination; + //todo: this should be moved to parent class. it's duplicated in both Adapters + setContextParam(ServletAdapter.HTTP_UPLOAD_DIR, this.uploadDestination); + } + + protected String escape(String string) { + if (string == null) { + return string; + } + + StringBuffer buffer = new StringBuffer(string.length()); + char c; + for (int index = 0; index < string.length(); index++) { + c = string.charAt(index); + switch (c) { + case '\n': + buffer.append('\\').append('n'); + break; + case '\r': + buffer.append('\\').append('r'); + break; + case '\t': + buffer.append('\\').append('t'); + break; + case '\'': + buffer.append('\\').append('\''); + break; + case '\"': + buffer.append('\\').append('\"'); + break; + default: + buffer.append(c); + break; + } + } + + return buffer.toString(); + } + +} +// end of class diff --git a/source/java/org/alfresco/web/templating/xforms/flux/FluxException.java b/source/java/org/alfresco/web/templating/xforms/flux/FluxException.java new file mode 100644 index 0000000000..9427552913 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/flux/FluxException.java @@ -0,0 +1,23 @@ +package org.alfresco.web.templating.xforms.flux; + +/** + * Used for signalling problems with Flux execution + * + * @author Joern Turner + * @version $Id: FluxException.java,v 1.1 2005/11/08 17:34:07 joernt Exp $ + */ +public class FluxException extends Exception{ + + public FluxException() { + } + + public FluxException(String string) { + super(string); + } + + public FluxException(Throwable throwable) { + super(throwable); + } +} + + diff --git a/source/java/org/alfresco/web/templating/xforms/flux/FluxFacade.java b/source/java/org/alfresco/web/templating/xforms/flux/FluxFacade.java new file mode 100644 index 0000000000..9a5f91ed3e --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/flux/FluxFacade.java @@ -0,0 +1,144 @@ +package org.alfresco.web.templating.xforms.flux; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chiba.adapter.ChibaAdapter; +import org.chiba.adapter.ChibaEvent; +import org.chiba.adapter.DefaultChibaEventImpl; +import org.alfresco.web.templating.xforms.servlet.ChibaServlet; +import org.chiba.xml.util.DOMUtil; +import org.chiba.xml.xforms.exception.XFormsException; +import org.w3c.dom.Element; +import uk.ltd.getahead.dwr.ExecutionContext; + +import javax.servlet.http.HttpSession; +import javax.xml.transform.TransformerException; + +/** + * AJAX Facade class to hide the full functionality from the web-client. + * + * @author Joern Turner + * @version $Id: FluxFacade.java,v 1.9 2005/12/21 19:06:55 unl Exp $ + */ +public class FluxFacade +{ + + //this is a custom event to activate a trigger in XForms. + private static final Log LOGGER = LogFactory.getLog(FluxFacade.class); + public static final String FLUX_ACTIVATE_EVENT = "flux-action-event"; + ChibaAdapter adapter = null; + private HttpSession session; + + + /** + * grabs the actual adapter from the session. + */ + public FluxFacade() { + session = ExecutionContext.get().getSession(); + adapter = (ChibaAdapter) session.getAttribute(ChibaServlet.CHIBA_ADAPTER); + } + + /** + * executes a trigger + * + * @param id the id of the trigger to execute + * @return the list of events that may result through this action + * @throws FluxException + */ + public Element fireAction(String id) throws FluxException { + LOGGER.debug("fireAction " + id); + ChibaEvent chibaActivateEvent = new DefaultChibaEventImpl(); + chibaActivateEvent.initEvent(FLUX_ACTIVATE_EVENT, id, null); + return dispatch(chibaActivateEvent); + } + + /** + * sets the value of a control in the processor. + * + * @param id the id of the control in the host document + * @param value the new value + * @return the list of events that may result through this action + * @throws FluxException + */ + public Element setXFormsValue(String id, String value) throws FluxException { + LOGGER.debug("setXFormsValue(" + id + ", " + value + ")"); + ChibaEvent event = new DefaultChibaEventImpl(); + event.initEvent("SETVALUE", id, value); + return dispatch(event); + } + + public Element setRepeatIndex(String id, String position) throws FluxException { + LOGGER.debug("setRepeatPosition(" + id + ", " + position + ")"); + ChibaEvent event = new DefaultChibaEventImpl(); + event.initEvent("SETINDEX", id, position); + return dispatch(event); + } + + /** + * fetches the progress of a running upload. + * + * @param id id of the upload control in use + * @param filename filename for uploaded data + * @return a array containing two elements for evaluation in browser. First + * param is the upload control id and second will be the current + * progress of the upload. + */ + public Element fetchProgress(String id, String filename) { + String progress = "0"; + + if (session.getAttribute(filename) != null) { + progress = ((Integer) session.getAttribute(filename)).toString(); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Percent completed: " + progress); + } + } + + EventLog eventLog = (EventLog) adapter.getContextParam("EVENT-LOG"); + if (eventLog == null) { + eventLog = new EventLog(); + } + Element eventlogElement = eventLog.getLog(); + eventLog.flush(); + + Element progressEvent = eventLog.add("upload-progress-event", id, "upload"); + eventLog.addProperty(progressEvent, "progress", progress); + return eventlogElement; + } + + private Element dispatch(ChibaEvent event) throws FluxException { + LOGGER.debug("dispatching " + event); + if (adapter != null) { + try { + adapter.dispatch(event); + } + catch (XFormsException e) { + throw new FluxException(e); + } + } + else { + //session expired or cookie got lost + throw new FluxException("Session expired. Please start again."); + } + EventLog eventLog = (EventLog) adapter.getContextParam("EVENT-LOG"); + Element eventlogElement = eventLog.getLog(); + + if (LOGGER.isDebugEnabled()) { + try + { + DOMUtil.prettyPrintDOM(eventlogElement, System.out); + } + catch (TransformerException e) + { + e.printStackTrace(); + } + } + return eventlogElement; + } + + public String getInfo() + { + return "FluxFacade using " + adapter.toString(); + } +} + +// end of class diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/AbstractSchemaFormBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/AbstractSchemaFormBuilder.java new file mode 100644 index 0000000000..823e5ac5f7 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/AbstractSchemaFormBuilder.java @@ -0,0 +1,3313 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.jxpath.Pointer; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Layout; +import org.apache.log4j.SimpleLayout; +import org.apache.xerces.xs.*; +import org.chiba.xml.util.DOMUtil; +import org.chiba.xml.xforms.NamespaceCtx; +import org.w3c.dom.*; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import org.xml.sax.InputSource; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.*; + +/* + * Search for TODO for things remaining to-do in this implementation. + * + * TODO: Support configuration mechanism to allow properties to be set without programming. + * TODO: i18n/l10n of messages, hints, captions. Possibly leverage org.chiba.i18n classes. + * TODO: When Chiba supports itemset, use schema keyref and key constraints for validation. + * TODO: Support namespaces in instance documents. Currently can't do this due to Chiba bugs. + * TODO: Place default values for list and enumeration types at the beginning of the item list. + * + */ + +/** + * An abstract implementation of the SchemaFormBuilder interface allowing + * an XForm to be automatically generated for an XML Schema definition. + * This abstract class implements the buildForm and buildFormAsString methods + * and associated helper but relies on concrete subclasses to implement other + * required interface methods (createXXX, startXXX, and endXXX methods). + * + * @author $Author: unl $ + * @version $Id: AbstractSchemaFormBuilder.java,v 1.25 2005/03/29 14:12:06 unl Exp $ + */ +public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder { + + private final Comparator typeExtensionSorter = new Comparator() + { + public int compare(Object obj1, Object obj2) + { + if (obj1 == null && obj2 != null) + return -1; + else if (obj1 != null && obj2 == null) + return 1; + else if (obj1 == obj2 || (obj1 == null && obj2 == null)) + return 0; + else + { + try + { + final XSTypeDefinition type1 = (XSTypeDefinition) obj1; + final XSTypeDefinition type2 = (XSTypeDefinition) obj2; + return (type1.derivedFromType(type2, XSConstants.DERIVATION_EXTENSION) + ? 1 + : (type2.derivedFromType(type1, XSConstants.DERIVATION_EXTENSION) + ? -1 + : 0)); + } + catch (ClassCastException ex) + { + String s = "ClassCastException in typeExtensionSorter: one of the types is not a type !"; + s = s + "\n obj1 class = " + obj1.getClass().getName() + ", toString=" + obj1.toString(); + s = s + "\n obj2 class = " + obj2.getClass().getName() + ", toString=" + obj2.toString(); + SchemaFormBuilder.LOGGER.error(s, ex); + return 0; + } + } + } + }; + + private static final String PROPERTY_PREFIX = + "http://www.chiba.org/properties/schemaFormBuilder/"; + /** + * Property to control the cascading style sheet used for the XForm - corresponds to envelope@chiba:css-style. + */ + public static final String CSS_STYLE_PROP = + PROPERTY_PREFIX + "envelope@css-style"; + private static final String DEFAULT_CSS_STYLE_PROP = "style.css"; + + /** + * Property to control the selection of UI control for a selectOne control. + * If a selectOne control has >= the number of values specified in this property, + * it is considered a long list, and the UI control specified by + * SELECTONE_UI_CONTROL_LONG_PROP is used. Otherwise, the value of SELECTONE_UI_CONTROL_SHORT_PROP + * is used. + */ + public static final String SELECTONE_LONG_LIST_SIZE_PROP = + PROPERTY_PREFIX + "select1@longListSize"; + + /** + * Property to specify the selectMany UI control to be used when there are releatively few items + * to choose from. + */ + public static final String SELECTONE_UI_CONTROL_SHORT_PROP = + PROPERTY_PREFIX + "select1@appearance/short"; + + /** + * Property to specify the selectMany UI control to be used when there are large numbers of items + * to choose from. + */ + public static final String SELECTONE_UI_CONTROL_LONG_PROP = + PROPERTY_PREFIX + "select1@appearance/long"; + private static final String DEFAULT_SELECTONE_UI_CONTROL_SHORT_PROP = + "full"; + private static final String DEFAULT_SELECTONE_UI_CONTROL_LONG_PROP = + "minimal"; + + /** + * Property to control the selection of UI control for a selectMany control. + * If a selectMany control has >= the number of values specified in this property, + * it is considered a long list, and the UI control specified by + * SELECTMANY_UI_CONTROL_LONG_PROP is used. Otherwise, the value of SELECTMANY_UI_CONTROL_SHORT_PROP + * is used. + */ + public static final String SELECTMANY_LONG_LIST_SIZE_PROP = + PROPERTY_PREFIX + "select@longListSize"; + + /** + * Property to specify the selectMany UI control to be used when there are releatively few items + * to choose from. + */ + public static final String SELECTMANY_UI_CONTROL_SHORT_PROP = + PROPERTY_PREFIX + "select@appearance/short"; + + /** + * Property to specify the selectMany UI control to be used when there are large numbers of items + * to choose from. + */ + public static final String SELECTMANY_UI_CONTROL_LONG_PROP = + PROPERTY_PREFIX + "select@appearance/long"; + private static final String DEFAULT_SELECTMANY_UI_CONTROL_SHORT_PROP = + "full"; + private static final String DEFAULT_SELECTMANY_UI_CONTROL_LONG_PROP = + "compact"; + private static final String DEFAULT_LONG_LIST_MAX_SIZE = "6"; + + /** + * Property to control the box alignment of a group - corresponds to xforms:group@chiba:box-align. + * There are four valid values for this property - right, left, top, and bottom. + * The default value is right. + */ + public static final String GROUP_BOX_ALIGN_PROP = + PROPERTY_PREFIX + "group@box-align"; + private static final String DEFAULT_GROUP_BOX_ALIGN = "right"; + + /** + * Property to control the box orientation of a group - corresponds to xforms:group@chiba:box-orient. + * There are two valid values for this property - vertical and horizontal. + * The default value is vertical. + */ + public static final String GROUP_BOX_ORIENT_PROP = + PROPERTY_PREFIX + "group@box-orient"; + private static final String DEFAULT_GROUP_BOX_ORIENT = "vertical"; + + /** + * Property to control the width of a group - corresponds to xforms:group/@chiba:width. + * This value may be expressed as a percentage value or as an absolute size. + */ + public static final String GROUP_WIDTH_PROP = + PROPERTY_PREFIX + "group@width"; + private static final String DEFAULT_GROUP_WIDTH = "60%"; + + /** + * Property to control the caption width of a group - corresponds to xforms:group/@chiba:caption-width. + * This value may be expressed as a percentage value or as an absolute size. + */ + public static final String GROUP_CAPTION_WIDTH_PROP = + PROPERTY_PREFIX + "group@caption-width"; + private static final String DEFAULT_GROUP_CAPTION_WIDTH = "30%"; + + /** + * Property to control the border of a group - corresponds to xforms:group/@chiba:border. + * A value of 0 indicates no border, a value of 1 indicates a border is provided. + */ + public static final String GROUP_BORDER_PROP = + PROPERTY_PREFIX + "group@border"; + private static final String DEFAULT_GROUP_BORDER = "0"; + + /** + * Prossible values of the "@method" on the "submission" element + */ + public static final String SUBMIT_METHOD_POST = "post"; + + /** + * __UNDOCUMENTED__ + */ + public static final String SUBMIT_METHOD_PUT = "put"; + + /** + * __UNDOCUMENTED__ + */ + public static final String SUBMIT_METHOD_GET = "get"; + + /** + * __UNDOCUMENTED__ + */ + public static final String SUBMIT_METHOD_FORM_DATA_POST = "form-data-post"; + + /** + * __UNDOCUMENTED__ + */ + public static final String SUBMIT_METHOD_URLENCODED_POST = + "urlencoded-post"; + + /** + * possible instance modes + */ + public static final int INSTANCE_MODE_NONE = 0; + + /** + * __UNDOCUMENTED__ + */ + public static final int INSTANCE_MODE_INCLUDED = 1; + + /** + * __UNDOCUMENTED__ + */ + public static final int INSTANCE_MODE_HREF = 2; + + /** + * __UNDOCUMENTED__ + */ + protected Source _instanceSource; + + /** + * __UNDOCUMENTED__ + */ + protected Document _instanceDocument; + + /** + * __UNDOCUMENTED__ + */ + protected String _action; + + /** + * __UNDOCUMENTED__ + */ + protected String _instanceHref; + + /** + * Properties choosed by the user + */ + protected String _rootTagName; + + /** + * __UNDOCUMENTED__ + */ + protected String _stylesheet; + + /** + * __UNDOCUMENTED__ + */ + protected String _submitMethod; + + /** + * __UNDOCUMENTED__ + */ + protected String _base; + + /** + * __UNDOCUMENTED__ + */ + protected WrapperElementsBuilder _wrapper = new XHTMLWrapperElementsBuilder(); + + /** + * __UNDOCUMENTED__ + */ + protected int _instanceMode = 0; + + /** + * __UNDOCUMENTED__ + */ + protected boolean _useSchemaTypes = false; + + private DocumentBuilder documentBuilder; + + /** + * generic counter -> replaced by an hashMap with: + * keys: name of the elements + * values: "Long" representing the counter for this element + */ + + //private long refCounter; + private HashMap counter; + private final Properties properties = new Properties(); + protected XSModel schema; + private String targetNamespace; + + private final Map namespacePrefixes = new HashMap(); + + // typeTree + // each entry is keyed by the type name + // value is an ArrayList that contains the XSTypeDefinition's which + // are compatible with the specific type. Compatible means that + // can be used as a substituted type using xsi:type + // In order for it to be compatible, it cannot be abstract, and + // it must be derived by extension. +// The ArrayList does not contain its own type + has the other types only once + // + private final TreeMap typeTree = new TreeMap(); + + /** + * Creates a new instance of AbstractSchemaFormBuilder + */ + public AbstractSchemaFormBuilder(String rootTagName) { + this._rootTagName = rootTagName; + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + + try { + factory.setNamespaceAware(true); + factory.setValidating(false); + documentBuilder = factory.newDocumentBuilder(); + } catch (ParserConfigurationException x) { + x.printStackTrace(); + } + + reset(); + } + + /** + * Creates a new AbstractSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceSource __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public AbstractSchemaFormBuilder(String rootTagName, + Source instanceSource, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + this(rootTagName); + this._instanceSource = instanceSource; + + if (instanceSource != null) + this._instanceMode = AbstractSchemaFormBuilder.INSTANCE_MODE_INCLUDED; + + this._action = action; + this._stylesheet = stylesheet; + this._base = base; + this._useSchemaTypes = userSchemaTypes; + + //control if it is one of the SUBMIT_METHOD attributes? + this._submitMethod = submitMethod; + this._wrapper = wrapper; + } + + /** + * Creates a new AbstractSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceSource __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public AbstractSchemaFormBuilder(String rootTagName, + Document instanceDocument, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + this(rootTagName); + this._instanceDocument = instanceDocument; + + if (instanceDocument != null) + this._instanceMode = AbstractSchemaFormBuilder.INSTANCE_MODE_INCLUDED; + + this._action = action; + this._stylesheet = stylesheet; + this._base = base; + this._useSchemaTypes = userSchemaTypes; + + //control if it is one of the SUBMIT_METHOD attributes? + this._submitMethod = submitMethod; + this._wrapper = wrapper; + } + + /** + * Creates a new AbstractSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceHref __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public AbstractSchemaFormBuilder(String rootTagName, + String instanceHref, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + this(rootTagName); + this._instanceHref = instanceHref; + + if ((instanceHref != null) && !"".equals(instanceHref)) + this._instanceMode = AbstractSchemaFormBuilder.INSTANCE_MODE_HREF; + + this._action = action; + this._stylesheet = stylesheet; + this._base = base; + this._useSchemaTypes = userSchemaTypes; + + //control if it is one of the SUBMIT_METHOD attributes? + this._submitMethod = submitMethod; + this._wrapper = wrapper; + + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getAction() { + return _action; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getInstanceHref() { + return _instanceHref; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public int getInstanceMode() { + return _instanceMode; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public Source getInstanceSource() { + return _instanceSource; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public Document getInstanceDocument() { + return _instanceDocument; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public Properties getProperties() { + return properties; + } + + /** + * __UNDOCUMENTED__ + * + * @param key __UNDOCUMENTED__ + * @param value __UNDOCUMENTED__ + */ + public void setProperty(String key, String value) { + getProperties().setProperty(key, value); + } + + /** + * __UNDOCUMENTED__ + * + * @param key __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String getProperty(String key) { + return getProperties().getProperty(key); + } + + /** + * __UNDOCUMENTED__ + * + * @param key __UNDOCUMENTED__ + * @param defaultValue __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String getProperty(String key, String defaultValue) { + return getProperties().getProperty(key, defaultValue); + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getRootTagName() { + return _rootTagName; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getStylesheet() { + return _stylesheet; + } + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getSubmitMethod() { + return _submitMethod; + } + + private void loadSchema(String inputURI) + throws ClassNotFoundException, + InstantiationException, + IllegalAccessException + { + + // Get DOM Implementation using DOM Registry + System.setProperty(DOMImplementationRegistry.PROPERTY, + "org.apache.xerces.dom.DOMXSImplementationSourceImpl"); + DOMImplementationRegistry registry = + DOMImplementationRegistry.newInstance(); + Object o = registry.getDOMImplementation("XS-Loader"); + if (o instanceof XSImplementation) + { + XSImplementation impl = (XSImplementation) o; + XSLoader schemaLoader = impl.createXSLoader(null); + this.schema = schemaLoader.loadURI(inputURI); + } + else if (o != null) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("DOMImplementation is not a XSImplementation: " + + o.getClass().getName()); + } + throw new RuntimeException(o.getClass().getName() + " is not a XSImplementation"); + } + } + + /** + * builds a form from a XML schema. + * + * @param inputURI the URI of the Schema to be used + * @return __UNDOCUMENTED__ + * @throws FormBuilderException __UNDOCUMENTED__ + */ + public Document buildForm(String inputFile) throws FormBuilderException { + try { + this.loadSchema(new File(inputFile).toURI().toString()); + buildTypeTree(schema); + + //refCounter = 0; + counter = new HashMap(); + + Document xForm = + createFormTemplate(_rootTagName, + _rootTagName + " Form", + getProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP)); + + //this.buildInheritenceTree(schema); + Element envelopeElement = xForm.getDocumentElement(); + + //Element formSection = (Element) envelopeElement.getElementsByTagNameNS(CHIBA_NS, "form").item(0); + //Element formSection =(Element) envelopeElement.getElementsByTagName("body").item(0); + //find form element: last element created + NodeList children = xForm.getDocumentElement().getChildNodes(); + + Element formSection = (Element)children.item(children.getLength() - 1); + Element modelSection = (Element) + envelopeElement.getElementsByTagNameNS(XFORMS_NS, "model").item(0); + + //add XMLSchema if we use schema types + if (_useSchemaTypes && modelSection != null) + modelSection.setAttributeNS(XFORMS_NS, + this.getXFormsNSPrefix() + "schema", + new File(inputFile).toURI().toString()); + + //change stylesheet + String stylesheet = this.getStylesheet(); + + if (stylesheet != null && stylesheet.length() != 0) + envelopeElement.setAttributeNS(CHIBA_NS, + this.getChibaNSPrefix() + "stylesheet", + stylesheet); + + // TODO: Commented out because comments aren't output properly by the Transformer. + //String comment = "This XForm was automatically generated by " + this.getClass().getName() + " on " + (new Date()) + System.getProperty("line.separator") + " from the '" + rootElementName + "' element from the '" + schema.getSchemaTargetNS() + "' XML Schema."; + //xForm.insertBefore(xForm.createComment(comment),envelopeElement); + //xxx XSDNode node = findXSDNodeByName(rootElementTagName,schemaNode.getElementSet()); + + //check if target namespace + //no way to do this with XS API ? load DOM document ? + //TODO: find a better way to find the targetNamespace + try + { + Document domDoc = DOMUtil.parseXmlFile(inputFile, true, false); + if (domDoc != null) + { + Element root = domDoc.getDocumentElement(); + targetNamespace = root.getAttribute("targetNamespace"); + if (targetNamespace != null && targetNamespace.length() == 0) + targetNamespace = null; + } + LOGGER.debug("using targetNamespace " + targetNamespace); + } catch (Exception ex) { + LOGGER.error("Schema not loaded as DOM document: " + ex.getMessage()); + } + + //if target namespace & we use the schema types: add it to form ns declarations + if (_useSchemaTypes && + targetNamespace != null && targetNamespace.length() != 0) + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:schema", + targetNamespace); + + //TODO: WARNING: in Xerces 2.6.1, parameters are switched !!! (name, namespace) + //XSElementDeclaration rootElementDecl =schema.getElementDeclaration(targetNamespace, _rootTagName); + XSElementDeclaration rootElementDecl = + this.schema.getElementDeclaration(_rootTagName, targetNamespace); + + if (rootElementDecl == null) { + //DEBUG + rootElementDecl = this.schema.getElementDeclaration(targetNamespace, + _rootTagName); + if (rootElementDecl != null && LOGGER.isDebugEnabled()) + LOGGER.debug("getElementDeclaration: inversed parameters OK !!!"); + + throw new FormBuilderException("Invalid root element tag name [" + + _rootTagName + + ", targetNamespace=" + + targetNamespace + + "]"); + } + + Element instanceElement = (Element) + modelSection.appendChild(xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "instance")); + this.setXFormsId(instanceElement); + + Element rootElement; + + if (_instanceMode == AbstractSchemaFormBuilder.INSTANCE_MODE_NONE) + { + rootElement = (Element) instanceElement.appendChild(xForm.createElementNS(targetNamespace, getElementName(rootElementDecl, xForm))); + + String prefix = xmlSchemaInstancePrefix.substring(0, xmlSchemaInstancePrefix.length() - 1); + rootElement.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns:" + prefix, XMLSCHEMA_INSTANCE_NAMESPACE_URI); + + } + else if (_instanceMode == AbstractSchemaFormBuilder.INSTANCE_MODE_INCLUDED) + { + //get the instance element + boolean ok = true; + try + { + if (_instanceDocument == null) + { + DocumentBuilderFactory docFact = DocumentBuilderFactory.newInstance(); + docFact.setNamespaceAware(true); + docFact.setValidating(false); + DocumentBuilder parser = docFact.newDocumentBuilder(); + _instanceDocument = parser.parse(new InputSource(_instanceSource.getSystemId())); + } + //possibility abandonned for the moment: + //modify the instance to add the correct "xsi:type" attributes wherever needed + //Document instanceDoc=this.setXMLSchemaAndPSVILoad(inputURI, _instanceSource, targetNamespace); + + if (_instanceDocument == null) + { + LOGGER.debug("instanceDocument is null"); + ok = false; + } + else + { + Element instanceInOtherDoc = _instanceDocument.getDocumentElement(); + if (!instanceInOtherDoc.getNodeName().equals(_rootTagName)) + throw new IllegalArgumentException("instance document root tag name invalid. " + + "expected " + _rootTagName + + ", got " + instanceInOtherDoc.getNodeName()); + else + { + LOGGER.debug("importing rootElement from other document"); + rootElement = (Element)xForm.importNode(instanceInOtherDoc, true); + instanceElement.appendChild(rootElement); + + //add XMLSchema instance NS + String prefix = xmlSchemaInstancePrefix.substring(0, xmlSchemaInstancePrefix.length() - 1); + if (!rootElement.hasAttributeNS(XMLNS_NAMESPACE_URI, prefix)) + rootElement.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns:" + prefix, XMLSCHEMA_INSTANCE_NAMESPACE_URI); + + //possibility abandonned for the moment: + //modify the instance to add the correct "xsi:type" attributes wherever needed + //this.addXSITypeAttributes(rootElement); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + + //if there is an exception we put the empty root element + ok = false; + } + + //if there was a problem + if (!ok) + { + LOGGER.debug("using empty root for " + _rootTagName); + rootElement = (Element) + instanceElement.appendChild(xForm.createElement(_rootTagName)); + } + } + else if (_instanceMode == AbstractSchemaFormBuilder.INSTANCE_MODE_HREF) + //add the xlink:href attribute + { + instanceElement.setAttributeNS(SchemaFormBuilder.XLINK_NS, + this.getXLinkNSPrefix() + "href", + _instanceHref); + } + + Element formContentWrapper = + _wrapper.createGroupContentWrapper(formSection); + addElement(xForm, + modelSection, + formContentWrapper, + rootElementDecl, + rootElementDecl.getTypeDefinition(), + "/" + getElementName(rootElementDecl, xForm)); + + Element submitInfoElement = (Element) + modelSection.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "submission")); + + //submitInfoElement.setAttributeNS(XFORMS_NS,getXFormsNSPrefix()+"id","save"); + String submissionId = this.setXFormsId(submitInfoElement); + + //action + submitInfoElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "action", + _action == null ? "" : _action); + + //method + submitInfoElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "method", + (_submitMethod != null && _submitMethod.length() != 0 + ? _submitMethod + : AbstractSchemaFormBuilder.SUBMIT_METHOD_POST)); + + //Element submitButton = (Element) formSection.appendChild(xForm.createElementNS(XFORMS_NS,getXFormsNSPrefix()+"submit")); + Element submitButton = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "submit"); + Element submitControlWrapper = + _wrapper.createControlsWrapper(submitButton); + formContentWrapper.appendChild(submitControlWrapper); + submitButton.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "submission", + submissionId); + this.setXFormsId(submitButton); + + Element submitButtonCaption = (Element) + submitButton.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + submitButtonCaption.appendChild(xForm.createTextNode("Submit")); + this.setXFormsId(submitButtonCaption); + return xForm; + } catch (ParserConfigurationException x) { + throw new FormBuilderException(x); + } catch (ClassNotFoundException x) { + throw new FormBuilderException(x); + } catch (InstantiationException x) { + throw new FormBuilderException(x); + } catch (IllegalAccessException x) { + throw new FormBuilderException(x); + } + } + + /** + * This method is invoked after the form builder is finished creating and processing + * a form control. Implementations may choose to use this method to add/inspect/modify + * the controlElement prior to the builder moving onto the next control. + * + * @param controlElement The form control element that was created. + * @param controlType The XML Schema type for which controlElement was created. + */ + public void endFormControl(Element controlElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs) { + } + + /** + * __UNDOCUMENTED__ + */ + public void reset() { + //refCounter = 0; + counter = new HashMap(); + setProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP); + setProperty(SELECTMANY_LONG_LIST_SIZE_PROP, DEFAULT_LONG_LIST_MAX_SIZE); + setProperty(SELECTMANY_UI_CONTROL_SHORT_PROP, + DEFAULT_SELECTMANY_UI_CONTROL_SHORT_PROP); + setProperty(SELECTMANY_UI_CONTROL_LONG_PROP, + DEFAULT_SELECTMANY_UI_CONTROL_LONG_PROP); + setProperty(SELECTONE_LONG_LIST_SIZE_PROP, DEFAULT_LONG_LIST_MAX_SIZE); + setProperty(SELECTONE_UI_CONTROL_SHORT_PROP, + DEFAULT_SELECTONE_UI_CONTROL_SHORT_PROP); + setProperty(SELECTONE_UI_CONTROL_LONG_PROP, + DEFAULT_SELECTONE_UI_CONTROL_LONG_PROP); + setProperty(GROUP_BOX_ALIGN_PROP, DEFAULT_GROUP_BOX_ALIGN); + setProperty(GROUP_BOX_ORIENT_PROP, DEFAULT_GROUP_BOX_ORIENT); + setProperty(GROUP_CAPTION_WIDTH_PROP, DEFAULT_GROUP_CAPTION_WIDTH); + setProperty(GROUP_WIDTH_PROP, DEFAULT_GROUP_WIDTH); + setProperty(GROUP_BORDER_PROP, DEFAULT_GROUP_BORDER); + } + + /** + * Returns the most-specific built-in base type for the provided type. + */ + protected short getBuiltInType(XSTypeDefinition type) { + // type.getName() may be 'null' for anonymous types, so compare against + // static string (see bug #1172541 on sf.net) + if (("anyType").equals(type.getName())) { + return XSConstants.ANYSIMPLETYPE_DT; + } else { + XSSimpleTypeDefinition simpleType = (XSSimpleTypeDefinition) type; + + //get built-in type + //only working method found: getBuiltInKind, but it returns a short ! + //XSTypeDefinition builtIn = simpleType.getPrimitiveType(); + /*XSTypeDefinition builtIn = type.getBaseType(); + if (builtIn == null) { + // always null for a ListType + if (simpleType.getItemType() != null) //if not null it's a list + return getBuiltInType(simpleType.getItemType()); + else + return simpleType; + } + else if(LOGGER.isDebugEnabled()) + LOGGER.debug(" -> builtinType="+builtIn.getName()); + return builtIn;*/ + + short result = simpleType.getBuiltInKind(); + if (result == XSConstants.LIST_DT) { + result = getBuiltInType(simpleType.getItemType()); + } + return result; + } + } + + /** + * get the name of a datatype defined by its value in XSConstants + * TODO: find an automatic way to do this ! + * + * @param dt the short representating this datatype from XSConstants + * @return the name of the datatype + */ + public String getDataTypeName(short dt) { + String name = ""; + switch (dt) { + case XSConstants.ANYSIMPLETYPE_DT: + name = "anyType"; + break; + case XSConstants.ANYURI_DT: + name = "anyURI"; + break; + case XSConstants.BASE64BINARY_DT: + name = "base64Binary"; + break; + case XSConstants.BOOLEAN_DT: + name = "boolean"; + break; + case XSConstants.BYTE_DT: + name = "byte"; + break; + case XSConstants.DATE_DT: + name = "date"; + break; + case XSConstants.DATETIME_DT: + name = "dateTime"; + break; + case XSConstants.DECIMAL_DT: + name = "decimal"; + break; + case XSConstants.DOUBLE_DT: + name = "double"; + break; + case XSConstants.DURATION_DT: + name = "duration"; + break; + case XSConstants.ENTITY_DT: + name = "ENTITY"; + break; + case XSConstants.FLOAT_DT: + name = "float"; + break; + case XSConstants.GDAY_DT: + name = "gDay"; + break; + case XSConstants.GMONTH_DT: + name = "gMonth"; + break; + case XSConstants.GMONTHDAY_DT: + name = "gMonthDay"; + break; + case XSConstants.GYEAR_DT: + name = "gYear"; + break; + case XSConstants.GYEARMONTH_DT: + name = "gYearMonth"; + break; + case XSConstants.ID_DT: + name = "ID"; + break; + case XSConstants.IDREF_DT: + name = "IDREF"; + break; + case XSConstants.INT_DT: + name = "int"; + break; + case XSConstants.INTEGER_DT: + name = "integer"; + break; + case XSConstants.LANGUAGE_DT: + name = "language"; + break; + case XSConstants.LONG_DT: + name = "long"; + break; + case XSConstants.NAME_DT: + name = "Name"; + break; + case XSConstants.NCNAME_DT: + name = "NCName"; + break; + case XSConstants.NEGATIVEINTEGER_DT: + name = "negativeInteger"; + break; + case XSConstants.NMTOKEN_DT: + name = "NMTOKEN"; + break; + case XSConstants.NONNEGATIVEINTEGER_DT: + name = "nonNegativeInteger"; + break; + case XSConstants.NONPOSITIVEINTEGER_DT: + name = "nonPositiveInteger"; + break; + case XSConstants.NORMALIZEDSTRING_DT: + name = "normalizedString"; + break; + case XSConstants.NOTATION_DT: + name = "NOTATION"; + break; + case XSConstants.POSITIVEINTEGER_DT: + name = "positiveInteger"; + break; + case XSConstants.QNAME_DT: + name = "QName"; + break; + case XSConstants.SHORT_DT: + name = "short"; + break; + case XSConstants.STRING_DT: + name = "string"; + break; + case XSConstants.TIME_DT: + name = "time"; + break; + case XSConstants.TOKEN_DT: + name = "TOKEN"; + break; + case XSConstants.UNSIGNEDBYTE_DT: + name = "unsignedByte"; + break; + case XSConstants.UNSIGNEDINT_DT: + name = "unsignedInt"; + break; + case XSConstants.UNSIGNEDLONG_DT: + name = "unsignedLong"; + break; + case XSConstants.UNSIGNEDSHORT_DT: + name = "unsignedShort"; + break; + } + return name; + } + + /** + * Returns the prefix for the Chiba namespace. + */ + protected String getChibaNSPrefix() { + return chibaNSPrefix; + } + + /* Increments the xforms:ref attribute counter. + * + */ + /*protected long incRefCounter() { + return refCounter++; + }*/ + protected String setXFormsId(Element el) { + //remove the eventuel "id" attribute + if (el.hasAttributeNS(SchemaFormBuilder.XFORMS_NS, "id")) { + el.removeAttributeNS(SchemaFormBuilder.XFORMS_NS, "id"); + } + + //long count=this.incIdCounter(); + long count = 0; + String name = el.getLocalName(); + Long l = (Long) counter.get(name); + + if (l != null) { + count = l.longValue(); + } + + String id = name + "_" + count; + + //increment the counter + counter.put(name, new Long(count + 1)); + el.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + this.getXFormsNSPrefix() + "id", + id); + + return id; + } + + /** + * method to set an Id to this element and to all XForms descendants of this element + */ + private void resetXFormIds(Element newControl) { + if (newControl.getNamespaceURI() != null + && newControl.getNamespaceURI().equals(XFORMS_NS)) + this.setXFormsId(newControl); + + //recursive call + NodeList children = newControl.getChildNodes(); + int nb = children.getLength(); + for (int i = 0; i < nb; i++) { + Node child = children.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) + this.resetXFormIds((Element) child); + } + } + + /** + * Returns the prefix for the XForms namespace. + */ + protected String getXFormsNSPrefix() { + return xformsNSPrefix; + } + + /** + * Returns the prefix for the XLink namespace. + */ + protected String getXLinkNSPrefix() { + return xlinkNSPrefix; + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param choicesElement __UNDOCUMENTED__ + * @param choiceValues __UNDOCUMENTED__ + */ + protected void addChoicesForSelectControl(Document xForm, + Element choicesElement, + Vector choiceValues) { + // sort the enums values and then add them as choices + // + // TODO: Should really put the default value (if any) at the top of the list. + // + List sortedList = choiceValues.subList(0, choiceValues.size()); + Collections.sort(sortedList); + + Iterator iterator = sortedList.iterator(); + + while (iterator.hasNext()) { + String textValue = (String) iterator.next(); + Element item = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "item"); + this.setXFormsId(item); + choicesElement.appendChild(item); + + Element captionElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "label"); + this.setXFormsId(captionElement); + item.appendChild(captionElement); + captionElement.appendChild(xForm.createTextNode(createCaption(textValue))); + + Element value = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "value"); + this.setXFormsId(value); + item.appendChild(value); + value.appendChild(xForm.createTextNode(textValue)); + } + } + + //protected void addChoicesForSelectSwitchControl(Document xForm, Element choicesElement, Vector choiceValues, String bindIdPrefix) { + protected void addChoicesForSelectSwitchControl(Document xForm, + Element choicesElement, + Vector choiceValues, + HashMap case_types) { + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("addChoicesForSelectSwitchControl, values="); + Iterator it = choiceValues.iterator(); + while (it.hasNext()) { +//String name=(String) it.next(); + XSTypeDefinition type = (XSTypeDefinition) it.next(); + String name = type.getName(); + LOGGER.debug(" - " + name); + } + } + + + // sort the enums values and then add them as choices + // + // TODO: Should really put the default value (if any) at the top of the list. + // + /*List sortedList = choiceValues.subList(0, choiceValues.size()); + Collections.sort(sortedList); + Iterator iterator = sortedList.iterator();*/ +// -> no, already sorted + Iterator iterator = choiceValues.iterator(); + while (iterator.hasNext()) { + XSTypeDefinition type = (XSTypeDefinition) iterator.next(); + String textValue = type.getName(); + //String textValue = (String) iterator.next(); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("addChoicesForSelectSwitchControl, processing " + textValue); + + Element item = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "item"); + this.setXFormsId(item); + choicesElement.appendChild(item); + + Element captionElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "label"); + this.setXFormsId(captionElement); + item.appendChild(captionElement); + captionElement.appendChild(xForm.createTextNode(createCaption(textValue))); + + Element value = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "value"); + this.setXFormsId(value); + item.appendChild(value); + value.appendChild(xForm.createTextNode(textValue)); + +/// action in the case + + Element action = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "action"); + this.setXFormsId(action); + item.appendChild(action); + + action.setAttributeNS(XMLEVENTS_NS, xmleventsNSPrefix + "event", "xforms-select"); + + Element toggle = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "toggle"); + this.setXFormsId(toggle); + + //build the case element + Element caseElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "case"); + String case_id = this.setXFormsId(caseElement); + case_types.put(textValue, caseElement); + + toggle.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "case", + case_id); + + //toggle.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "case",bindIdPrefix + "_" + textValue +"_case"); + action.appendChild(toggle); + } + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param annotation __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + protected Element addHintFromDocumentation(Document xForm, + XSAnnotation annotation) { + if (annotation != null) { + Element hintElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "hint"); + this.setXFormsId(hintElement); + + Text hintText = + (Text) hintElement.appendChild(xForm.createTextNode("")); + + //write annotation to empty doc + Document doc = DOMUtil.newDocument(true, false); + annotation.writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT); + + //get "annotation" element + NodeList annots = + doc.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", + "annotation"); + if (annots.getLength() > 0) { + Element annotEl = (Element) annots.item(0); + + //documentation + NodeList docos = + annotEl.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", + "documentation"); + int nbDocos = docos.getLength(); + for (int j = 0; j < nbDocos; j++) { + Element doco = (Element) docos.item(j); + + //get text value + String text = DOMUtil.getTextNodeAsString(doco); + hintText.appendData(text); + + if (j < nbDocos - 1) { + hintText.appendData(" "); + } + } + return hintElement; + } + return null; + } + + return null; + } + + private XSModel getSchema() { + return schema; + } + + public XSParticle findCorrespondingParticleInComplexType(XSElementDeclaration elDecl) { + XSParticle thisParticle = null; + + XSComplexTypeDefinition complexType = elDecl.getEnclosingCTDefinition(); + if (complexType != null) { + XSParticle particle = complexType.getParticle(); + XSTerm term = particle.getTerm(); + XSObjectList particles; + if (term instanceof XSModelGroup) { + XSModelGroup group = (XSModelGroup) term; + particles = group.getParticles(); + if (particles != null) { + int nb = particles.getLength(); + int i = 0; + while (i < nb && thisParticle == null) { + XSParticle part = (XSParticle) particles.item(i); + //test term + XSTerm thisTerm = part.getTerm(); + if (thisTerm == elDecl) + thisParticle = part; + + i++; + } + } + } + } + return thisParticle; + } + + /** + * finds the minOccurs and maxOccurs of an element declaration + * + * @return a table containing minOccurs and MaxOccurs + */ + public int[] getOccurance(XSElementDeclaration elDecl) { + int minOccurs = 1; + int maxOccurs = 1; + + //get occurance on encosing element declaration + XSParticle particle = + this.findCorrespondingParticleInComplexType(elDecl); + if (particle != null) { + minOccurs = particle.getMinOccurs(); + if (particle.getMaxOccursUnbounded()) + maxOccurs = -1; + else + maxOccurs = particle.getMaxOccurs(); + } + + //if not set, get occurance of model group content + //no -> this is made in "addGroup" directly ! + /*if (minOccurs == 1 && maxOccurs == 1) { + XSTypeDefinition type = elDecl.getTypeDefinition(); + if (type != null + && type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { + XSComplexTypeDefinition complexType = + (XSComplexTypeDefinition) type; + XSParticle thisParticle = complexType.getParticle(); + if (thisParticle != null) { + minOccurs = thisParticle.getMinOccurs(); + if (thisParticle.getMaxOccursUnbounded()) + maxOccurs = -1; + else + maxOccurs = thisParticle.getMaxOccurs(); + } + } + }*/ + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("getOccurance for " + + elDecl.getName() + + ", minOccurs=" + + minOccurs + + ", maxOccurs=" + + maxOccurs); + + int[] result = new int[2]; + result[0] = minOccurs; + result[1] = maxOccurs; + return result; + } + + private void addAnyType(Document xForm, + Element modelSection, + Element formSection, + XSTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot) { + + int[] occurance = this.getOccurance(owner); + + addSimpleType(xForm, + modelSection, + formSection, + controlType, + owner.getName(), + owner, + pathToRoot, + occurance[0], + occurance[1]); + } + + private void addAttributeSet(Document xForm, + Element modelSection, + Element formSection, + XSComplexTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot, + boolean checkIfExtension) { + XSObjectList attrUses = controlType.getAttributeUses(); + + if (attrUses != null) { + int nbAttr = attrUses.getLength(); + for (int i = 0; i < nbAttr; i++) { + XSAttributeUse currentAttributeUse = + (XSAttributeUse) attrUses.item(i); + XSAttributeDeclaration currentAttribute = + currentAttributeUse.getAttrDeclaration(); + +//test if extended ! + if (checkIfExtension && this.doesAttributeComeFromExtension(currentAttributeUse, controlType)) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("This attribute comes from an extension: recopy form controls. \n Model section: "); + DOMUtil.prettyPrintDOM(modelSection); + } + + String attributeName = currentAttributeUse.getName(); + if (attributeName == null || attributeName.equals("")) + attributeName = currentAttributeUse.getAttrDeclaration().getName(); + +//find the existing bind Id +//(modelSection is the enclosing bind of the element) + NodeList binds = modelSection.getElementsByTagNameNS(XFORMS_NS, "bind"); + int j = 0; + int nb = binds.getLength(); + String bindId = null; + while (j < nb && bindId == null) { + Element bind = (Element) binds.item(j); + String nodeset = bind.getAttributeNS(XFORMS_NS, "nodeset"); + if (nodeset != null) { + String name = nodeset.substring(1); //remove "@" in nodeset + if (name.equals(attributeName)) + bindId = bind.getAttributeNS(XFORMS_NS, "id"); + } + j++; + } + +//find the control + Element control = null; + if (bindId != null) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("bindId found: " + bindId); + + JXPathContext context = JXPathContext.newContext(formSection.getOwnerDocument()); + Pointer pointer = context.getPointer("//*[@" + this.getXFormsNSPrefix() + "bind='" + bindId + "']"); + if (pointer != null) + control = (Element) pointer.getNode(); + } + +//copy it + if (control == null) { + LOGGER.warn("Corresponding control not found"); + } else { + Element newControl = (Element) control.cloneNode(true); +//set new Ids to XForm elements + this.resetXFormIds(newControl); + + formSection.appendChild(newControl); + } + + } else { + String newPathToRoot; + + if ((pathToRoot == null) || pathToRoot.equals("")) { + newPathToRoot = "@" + currentAttribute.getName(); + } else if (pathToRoot.endsWith("/")) { + newPathToRoot = + pathToRoot + "@" + currentAttribute.getName(); + } else { + newPathToRoot = + pathToRoot + "/@" + currentAttribute.getName(); + } + + XSSimpleTypeDefinition simpleType = + currentAttribute.getTypeDefinition(); + //TODO SRA: UrType ? + /*if(simpleType==null){ + simpleType=new UrType(); + }*/ + + addSimpleType(xForm, + modelSection, + formSection, + simpleType, + currentAttributeUse, + newPathToRoot); + } + } + } + } + + private void addComplexType(Document xForm, + Element modelSection, + Element formSection, + XSComplexTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot, + boolean relative, + boolean checkIfExtension) { + + if (controlType != null) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("addComplexType for " + controlType.getName()); + if (owner != null) + LOGGER.debug(" owner=" + owner.getName()); + } + + // add a group node and recurse + // + Element groupElement = + createGroup(xForm, modelSection, formSection, owner); + Element groupWrapper = groupElement; + + if (groupElement != modelSection) { + groupWrapper = _wrapper.createGroupContentWrapper(groupElement); + } + + int occurance[] = this.getOccurance(owner); + int minOccurs = occurance[0]; + int maxOccurs = occurance[1]; + + Element repeatSection = + addRepeatIfNecessary(xForm, + modelSection, + groupWrapper, + controlType, + minOccurs, + maxOccurs, + pathToRoot); + Element repeatContentWrapper = repeatSection; + + /*if(repeatSection!=groupWrapper) + //we have a repeat + { + repeatContentWrapper=_wrapper.createGroupContentWrapper(repeatSection); + addComplexTypeChildren(xForm,modelSection,repeatContentWrapper,controlType,owner,pathToRoot, true); + } + else + addComplexTypeChildren(xForm,modelSection,repeatContentWrapper,controlType,owner,pathToRoot, false); + */ + if (repeatSection != groupWrapper) { //we have a repeat + repeatContentWrapper = + _wrapper.createGroupContentWrapper(repeatSection); + relative = true; + } + + addComplexTypeChildren(xForm, + modelSection, + repeatContentWrapper, + controlType, + owner, + pathToRoot, + relative, + checkIfExtension); + + Element realModel = modelSection; + if (relative) { + //modelSection: find the last element put in the modelSection = bind + realModel = DOMUtil.getLastChildElement(modelSection); + } + + endFormGroup(groupElement, + controlType, + minOccurs, + maxOccurs, + realModel); + + } else if (LOGGER.isDebugEnabled()) + LOGGER.debug("addComplexType: control type is null for pathToRoot=" + + pathToRoot); + } + + private void addComplexTypeChildren(Document xForm, + Element modelSection, + Element formSection, + XSComplexTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot, + boolean relative, + boolean checkIfExtension) { + + if (controlType != null) { + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("addComplexTypeChildren for " + controlType.getName()); + if (owner != null) + LOGGER.debug(" owner=" + owner.getName()); + } + if (controlType.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_MIXED + || (controlType.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE + && controlType.getAttributeUses() != null && controlType.getAttributeUses().getLength() > 0) + ) { + XSTypeDefinition base = controlType.getBaseType(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(" Control type is mixed . base type=" + base.getName()); + + if (base != null && base != controlType) { + if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { + addSimpleType(xForm, + modelSection, + formSection, + (XSSimpleTypeDefinition) base, + owner, + pathToRoot); + } else + LOGGER.warn("addComplexTypeChildren for mixed type with basic type complex !"); + } + } else if (LOGGER.isDebugEnabled()) + LOGGER.debug(" Content type = " + controlType.getContentType()); + + + // check for compatible subtypes + // of controlType. + // add a type switch if there are any + // compatible sub-types (i.e. anything + // that derives from controlType) + // add child elements + if (relative) { + pathToRoot = ""; + + //modelSection: find the last element put in the modelSection = bind + modelSection = DOMUtil.getLastChildElement(modelSection); + } + + //attributes + addAttributeSet(xForm, + modelSection, + formSection, + controlType, + owner, + pathToRoot, + checkIfExtension); + + //process group + XSParticle particle = controlType.getParticle(); + if (particle != null) { + XSTerm term = particle.getTerm(); + if (term instanceof XSModelGroup) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(" Particle of " + + controlType.getName() + + " is a group --->"); + + XSModelGroup group = (XSModelGroup) term; + + //get maxOccurs + int maxOccurs = particle.getMaxOccurs(); + if (particle.getMaxOccursUnbounded()) { + maxOccurs = -1; + } + int minOccurs = particle.getMinOccurs(); + + //call addGroup on this group + this.addGroup(xForm, + modelSection, + formSection, + group, + controlType, + owner, + pathToRoot, + minOccurs, + maxOccurs, + checkIfExtension); + + } else if (LOGGER.isDebugEnabled()) + LOGGER.debug(" Particle of " + + controlType.getName() + + " is not a group: " + + term.getClass().getName()); + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("--->end of addComplexTypeChildren for " + + controlType.getName()); + } + } + + /** + * add an element to the XForms document: the bind + the control + * (only the control if "withBind" is false) + */ + private void addElement(Document xForm, + Element modelSection, + Element formSection, + XSElementDeclaration elementDecl, + XSTypeDefinition controlType, + String pathToRoot) { + + if (controlType == null) { + // TODO!!! Figure out why this happens... for now just warn... + // seems to happen when there is an element of type IDREFS + LOGGER.warn("WARNING!!! controlType is null for " + + elementDecl + + ", " + + elementDecl.getName()); + + return; + } + + switch (controlType.getTypeCategory()) { + case XSTypeDefinition.SIMPLE_TYPE: + { + addSimpleType(xForm, + modelSection, + formSection, + (XSSimpleTypeDefinition) controlType, + elementDecl, + pathToRoot); + + break; + } + case XSTypeDefinition.COMPLEX_TYPE: + { + + if (controlType.getName() != null + && controlType.getName().equals("anyType")) { + addAnyType(xForm, + modelSection, + formSection, + (XSComplexTypeDefinition) controlType, + elementDecl, + pathToRoot); + + break; + } else { + + // find the types which are compatible(derived from) the parent type. + // + // This is used if we encounter a XML Schema that permits the xsi:type + // attribute to specify subtypes for the element. + // + // For example, the
element may be typed to permit any of + // the following scenarios: + //
+ //
+ //
+ //
+ //
+ //
+ // + // What we want to do is generate an XForm' switch element with cases + // representing any valid non-abstract subtype. + // + // Address + // + // + // US Address Type + // USAddressType + // + // + // + // + // + // Canadian Address Type + // CanadianAddressType + // + // + // + // + // + // International Address Type + // InternationalAddressType + // + // + // + // + // + // + // + // + // validate Address type + // + // + // + // + // + // + // + // + // + // + // + // + // ... + // + // + // + change bindings to add: + // - a bind for the "@xsi:type" attribute + // - for each possible element that can be added through the use of an inheritance, add a "relevant" attribute: + // ex: xforms:relevant="../@xsi:type='USAddress'" + + // look for compatible types + // + String typeName = controlType.getName(); + boolean relative = true; + + if (typeName != null) { + TreeSet compatibleTypes = (TreeSet) typeTree.get(controlType.getName()); + //TreeSet compatibleTypes = (TreeSet) typeTree.get(controlType); + + if (compatibleTypes != null) { + relative = false; + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("compatible types for " + + typeName + + ":"); + Iterator it1 = compatibleTypes.iterator(); + while (it1.hasNext()) { + //String name = (String) it1.next(); + XSTypeDefinition compType = (XSTypeDefinition) it1.next(); + LOGGER.debug(" compatible type name=" + compType.getName()); + } + } + + Element control = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "select1"); + String select1_id = this.setXFormsId(control); + + Element choices = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "choices"); + this.setXFormsId(choices); + + //get possible values + Vector enumValues = new Vector(); + //add the type (if not abstract) + if (!((XSComplexTypeDefinition) controlType).getAbstract()) + enumValues.add(controlType); + //enumValues.add(typeName); + + //add compatible types + Iterator it = compatibleTypes.iterator(); + while (it.hasNext()) { + enumValues.add(it.next()); + } + + if (enumValues.size() > 1) { + + String caption = + createCaption(elementDecl.getName() + " Type"); + Element controlCaption = + (Element) control.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(controlCaption); + controlCaption.appendChild(xForm.createTextNode(caption)); + + // multiple compatible types for this element exist + // in the schema - allow the user to choose from + // between compatible non-abstract types + Element bindElement = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "bind"); + String bindId = + this.setXFormsId(bindElement); + + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "nodeset", + pathToRoot + "/@xsi:type"); + + modelSection.appendChild(bindElement); + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "bind", + bindId); + + //add the "element" bind, in addition + Element bindElement2 = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "bind"); + String bindId2 = + this.setXFormsId(bindElement2); + bindElement2.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "nodeset", + pathToRoot); + + modelSection.appendChild(bindElement2); + + if (enumValues.size() + < Long.parseLong(getProperty(SELECTONE_LONG_LIST_SIZE_PROP))) { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTONE_UI_CONTROL_SHORT_PROP)); + } else { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTONE_UI_CONTROL_LONG_PROP)); + + // add the "Please select..." instruction item for the combobox + // and set the isValid attribute on the bind element to check for the "Please select..." + // item to indicate that is not a valid value + // + String pleaseSelect = + "[Select1 " + caption + "]"; + Element item = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + + "item"); + this.setXFormsId(item); + choices.appendChild(item); + + Element captionElement = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + + "label"); + this.setXFormsId(captionElement); + item.appendChild(captionElement); + captionElement.appendChild(xForm.createTextNode(pleaseSelect)); + + Element value = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + + "value"); + this.setXFormsId(value); + item.appendChild(value); + value.appendChild(xForm.createTextNode(pleaseSelect)); + + // not(purchaseOrder/state = '[Choose State]') + //String isValidExpr = "not(" + bindElement.getAttributeNS(XFORMS_NS, "nodeset") + " = '" + pleaseSelect + "')"; + // ->no, not(. = '[Choose State]') + String isValidExpr = + "not( . = '" + + pleaseSelect + + "')"; + + //check if there was a constraint + String constraint = + bindElement.getAttributeNS(XFORMS_NS, + "constraint"); + + if ((constraint != null) + && !constraint.equals("")) { + constraint = + constraint + + " && " + + isValidExpr; + } else { + constraint = isValidExpr; + } + + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + + "constraint", + constraint); + } + + Element choicesControlWrapper = + _wrapper.createControlsWrapper(choices); + control.appendChild(choicesControlWrapper); + + Element controlWrapper = + _wrapper.createControlsWrapper(control); + formSection.appendChild(controlWrapper); + + ///////////////// /////////////// + // add content to select1 + HashMap case_types = new HashMap(); + addChoicesForSelectSwitchControl(xForm, + choices, + enumValues, + case_types); + + ///////////////// + //add a trigger for this control (is there a way to not need it ?) + Element trigger = xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "trigger"); + formSection.appendChild(trigger); + this.setXFormsId(trigger); + Element label_trigger = xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label"); + this.setXFormsId(label_trigger); + trigger.appendChild(label_trigger); + String trigger_caption = createCaption("validate choice"); + label_trigger.appendChild(xForm.createTextNode(trigger_caption)); + Element action_trigger = xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "action"); + this.setXFormsId(action_trigger); + trigger.appendChild(action_trigger); + Element dispatch_trigger = xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "dispatch"); + this.setXFormsId(dispatch_trigger); + action_trigger.appendChild(dispatch_trigger); + dispatch_trigger.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "name", + "DOMActivate"); + dispatch_trigger.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "target", + select1_id); + + ///////////////// + //add switch + Element switchElement = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "switch"); + this.setXFormsId(switchElement); + + Element switchControlWrapper = + _wrapper.createControlsWrapper(switchElement); + formSection.appendChild(switchControlWrapper); + //formSection.appendChild(switchElement); + + /////////////// add this type ////////////// + Element firstCaseElement = (Element) case_types.get(controlType.getName()); + switchElement.appendChild(firstCaseElement); + addComplexType(xForm, + modelSection, + firstCaseElement, + (XSComplexTypeDefinition) controlType, + elementDecl, + pathToRoot, + true, + false); + + /////////////// add sub types ////////////// + it = compatibleTypes.iterator(); + // add each compatible type within + // a case statement + while (it.hasNext()) { + /*String compatibleTypeName = (String) it.next(); + //WARNING: order of parameters inversed from the doc for 2.6.0 !!! + XSTypeDefinition type =getSchema().getTypeDefinition( + compatibleTypeName, + targetNamespace);*/ + XSTypeDefinition type = (XSTypeDefinition) it.next(); + String compatibleTypeName = type.getName(); + + if (LOGGER.isDebugEnabled()) { + if (type == null) + LOGGER.debug(">>>addElement: compatible type is null!! type=" + + compatibleTypeName + + ", targetNamespace=" + + targetNamespace); + else + LOGGER.debug(" >>>addElement: adding compatible type " + + type.getName()); + } + + if (type != null + && type.getTypeCategory() + == XSTypeDefinition + .COMPLEX_TYPE) { + + //Element caseElement = (Element) xForm.createElementNS(XFORMS_NS,getXFormsNSPrefix() + "case"); + //caseElement.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "id",bindId + "_" + type.getName() +"_case"); + //String case_id=this.setXFormsId(caseElement); + Element caseElement = + (Element) case_types.get(type.getName()); + switchElement.appendChild(caseElement); + + addComplexType(xForm, + modelSection, + caseElement, + (XSComplexTypeDefinition) type, + elementDecl, + pathToRoot, + true, + true); + + ////// + // modify bind to add a "relevant" attribute that checks the value of @xsi:type + // + if (LOGGER.isDebugEnabled()) + DOMUtil.prettyPrintDOM(bindElement2); + NodeList binds = bindElement2.getElementsByTagNameNS(XFORMS_NS, "bind"); + Element thisBind = null; + int nb_binds = binds.getLength(); + int i = 0; + while (i < nb_binds && thisBind == null) { + Element subBind = (Element) binds.item(i); + String name = subBind.getAttributeNS(XFORMS_NS, "nodeset"); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Testing sub-bind with nodeset " + name); + + if (this.isElementDeclaredIn(name, (XSComplexTypeDefinition) type, false) + || this.isAttributeDeclaredIn(name, (XSComplexTypeDefinition) type, false) + ) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Element/Attribute " + name + " declared in type " + type.getName() + ": adding relevant attribute"); + + //test sub types of this type + TreeSet subCompatibleTypes = (TreeSet) typeTree.get(type.getName()); + //TreeSet subCompatibleTypes = (TreeSet) typeTree.get(type); + + String newRelevant = null; + if (subCompatibleTypes == null || subCompatibleTypes.isEmpty()) { + //just add ../@xsi:type='type' + newRelevant = "../@xsi:type='" + type.getName() + "'"; + } else { + //add ../@xsi:type='type' or ../@xsi:type='otherType' or ... + newRelevant = "../@xsi:type='" + type.getName() + "'"; + Iterator it_ct = subCompatibleTypes.iterator(); + while (it_ct.hasNext()) { + //String otherTypeName = (String) it_ct.next(); + XSTypeDefinition otherType = (XSTypeDefinition) it_ct.next(); + String otherTypeName = otherType.getName(); + newRelevant = newRelevant + " or ../@xsi:type='" + otherTypeName + "'"; + } + } + + //change relevant attribute + String relevant = subBind.getAttributeNS(XFORMS_NS, "relevant"); + if (relevant != null && !relevant.equals("")) { + newRelevant = "(" + relevant + ") and " + newRelevant; + } + if (newRelevant != null && !newRelevant.equals("")) + subBind.setAttributeNS(XFORMS_NS, getXFormsNSPrefix() + "relevant", newRelevant); + } + + i++; + } + } + } + + /*if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "###addElement for derived type: bind created:"); + DOMUtil.prettyPrintDOM(bindElement2); + }*/ + + // we're done + // + break; + + } else if (enumValues.size() == 1) { + // only one compatible type, set the controlType value + // and fall through + // + //controlType = getSchema().getComplexType((String)enumValues.get(0)); + controlType = + getSchema().getTypeDefinition((String) enumValues.get(0), + targetNamespace); + } + } else if (LOGGER.isDebugEnabled()) + LOGGER.debug("No compatible type found for " + typeName); + + //name not null but no compatibleType? + relative = true; + } + + if (relative) //create the bind in case it is a repeat + { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(">>>Adding empty bind for " + typeName); + + // create the element and add it to the model. + Element bindElement = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "bind"); + String bindId = this.setXFormsId(bindElement); + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "nodeset", + pathToRoot); + + modelSection.appendChild(bindElement); + } else if (LOGGER.isDebugEnabled()) { + LOGGER.debug("addElement: bind is not relative for " + + elementDecl.getName()); + } + + //addComplexType(xForm,modelSection, formSection,(ComplexType)controlType,elementDecl,pathToRoot, relative); + addComplexType(xForm, + modelSection, + formSection, + (XSComplexTypeDefinition) controlType, + elementDecl, + pathToRoot, + true, + false); + + break; + } + } + + default : // TODO: add wildcard support + LOGGER.warn("\nWARNING!!! - Unsupported type [" + + elementDecl.getType() + + "] for node [" + + controlType.getName() + + "]"); + } + } + + /** + * check that the element defined by this name is declared directly in the type + */ + private boolean isElementDeclaredIn(String name, XSComplexTypeDefinition type, boolean recursive) { + boolean found = false; + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("isElement " + name + " declared in " + type.getName()); + +//test if extension + declared in parent + not recursive -> NOK + if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) { + XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("testing if it is not on parent " + parent.getName()); + if (this.isElementDeclaredIn(name, parent, true)) + return false; + } + + XSParticle particle = type.getParticle(); + if (particle != null) { + XSTerm term = particle.getTerm(); + if (term instanceof XSModelGroup) { + XSModelGroup group = (XSModelGroup) term; + found = this.isElementDeclaredIn(name, group); + } + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("isElement " + name + " declared in " + type.getName() + ": " + found); + + return found; + } + + /** + * private recursive method called by isElementDeclaredIn(String name, XSComplexTypeDefinition type) + */ + private boolean isElementDeclaredIn(String name, XSModelGroup group) { + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("isElement " + name + " declared in group " + group.getName()); + + boolean found = false; + XSObjectList particles = group.getParticles(); + int i = 0; + int nb = particles.getLength(); + while (i < nb) { + XSParticle subPart = (XSParticle) particles.item(i); + XSTerm subTerm = subPart.getTerm(); + if (subTerm instanceof XSElementDeclaration) { + XSElementDeclaration elDecl = (XSElementDeclaration) subTerm; + if (name.equals(elDecl.getName())) + found = true; + } else if (subTerm instanceof XSModelGroup) { //recursive + found = this.isElementDeclaredIn(name, (XSModelGroup) subTerm); + } + + i++; + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("isElement " + name + " declared in group " + group.getName() + ": " + found); + return found; + } + + private boolean doesElementComeFromExtension(XSElementDeclaration element, XSComplexTypeDefinition controlType) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesElementComeFromExtension for " + element.getName() + " and controlType=" + controlType.getName()); + boolean comesFromExtension = false; + if (controlType.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) { + XSTypeDefinition baseType = controlType.getBaseType(); + if (baseType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { + XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) baseType; + if (this.isElementDeclaredIn(element.getName(), complexType, true)) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesElementComeFromExtension: yes"); + comesFromExtension = true; + } else { //recursive call + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesElementComeFromExtension: recursive call on previous level"); + comesFromExtension = this.doesElementComeFromExtension(element, complexType); + } + } + } + return comesFromExtension; + } + + /** + * check that the element defined by this name is declared directly in the type + */ + private boolean isAttributeDeclaredIn(XSAttributeUse attr, XSComplexTypeDefinition type, boolean recursive) { + boolean found = false; + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("is Attribute " + attr.getAttrDeclaration().getName() + " declared in " + type.getName()); + +//check on parent if not recursive + if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) { + XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("testing if it is not on parent " + parent.getName()); + if (this.isAttributeDeclaredIn(attr, parent, true)) + return false; + } + +//check on this type (also checks recursively) + XSObjectList attrs = type.getAttributeUses(); + int nb = attrs.getLength(); + int i = 0; + while (i < nb && !found) { + XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i); + if (anAttr == attr) + found = true; + i++; + } + +//recursive call +/*if(!found && recursive && + type.getDerivationMethod()==XSConstants.DERIVATION_EXTENSION){ + XSComplexTypeDefinition base=(XSComplexTypeDefinition) type.getBaseType(); + if(base!=null && base!=type) + found = this.isAttributeDeclaredIn(attr, base, true); + }*/ + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("is Attribute " + attr.getName() + " declared in " + type.getName() + ": " + found); + + return found; + } + + /** + * check that the element defined by this name is declared directly in the type + * -> idem with string + */ + private boolean isAttributeDeclaredIn(String attrName, XSComplexTypeDefinition type, boolean recursive) { + boolean found = false; + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName()); + + if (attrName.startsWith("@")) + attrName = attrName.substring(1); + +//check on parent if not recursive + if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) { + XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("testing if it is not on parent " + parent.getName()); + if (this.isAttributeDeclaredIn(attrName, parent, true)) + return false; + } + +//check on this type (also checks recursively) + XSObjectList attrs = type.getAttributeUses(); + int nb = attrs.getLength(); + int i = 0; + while (i < nb && !found) { + XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i); + if (anAttr != null) { + String name = anAttr.getName(); + if (name == null || name.equals("")) + name = anAttr.getAttrDeclaration().getName(); + if (attrName.equals(name)) + found = true; + } + i++; + } + +//recursive call -> no need +/*if(!found && recursive && + type.getDerivationMethod()==XSConstants.DERIVATION_EXTENSION){ + XSComplexTypeDefinition base=(XSComplexTypeDefinition) type.getBaseType(); + if(base!=null && base!=type) + found = this.isAttributeDeclaredIn(attrName, base, true); + }*/ + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName() + ": " + found); + + return found; + } + + private boolean doesAttributeComeFromExtension(XSAttributeUse attr, XSComplexTypeDefinition controlType) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesAttributeComeFromExtension for " + attr.getAttrDeclaration().getName() + " and controlType=" + controlType.getName()); + boolean comesFromExtension = false; + if (controlType.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) { + XSTypeDefinition baseType = controlType.getBaseType(); + if (baseType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { + XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) baseType; + if (this.isAttributeDeclaredIn(attr, complexType, true)) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesAttributeComeFromExtension: yes"); + comesFromExtension = true; + } else { //recursive call + if (LOGGER.isDebugEnabled()) + LOGGER.debug("doesAttributeComeFromExtension: recursive call on previous level"); + comesFromExtension = this.doesAttributeComeFromExtension(attr, complexType); + } + } + } + return comesFromExtension; + } + + /** + * checkIfExtension: if false, addElement is called wether it is an extension or not + * if true, if it is an extension, element is recopied (and no additional bind) + */ + private void addGroup(Document xForm, + Element modelSection, + Element formSection, + XSModelGroup group, + XSComplexTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot, + int minOccurs, + int maxOccurs, + boolean checkIfExtension) { + if (group != null) { + + Element repeatSection = + addRepeatIfNecessary(xForm, + modelSection, + formSection, + owner.getTypeDefinition(), + minOccurs, + maxOccurs, + pathToRoot); + Element repeatContentWrapper = repeatSection; + + if (repeatSection != formSection) { + //selector -> no more needed? + //this.addSelector(xForm, repeatSection); + //group wrapper + repeatContentWrapper = + _wrapper.createGroupContentWrapper(repeatSection); + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("addGroup from owner=" + owner.getName() + " and controlType=" + controlType.getName()); + + XSObjectList particles = group.getParticles(); + for (int counter = 0; counter < particles.getLength(); counter++) { + XSParticle currentNode = (XSParticle) particles.item(counter); + XSTerm term = currentNode.getTerm(); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug(" : next term = " + term.getName()); + + int childMaxOccurs = currentNode.getMaxOccurs(); + if (currentNode.getMaxOccursUnbounded()) + childMaxOccurs = -1; + int childMinOccurs = currentNode.getMinOccurs(); + + if (term instanceof XSModelGroup) { + + if (LOGGER.isDebugEnabled()) + LOGGER.debug(" term is a group"); + + addGroup(xForm, + modelSection, + repeatContentWrapper, + ((XSModelGroup) term), + controlType, + owner, + pathToRoot, + childMinOccurs, + childMaxOccurs, + checkIfExtension); + } else if (term instanceof XSElementDeclaration) { + XSElementDeclaration element = (XSElementDeclaration) term; + + if (LOGGER.isDebugEnabled()) + LOGGER.debug(" term is an element declaration: " + + term.getName()); + + //special case for types already added because used in an extension + //do not add it when it comes from an extension !!! + //-> make a copy from the existing form control + if (checkIfExtension && this.doesElementComeFromExtension(element, controlType)) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("This element comes from an extension: recopy form controls.\n Model Section="); + DOMUtil.prettyPrintDOM(modelSection); + } + + //find the existing bind Id + //(modelSection is the enclosing bind of the element) + NodeList binds = modelSection.getElementsByTagNameNS(XFORMS_NS, "bind"); + int i = 0; + int nb = binds.getLength(); + String bindId = null; + while (i < nb && bindId == null) { + Element bind = (Element) binds.item(i); + String nodeset = bind.getAttributeNS(XFORMS_NS, "nodeset"); + if (nodeset != null && nodeset.equals(element.getName())) + bindId = bind.getAttributeNS(XFORMS_NS, "id"); + i++; + } + + //find the control + Element control = null; + if (bindId != null) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("bindId found: " + bindId); + + JXPathContext context = JXPathContext.newContext(formSection.getOwnerDocument()); + Pointer pointer = context.getPointer("//*[@" + this.getXFormsNSPrefix() + "bind='" + bindId + "']"); + if (pointer != null) + control = (Element) pointer.getNode(); + } + + //copy it + if (control == null) { + LOGGER.warn("Corresponding control not found"); + } else { + Element newControl = (Element) control.cloneNode(true); + //set new Ids to XForm elements + this.resetXFormIds(newControl); + + repeatContentWrapper.appendChild(newControl); + } + + } else { //add it normally + String elementName = getElementName(element, xForm); + + String path = pathToRoot + "/" + elementName; + + if (pathToRoot.equals("")) { //relative + path = elementName; + } + + addElement(xForm, + modelSection, + repeatContentWrapper, + element, + element.getTypeDefinition(), + path); + } + } else { //XSWildcard -> ignore ? + //LOGGER.warn("XSWildcard found in group from "+owner.getName()+" for pathToRoot="+pathToRoot); + } + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("--- end of addGroup from owner=" + owner.getName()); + } + } + + /** + * Add a repeat section if maxOccurs > 1. + */ + private Element addRepeatIfNecessary(Document xForm, + Element modelSection, + Element formSection, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs, + String pathToRoot) { + Element repeatSection = formSection; + + // add xforms:repeat section if this element re-occurs + // + if (maxOccurs != 1) { + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("DEBUG: AddRepeatIfNecessary for multiple element for type " + + controlType.getName() + + ", maxOccurs=" + maxOccurs); + + //repeatSection = (Element) formSection.appendChild(xForm.createElementNS(XFORMS_NS,getXFormsNSPrefix() + "repeat")); + repeatSection = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "repeat"); + + //bind instead of repeat + //repeatSection.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "nodeset",pathToRoot); + // bind -> last element in the modelSection + Element bind = DOMUtil.getLastChildElement(modelSection); + String bindId = null; + + if ((bind != null) + && (bind.getLocalName() != null) + && bind.getLocalName().equals("bind")) { + bindId = bind.getAttributeNS(SchemaFormBuilder.XFORMS_NS, "id"); + } else { + LOGGER.warn("addRepeatIfNecessary: bind not found: " + + bind + + " (model selection name=" + + modelSection.getNodeName() + + ")"); + + //if no bind is found -> modelSection is already a bind, get its parent last child + bind = + DOMUtil.getLastChildElement(modelSection.getParentNode()); + + if ((bind != null) + && (bind.getLocalName() != null) + && bind.getLocalName().equals("bind")) { + bindId = + bind.getAttributeNS(SchemaFormBuilder.XFORMS_NS, "id"); + } else { + LOGGER.warn("addRepeatIfNecessary: bind really not found"); + } + } + + repeatSection.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "bind", + bindId); + this.setXFormsId(repeatSection); + + //appearance=full is more user friendly + repeatSection.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + "full"); + + //triggers + this.addTriggersForRepeat(xForm, + formSection, + repeatSection, + minOccurs, + maxOccurs, + bindId); + + Element controlWrapper = + _wrapper.createControlsWrapper(repeatSection); + formSection.appendChild(controlWrapper); + + //add a group inside the repeat? + Element group = + xForm.createElementNS(XFORMS_NS, + this.getXFormsNSPrefix() + "group"); + this.setXFormsId(group); + repeatSection.appendChild(group); + repeatSection = group; + } + + return repeatSection; + } + + /** + * if "createBind", a bind is created, otherwise bindId is used + */ + private void addSimpleType(Document xForm, + Element modelSection, + Element formSection, + XSTypeDefinition controlType, + String owningElementName, + XSObject owner, + String pathToRoot, + int minOccurs, + int maxOccurs) { + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("addSimpleType for " + + controlType.getName() + + " (owningElementName=" + + owningElementName + + ")"); + + // create the element and add it to the model. + Element bindElement = xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "bind"); + String bindId = this.setXFormsId(bindElement); + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "nodeset", + pathToRoot); + bindElement = (Element) modelSection.appendChild(bindElement); + bindElement = startBindElement(bindElement, controlType, minOccurs, maxOccurs); + + // add a group if a repeat ! + if (owner instanceof XSElementDeclaration + && maxOccurs != 1 + ) { + Element groupElement = createGroup(xForm, modelSection, formSection, (XSElementDeclaration) owner); + //set content + Element groupWrapper = groupElement; + if (groupElement != modelSection) { + groupWrapper = _wrapper.createGroupContentWrapper(groupElement); + } + formSection = groupWrapper; + } + + //eventual repeat + Element repeatSection = + addRepeatIfNecessary(xForm, + modelSection, + formSection, + controlType, + minOccurs, + maxOccurs, + pathToRoot); + + // create the form control element + //put a wrapper for the repeat content, but only if it is really a repeat + Element contentWrapper = repeatSection; + + if (repeatSection != formSection) { + //content of repeat + contentWrapper = _wrapper.createGroupContentWrapper(repeatSection); + + //if there is a repeat -> create another bind with "." + Element bindElement2 = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "bind"); + String bindId2 = this.setXFormsId(bindElement2); + bindElement2.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "nodeset", + "."); + + //recopy other attributes: required and type + // ->no, attributes shouldn't be copied + /*String required = "required"; + String type = "type"; + if (bindElement.hasAttributeNS(XFORMS_NS, required)) { + bindElement2.setAttributeNS(XFORMS_NS, getXFormsNSPrefix() + required, + bindElement.getAttributeNS(XFORMS_NS, required)); + } + if (bindElement.hasAttributeNS(XFORMS_NS, type)) { + bindElement2.setAttributeNS(XFORMS_NS, getXFormsNSPrefix() + type, + bindElement.getAttributeNS(XFORMS_NS, type)); + }*/ + + bindElement.appendChild(bindElement2); + bindId = bindId2; + } + + String caption = createCaption(owningElementName); + + //Element formControl = (Element) contentWrapper.appendChild(createFormControl(xForm,caption,controlType,bindId,bindElement,minOccurs,maxOccurs)); + Element formControl = + createFormControl(xForm, + caption, + controlType, + bindId, + bindElement, + minOccurs, + maxOccurs); + Element controlWrapper = _wrapper.createControlsWrapper(formControl); + contentWrapper.appendChild(controlWrapper); + + // if this is a repeatable then set ref to point to current element + // not sure if this is a workaround or this is just the way XForms works... + // + if (!repeatSection.equals(formSection)) { + formControl.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "ref", + "."); + } + + Element hint = createHint(xForm, owner); + + if (hint != null) { + formControl.appendChild(hint); + } + + //add selector if repeat + //if (repeatSection != formSection) + //this.addSelector(xForm, (Element) formControl.getParentNode()); + // + // TODO: Generate help message based on datatype and restrictions + endFormControl(formControl, controlType, minOccurs, maxOccurs); + endBindElement(bindElement); + } + + private void addSimpleType(Document xForm, + Element modelSection, + Element formSection, + XSSimpleTypeDefinition controlType, + XSElementDeclaration owner, + String pathToRoot) { + + int[] occurance = this.getOccurance(owner); + addSimpleType(xForm, + modelSection, + formSection, + controlType, + owner.getName(), + owner, + pathToRoot, + occurance[0], + occurance[1]); + } + + private void addSimpleType(Document xForm, + Element modelSection, + Element formSection, + XSSimpleTypeDefinition controlType, + XSAttributeUse owningAttribute, + String pathToRoot) { + + addSimpleType(xForm, + modelSection, + formSection, + controlType, + owningAttribute.getAttrDeclaration().getName(), + owningAttribute, + pathToRoot, + owningAttribute.getRequired() ? 1 : 0, + 1); + } + + /** + * add triggers to use the repeat elements (allow to add an element, ...) + */ + private void addTriggersForRepeat(Document xForm, + Element formSection, + Element repeatSection, + int minOccurs, + int maxOccurs, + String bindId) { + ///////////// insert ////////////////// + //trigger insert + Element trigger_insert = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "trigger"); + this.setXFormsId(trigger_insert); + + //label insert + Element triggerLabel_insert = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "label"); + this.setXFormsId(triggerLabel_insert); + trigger_insert.appendChild(triggerLabel_insert); + triggerLabel_insert.setAttributeNS(SchemaFormBuilder.XLINK_NS, + SchemaFormBuilder.xlinkNSPrefix + "href", + "images/add_new.gif"); + + Text label_insert = xForm.createTextNode("Insert after selected"); + triggerLabel_insert.appendChild(label_insert); + + //hint insert + Element hint_insert = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "hint"); + this.setXFormsId(hint_insert); + Text hint_insert_text = + xForm.createTextNode("inserts a new entry in this collection"); + hint_insert.appendChild(hint_insert_text); + trigger_insert.appendChild(hint_insert); + + //insert action + Element action_insert = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "action"); + trigger_insert.appendChild(action_insert); + this.setXFormsId(action_insert); + + Element insert = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "insert"); + action_insert.appendChild(insert); + this.setXFormsId(insert); + + //insert: bind & other attributes + if (bindId != null) { + insert.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "bind", + bindId); + } + + insert.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "position", + "after"); + + //xforms:at = xforms:index from the "id" attribute on the repeat element + String repeatId = + repeatSection.getAttributeNS(SchemaFormBuilder.XFORMS_NS, "id"); + + if (repeatId != null) { + insert.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "at", + SchemaFormBuilder.xformsNSPrefix + "index('" + repeatId + "')"); + } + + ///////////// delete ////////////////// + //trigger delete + Element trigger_delete = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "trigger"); + this.setXFormsId(trigger_delete); + + //label delete + Element triggerLabel_delete = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "label"); + this.setXFormsId(triggerLabel_delete); + trigger_delete.appendChild(triggerLabel_delete); + triggerLabel_delete.setAttributeNS(SchemaFormBuilder.XLINK_NS, + SchemaFormBuilder.xlinkNSPrefix + "href", + "images/delete.gif"); + + Text label_delete = xForm.createTextNode("Delete selected"); + triggerLabel_delete.appendChild(label_delete); + + //hint delete + Element hint_delete = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "hint"); + this.setXFormsId(hint_delete); + Text hint_delete_text = + xForm.createTextNode("deletes selected entry from this collection"); + hint_delete.appendChild(hint_delete_text); + trigger_delete.appendChild(hint_delete); + + //delete action + Element action_delete = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "action"); + trigger_delete.appendChild(action_delete); + this.setXFormsId(action_delete); + + Element delete = + xForm.createElementNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "delete"); + action_delete.appendChild(delete); + this.setXFormsId(delete); + + //delete: bind & other attributes + if (bindId != null) { + delete.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "bind", + bindId); + } + + //xforms:at = xforms:index from the "id" attribute on the repeat element + if (repeatId != null) { + delete.setAttributeNS(SchemaFormBuilder.XFORMS_NS, + SchemaFormBuilder.xformsNSPrefix + "at", + SchemaFormBuilder.xformsNSPrefix + "index('" + repeatId + "')"); + } + + //add the triggers + Element wrapper_triggers = + _wrapper.createControlsWrapper(trigger_insert); + + if (wrapper_triggers == trigger_insert) { //no wrapper + formSection.appendChild(trigger_insert); + formSection.appendChild(trigger_delete); + } else { + formSection.appendChild(wrapper_triggers); + + Element insert_parent = (Element) trigger_insert.getParentNode(); + + if (insert_parent != null) { + insert_parent.appendChild(trigger_delete); + } + } + } + + private void buildTypeTree(XSTypeDefinition type, TreeSet descendents) { + if (type != null) { + + if (descendents.size() > 0) { + //TreeSet compatibleTypes = (TreeSet) typeTree.get(type.getName()); + TreeSet compatibleTypes = (TreeSet) typeTree.get(type.getName()); + + if (compatibleTypes == null) { + //compatibleTypes = new TreeSet(descendents); + compatibleTypes = new TreeSet(this.typeExtensionSorter); + compatibleTypes.addAll(descendents); + //typeTree.put(type.getName(), compatibleTypes); + typeTree.put(type.getName(), compatibleTypes); + } else { + compatibleTypes.addAll(descendents); + } + } + + XSTypeDefinition parentType = type.getBaseType(); + + if (parentType != null + && type.getTypeCategory() == parentType.getTypeCategory()) { + /*String typeName = type.getName(); + String parentTypeName = parentType.getName(); + if ((typeName == null && parentTypeName != null) + || (typeName != null && parentTypeName == null) + || (typeName != null + && parentTypeName != null + && !type.getName().equals(parentType.getName()) + && !parentType.getName().equals("anyType"))) {*/ + if (type != parentType + && (parentType.getName() == null + || !parentType.getName().equals("anyType"))) { + + //TreeSet newDescendents=new TreeSet(descendents); + TreeSet newDescendents = new TreeSet(this.typeExtensionSorter); + newDescendents.addAll(descendents); + +//extension (we only add it to "newDescendants" because we don't want +//to have a type descendant to itself, but to consider it for the parent + if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { + XSComplexTypeDefinition complexType = + (XSComplexTypeDefinition) type; + if (complexType.getDerivationMethod() + == XSConstants.DERIVATION_EXTENSION + && !complexType.getAbstract() + && !descendents.contains(type) //to be tested + //&& !descendents.contains(type.getName()) //to be tested + ) { +//newDescendents.add(type.getName()); + newDescendents.add(type); + } + } +//note: extensions are impossible on simpleTypes ! + + buildTypeTree(parentType, newDescendents); + } + } + } + } + + private void buildTypeTree(XSModel schema) { + // build the type tree for complex types + // + XSNamedMap types = schema.getComponents(XSConstants.TYPE_DEFINITION); + int nb = types.getLength(); + for (int i = 0; i < nb; i++) { + XSTypeDefinition t = (XSTypeDefinition) types.item(i); + if (t.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { + XSComplexTypeDefinition type = (XSComplexTypeDefinition) t; + buildTypeTree(type, new TreeSet(this.typeExtensionSorter)); + } + } + + // build the type tree for simple types + for (int i = 0; i < nb; i++) { + XSTypeDefinition t = (XSTypeDefinition) types.item(i); + if (t.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { + XSSimpleTypeDefinition type = (XSSimpleTypeDefinition) t; + buildTypeTree(type, new TreeSet(this.typeExtensionSorter)); + } + } + + // print out type hierarchy for debugging purposes + if (LOGGER.isDebugEnabled()) { + Iterator keys = typeTree.keySet().iterator(); + while (keys.hasNext()) { + String typeName = (String) keys.next(); + TreeSet descendents = (TreeSet) typeTree.get(typeName); + LOGGER.debug(">>>> for " + typeName + " Descendants=\n "); + Iterator it = descendents.iterator(); + while (it.hasNext()) { + XSTypeDefinition desc = (XSTypeDefinition) it.next(); + LOGGER.debug(" " + desc.getName()); + } + } + } + } + + private Element createFormControl(Document xForm, + String caption, + XSTypeDefinition controlType, + String bindId, + Element bindElement, + int minOccurs, + int maxOccurs) { + // Select1 xform control to use: + // Will use one of the following: input, textarea, selectOne, selectBoolean, selectMany, range + // secret, output, button, do not apply + // + // select1: enumeration or keyref constrained value + // select: list + // range: union (? not sure about this) + // textarea : ??? + // input: default + // + Element formControl = null; + + if (controlType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { + XSSimpleTypeDefinition simpleType = + (XSSimpleTypeDefinition) controlType; + if (simpleType.getItemType() != null) //list + { + formControl = + createControlForListType(xForm, + simpleType, + caption, + bindElement); + } else { //other simple type + // need to check constraints to determine which form control to use + // + // use the selectOne control + // + //XSObjectList enumerationFacets = simpleType.getFacets(XSSimpleTypeDefinition.FACET_ENUMERATION); + //if(enumerationFacets.getLength()>0){ + if (simpleType + .isDefinedFacet(XSSimpleTypeDefinition.FACET_ENUMERATION)) { + formControl = + createControlForEnumerationType(xForm, + simpleType, + caption, + bindElement); + } + /*if (enumerationFacets.hasMoreElements()) { + formControl = createControlForEnumerationType(xForm, (SimpleType)controlType, caption, + bindElement); + } */ + } + } else if ( + controlType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE + && controlType.getName().equals("anyType")) { + formControl = createControlForAnyType(xForm, caption, controlType); + } + + if (formControl == null) { + // default situation - use an input control + // + formControl = + createControlForAtomicType(xForm, + caption, + (XSSimpleTypeDefinition) controlType); + } + + startFormControl(formControl, controlType); + formControl.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "bind", + bindId); + + //put the label before + // no -> put in the "createControlFor..." methods + + /*Element captionElement=xForm.createElementNS(XFORMS_NS,getXFormsNSPrefix() + "label"); + this.setXFormsId(captionElement); + captionElement.appendChild(xForm.createTextNode(caption)); + if(formControl.hasChildNodes()) + { + Node first=formControl.getFirstChild(); + captionElement = (Element) formControl.insertBefore(captionElement, first); + } + else + captionElement = (Element) formControl.appendChild(captionElement); */ + + // TODO: Enhance alert statement based on facet restrictions. + // TODO: Enhance to support minOccurs > 1 and maxOccurs > 1. + // TODO: Add i18n/l10n suppport to this - use java MessageFormatter... + // + // e.g. Please provide a valid value for 'Address'. 'Address' is a mandatory decimal field. + // + Element alertElement = + (Element) formControl.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "alert")); + this.setXFormsId(alertElement); + + StringBuffer alert = + new StringBuffer("Please provide a valid value for '" + caption + "'."); + + Element enveloppe = xForm.getDocumentElement(); + + if (minOccurs != 0) { + alert.append(" '" + + caption + + "' is a required '" + + createCaption(this.getXFormsTypeName(enveloppe, controlType)) + + "' value."); + } else { + alert.append(" '" + + caption + + "' is an optional '" + + createCaption(this.getXFormsTypeName(enveloppe, controlType)) + + "' value."); + } + + alertElement.appendChild(xForm.createTextNode(alert.toString())); + + return formControl; + } + + /** + * used to get the type name that will be used in the XForms document + * + * @param context the element which will serve as context for namespaces + * @param controlType the type from which we want the name + * @return the complete type name (with namespace prefix) of the type in the XForms doc + */ + protected String getXFormsTypeName(Element context, XSTypeDefinition controlType) { + String result = null; + + String typeName = controlType.getName(); + String typeNS = controlType.getNamespace(); + + //if we use XMLSchema types: + //first check if it is a simple type named in the XMLSchema + if (_useSchemaTypes + && controlType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE + && typeName != null && !typeName.equals("") + && schema.getTypeDefinition(typeName, typeNS) != null) { //type is globally defined + //use schema type + + //local type name + String localTypeName = typeName; + int index = typeName.indexOf(":"); + if (index > -1 && typeName.length() > index) + localTypeName = typeName.substring(index + 1); + + //namespace prefix in this document + String prefix = NamespaceCtx.getPrefix(context, typeNS); + + //completeTypeName = new prefix + local name + result = localTypeName; + if (prefix != null && !prefix.equals("")) + result = prefix + ":" + localTypeName; + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("getXFormsTypeName: typeName=" + typeName + ", typeNS=" + typeNS + ", result=" + result); + } else { //use built in type + result = this.getDataTypeName(getBuiltInType(controlType)); + } + return result; + } + + private Document createFormTemplate(String formId) + throws IOException, ParserConfigurationException { + return createFormTemplate(formId, + "Form " + formId, + getProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP)); + } + + private Document createFormTemplate(String formId, + String formName, + String stylesheet) + throws ParserConfigurationException { + Document xForm = documentBuilder.newDocument(); + + Element envelopeElement = _wrapper.createEnvelope(xForm); + + // set required namespace attributes + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:" + + getChibaNSPrefix().substring(0, + getChibaNSPrefix().length() - 1), + CHIBA_NS); + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:" + + getXFormsNSPrefix().substring(0, + getXFormsNSPrefix().length() - 1), + XFORMS_NS); + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:" + + getXLinkNSPrefix().substring(0, + getXLinkNSPrefix().length() - 1), + XLINK_NS); +//XMLEvent + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:" + + xmleventsNSPrefix.substring(0, xmleventsNSPrefix.length() - 1), + XMLEVENTS_NS); +//XML Schema Instance + envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI, + "xmlns:" + + xmlSchemaInstancePrefix.substring(0, xmlSchemaInstancePrefix.length() - 1), + XMLSCHEMA_INSTANCE_NAMESPACE_URI); +//base + if (_base != null && !_base.equals("")) { + envelopeElement.setAttributeNS(XML_NAMESPACE_URI, + "xml:base", + _base); + } + + //model element + Element modelElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "model"); + this.setXFormsId(modelElement); + Element modelWrapper = _wrapper.createModelWrapper(modelElement); + envelopeElement.appendChild(modelWrapper); + + //form control wrapper -> created by wrapper + //Element formWrapper = xForm.createElement("body"); + //envelopeElement.appendChild(formWrapper); + Element formWrapper = _wrapper.createFormWrapper(envelopeElement); + + return xForm; + } + + private Element createGroup(Document xForm, + Element modelSection, + Element formSection, + XSElementDeclaration owner) { + // add a group node and recurse + // + Element groupElement = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "group"); + groupElement = startFormGroup(groupElement, owner); + + if (groupElement != null) { + this.setXFormsId(groupElement); + + Element controlsWrapper = + _wrapper.createControlsWrapper(groupElement); + + //groupElement = (Element) formSection.appendChild(groupElement); + formSection.appendChild(controlsWrapper); + + Element captionElement = + (Element) groupElement.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(captionElement); + captionElement.appendChild(xForm.createTextNode(createCaption(owner))); + + //no hint in groups + + /*Element hint = createHint(xForm,owner); + if (hint != null) { + groupElement.appendChild(hint); + }*/ + } else { + groupElement = modelSection; + } + + return groupElement; + } + + /** + * Get a fully qualified name for this element, and eventually declares a new prefix for the namespace if + * it was not declared before + * + * @param element + * @param xForm + * @return + */ + private String getElementName(XSElementDeclaration element, Document xForm) { + String elementName = element.getName(); + String namespace = element.getNamespace(); + if (namespace != null && !namespace.equals("")) { + String prefix; + if ((prefix = (String) namespacePrefixes.get(namespace)) == null) { + String basePrefix = (namespace.substring(namespace.lastIndexOf('/', namespace.length()-2)+1)); + int i=1; + prefix = basePrefix; + while (namespacePrefixes.containsValue(prefix)) { + prefix = basePrefix + (i++); + } + namespacePrefixes.put(namespace, prefix); + Element envelope = xForm.getDocumentElement(); + envelope.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns:"+prefix, namespace); + } + elementName = prefix + ":" + elementName; + } + return elementName; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseSchemaFormBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseSchemaFormBuilder.java new file mode 100644 index 0000000000..f257e5b9a9 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseSchemaFormBuilder.java @@ -0,0 +1,650 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.apache.xerces.xs.*; +import org.chiba.util.StringUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +import javax.xml.transform.Source; +import java.util.Vector; + +/* + * Search for TODO for things remaining to-do in this implementation. + * + * TODO: i18n/l10n of messages, hints, captions. Possibly leverage org.chiba.i18n classes. + * TODO: When Chiba supports itemset, use schema keyref and key constraints for validation. + * TODO: Add support for default and fixed values. + * TODO: Add support for use=prohibited. + */ + +/** + * A concrete base implementation of the SchemaFormBuilder interface allowing + * an XForm to be automatically generated for an XML Schema definition. + * + * @author Brian Dueck + * @version $Id: BaseSchemaFormBuilder.java,v 1.19 2005/03/29 14:24:34 unl Exp $ + */ +public class BaseSchemaFormBuilder + extends AbstractSchemaFormBuilder + implements SchemaFormBuilder { + /** + * Creates a new instance of BaseSchemaForBuilder + */ + public BaseSchemaFormBuilder(String rootTagName) { + super(rootTagName); + } + + /** + * Creates a new BaseSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceSource __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public BaseSchemaFormBuilder(String rootTagName, + Source instanceSource, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + super(rootTagName, + instanceSource, + action, + submitMethod, + wrapper, + stylesheet, + base, + userSchemaTypes); + } + + /** + * Creates a new BaseSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceSource __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public BaseSchemaFormBuilder(String rootTagName, + Document instanceDocument, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + super(rootTagName, + instanceDocument, + action, + submitMethod, + wrapper, + stylesheet, + base, + userSchemaTypes); + } + + /** + * Creates a new BaseSchemaFormBuilder object. + * + * @param rootTagName __UNDOCUMENTED__ + * @param instanceHref __UNDOCUMENTED__ + * @param action __UNDOCUMENTED__ + * @param submitMethod __UNDOCUMENTED__ + * @param wrapper __UNDOCUMENTED__ + * @param stylesheet __UNDOCUMENTED__ + */ + public BaseSchemaFormBuilder(String rootTagName, + String instanceHref, + String action, + String submitMethod, + WrapperElementsBuilder wrapper, + String stylesheet, + String base, + boolean userSchemaTypes) { + super(rootTagName, + instanceHref, + action, + submitMethod, + wrapper, + stylesheet, + base, + userSchemaTypes); + } + + /** + * __UNDOCUMENTED__ + * + * @param text __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String createCaption(String text) { + return StringUtil.capitalizeIdentifier(text); + } + + /** + * __UNDOCUMENTED__ + * + * @param attribute __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String createCaption(XSAttributeDeclaration attribute) { + // TODO: Improve i18n/l10n of caption - may have to use + // a custom element in the XML Schema to do this. + // + return createCaption(attribute.getName()); + } + + public String createCaption(XSAttributeUse attribute) { + // TODO: Improve i18n/l10n of caption - may have to use + // a custom element in the XML Schema to do this. + // + return createCaption(attribute.getAttrDeclaration().getName()); + } + + /** + * __UNDOCUMENTED__ + * + * @param element __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String createCaption(XSElementDeclaration element) { + // TODO: Improve i18n/l10n of caption - may have to use + // a custom element in the XML Schema to do this. + // + return createCaption(element.getName()); + } + + /** + * __UNDOCUMENTED__ + * + * @param element __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public String createCaption(XSObject element) { + // TODO: Improve i18n/l10n of caption - may have to use + // a custom element in the XML Schema to do this. + // + if (element instanceof XSElementDeclaration) { + return createCaption(((XSElementDeclaration) element).getName()); + } else if (element instanceof XSAttributeDeclaration) { + return createCaption(((XSAttributeDeclaration) element).getName()); + } else if (element instanceof XSAttributeUse) { + return createCaption(((XSAttributeUse) element).getAttrDeclaration().getName()); + } else + LOGGER.warn("WARNING: createCaption: element is not an attribute nor an element: " + + element.getClass().getName()); + + return null; + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param caption __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element createControlForAnyType(Document xForm, + String caption, + XSTypeDefinition controlType) { + Element control = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "textarea"); + this.setXFormsId(control); + control.setAttributeNS(CHIBA_NS, getChibaNSPrefix() + "height", "3"); + + //label + Element captionElement = + (Element) control.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(captionElement); + captionElement.appendChild(xForm.createTextNode(caption)); + + return control; + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param caption __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element createControlForAtomicType(Document xForm, + String caption, + XSSimpleTypeDefinition controlType) { + Element control; + + //remove while select1 do not work correctly in repeats + if ((controlType.getName() != null) + && controlType.getName().equals("boolean")) { + control = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "select1"); + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + "full"); + this.setXFormsId(control); + + Element item_true = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "item"); + this.setXFormsId(item_true); + Element label_true = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "label"); + this.setXFormsId(label_true); + Text label_true_text = xForm.createTextNode("true"); + label_true.appendChild(label_true_text); + item_true.appendChild(label_true); + + Element value_true = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "value"); + this.setXFormsId(value_true); + Text value_true_text = xForm.createTextNode("true"); + value_true.appendChild(value_true_text); + item_true.appendChild(value_true); + control.appendChild(item_true); + + Element item_false = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "item"); + this.setXFormsId(item_false); + Element label_false = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "label"); + this.setXFormsId(label_false); + Text label_false_text = xForm.createTextNode("false"); + label_false.appendChild(label_false_text); + item_false.appendChild(label_false); + + Element value_false = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "value"); + this.setXFormsId(value_false); + Text value_false_text = xForm.createTextNode("false"); + value_false.appendChild(value_false_text); + item_false.appendChild(value_false); + control.appendChild(item_false); + } else { + control = + xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "input"); + this.setXFormsId(control); + } + + //label + Element captionElement = + (Element) control.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(captionElement); + captionElement.appendChild(xForm.createTextNode(caption)); + + return control; + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + * @param caption __UNDOCUMENTED__ + * @param bindElement __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element createControlForEnumerationType(Document xForm, + XSSimpleTypeDefinition controlType, + String caption, + Element bindElement) { + // TODO: Figure out an intelligent or user determined way to decide between + // selectUI style (listbox, menu, combobox, radio) (radio and listbox best apply) + // Possibly look for special appInfo section in the schema and if not present default to comboBox... + // + // For now, use radio if enumValues < DEFAULT_LONG_LIST_MAX_SIZE otherwise use combobox + // + StringList enumFacets = controlType.getLexicalEnumeration(); + int nbFacets = enumFacets.getLength(); + if (nbFacets > 0) { + Vector enumValues = new Vector(); + + Element control = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "select1"); + this.setXFormsId(control); + + //label + Element captionElement1 = + (Element) control.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(captionElement1); + captionElement1.appendChild(xForm.createTextNode(caption)); + + Element choices = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "choices"); + this.setXFormsId(choices); + + for (int i = 0; i < nbFacets; i++) { + String facet = enumFacets.item(i); + enumValues.add(facet); + } + + if (nbFacets + < Long.parseLong(getProperty(SELECTONE_LONG_LIST_SIZE_PROP))) { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTONE_UI_CONTROL_SHORT_PROP)); + } else { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTONE_UI_CONTROL_LONG_PROP)); + + // add the "Please select..." instruction item for the combobox + // and set the isValid attribute on the bind element to check for the "Please select..." + // item to indicate that is not a valid value + // + { + String pleaseSelect = "[Select1 " + caption + "]"; + Element item = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "item"); + this.setXFormsId(item); + choices.appendChild(item); + + Element captionElement = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label"); + this.setXFormsId(captionElement); + item.appendChild(captionElement); + captionElement.appendChild(xForm.createTextNode(pleaseSelect)); + + Element value = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "value"); + this.setXFormsId(value); + item.appendChild(value); + value.appendChild(xForm.createTextNode(pleaseSelect)); + + // not(purchaseOrder/state = '[Choose State]') + //String isValidExpr = "not(" + bindElement.getAttributeNS(XFORMS_NS,"nodeset") + " = '" + pleaseSelect + "')"; + // ->no, not(. = '[Choose State]') + String isValidExpr = "not( . = '" + pleaseSelect + "')"; + + //check if there was a constraint + String constraint = + bindElement.getAttributeNS(XFORMS_NS, "constraint"); + + if ((constraint != null) && !constraint.equals("")) { + constraint = constraint + " and " + isValidExpr; + } else { + constraint = isValidExpr; + } + + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "constraint", + constraint); + } + } + + control.appendChild(choices); + + addChoicesForSelectControl(xForm, choices, enumValues); + + return control; + } else { + return null; + } + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param listType __UNDOCUMENTED__ + * @param caption __UNDOCUMENTED__ + * @param bindElement __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element createControlForListType(Document xForm, + XSSimpleTypeDefinition listType, + String caption, + Element bindElement) { + XSSimpleTypeDefinition controlType = listType.getItemType(); + + StringList enumFacets = controlType.getLexicalEnumeration(); + int nbFacets = enumFacets.getLength(); + if (nbFacets > 0) { + Element control = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "select"); + this.setXFormsId(control); + + //label + Element captionElement = + (Element) control.appendChild(xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "label")); + this.setXFormsId(captionElement); + captionElement.appendChild(xForm.createTextNode(caption)); + + Vector enumValues = new Vector(); + for (int i = 0; i < nbFacets; i++) { + String facet = enumFacets.item(i); + enumValues.add(facet); + } + + // TODO: Figure out an intelligent or user determined way to decide between + // selectUI style (listbox, menu, combobox, radio) (radio and listbox best apply) + // Possibly look for special appInfo section in the schema and if not present default to checkBox... + // + // For now, use checkbox if there are < DEFAULT_LONG_LIST_MAX_SIZE items, otherwise use long control + // + if (enumValues.size() + < Long.parseLong(getProperty(SELECTMANY_LONG_LIST_SIZE_PROP))) { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTMANY_UI_CONTROL_SHORT_PROP)); + } else { + control.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "appearance", + getProperty(SELECTMANY_UI_CONTROL_LONG_PROP)); + } + + Element choices = + xForm.createElementNS(XFORMS_NS, + getXFormsNSPrefix() + "choices"); + this.setXFormsId(choices); + control.appendChild(choices); + + addChoicesForSelectControl(xForm, choices, enumValues); + + return control; + } else { + return null; + } + } + + /** + * __UNDOCUMENTED__ + * + * @param xForm __UNDOCUMENTED__ + * @param node __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element createHint(Document xForm, XSObject node) { + XSAnnotation annotation = null; + if (node instanceof XSElementDeclaration) + annotation = ((XSElementDeclaration) node).getAnnotation(); + else if (node instanceof XSAttributeDeclaration) + annotation = ((XSAttributeDeclaration) node).getAnnotation(); + else if (node instanceof XSAttributeUse) + annotation = + ((XSAttributeUse) node).getAttrDeclaration().getAnnotation(); + + if (annotation != null) + return addHintFromDocumentation(xForm, annotation); + else + return null; + } + + /** + * __UNDOCUMENTED__ + * + * @param bindElement __UNDOCUMENTED__ + */ + public void endBindElement(Element bindElement) { + return; + } + + /** + * __UNDOCUMENTED__ + * + * @param controlElement __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + */ + public void endFormControl(Element controlElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs) { + return; + } + + /** + * __UNDOCUMENTED__ + * + * @param groupElement __UNDOCUMENTED__ + */ + public void endFormGroup(Element groupElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs, + Element modelSection) { + return; + } + + /** + * __UNDOCUMENTED__ + * + * @param bindElement __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + * @param minOccurs __UNDOCUMENTED__ + * @param maxOccurs __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element startBindElement(Element bindElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs) { + // START WORKAROUND + // Due to a Chiba bug, anyType is not a recognized type name. + // so, if this is an anyType, then we'll just skip the type + // setting. + // + // type.getName() may be 'null' for anonymous types, so compare against + // static string (see bug #1172541 on sf.net) + if (!("anyType").equals(controlType.getName())) { + Element enveloppe = bindElement.getOwnerDocument().getDocumentElement(); + String typeName = this.getXFormsTypeName(enveloppe, controlType); + if (typeName != null && !typeName.equals("")) + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "type", + typeName); + } + + if (minOccurs == 0) { + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "required", + "false()"); + } else { + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "required", + "true()"); + } + + //no more minOccurs & maxOccurs element: add a constraint if maxOccurs>1: + //count(.) <= maxOccurs && count(.) >= minOccurs + String minConstraint = null; + String maxConstraint = null; + + if (minOccurs > 1) { + //if 0 or 1 -> no constraint (managed by "required") + minConstraint = "count(.) >= " + minOccurs; + } + + if (maxOccurs > 1) { + //if 1 or unbounded -> no constraint + maxConstraint = "count(.) <= " + maxOccurs; + } + + String constraint = null; + + if ((minConstraint != null) && (maxConstraint != null)) { + constraint = minConstraint + " and " + maxConstraint; + } else if (minConstraint != null) { + constraint = minConstraint; + } else { + constraint = maxConstraint; + } + + if ((constraint != null) && !constraint.equals("")) { + bindElement.setAttributeNS(XFORMS_NS, + getXFormsNSPrefix() + "constraint", + constraint); + } + + /*if (minOccurs != 1) { + bindElement.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "minOccurs",String.valueOf(minOccurs)); + } + if (maxOccurs != 1) { + bindElement.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "maxOccurs",maxOccurs == -1 ? "unbounded" : String.valueOf((maxOccurs))); + }*/ + return bindElement; + } + + /** + * __UNDOCUMENTED__ + * + * @param controlElement __UNDOCUMENTED__ + * @param controlType __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element startFormControl(Element controlElement, + XSTypeDefinition controlType) { + return controlElement; + } + + /** + * __UNDOCUMENTED__ + * + * @param groupElement __UNDOCUMENTED__ + * @param schemaElement __UNDOCUMENTED__ + * @return __UNDOCUMENTED__ + */ + public Element startFormGroup(Element groupElement, + XSElementDeclaration schemaElement) { + //groupElement.setAttributeNS(CHIBA_NS,getChibaNSPrefix() + "box-align",getProperty(GROUP_BOX_ALIGN_PROP)); + //groupElement.setAttributeNS(CHIBA_NS,getChibaNSPrefix() + "box-orient",getProperty(GROUP_BOX_ORIENT_PROP)); + //groupElement.setAttributeNS(CHIBA_NS,getChibaNSPrefix() + "caption-width",getProperty(GROUP_CAPTION_WIDTH_PROP)); + //groupElement.setAttributeNS(CHIBA_NS,getChibaNSPrefix() + "width",getProperty(GROUP_WIDTH_PROP)); + //groupElement.setAttributeNS(CHIBA_NS,getChibaNSPrefix() + "border",getProperty(GROUP_BORDER_PROP)); + return groupElement; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseWrapperElementsBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseWrapperElementsBuilder.java new file mode 100644 index 0000000000..ba4333b9d9 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/BaseWrapperElementsBuilder.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Basic implementation of WrapperElementsBuilder, with no additional design + * + * @author - Sophie Ramel + */ +public class BaseWrapperElementsBuilder implements WrapperElementsBuilder { + /** + * Creates a new instance of BaseWrapperElementsBuilder + */ + public BaseWrapperElementsBuilder() { + } + + /** + * create the wrapper element of the different controls + * + * @param controlElement the control element (input, select, repeat, group, ...) + * @return the wrapper element, already containing the control element + */ + public Element createControlsWrapper(Element controlElement) { + return controlElement; + } + + /** + * creates the global enveloppe of the resulting document, and puts it in the document + * + * @return the enveloppe + */ + public Element createEnvelope(Document xForm) { + Element envelopeElement = xForm.createElement("envelope"); + + //Element envelopeElement = xForm.createElementNS(CHIBA_NS, this.getChibaNSPrefix()+"envelope"); + xForm.appendChild(envelopeElement); + + return envelopeElement; + } + + /** + * create the wrapper element of the form + * + * @param enveloppeElement the form element (chiba:form or other) + * @return the wrapper element + */ + + public Element createFormWrapper(Element enveloppeElement) { + //add a "body" element without NS + Document doc = enveloppeElement.getOwnerDocument(); + Element body = doc.createElement("body"); + //body.appendChild(formElement); + enveloppeElement.appendChild(body); + return body; + } + + /** + * create the element that will contain the content of the group (or repeat) element + * + * @param groupElement the group or repeat element + * @return the wrapper element, already containing the content of the group element + */ + public Element createGroupContentWrapper(Element groupElement) { + return groupElement; + } + + /** + * create the wrapper element of the xforms:model element + * + * @param modelElement the xforms:model element + * @return the wrapper element, already containing the model + */ + public Element createModelWrapper(Element modelElement) { + return modelElement; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/FormBuilderException.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/FormBuilderException.java new file mode 100644 index 0000000000..aa437e5605 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/FormBuilderException.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + + +/** + * This exception is thrown when implementations of SchemaFormBuilder encounters an + * error building a form. + * + * @author Brian Dueck + * @version $Id: FormBuilderException.java,v 1.4 2005/01/31 22:49:31 joernt Exp $ + */ +public class FormBuilderException extends java.lang.Exception { + private Exception cause = null; + + /** + * Creates a new instance of FormBuilderException without detail message. + */ + public FormBuilderException() { + } + + /** + * Constructs an instance of FormBuilderException with the specified detail message. + * + * @param msg the detail message. + */ + public FormBuilderException(String msg) { + super(msg); + } + + /** + * Constructs an instance of FormBuilderException with the specified root exception. + * + * @param x The root exception. + */ + public FormBuilderException(Exception x) { + //THIS DOES NOT WORK WITH JDK 1.3 CAUSE THIS IS NEW IN JDK 1.4 + //super(x); + super(x.getMessage()); + } +} + + +/* + $Log: FormBuilderException.java,v $ + Revision 1.4 2005/01/31 22:49:31 joernt + added copyright notice + + Revision 1.3 2004/08/15 14:14:07 joernt + preparing release... + -reformatted sources to fix mixture of tabs and spaces + -optimized imports on all files + + Revision 1.2 2003/10/02 15:15:49 joernt + applied chiba jalopy settings to whole src tree + + Revision 1.1 2003/07/12 12:22:48 joernt + package refactoring: moved from xforms.builder + Revision 1.1.1.1 2003/05/23 14:54:08 unl + no message + Revision 1.2 2003/02/19 09:09:15 soframel + print the exception's message + Revision 1.1 2002/12/11 14:50:42 soframel + transferred the Schema2XForms generator from chiba2 to chiba1 + Revision 1.3 2002/06/11 17:13:03 joernt + commented out jdk 1.3 incompatible constructor-impl + Revision 1.2 2002/06/11 14:06:31 joernt + commented out the jdk 1.4 constructor + Revision 1.1 2002/05/22 22:24:34 joernt + Brian's initial version of schema2xforms builder + */ diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/SchemaFormBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/SchemaFormBuilder.java new file mode 100644 index 0000000000..5058f4a797 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/SchemaFormBuilder.java @@ -0,0 +1,420 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.xerces.xs.*; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javax.xml.transform.Source; +import java.util.Properties; + +/** + * An object that implements this interface can build an XForm that conforms to + * the elements and attributes declared in an XML Schema. + * + * @author Brian Dueck + * @version $Id: SchemaFormBuilder.java,v 1.16 2005/02/10 13:24:57 joernt Exp $ + */ +public interface SchemaFormBuilder { + + public final static Log LOGGER = + LogFactory.getLog(SchemaFormBuilder.class); + + /** + * XMLSchema Instance Namespace declaration + */ + public static final String XMLSCHEMA_INSTANCE_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema-instance"; + + /** + * XMLNS Namespace declaration. + */ + public static final String XMLNS_NAMESPACE_URI = + "http://www.w3.org/2000/xmlns/"; + + /** + * XML Namespace declaration + */ + public static final String XML_NAMESPACE_URI = + "http://www.w3.org/XML/1998/namespace"; + + /** + * XForms namespace declaration. + */ + public static final String XFORMS_NS = "http://www.w3.org/2002/xforms"; + + /** + * Chiba namespace declaration. + */ + public static final String CHIBA_NS = + "http://chiba.sourceforge.net/xforms"; + + /** + * XLink namespace declaration. + */ + public static final String XLINK_NS = "http://www.w3.org/1999/xlink"; + + /** + * XML Events namsepace declaration. + */ + public static final String XMLEVENTS_NS = "http://www.w3.org/2001/xml-events"; + + /** + * Chiba prefix + */ + public static final String chibaNSPrefix = "chiba:"; + + /** + * XForms prefix + */ + public static final String xformsNSPrefix = "xforms:"; + + /** + * Xlink prefix + */ + public static final String xlinkNSPrefix = "xlink:"; + + /** + * XMLSchema instance prefix * + */ + public static final String xmlSchemaInstancePrefix = "xsi:"; + + /** + * XML Events prefix + */ + public static final String xmleventsNSPrefix = "ev:"; + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getAction(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getInstanceHref(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public int getInstanceMode(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public Source getInstanceSource(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public Document getInstanceDocument(); + + /** + * Get the current set of properties used by implementations of SchemaFormBuilder. + * + * @return The list of properties. + */ + public Properties getProperties(); + + /** + * Sets the property to the specified value. If the property exists, its value is overwritten. + * + * @param key The implementation defined property key. + * @param value The value for the property. + */ + public void setProperty(String key, String value); + + /** + * Gets the value for the specified property. + * + * @param key The implementation defined property key. + * @return The property value if found, or null if the property cannot be located. + */ + public String getProperty(String key); + + /** + * Gets the value for the specified property, with a default if the property cannot be located. + * + * @param key The implementation defined property key. + * @param defaultValue This value will be returned if the property does not exists. + * @return The property value if found, or defaultValue if the property cannot be located. + */ + public String getProperty(String key, String defaultValue); + + /** + * Properties choosed by the user + */ + public String getRootTagName(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getStylesheet(); + + /** + * __UNDOCUMENTED__ + * + * @return __UNDOCUMENTED__ + */ + public String getSubmitMethod(); + + /** + * Generate the XForm based on a user supplied XML Schema. + * + * @param inputURI The document source for the XML Schema. + * @return The Document containing the XForm. + * @throws org.chiba.tools.schemabuilder.FormBuilderException + * If an error occurs building the XForm. + */ + public Document buildForm(String inputURI) throws FormBuilderException; + + /** + * Creates a caption for the provided text extracted from the XML Schema. + * The implementation is responsible for reformatting the provided string to make it + * suitable to be displayed to users of the XForm. This typically includes translating + * XML tag name style identifiers (e.g. customerStreetAddress) into more reader friendly + * captions (e.g. Customer Street Address). + * + * @param text The string value to be reformatted for use as a caption. + * @return The caption. + */ + public String createCaption(String text); + + /** + * Creates a caption for the provided XML Schema attribute. + * The implementation is responsible for providing an appropriate caption + * suitable to be displayed to users of the XForm. This typically includes translating + * XML tag name style identifiers (e.g. customerStreetAddress) into more reader friendly + * captions (e.g. Customer Street Address). + * + * @param attribute The XML schema attribute for which a caption is required. + * @return The caption. + */ + public String createCaption(XSAttributeDeclaration attribute); + + /** + * Creates a caption for the provided XML Schema element. + * The implementation is responsible for providing an appropriate caption + * suitable to be displayed to users of the XForm. This typically includes translating + * XML tag name style identifiers (e.g. customerStreetAddress) into more reader friendly + * captions (e.g. Customer Street Address). + * + * @param element The XML schema element for which a caption is required. + * @return The caption. + */ + public String createCaption(XSElementDeclaration element); + + /** + * Creates a form control for an XML Schema any type. + *

+ * This method is called when the form builder determines a form control is required for + * an any type. + * The implementation of this method is responsible for creating an XML element of the + * appropriate type to receive a value for controlType. The caller is responsible + * for adding the returned element to the form and setting caption, bind, and other + * standard elements and attributes. + * + * @param xForm The XForm document. + * @param controlType The XML Schema type for which the form control is to be created. + * @return The element for the form control. + */ + public Element createControlForAnyType(Document xForm, + String caption, + XSTypeDefinition controlType); + + /** + * Creates a form control for an XML Schema simple atomic type. + *

+ * This method is called when the form builder determines a form control is required for + * an atomic type. + * The implementation of this method is responsible for creating an XML element of the + * appropriate type to receive a value for controlType. The caller is responsible + * for adding the returned element to the form and setting caption, bind, and other + * standard elements and attributes. + * + * @param xForm The XForm document. + * @param controlType The XML Schema type for which the form control is to be created. + * @return The element for the form control. + */ + public Element createControlForAtomicType(Document xForm, + String caption, + XSSimpleTypeDefinition controlType); + + /** + * Creates a form control for an XML Schema simple type restricted by an enumeration. + * This method is called when the form builder determines a form control is required for + * an enumerated type. + * The implementation of this method is responsible for creating an XML element of the + * appropriate type to receive a value for controlType. The caller is responsible + * for adding the returned element to the form and setting caption, bind, and other + * standard elements and attributes. + * + * @param xForm The XForm document. + * @param controlType The XML Schema type for which the form control is to be created. + * @param caption The caption for the form control. The caller The purpose of providing the caption + * is to permit the implementation to add a [Select1 .... ] message that involves the caption. + * @param bindElement The bind element for this control. The purpose of providing the bind element + * is to permit the implementation to add a isValid attribute to the bind element that prevents + * the [Select1 .... ] item from being selected. + * @return The element for the form control. + */ + public Element createControlForEnumerationType(Document xForm, + XSSimpleTypeDefinition controlType, + String caption, + Element bindElement); + + /** + * Creates a form control for an XML Schema simple list type. + *

+ * This method is called when the form builder determines a form control is required for + * a list type. + * The implementation of this method is responsible for creating an XML element of the + * appropriate type to receive a value for controlType. The caller is responsible + * for adding the returned element to the form and setting caption, bind, and other + * standard elements and attributes. + * + * @param xForm The XForm document. + * @param listType The XML Schema list type for which the form control is to be created. + * @param caption The caption for the form control. The caller The purpose of providing the caption + * is to permit the implementation to add a [Select1 .... ] message that involves the caption. + * @param bindElement The bind element for this control. The purpose of providing the bind element + * is to permit the implementation to add a isValid attribute to the bind element that prevents + * the [Select1 .... ] item from being selected. + * @return The element for the form control. + */ + public Element createControlForListType(Document xForm, + XSSimpleTypeDefinition listType, + String caption, + Element bindElement); + + /** + * Creates a hint XML Schema annotated node (AttributeDecl or ElementDecl). + * The implementation is responsible for providing an xforms:hint element for the + * specified schemaNode suitable to be dsipalayed to users of the XForm. The caller + * is responsible for adding the returned element to the form. + * This typically includes extracting documentation from the element/attribute's + * annotation/documentation elements and/or extracting the same information from the + * element/attribute's type annotation/documentation. + * + * @param schemaNode The string value to be reformatted for use as a caption. + * @return The xforms:hint element. If a null value is returned a hint is not added. + */ + public Element createHint(Document xForm, XSObject schemaNode); + + /** + * This method is invoked after the form builder is finished creating and processing + * a bind element. Implementations may choose to use this method to add/inspect/modify + * the bindElement prior to the builder moving onto the next bind element. + * + * @param bindElement The bind element being processed. + */ + public void endBindElement(Element bindElement); + + /** + * This method is invoked after the form builder is finished creating and processing + * a form control. Implementations may choose to use this method to add/inspect/modify + * the controlElement prior to the builder moving onto the next control. + * + * @param controlElement The form control element that was created. + * @param controlType The XML Schema type for which controlElement was created. + */ + public void endFormControl(Element controlElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs); + + /** + * __UNDOCUMENTED__ + * + * @param groupElement __UNDOCUMENTED__ + */ + public void endFormGroup(Element groupElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs, + Element modelSection); + + /** + * Reset the SchemaFormBuilder to default values. + */ + public void reset(); + + /** + * This method is invoked after an xforms:bind element is created for the specified SimpleType. + * The implementation is responsible for setting setting any/all bind attributes + * except for id and ref - these have been automatically set + * by the caller (and should not be touched by implementation of startBindElement) + * prior to invoking startBindElement. + * The caller automatically adds the returned element to the model section of + * the form. + * + * @param bindElement The bindElement being processed. + * @param controlType XML Schema type of the element/attribute this bind is for. + * @param minOccurs The minimum number of occurences for this element/attribute. + * @param maxOccurs The maximum number of occurences for this element/attribute. + * @return The bind Element to use in the XForm - bindElement or a replacement. + */ + public Element startBindElement(Element bindElement, + XSTypeDefinition controlType, + int minOccurs, + int maxOccurs); + + /** + * This method is invoked after the form builder creates a form control + * via a createControlForXXX() method but prior to decorating the form control + * with common attributes such as a caption, hint, help text elements, + * bind attributes, etc. + * The returned element is used in the XForm in place of controlElement. + * Implementations may choose to use this method to substitute controlElement + * with a different element, or perform any other processing on controlElement + * prior to it being added to the form. + * + * @param controlElement The form control element that was created. + * @param controlType The XML Schema type for which controlElement was created. + * @return The Element to use in the XForm - controlElement or a replacement. + */ + public Element startFormControl(Element controlElement, + XSTypeDefinition controlType); + + /** + * This method is invoked after an xforms:group element is created for the specified + * ElementDecl. A group is created whenever an element is encountered in the XML Schema + * that contains other elements and attributes (complex types or mixed content types). + * The caller automatically adds the returned element to the XForm. + * + * @param groupElement The groupElement being processed. + * @param schemaElement The schemaElement for the group. + * @return The group Element to use in the XForm - groupElement or a replacement. If a null + * value is returned, the group is not created. + */ + public Element startFormGroup(Element groupElement, + XSElementDeclaration schemaElement); +} diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/WrapperElementsBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/WrapperElementsBuilder.java new file mode 100644 index 0000000000..be42697229 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/WrapperElementsBuilder.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * This interface provides methods to create the "wrappers" elements that will contain the XForms document. + * These elements can be: + * - the first "enveloppe" element + * - other elements specific to a destination language or platform (ex: XHTML tags) + * + * @author Sophie Ramel + */ +public interface WrapperElementsBuilder { + /** + * create the wrapper element of the form (exemple_ "body" for HTML) + * + * @param enveloppeElement the containing enveloppe + * @return the wrapper element, already added in the enveloppe + */ + public Element createFormWrapper(Element enveloppeElement); + + /** + * create the wrapper element of the different controls + * + * @param controlElement the control element (input, select, repeat, group, ...) + * @return the wrapper element, already containing the control element + */ + public Element createControlsWrapper(Element controlElement); + + /** + * creates the global enveloppe of the resulting document, and puts it in the document + * + * @return the enveloppe + */ + public Element createEnvelope(Document xForm); + + /** + * create the element that will contain the content of the group (or repeat) element + * + * @param groupElement the group or repeat element + * @return - the wrapper element, already containing the content of the group element + */ + public Element createGroupContentWrapper(Element groupElement); + + /** + * create the wrapper element of the xforms:model element + * + * @param modelElement the xforms:model element + * @return - the wrapper element, already containing the model + */ + public Element createModelWrapper(Element modelElement); +} diff --git a/source/java/org/alfresco/web/templating/xforms/schemabuilder/XHTMLWrapperElementsBuilder.java b/source/java/org/alfresco/web/templating/xforms/schemabuilder/XHTMLWrapperElementsBuilder.java new file mode 100644 index 0000000000..cdd2ccca13 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/schemabuilder/XHTMLWrapperElementsBuilder.java @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.templating.xforms.schemabuilder; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Vector; + +/** + * XHTML implementation of WrapperElementsBuilder: allows to wrap the XForm document in XHTML tags. + * + * @author Sophie Ramel + */ +public class XHTMLWrapperElementsBuilder implements WrapperElementsBuilder { + + private final static String XHTML_NS = "http://www.w3.org/1999/xhtml"; + private final static String XHTML_PREFIX = "xhtml"; + // private final static String XHTML_NS = "http://www.w3.org/2002/06/xhtml2"; + // private final static String XHTML_PREFIX = "html"; + + private String title; + private final Vector links = new Vector(); + private final Vector meta = new Vector(); + private final Hashtable namespaces = new Hashtable(); + + /** + * Creates a new instance of XHTMLWrapperElementsBuilder + */ + public XHTMLWrapperElementsBuilder() { } + + /** + * add a tag "title" in the header of the HTML document + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * add a tag "link" in the header of the HTML document + * + * @param href the "href" parameter of the "link" tag + * @param type the "type" parameter of the "link" tag + * @param rel the "rel" parameter of the "link" tag + */ + public void addLink(String href, String type, String rel) { + String[] l = { href, type, rel }; + links.add(l); + } + + /** + * add a tag "meta" in the header of the HTML document + * + * @param http_equiv the "http-equiv" parameter of the "META" tag + * @param name the "name" parameter of the "META" tag + * @param content the "content" parameter of the "META" tag + * @param scheme the "scheme" parameter of the "META" tag + */ + public void addMeta(String http_equiv, + String name, + String content, + String scheme) { + String[] s = new String[] { http_equiv, name, content, scheme}; + meta.add(s); + } + + public void addNamespaceDeclaration(String prefix, String url) { + namespaces.put(prefix, url); + } + + /** + * create the wrapper element of the different controls + * + * @param controlElement the control element (input, select, repeat, group, ...) + * @return the wrapper element, already containing the control element + */ + public Element createControlsWrapper(Element controlElement) { + return controlElement; + } + + /** + * creates the global enveloppe of the resulting document, and puts it in the document + * + * @return the enveloppe + */ + public Element createEnvelope(Document doc) { + Element html = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":html"); + //set namespace attribute + html.setAttributeNS(SchemaFormBuilder.XMLNS_NAMESPACE_URI, + "xmlns:" + XHTML_PREFIX, + XHTMLWrapperElementsBuilder.XHTML_NS); + doc.appendChild(html); + + //other namespaces + Enumeration enumeration = namespaces.keys(); + while (enumeration.hasMoreElements()) { + String prefix = (String) enumeration.nextElement(); + String ns = (String) namespaces.get(prefix); + html.setAttributeNS(SchemaFormBuilder.XMLNS_NAMESPACE_URI, + "xmlns:" + prefix, + ns); + + } + + return html; + } + + /** + * create the element that will contain the content of the group (or repeat) element + * + * @param groupElement the group or repeat element + * @return the wrapper element + */ + public Element createGroupContentWrapper(Element groupElement) { + return groupElement; + } + + /** + * create the wrapper element of the form + * + * @param enveloppeElement the form element (chiba:form or other) + * @return the wrapper element + */ + + public Element createFormWrapper(Element enveloppeElement) { + Document doc = enveloppeElement.getOwnerDocument(); + Element body = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":body"); + //body.appendChild(formElement); + enveloppeElement.appendChild(body); + return body; + } + + /** + * create the wrapper element of the xforms:model element + * + * @param modelElement the xforms:model element + * @return the wrapper element, already containing the model + */ + public Element createModelWrapper(Element modelElement) { + Document doc = modelElement.getOwnerDocument(); + Element head = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":head"); + head.appendChild(modelElement); + + //eventually add other info + if ((title != null) && !title.equals("")) { + Element title_el = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":title"); + Text title_text = doc.createTextNode(title); + title_el.appendChild(title_text); + head.appendChild(title_el); + } + + if ((meta != null) && !meta.isEmpty()) { + Iterator it = meta.iterator(); + + while (it.hasNext()) { + String[] m = (String[]) it.next(); + String http_equiv = m[0]; + String name = m[1]; + String content = m[2]; + String scheme = m[3]; + + Element meta_el = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":META"); + head.appendChild(meta_el); + + //attributes + if ((http_equiv != null) && !http_equiv.equals("")) { + meta_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":http-equiv", http_equiv); + } + + if ((name != null) && !name.equals("")) { + meta_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":name", name); + } + + if ((content != null) && !content.equals("")) { + meta_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":content", content); + } + + if ((scheme != null) && !scheme.equals("")) { + meta_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":scheme", scheme); + } + } + } + + if ((links != null) && !links.isEmpty()) { + Iterator it = links.iterator(); + + while (it.hasNext()) { + String[] l = (String[]) it.next(); + String href = l[0]; + String type = l[1]; + String rel = l[2]; + + Element link_el = doc.createElementNS(XHTML_NS, XHTML_PREFIX + ":LINK"); + head.appendChild(link_el); + + //attributes + if ((href != null) && !href.equals("")) { + link_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":href", href); + } + + if ((type != null) && !type.equals("")) { + link_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":type", type); + } + + if ((rel != null) && !rel.equals("")) { + link_el.setAttributeNS(XHTML_NS, XHTML_PREFIX + ":rel", rel); + } + } + } + return head; + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/ChibaServlet.java b/source/java/org/alfresco/web/templating/xforms/servlet/ChibaServlet.java new file mode 100644 index 0000000000..f4d24265fb --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/ChibaServlet.java @@ -0,0 +1,472 @@ +package org.alfresco.web.templating.xforms.servlet; + +import org.alfresco.web.app.Application; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.httpclient.Cookie; +import org.chiba.adapter.ChibaAdapter; +import org.alfresco.web.templating.xforms.flux.FluxAdapter; +import org.chiba.tools.xslt.StylesheetLoader; +import org.chiba.tools.xslt.UIGenerator; +import org.chiba.tools.xslt.XSLTGenerator; +import org.chiba.xml.xforms.config.Config; +import org.chiba.xml.xforms.exception.XFormsException; +import org.chiba.xml.xforms.connector.http.AbstractHTTPConnector; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.*; +import java.io.*; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * The ChibaServlet handles all interactions between client and + * form-processor (ChibaBean) for the whole lifetime of a form-filling session. + *
+ * The Processor will be started through a Get-request from the client + * pointing to the desired form-container. The Processor instance will + * be stored in a Session-object.
+ *
+ * All further interaction will be handled through Post-requests. + * Incoming request params will be mapped to data and action-handlers. + * + * @author Joern Turner + * @author Ulrich Nicolas Lissé + * @author William Boyd + * @version $Id: ChibaServlet.java,v 1.14 2005/12/21 22:59:27 unl Exp $ + */ +public class ChibaServlet extends HttpServlet { + //init-params + private static Log logger = LogFactory.getLog(ChibaServlet.class); + + + private static final String FORM_PARAM_NAME = "form"; + private static final String XSL_PARAM_NAME = "xslt"; + private static final String CSS_PARAM_NAME = "css"; + private static final String ACTIONURL_PARAM_NAME = "action_url"; + + public static final String CHIBA_ADAPTER = "chiba.adapter"; + public static final String CHIBA_UI_GENERATOR = "chiba.ui.generator"; + public static final String CHIBA_SUBMISSION_RESPONSE = "chiba.submission.response"; + + /* + * It is not thread safe to modify these variables once the + * init(ServletConfig) method has been called + */ + // the absolute path to the Chiba config-file + protected String configPath = null; + + // the rootdir of this app; forms + documents fill be searched under this root + protected String contextRoot = null; + + // where uploaded files are stored + protected String uploadDir = null; + + protected String stylesPath = null; + + protected String agent; + + + /** + * Returns a short description of the servlet. + * + * @return - Returns a short description of the servlet. + */ + public String getServletInfo() { + return "Servlet Controller for Chiba XForms Processor"; + } + + /** + * Destroys the servlet. + */ + public void destroy() { + } + + /** + * Initializes the servlet. + * + * @param config - the ServletConfig object + * @throws javax.servlet.ServletException + */ + public void init(ServletConfig config) throws ServletException { + super.init(config); + + logger.info("--------------- initing ChibaServlet... ---------------"); + //read some params from web-inf + contextRoot = getServletConfig().getServletContext().getRealPath(""); + if (contextRoot == null) + contextRoot = getServletConfig().getServletContext().getRealPath("."); + + //get the relative path to the chiba config-file + String path = getServletConfig().getInitParameter("chiba.config"); + + //get the real path for the config-file + if (path != null) { + configPath = getServletConfig().getServletContext().getRealPath(path); + } + + //get the path for the stylesheets + path = getServletConfig().getServletContext().getInitParameter("chiba.xforms.stylesPath"); + + //get the real path for the stylesheets and configure a new StylesheetLoader with it + if (path != null) { + stylesPath = getServletConfig().getServletContext().getRealPath(path); + logger.info("stylesPath: " + stylesPath); + } + + //uploadDir = contextRoot + "/" + getServletConfig().getServletContext().getInitParameter("chiba.upload"); + uploadDir = getServletConfig().getServletContext().getInitParameter("chiba.upload"); + + //Security constraint + if (uploadDir != null) { + if (uploadDir.toUpperCase().indexOf("WEB-INF") >= 0) { + throw new ServletException("Chiba security constraint: uploadDir '" + uploadDir + "' not allowed"); + } + } + + //user-agent mappings + agent = getServletConfig().getServletContext().getInitParameter("chiba.useragent.ajax.path"); + } + + /** + * Starts a new form-editing session.
+ *

+ * The default value of a number of settings can be overridden as follows: + *

+ * 1. The uru of the xform to be displayed can be specified by using a param name of 'form' and a param value + * of the location of the xform file as follows, which will attempt to load the current xforms file. + *

+ * http://localhost:8080/chiba-0.9.3/XFormsServlet?form=/forms/hello.xhtml + *

+ * 2. The uru of the CSS file used to style the form can be specified using a param name of 'css' as follows: + *

+ * http://localhost:8080/chiba-0.9.3/XFormsServlet?form=/forms/hello.xhtml&css=/chiba/my.css + *

+ * 3. The uri of the XSLT file used to generate the form can be specified using a param name of 'xslt' as follows: + *

+ * http://localhost:8080/chiba-0.9.3/XFormsServlet?form=/forms/hello.xhtml&xslt=/chiba/my.xslt + *

+ * 4. Besides these special params arbitrary other params can be passed via the GET-string and will be available + * in the context map of ChibaBean. This means they can be used as instance data (with the help of ContextResolver) + * or to set params for URI resolution. + * + * @param request servlet request + * @param response servlet response + * @throws javax.servlet.ServletException + * @throws java.io.IOException + * @see org.chiba.xml.xforms.connector.context.ContextResolver + * @see org.chiba.xml.xforms.connector.ConnectorFactory + */ + protected void doGet(HttpServletRequest request, + HttpServletResponse response) + throws ServletException, IOException { + + ChibaAdapter adapter = null; + HttpSession session = request.getSession(true); + + logger.info("--------------- new XForms session ---------------"); + try { + //kill everything that may have lived before + session.removeAttribute(CHIBA_ADAPTER); + session.removeAttribute(CHIBA_UI_GENERATOR); + + // determine Form to load + String formURI = /*getRequestURI(request) +*/ request.getParameter(FORM_PARAM_NAME); + logger.info("formURI: " + formURI); + String xslFile = request.getParameter(XSL_PARAM_NAME); + String css = request.getParameter(CSS_PARAM_NAME); + String actionURL = getActionURL(request, response,true); + logger.info("setting up adapeter"); + + //setup Adapter + adapter = setupAdapter(new FluxAdapter(session), session, formURI); + setContextParams(request, adapter); + storeCookies(request, adapter); + adapter.init(); + + if (load(adapter, response)) return; + if (replaceAll(adapter, response)) return; + + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + logger.info("generating ui"); + + UIGenerator uiGenerator = createUIGenerator(request, actionURL, xslFile, css); + uiGenerator.setInputNode(adapter.getXForms()); + uiGenerator.setOutput(out); + uiGenerator.generate(); + + //store adapter in session + session.setAttribute(CHIBA_ADAPTER, adapter); + session.setAttribute(CHIBA_UI_GENERATOR,uiGenerator); + + out.close(); + logger.info("done!"); + } catch (Exception e) { + e.printStackTrace(); + shutdown(adapter, session, e, response, request); + } + } + + /** + * configures the an Adapter for interacting with the XForms processor (ChibaBean). The Adapter itself + * will create the XFormsProcessor (ChibaBean) and configure it for processing. + * + * If you'd like to use a different source of XForms documents e.g. DOM you should extend this class and + * overwrite this method. Please take care to also set the baseURI of the processor to a reasonable value + * cause this will be the fundament for all URI resolutions taking place. + * + * @param adapter the ChibaAdapter implementation to setup + * @param session - the Servlet session + * @param formPath - the relative location where forms are stored + * @return ServletAdapter + */ + protected ChibaAdapter setupAdapter(ChibaAdapter adapter, + HttpSession session, + String formPath) + throws XFormsException, URISyntaxException { + + adapter.createXFormsProcessor(); + + if ((configPath != null) && !(configPath.equals(""))) { + adapter.setConfigPath(configPath); + } + adapter.setXForms(new URI(formPath)); + adapter.setBaseURI(formPath); + adapter.setUploadDestination(uploadDir); + + Map servletMap = new HashMap(); + servletMap.put(ChibaAdapter.SESSION_ID, session.getId()); + adapter.setContextParam(ChibaAdapter.SUBMISSION_RESPONSE, servletMap); + + return adapter; + } + + /** + * stores cookies that may exist in request and passes them on to processor for usage in + * HTTPConnectors. Instance loading and submission then uses these cookies. Important for + * applications using auth. + * + * @param request the servlet request + * @param adapter the Chiba adapter instance + */ + protected void storeCookies(HttpServletRequest request,ChibaAdapter adapter){ + javax.servlet.http.Cookie[] cookiesIn = request.getCookies(); + if (cookiesIn != null) { + Cookie[] commonsCookies = new org.apache.commons.httpclient.Cookie[cookiesIn.length]; + for (int i = 0; i < cookiesIn.length; i += 1) { + javax.servlet.http.Cookie c = cookiesIn[i]; + Cookie newCookie = new Cookie(c.getDomain(), + c.getName(), + c.getValue(), + c.getPath(), + c.getMaxAge(), + c.getSecure()); + commonsCookies[i] = newCookie; + } + adapter.setContextParam(AbstractHTTPConnector.REQUEST_COOKIE,commonsCookies); + } + } + + /** + * + * creates and configures the UI generating component. + * @param request + * @param actionURL + * @param xslFile + * @param css + * @return + * @throws XFormsException + */ + protected UIGenerator createUIGenerator(HttpServletRequest request, + String actionURL, + String xslFile, + String css) + throws XFormsException { + StylesheetLoader stylesheetLoader = new StylesheetLoader(stylesPath); + if (xslFile != null){ + stylesheetLoader.setStylesheetFile(xslFile); + } + UIGenerator uiGenerator = new XSLTGenerator(stylesheetLoader); + + //set parameters + uiGenerator.setParameter("contextroot",request.getContextPath()); + uiGenerator.setParameter("action-url",actionURL); + uiGenerator.setParameter("debug-enabled", true /*String.valueOf(logger.isDebugEnabled()) */); + String selectorPrefix = Config.getInstance().getProperty(HttpRequestHandler.SELECTOR_PREFIX_PROPERTY, + HttpRequestHandler.SELECTOR_PREFIX_DEFAULT); + uiGenerator.setParameter("selector-prefix", selectorPrefix); + String removeUploadPrefix = Config.getInstance().getProperty(HttpRequestHandler.REMOVE_UPLOAD_PREFIX_PROPERTY, + HttpRequestHandler.REMOVE_UPLOAD_PREFIX_DEFAULT); + uiGenerator.setParameter("remove-upload-prefix", removeUploadPrefix); + if (css != null) { + uiGenerator.setParameter("css-file", css); + } + String dataPrefix = Config.getInstance().getProperty("chiba.web.dataPrefix"); + uiGenerator.setParameter("data-prefix", dataPrefix); + + String triggerPrefix = Config.getInstance().getProperty("chiba.web.triggerPrefix"); + uiGenerator.setParameter("trigger-prefix", triggerPrefix); + + uiGenerator.setParameter("user-agent", request.getHeader("User-Agent")); + + uiGenerator.setParameter("scripted","true"); + + return uiGenerator; + } + + /** + * this method is responsible for passing all context information needed by the Adapter and Processor from + * ServletRequest to ChibaContext. Will be called only once when the form-session is inited (GET). + * + * @param request the ServletRequest + * @param chibaAdapter the ChibaAdapter to use + */ + protected void setContextParams(HttpServletRequest request, ChibaAdapter chibaAdapter) { + + //[1] pass user-agent to Adapter for UI-building + chibaAdapter.setContextParam(ServletAdapter.USERAGENT, request.getHeader("User-Agent")); + + //[2] read any request params that are *not* Chiba params and pass them into the context map + Enumeration params = request.getParameterNames(); + while (params.hasMoreElements()) { + String s = (String) params.nextElement(); + //store all request-params we don't use in the context map of ChibaBean + if (!(s.equals(FORM_PARAM_NAME) || + s.equals(XSL_PARAM_NAME) || + s.equals(CSS_PARAM_NAME) || + s.equals(ACTIONURL_PARAM_NAME))) { + String value = request.getParameter(s); + //servletAdapter.setContextProperty(s, value); + chibaAdapter.setContextParam(s, value); + if (logger.isDebugEnabled()) { + logger.debug("added request param '" + s + "' added to context"); + } + } + } + } + + /** + * @deprecated should be re-implemented using chiba events on adapter + */ + protected boolean load(ChibaAdapter adapter, HttpServletResponse response) throws XFormsException, IOException { + if (adapter.getContextParam(ChibaAdapter.LOAD_URI) != null) { + String redirectTo = (String) adapter.removeContextParam(ChibaAdapter.LOAD_URI); + adapter.shutdown(); + response.sendRedirect(response.encodeRedirectURL(redirectTo)); + return true; + } + return false; + } + + /** + * @deprecated should be re-implemented using chiba events on adapter + */ + protected boolean replaceAll(ChibaAdapter chibaAdapter, HttpServletResponse response) + throws XFormsException, IOException { + if (chibaAdapter.getContextParam(ChibaAdapter.SUBMISSION_RESPONSE) != null) { + Map forwardMap = (Map) chibaAdapter.removeContextParam(ChibaAdapter.SUBMISSION_RESPONSE); + if (forwardMap.containsKey(ChibaAdapter.SUBMISSION_RESPONSE_STREAM)) { + forwardResponse(forwardMap, response); + chibaAdapter.shutdown(); + return true; + } + } + return false; + } + + private String getActionURL(HttpServletRequest request, HttpServletResponse response, boolean scripted) { + String defaultActionURL = getRequestURI(request) + agent; + String encodedDefaultActionURL = response.encodeURL(defaultActionURL); + int sessIdx = encodedDefaultActionURL.indexOf(";jsession"); + String sessionId = null; + if (sessIdx > -1) { + sessionId = encodedDefaultActionURL.substring(sessIdx); + } + String actionURL = request.getParameter(ACTIONURL_PARAM_NAME); + if (null == actionURL) { + actionURL = encodedDefaultActionURL; + } else if (null != sessionId) { + actionURL += sessionId; + } + + logger.info("actionURL: " + actionURL); + // encode the URL to allow for session id rewriting + return response.encodeURL(actionURL); + } + + private String getRequestURI(HttpServletRequest request){ + StringBuffer buffer = new StringBuffer(request.getScheme()); + buffer.append("://"); + buffer.append(request.getServerName()); + buffer.append(":"); + buffer.append(request.getServerPort()) ; + buffer.append(request.getContextPath()); + return buffer.toString(); + } + + private void forwardResponse(Map forwardMap, HttpServletResponse response) throws IOException { + // fetch response stream + InputStream responseStream = (InputStream) forwardMap.remove(ChibaAdapter.SUBMISSION_RESPONSE_STREAM); + + // copy header information + Iterator iterator = forwardMap.keySet().iterator(); + while (iterator.hasNext()) { + + String name = (String) iterator.next(); + + if ("Transfer-Encoding".equalsIgnoreCase(name)) { + // Some servers (e.g. WebSphere) may set a "Transfer-Encoding" + // with the value "chunked". This may confuse the client since + // ChibaServlet output is not encoded as "chunked", so this + // header is ignored. + continue; + } + String value = (String) forwardMap.get(name); + response.setHeader(name, value); + } + + // copy stream content + OutputStream outputStream = new BufferedOutputStream(response.getOutputStream()); + for (int b = responseStream.read(); + b > -1; + b = responseStream.read()) { + outputStream.write(b); + } + + // close streams + responseStream.close(); + outputStream.close(); + } + + protected void shutdown(ChibaAdapter chibaAdapter, + HttpSession session, + Exception e, + HttpServletResponse response, + HttpServletRequest request) + throws IOException, + ServletException { + // attempt to shutdown processor + if (chibaAdapter != null) { + try { + chibaAdapter.shutdown(); + } catch (XFormsException xfe) { + xfe.printStackTrace(); + } + } + Application.handleServletError(this.getServletContext(), + request, + response, + e, + logger, + null); + } +} + +// end of class diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/FluxHelperServlet.java b/source/java/org/alfresco/web/templating/xforms/servlet/FluxHelperServlet.java new file mode 100644 index 0000000000..413ce951a5 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/FluxHelperServlet.java @@ -0,0 +1,101 @@ +package org.alfresco.web.templating.xforms.servlet; + +import org.apache.commons.fileupload.FileUpload; +import org.apache.log4j.Category; +import org.chiba.adapter.ChibaAdapter; +import org.chiba.adapter.ChibaEvent; +import org.chiba.adapter.DefaultChibaEventImpl; +import org.chiba.xml.xforms.config.Config; +import org.chiba.tools.xslt.UIGenerator; + +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +/** + * Provides extra functionality that's not easily handled with AJAX. This helper servlet will only be triggered in + * in one of two situations:
+ * 1. an upload
+ * for an file upload to happen the browser has to submit the file as multipart-request. In this case the browser + * form must be submitted cause there's no way to get the file content from javascript to send an AJAX request.

+ * 2. for a submission replace="all"
+ * This mode requires that the response will be directly streamed back to the client, replacing the existing viewport. + * To maintain the correct location of that response in the location bar of the browser there seems no way but to + * also let the browser do the request/response handling itself by the use of a normal form submit. + * + * @author Joern Turner + * @version $Version: $ + */ +public class FluxHelperServlet extends ChibaServlet { + //init-params + private static Category cat = Category.getInstance(FluxHelperServlet.class); + + + /** + * Returns a short description of the servlet. + * + * @return - Returns a short description of the servlet. + */ + public String getServletInfo() { + return "Ajax Servlet Controller for Chiba XForms Processor"; + } + + /** + * Destroys the servlet. + */ + public void destroy() { + } + + /** + * handles all interaction with the user during a form-session. + * + * Note: this method is only triggered if the + * browser has javascript turned off. + * + * @param request servlet request + * @param response servlet response + * @throws javax.servlet.ServletException + * @throws java.io.IOException + */ + protected void doPost(HttpServletRequest request, + HttpServletResponse response) + throws ServletException, IOException { + HttpSession session = request.getSession(true); + ChibaAdapter chibaAdapter =null; + + response.setContentType("text/html"); + + try { + chibaAdapter = (ChibaAdapter) session.getAttribute(CHIBA_ADAPTER); + if (chibaAdapter == null) { + throw new ServletException(Config.getInstance().getErrorMessage("session-invalid")); + } + ChibaEvent chibaEvent = new DefaultChibaEventImpl(); + chibaEvent.initEvent("http-request",null,request); + chibaAdapter.dispatch(chibaEvent); + + boolean isUpload = FileUpload.isMultipartContent(request); + + if(isUpload){ + ServletOutputStream out = response.getOutputStream(); + out.println("status

 
"); + out.close(); + }else{ + if(!replaceAll(chibaAdapter, response)){ + UIGenerator uiGenerator = (UIGenerator) session.getAttribute(CHIBA_UI_GENERATOR); + uiGenerator.setInputNode(chibaAdapter.getXForms()); + uiGenerator.setOutput(response.getWriter()); + uiGenerator.generate(); + response.getWriter().close(); + } + } + } catch (Exception e) { + shutdown(chibaAdapter, session, e, response, request); + } + } +} + +// end of class diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/HttpRequestHandler.java b/source/java/org/alfresco/web/templating/xforms/servlet/HttpRequestHandler.java new file mode 100644 index 0000000000..33723fbb72 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/HttpRequestHandler.java @@ -0,0 +1,439 @@ +package org.alfresco.web.templating.xforms.servlet; + +import org.apache.commons.fileupload.DiskFileUpload; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileUpload; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.log4j.Category; +import org.chiba.xml.xforms.ChibaBean; +import org.chiba.xml.xforms.config.Config; +import org.chiba.xml.xforms.events.XFormsEventFactory; +import org.chiba.xml.xforms.exception.XFormsException; +import org.chiba.xml.xforms.ui.Repeat; +import org.chiba.adapter.ChibaEvent; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.util.*; + +/** + * Default implementation for handling http servlet requests. + * + * @author joern turner + * @version $Id: HttpRequestHandler.java,v 1.7 2005/10/27 23:10:31 joernt Exp $ + */ +public class HttpRequestHandler { + private static final Category LOGGER = Category.getInstance(HttpRequestHandler.class); + public static final String DATA_PREFIX_PROPERTY = "chiba.web.dataPrefix"; + public static final String TRIGGER_PREFIX_PROPERTY = "chiba.web.triggerPrefix"; + public static final String SELECTOR_PREFIX_PROPERTY = "chiba.web.selectorPrefix"; + public static final String REMOVE_UPLOAD_PREFIX_PROPERTY = "chiba.web.removeUploadPrefix"; + public static final String DATA_PREFIX_DEFAULT = "d_"; + public static final String TRIGGER_PREFIX_DEFAULT = "t_"; + public static final String SELECTOR_PREFIX_DEFAULT = "s_"; + public static final String REMOVE_UPLOAD_PREFIX_DEFAULT = "ru_"; + + private ChibaBean chibaBean; + + private String dataPrefix; + private String selectorPrefix; + private String triggerPrefix; + private String removeUploadPrefix; + private String uploadRoot; + + + public HttpRequestHandler(ChibaBean chibaBean) { + this.chibaBean = chibaBean; + } + + /** + * executes this handler. + * + * @throws XFormsException + */ + public void execute(ChibaEvent event) throws XFormsException { + //HttpServletRequest request = (HttpServletRequest) this.chibaBean.getContext().get(ServletAdapter.HTTP_SERVLET_REQUEST); + HttpServletRequest request= (HttpServletRequest) event.getContextInfo(); + + String contextRoot = request.getSession().getServletContext().getRealPath(""); + if (contextRoot == null) { + contextRoot = request.getSession().getServletContext().getRealPath("."); + } + + String uploadDir = (String) this.chibaBean.getContext().get(ServletAdapter.HTTP_UPLOAD_DIR); + this.uploadRoot = new File(contextRoot, uploadDir).getAbsolutePath(); + + handleRequest(request); + } + + /** + * checks whether we have multipart or urlencoded request and processes it accordingly. After updating + * the data, a reacalculate, revalidate refresh sequence is fired and the found trigger is executed. + * + * @param request Servlet request + * @throws org.chiba.xml.xforms.exception.XFormsException + * todo: implement action block behaviour + */ + protected void handleRequest(HttpServletRequest request) throws XFormsException { + String trigger = null; + + // Check that we have a file upload request + boolean isMultipart = FileUpload.isMultipartContent(request); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("request isMultipart: " + isMultipart); + LOGGER.debug("base URI: " + this.chibaBean.getBaseURI()); + LOGGER.debug("user agent: " + request.getHeader("User-Agent")); + } + + if (isMultipart) { + trigger = processMultiPartRequest(request, trigger); + } else { + trigger = processUrlencodedRequest(request, trigger); + } + + // finally activate trigger if any + if (trigger != null) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("trigger '" + trigger + "'"); + } + + this.chibaBean.dispatch(trigger, XFormsEventFactory.DOM_ACTIVATE); + } + } + + /** + * @param request Servlet request + * @param trigger Trigger control + * @return the calculated trigger + * @throws XFormsException If an error occurs + */ + protected String processMultiPartRequest(HttpServletRequest request, String trigger) throws XFormsException { + DiskFileUpload upload = new DiskFileUpload(); + + String encoding = request.getCharacterEncoding(); + if (encoding == null) { + encoding = "ISO-8859-1"; + } + + upload.setRepositoryPath(this.uploadRoot); + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("root dir for uploads: " + this.uploadRoot); + } + + List items; + try { + items = upload.parseRequest(request); + } catch (FileUploadException fue) { + throw new XFormsException(fue); + } + + Map formFields = new HashMap(); + Iterator iter = items.iterator(); + while (iter.hasNext()) { + FileItem item = (FileItem) iter.next(); + String itemName = item.getName(); + String fieldName = item.getFieldName(); + String id = fieldName.substring(Config.getInstance().getProperty("chiba.web.dataPrefix").length()); + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Multipart item name is: " + itemName + + " and fieldname is: " + fieldName + + " and id is: " + id); + LOGGER.debug("Is formfield: " + item.isFormField()); + } + + if (item.isFormField()) { + + // check for upload-remove action + if (fieldName.startsWith(getRemoveUploadPrefix())) { + id = fieldName.substring(getRemoveUploadPrefix().length()); + // if data is null, file will be removed ... + // TODO: remove the file from the disk as well + chibaBean.updateControlValue(id, "", "", null); + continue; + } + + // It's a field name, it means that we got a non-file + // form field. Upload is not required. We must treat it as we + // do in processUrlencodedRequest() + processMultipartParam(formFields, fieldName, item, encoding); + } else { + + String uniqueFilename = new File(getUniqueParameterName("file"), + new File(itemName).getName()).getPath(); + + File savedFile = new File(this.uploadRoot, uniqueFilename); + + byte[] data = null; + + data = processMultiPartFile(item, id, savedFile, encoding, data); + + // if data is null, file will be removed ... + // TODO: remove the file from the disk as well + chibaBean.updateControlValue(id, item.getContentType(), + itemName, data); + } + + // handle regular fields + if (formFields.size() > 0) { + + Iterator it = formFields.keySet().iterator(); + while (it.hasNext()) { + + fieldName = (String) it.next(); + String[] values = (String[]) formFields.get(fieldName); + + // [1] handle data + handleData(fieldName, values); + + // [2] handle selector + handleSelector(fieldName, values[0]); + + // [3] handle trigger + trigger = handleTrigger(trigger, fieldName); + } + } + } + + return trigger; + } + + protected String processUrlencodedRequest(HttpServletRequest request, String trigger) throws XFormsException { + // iterate request parameters + Enumeration names = request.getParameterNames(); + while (names.hasMoreElements()) { + String paramName = names.nextElement().toString(); + String[] values = request.getParameterValues(paramName); + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(this + " parameter-name: " + paramName); + for (int i = 0; i < values.length; i++) { + LOGGER.debug(this + " value: " + values[i]); + } + } + + // [1] handle data + handleData(paramName, values); + + // [2] handle selector + handleSelector(paramName, values[0]); + + // [3] handle trigger + trigger = handleTrigger(trigger, paramName); + } + return trigger; + } + + /** + * @param name + * @throws XFormsException + */ + protected void handleData(String name, String[] values) + throws XFormsException { + if (name.startsWith(getDataPrefix())) { + String id = name.substring(getDataPrefix().length()); + + // assemble new control value + String newValue; + + if (values.length > 1) { + StringBuffer buffer = new StringBuffer(values[0]); + + for (int i = 1; i < values.length; i++) { + buffer.append(" ").append(values[i]); + } + + newValue = trim( buffer.toString() ); + } else { + newValue = trim( values[0] ); + } + + this.chibaBean.updateControlValue(id, newValue); + } + } + + /** + * patch to handle linefeed duplication in textareas with some browsers. + * + * @param value the value where linebreaks will be trimmed + * @return returns a cleaned up version of the value + */ + + protected String trim(String value) { + if (value != null && value.length() > 0) { + value = value.replaceAll("\r\n", "\r"); + value = value.trim(); + } + return value; + } + + /** + * @param name + * @throws XFormsException + */ + protected void handleSelector(String name, String value) throws XFormsException { + if (name.startsWith(getSelectorPrefix())) { + int separator = value.lastIndexOf(':'); + + String id = value.substring(0, separator); + int index = Integer.valueOf(value.substring(separator + 1)).intValue(); + + Repeat repeat = (Repeat) this.chibaBean.lookup(id); + repeat.setIndex(index); + } + } + + protected String handleTrigger(String trigger, String name) { + if ((trigger == null) && name.startsWith(getTriggerPrefix())) { + String parameter = name; + int x = parameter.lastIndexOf(".x"); + int y = parameter.lastIndexOf(".y"); + + if (x > -1) { + parameter = parameter.substring(0, x); + } + + if (y > -1) { + parameter = parameter.substring(0, y); + } + + // keep trigger id + trigger = name.substring(getTriggerPrefix().length()); + } + return trigger; + } + + private byte[] processMultiPartFile(FileItem item, String id, File savedFile, String encoding, byte[] data) + throws XFormsException { + // some data uploaded ... + if (item.getSize() > 0) { + + if (chibaBean.storesExternalData(id)) { + + // store data to file and create URI + try { + savedFile.getParentFile().mkdir(); + item.write(savedFile); + } catch (Exception e) { + throw new XFormsException(e); + } + // content is URI in this case + try { + data = savedFile.toURI().toString().getBytes(encoding); + } catch (UnsupportedEncodingException e) { + throw new XFormsException(e); + } + + } else { + // content is the data + data = item.get(); + } + } + return data; + } + + private void processMultipartParam(Map formFields, String fieldName, FileItem item, String encoding) throws XFormsException { + String values[] = (String[]) formFields.get(fieldName); + String formFieldValue = null; + try { + formFieldValue = item.getString(encoding); + } catch (UnsupportedEncodingException e) { + throw new XFormsException(e.getMessage(), e); + } + + if (values == null) { + formFields.put(fieldName, new String[]{formFieldValue}); + } else { + // not very effective, but not many duplicate values + // expected either ... + String[] tmp = new String[values.length + 1]; + System.arraycopy(values, 0, tmp, 0, values.length); + tmp[values.length] = formFieldValue; + formFields.put(fieldName, tmp); + } + } + + + /** + * returns the prefix which is used to identify trigger parameters. + * + * @return the prefix which is used to identify trigger parameters + */ + protected final String getTriggerPrefix() { + if (this.triggerPrefix == null) { + try { + this.triggerPrefix = + Config.getInstance().getProperty(TRIGGER_PREFIX_PROPERTY, TRIGGER_PREFIX_DEFAULT); + } catch (Exception e) { + this.triggerPrefix = TRIGGER_PREFIX_DEFAULT; + } + } + + return this.triggerPrefix; + } + + protected final String getDataPrefix() { + if (this.dataPrefix == null) { + try { + this.dataPrefix = Config.getInstance().getProperty(DATA_PREFIX_PROPERTY, DATA_PREFIX_DEFAULT); + } catch (Exception e) { + this.dataPrefix = DATA_PREFIX_DEFAULT; + } + } + + return this.dataPrefix; + } + + protected final String getRemoveUploadPrefix() { + if (this.removeUploadPrefix == null) { + try { + this.removeUploadPrefix = Config.getInstance().getProperty(REMOVE_UPLOAD_PREFIX_PROPERTY, REMOVE_UPLOAD_PREFIX_DEFAULT); + } catch (Exception e) { + this.removeUploadPrefix = REMOVE_UPLOAD_PREFIX_DEFAULT; + } + } + + return this.removeUploadPrefix; + } + + + private String getUniqueParameterName(String prefix) { + return prefix + Integer.toHexString((int) (Math.random() * 10000)); + } + + /** + * returns the configured prefix which identifies 'selector' parameters. These are used to transport + * the state of repeat indices via http. + * + * @return the prefix for selector parameters from the configuration + */ + public final String getSelectorPrefix() { + if (this.selectorPrefix == null) { + try { + this.selectorPrefix = + Config.getInstance().getProperty(SELECTOR_PREFIX_PROPERTY, + SELECTOR_PREFIX_DEFAULT); + } catch (Exception e) { + this.selectorPrefix = SELECTOR_PREFIX_DEFAULT; + } + } + + return this.selectorPrefix; + } + + /** + * Get the value of chibaBean. + * + * @return the value of chibaBean + */ + public ChibaBean getChibaBean() { + return this.chibaBean; + } + +} + +// end of class + + diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/ServletAdapter.java b/source/java/org/alfresco/web/templating/xforms/servlet/ServletAdapter.java new file mode 100644 index 0000000000..9fb9385f8a --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/ServletAdapter.java @@ -0,0 +1,167 @@ +package org.alfresco.web.templating.xforms.servlet; + +import org.apache.log4j.Category; +import org.chiba.adapter.AbstractChibaAdapter; +import org.chiba.adapter.ChibaEvent; +import org.chiba.xml.xforms.events.XFormsEvent; +import org.chiba.xml.xforms.events.XFormsEventFactory; +import org.chiba.xml.xforms.exception.XFormsException; +import org.w3c.dom.Element; +import org.w3c.dom.events.Event; +import org.w3c.dom.events.EventListener; + +import java.util.Map; + +/** + * integrates XForms Processor into Web-applications and handles request + * processing. This is the default implementation of ChibaAdapter and besides + * handling the interaction it also manages a UIGenerator to build the rendered + * output for the browser. + * + * @author joern turner + * @version $Id: ServletAdapter.java,v 1.8 2005/12/15 11:45:38 unl Exp $ + */ +public class ServletAdapter extends AbstractChibaAdapter implements EventListener { + + private static final Category LOGGER = Category.getInstance(ServletAdapter.class); + public static final String HTTP_SERVLET_REQUEST = "chiba.web.request"; + //public static final String HTTP_SESSION_OBJECT = "chiba.web.session"; + public static final String HTTP_UPLOAD_DIR = "chiba.web.uploadDir"; + + //private ChibaBean chibaBean = null; + //private String formURI = null; + //private String actionUrl = null; + //private String CSSFile = null; + //private String stylesheet = null; + //private UIGenerator generator = null; + //private String stylesheetPath = null; + //private HashMap context = null; + public static final String USERAGENT = "chiba.useragent"; + private HttpRequestHandler handler; + public static final Object XSLT_PATH = "xslt-path"; + + /** + * Creates a new ServletAdapter object. + */ + public ServletAdapter() { + } + + /** + * place to put application-specific params or configurations before + * actually starting off the XFormsProcessor. It's the responsibility of + * this method to call chibaBean.init() to finish up the processor setup. + * + * @throws XFormsException If an error occurs + */ + public void init() throws XFormsException { + this.chibaBean.init(); + this.handler = getNewInteractionHandler(); + } + + + /** + * ServletAdapter knows and executes only one ChibaEvent: 'http-request' + * which will contain the HttpServletRequest as contextInfo. + * + * @param event only events of type 'http-request' will be handled + * @throws XFormsException + */ + public void dispatch(ChibaEvent event) throws XFormsException { + if (event.getEventName().equals("http-request")) { + this.handler.execute(event); + } + else { + LOGGER.warn("unknown event: '" + event.getEventName() + "' - ignoring"); + } + + } + + /** + * terminates the XForms processing. right place to do cleanup of + * resources. + * + * @throws org.chiba.xml.xforms.exception.XFormsException + */ + public void shutdown() throws XFormsException { + this.chibaBean.shutdown(); + } + + /** + * Instructs the application environment to forward the given response. + * + * @param response a map containing at least a response stream and optional + * header information. + */ + public void forward(Map response) { + this.chibaBean.getContext().put(SUBMISSION_RESPONSE, response); + } + + // todo: should be set by servlet + + /** + * return a new InteractionHandler. + *

+ * This method returns a new HttpRequestHandler. + * + * @return returns a new + */ + protected HttpRequestHandler getNewInteractionHandler() + throws XFormsException { + return new HttpRequestHandler(this.chibaBean); + } + + public void setUploadDestination(String uploadDir) { + super.setUploadDestination(uploadDir); + //HttpRequestHandler uses this + // todo: should be a member of request handler and set directly + setContextParam(HTTP_UPLOAD_DIR, uploadDir); + } + + // event handling + // todo: should be moved up to base class + + /** + * This method is called whenever an event occurs of the type for which the + * EventListener interface was registered. + * + * @param event The Event contains contextual information about + * the event. It also contains the stopPropagation and + * preventDefault methods which are used in determining the + * event's flow and default action. + */ + public void handleEvent(Event event) { + String type = event.getType(); + String targetId = ((Element) event.getTarget()).getAttributeNS(null, "id"); + XFormsEvent xformsEvent = (XFormsEvent) event; + + if (XFormsEventFactory.CHIBA_LOAD_URI.equals(type)) { + handleLoadURI(targetId, (String) xformsEvent.getContextInfo("uri"), (String) xformsEvent.getContextInfo("show")); + return; + } + if (XFormsEventFactory.CHIBA_RENDER_MESSAGE.equals(type)) { + handleMessage(targetId, (String) xformsEvent.getContextInfo("message"), (String) xformsEvent.getContextInfo("level")); + return; + } + if (XFormsEventFactory.CHIBA_REPLACE_ALL.equals(type)) { + handleReplaceAll(targetId, (Map) xformsEvent.getContextInfo("header"), xformsEvent.getContextInfo("body")); + return; + } + + // unknown event ignored + } + + // todo: *either* move up these three methods as abstract template methods *or* use event log ? + public void handleLoadURI(String targetId, String uri, String show) { + // todo + } + + public void handleMessage(String targetId, String message, String level) { + // todo + } + + public void handleReplaceAll(String targetId, Map header, Object body) { + // todo + } +} + +// end of class diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/SubmissionResponseServlet.java b/source/java/org/alfresco/web/templating/xforms/servlet/SubmissionResponseServlet.java new file mode 100644 index 0000000000..bc67bac265 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/SubmissionResponseServlet.java @@ -0,0 +1,84 @@ +package org.alfresco.web.templating.xforms.servlet; + +import org.chiba.adapter.ChibaAdapter; +import org.chiba.xml.xforms.exception.XFormsException; +import org.apache.log4j.Category; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Map; + +/** + * Returns a submission response exactly once. + * + * @author Ulrich Nicolas Lissé + * @version $Id: SubmissionResponseServlet.java,v 1.1 2005/12/21 22:59:27 unl Exp $ + */ +public class SubmissionResponseServlet extends HttpServlet { + private static Category LOGGER = Category.getInstance(SubmissionResponseServlet.class); + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + // lookup session + HttpSession session = request.getSession(false); + if (session != null) { + // lookup attribute containing submission response map + Map submissionResponse = (Map) session.getAttribute(ChibaServlet.CHIBA_SUBMISSION_RESPONSE); + if (submissionResponse != null) { + // shutdown form session + ChibaAdapter adapter = (ChibaAdapter) session.getAttribute(ChibaServlet.CHIBA_ADAPTER); + if (adapter != null) { + try { + adapter.shutdown(); + } + catch (XFormsException e) { + LOGGER.error("xforms shutdown failed", e); + } + } + + // remove session attributes + session.removeAttribute(ChibaServlet.CHIBA_ADAPTER); + session.removeAttribute(ChibaServlet.CHIBA_SUBMISSION_RESPONSE); + + // copy header fields + Map headerMap = (Map) submissionResponse.get("header"); + Iterator iterator = headerMap.keySet().iterator(); + while (iterator.hasNext()) { + final String name = (String) iterator.next(); + if (name.equalsIgnoreCase("Transfer-Encoding")) { + // Some servers (e.g. WebSphere) may set a "Transfer-Encoding" + // with the value "chunked". This may confuse the client since + // ChibaServlet output is not encoded as "chunked", so this + // header is ignored. + continue; + } + + final String value = (String) headerMap.get(name); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("added header: " + name + "=" + value); + } + + response.setHeader(name, value); + } + + // copy body stream + InputStream bodyStream = (InputStream) submissionResponse.get("body"); + OutputStream outputStream = new BufferedOutputStream(response.getOutputStream()); + for (int b = bodyStream.read(); b > -1; b = bodyStream.read()) { + outputStream.write(b); + } + + // close streams + bodyStream.close(); + outputStream.close(); + } + } + // response.sendError(HttpServletResponse.SC_FORBIDDEN, "no submission response available"); + } +} diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/tokens.properties b/source/java/org/alfresco/web/templating/xforms/servlet/tokens.properties new file mode 100644 index 0000000000..2dcf2fdb37 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/tokens.properties @@ -0,0 +1,5 @@ +# Tokens +chiba-version=1.0.0 +baseurl.host=localhost +baseurl.port=8080 + diff --git a/source/java/org/alfresco/web/templating/xforms/servlet/version.info b/source/java/org/alfresco/web/templating/xforms/servlet/version.info new file mode 100644 index 0000000000..0a6f4d8a70 --- /dev/null +++ b/source/java/org/alfresco/web/templating/xforms/servlet/version.info @@ -0,0 +1 @@ +@version.major@ [build @version.build@] \ No newline at end of file diff --git a/source/web/WEB-INF/chiba.xml b/source/web/WEB-INF/chiba.xml new file mode 100644 index 0000000000..ce672dfeea --- /dev/null +++ b/source/web/WEB-INF/chiba.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/web/WEB-INF/dwr.xml b/source/web/WEB-INF/dwr.xml new file mode 100644 index 0000000000..55d2f351c0 --- /dev/null +++ b/source/web/WEB-INF/dwr.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 296811df9b..b97e96c9be 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -481,6 +481,42 @@ #{DictionaryService} + + + The bean that backs up the Create Content Wizard + + CreateXmlContentTypeWizard + org.alfresco.web.bean.content.CreateXmlContentTypeWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 5ca6e3a9c2..cf8683f9f5 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -130,6 +130,10 @@ editTextInline /jsp/dialog/edit-text-inline.jsp + + editXmlInline + /jsp/dialog/edit-xml-inline.jsp + manageInvitedUsers /jsp/roles/manage-invited-users.jsp @@ -240,6 +244,14 @@ /jsp/dialog/checkout-file.jsp + + + /jsp/dialog/edit-xml-inline.jsp + + checkoutFile + /jsp/dialog/checkout-file.jsp + + /jsp/dialog/checkout-file.jsp @@ -315,6 +327,10 @@ editTextInline /jsp/dialog/edit-text-inline.jsp + + editXmlInline + /jsp/dialog/edit-xml-inline.jsp + editSimpleWorkflow /jsp/dialog/edit-simple-workflow.jsp diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index 45e03798a7..a15c9c1a31 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -64,6 +64,24 @@ Spring config file locations + + chiba.upload + upload + relative path to upload-dir + + + + chiba.useragent.ajax.path + /FluxHelper + relative path under which AJAX helper servlet is mapped + + + + chiba.xforms.stylesPath + /jsp/content/xforms/forms/xslt + location of stylesheets relative to webapp-dir + + Authentication Filter org.alfresco.web.app.servlet.AuthenticationFilter @@ -179,6 +197,37 @@ 5 + + XFormsServlet + org.alfresco.web.templating.xforms.servlet.ChibaServlet + + + chiba.config + WEB-INF/chiba.xml + + + + + Flux + uk.ltd.getahead.dwr.DWRServlet + + + debug + true + Do we startup in debug mode? + + + + + FluxHelper + org.alfresco.web.templating.xforms.servlet.FluxHelperServlet + 1 + + + + SubmissionResponse + org.alfresco.web.templating.xforms.servlet.SubmissionResponseServlet + Faces Servlet @@ -224,6 +273,26 @@ WebDAV /webdav/* + + + Flux + /Flux/* + + + + FluxHelper + /FluxHelper/* + + + + XFormsServlet + /XFormsServlet + + + + SubmissionResponse + /SubmissionResponse + 60 diff --git a/source/web/jsp/content/create-content-wizard/create-xml.jsp b/source/web/jsp/content/create-content-wizard/create-xml.jsp new file mode 100644 index 0000000000..db9d933b40 --- /dev/null +++ b/source/web/jsp/content/create-content-wizard/create-xml.jsp @@ -0,0 +1,41 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ page import="org.alfresco.web.templating.*" %> +<%@ page import="javax.faces.context.FacesContext" %> +<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %> +<%@ page import="org.alfresco.web.bean.content.CreateContentWizard" %> + +<% +TemplatingService ts = TemplatingService.getInstance(); +CreateContentWizard ccw = (CreateContentWizard) + FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "CreateContentWizard"); + +TemplateType tt = ts.getTemplateType(ccw.getTemplateType()); +final TemplateInputMethod tim = tt.getInputMethods()[0]; +String url = tim.getInputURL(tt.getSampleXml(tt.getName()), tt); +%> + +

+ +
+ \ No newline at end of file diff --git a/source/web/jsp/content/create-content-wizard/details.jsp b/source/web/jsp/content/create-content-wizard/details.jsp index fdb516d9c1..22d43ef61a 100644 --- a/source/web/jsp/content/create-content-wizard/details.jsp +++ b/source/web/jsp/content/create-content-wizard/details.jsp @@ -91,6 +91,12 @@ valueChangeListener="#{WizardManager.bean.createContentChanged}"> + + + + + + +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ page import="org.alfresco.web.bean.FileUploadBean" %> + + + + + + + + + + + +<%-- + + + +--%> + + + +<% +FileUploadBean upload = (FileUploadBean) + session.getAttribute(FileUploadBean.FILE_UPLOAD_BEAN_NAME); +if (upload == null || upload.getFile() == null) +{ +%> + + + + +<% +} else { +%> + + + +<% +} +%> + + + + + + + + + + + + + diff --git a/source/web/jsp/content/create-xml-content-type-wizard/edit.jsp b/source/web/jsp/content/create-xml-content-type-wizard/edit.jsp new file mode 100644 index 0000000000..61fa96b74e --- /dev/null +++ b/source/web/jsp/content/create-xml-content-type-wizard/edit.jsp @@ -0,0 +1,49 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ page import="java.io.*" %> + + +
+ + + |  + + + + +" escape="false"/> + diff --git a/source/web/jsp/content/xforms/debug-instance.jsp b/source/web/jsp/content/xforms/debug-instance.jsp new file mode 100644 index 0000000000..d7cc9483e1 --- /dev/null +++ b/source/web/jsp/content/xforms/debug-instance.jsp @@ -0,0 +1,46 @@ +<%@ page import="java.io.*, + java.util.Enumeration, + java.text.DateFormat, + java.util.Date, + org.alfresco.web.bean.content.*, + org.alfresco.web.bean.*"%> +<%@ page session="true" %> +<%@ page errorPage="error.jsp" %> +<% +CreateContentWizard wiz = (CreateContentWizard)session.getAttribute("CreateContentWizard"); +CheckinCheckoutBean wiz2 = (CheckinCheckoutBean)session.getAttribute("CheckinCheckoutBean"); +char[] readerBuffer = new char[request.getContentLength()]; +BufferedReader bufferedReader = request.getReader(); +StringBuffer sb = new StringBuffer(); +do +{ + String s = bufferedReader.readLine(); + if (s == null) + break; + sb.append(s).append('\n'); +} +while (true); +String xml = sb.toString(); +wiz.setContent(xml); +if (wiz2 != null) +{ + System.out.println("saving " + xml + " to checkincheckout"); + wiz2.setEditorOutput(xml); +} +xml = xml.replaceAll("<", "<"); +%> + + + Instance Data submitted + + + + +
+ XML submitted successfully! you rock! Click next! +
+
+<%= xml %> +
+ + diff --git a/source/web/jsp/content/xforms/forms/images/chiba-logo_klein2.gif b/source/web/jsp/content/xforms/forms/images/chiba-logo_klein2.gif new file mode 100644 index 0000000000..e7cf81735f Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/chiba-logo_klein2.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/chiba50t.gif b/source/web/jsp/content/xforms/forms/images/chiba50t.gif new file mode 100644 index 0000000000..8ec208baa2 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/chiba50t.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/favicon.ico.gif b/source/web/jsp/content/xforms/forms/images/favicon.ico.gif new file mode 100644 index 0000000000..053aa256bb Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/favicon.ico.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/favicon2.ico.gif b/source/web/jsp/content/xforms/forms/images/favicon2.ico.gif new file mode 100644 index 0000000000..65530cdfef Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/favicon2.ico.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/folder.gif b/source/web/jsp/content/xforms/forms/images/folder.gif new file mode 100644 index 0000000000..64aa8a0a18 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/folder.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/help_icon.gif b/source/web/jsp/content/xforms/forms/images/help_icon.gif new file mode 100644 index 0000000000..b093c745c6 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/help_icon.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/poweredby.gif b/source/web/jsp/content/xforms/forms/images/poweredby.gif new file mode 100644 index 0000000000..2145dc915c Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/poweredby.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/poweredby_sw.gif b/source/web/jsp/content/xforms/forms/images/poweredby_sw.gif new file mode 100644 index 0000000000..6721d7af70 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/poweredby_sw.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/progress-bar.gif b/source/web/jsp/content/xforms/forms/images/progress-bar.gif new file mode 100644 index 0000000000..91bc2fedc1 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/progress-bar.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/progress-remainder.gif b/source/web/jsp/content/xforms/forms/images/progress-remainder.gif new file mode 100644 index 0000000000..4b6356ed20 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/progress-remainder.gif differ diff --git a/source/web/jsp/content/xforms/forms/images/text.gif b/source/web/jsp/content/xforms/forms/images/text.gif new file mode 100644 index 0000000000..f8d18085ca Binary files /dev/null and b/source/web/jsp/content/xforms/forms/images/text.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/FluxInterface.js b/source/web/jsp/content/xforms/forms/scripts/FluxInterface.js new file mode 100644 index 0000000000..160335d771 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/FluxInterface.js @@ -0,0 +1,485 @@ +// todo: make configurable +var DATE_DISPLAY_FORMAT = "%d.%m.%Y"; +var DATETIME_DISPLAY_FORMAT = "%d.%m.%Y %H:%M"; + +/****************************************************************************** +GENERAL STUFF +******************************************************************************/ +function useLoadingMessage() { + DWREngine.setPreHook(function() { + document.getElementById('indicator').className = 'enabled'; + }); + + DWREngine.setPostHook(function() { + document.getElementById('indicator').className = 'disabled'; + }); +} + +/* +just a starter. +*/ +function handleExceptions(msg){ + if(msg.indexOf(":") != -1){ + alert(msg.substring(msg.lastIndexOf(":") +1 )); + }else{ + alert(msg); + } +} +/* +This function is called whenever the user presses ENTER in an input or secret +or on a radiobutton or checkbox. Normally this should not result in a post request +in an AJAX environment. The current function simply does nothing. If something is +expected to happen on an ENTER it has to be handled here. +*/ + +function submitFunction(control){ + return false; +} + +// call processor to execute a trigger +function activate(control) { + + var target = window.event ? window.event.srcElement : control; + + var id = target.id; + if (id.substring(id.length - 6, id.length) == "-value") { + // cut off "-value" + id = id.substring(0, id.length - 6); + } + + _clear(); + _debug("Flux.fireAction: " + id); + useLoadingMessage(); + + DWREngine.setErrorHandler(handleExceptions); + DWREngine.setOrdered(true); + Flux.fireAction(updateUI, id); +} + +// call processor to update a controls' value +function setXFormsValue(control) { + DWREngine.setErrorHandler(handleExceptions); + var target; + if (window.event) { + target = window.event.srcElement; + } + else { + target = control; + } + + var id = target.id; + if (id.substring(id.length - 6, id.length) == "-value") { + // cut off "-value" + id = id.substring(0, id.length - 6); + } + + var value = ""; + if (target.value) { + value = target.value; + } + + switch (target.type){ + case "radio": + // get target id from parent control, since the id passed in is the item's id + while(! _hasClass(target, "select1")) { + target = target.parentNode; + } + id = target.id; + break; + case "checkbox": + // keep name + var name = target.name; + + // get target id from parent control, since the id passed in is the item's id + while(! _hasClass(target, "select")) { + target = target.parentNode; + } + id = target.id; + + // assemble value from selected checkboxes + var elements = eval("document.chibaform.elements"); + var checkboxes = new Array(); + for (i = 0; i < elements.length; i++) { + if (elements[i].name == name && elements[i].type != "hidden" && elements[i].checked) { + checkboxes.push(elements[i].value); + } + } + value = checkboxes.join(" "); + break; + case "select-multiple": + // assemble value from selected options + var options = target.options; + var multiple = new Array(); + for (i = 0 ; i < options.length; i++){ + if (options[i].selected){ + multiple.push(options[i].value); + } + } + value = multiple.join(" "); + break; + default: + break; + } + + _clear(); + _debug("Flux.setXFormsValue: " + id + "='" + value + "'"); + useLoadingMessage(); + + DWREngine.setOrdered(true); + DWREngine.setErrorHandler(handleExceptions); + Flux.setXFormsValue(updateUI, id, value); +} + +/****************************************************************************** +CONTROL SPECIFIC FUNCTIONS +******************************************************************************/ + +/* +upload related functions. +*/ +var progressUpdate; +function submitFile(control){ + + var target; + if (window.event) { + target = window.event.srcElement; + } + else { + target = control; + } + + var id = target.id; + if (id.substring(id.length - 6, id.length) == "-value") { + id = id.substring(0, id.length - 6); + } + + var path = control.value; + var filename = path.substring(path.lastIndexOf("/")+1); + +// progressUpdate = setInterval("Flux.fetchProgress(updateProgress,'" + id + "','" + filename + "')",500); + progressUpdate = setInterval("Flux.fetchProgress(updateUI,'" + id + "','" + filename + "')",500); + + document.forms[0].target= "UploadTarget"; + document.forms[0].submit(); + + return true; +} + + +/* todo: updating of range still missing */ +function setRange(id,value){ + _debug("Flux.setRangeValue: " + id + "='" + value + "'"); + + //todo: fix for IE +// var oldValue = document.getElementsByName(id + '-value')[0]; + var oldValue = document.getElementsByClassName('rangevalue', document.getElementById(id))[0]; + if(oldValue){ + oldValue.className = "step"; +// oldValue.removeAttribute("name"); + } + + var newValue = document.getElementById(id + value); + newValue.className = newValue.className + " rangevalue"; +// newValue.setAttribute("name", id + "-value"); + + DWREngine.setErrorHandler(handleExceptions); + Flux.setXFormsValue(updateUI, id, value); +} + + +// call the processor to set a repeat's index +function setRepeatIndex(e) { + var target; + if (window.event) { + // stop event propagation (for IE) + window.event.cancelBubble = true; + target = window.event.srcElement; + } + else { + e.cancelBubble = true; + target = e.target; + } + + // lookup repeat item + while (target && ! _hasClass(target, "repeat-item")) { + target = target.parentNode; + } + + // maybe the user clicked on a whitespace node between to items *or* + // on an already selected item, so there is no item to select + if ((!target) || _hasClass(target, "repeat-index")) { + return; + } + + target.setAttribute("selected", "true"); + + var repeatItems = target.parentNode.childNodes; + var currentPosition = 0; + var targetPosition = 0; + + // lookup target to compute logical position + for (var index = 0; index < repeatItems.length; index++) { + if (repeatItems[index].nodeType == 1 && _hasClass(repeatItems[index], "repeat-item")) { + currentPosition++; + + if (repeatItems[index].getAttribute("selected") == "true") { + repeatItems[index].removeAttribute("selected"); + targetPosition = currentPosition; + + // optimistic update + _addClass(repeatItems[index], "repeat-index-pre"); + } + + _removeClass(repeatItems[index], "repeat-index") + } + } + + // lookup repeat id + while (! _hasClass(target, "repeat")) { + target = target.parentNode; + } + var repeatId = target.id; + + _clear(); + _debug("Flux.setRepeatIndex: " + repeatId + "='" + targetPosition + "'"); + useLoadingMessage(); + DWREngine.setErrorHandler(handleExceptions); +// DWREngine.setOrdered(true); + + Flux.setRepeatIndex(updateUI, repeatId, targetPosition); +} + +// callback for updating any control +function updateUI(data) +{ + _debug("updateUI(" + data.toString() + ")"); +// _debug("updateUI: " + data); + + var eventLog = data.documentElement.childNodes; +// _debug("EventLog length: " + eventLog.length); + + for (var i = 0; i < eventLog.length; i++) { + var type = eventLog[i].getAttribute("type"); + var targetId = eventLog[i].getAttribute("targetId"); + var targetName = eventLog[i].getAttribute("targetName"); + var properties = new Array; + var name; + for (var j = 0; j < eventLog[i].childNodes.length; j++) { + if (eventLog[i].childNodes[j].nodeName == "property") { + name = eventLog[i].childNodes[j].getAttribute("name"); + if (eventLog[i].childNodes[j].childNodes.length > 0) { + properties[name] = eventLog[i].childNodes[j].childNodes[0].nodeValue; + } + else { + properties[name] = ""; + } + } + } + + var context = new PresentationContext(); + _handleServerEvent(context, type, targetId, targetName, properties); + } +} + +function _updateProgress(uploadId,value){ + var progressDiv = document.getElementById(uploadId + "-progress-bg"); + if(value!=0){ + progressDiv.style.width = value + "%"; + } + + //check for existence of id within iframe +// var statusOK = window.frames[0].document.getElementById("upload-status-ok"); + var statusOK = window.UploadTarget.document.getElementById("upload-status-ok"); + if(statusOK){ + //stop polling + clearInterval(progressUpdate); + progressDiv.style.width = 100 +"%"; + + //reset progress bar + var elemId = uploadId + "-progress-bg"; + setTimeout("document.getElementById('" + elemId + "').style.width=0",2000); + + //reset iframe status attribute + statusOK.setAttribute("id","upload-status"); + statusOK.style.background="white"; + } +} + +function _handleServerEvent(context, type, targetId, targetName, properties) { + switch(type){ + case "chiba-load-uri": + context.handleLoadURI(properties["uri"], properties["show"]); + break; + case "chiba-render-message": + context.handleRenderMessage(properties["message"], properties["level"]); + break; + case "chiba-replace-all": + context.handleReplaceAll(); + break; + case "chiba-state-changed": + // this is a bit clumsy but needed to distinguish between controls and helper elements + if (properties["parentId"]) { + context.handleHelperChanged(properties["parentId"], targetName, properties["value"]); + } + else { + context.handleStateChanged(targetId, properties["valid"], properties["readonly"], properties["required"], properties["enabled"], properties["value"]); + } + break; + case "chiba-prototype-cloned": + context.handlePrototypeCloned(targetId, targetName, properties["originalId"], properties["prototypeId"]); + break; + case "chiba-id-generated": + context.handleIdGenerated(targetId, properties["originalId"]); + break; + case "chiba-item-inserted": + context.handleItemInserted(targetId, targetName, properties["originalId"], properties["position"]); + break; + case "chiba-item-deleted": + context.handleItemDeleted(targetId, targetName, properties["originalId"], properties["position"]); + break; + case "chiba-index-changed": + context.handleIndexChanged(targetId, properties["originalId"], properties["index"]); + break; + case "chiba-switch-toggled": + context.handleSwitchToggled(properties["deselected"], properties["selected"]); + break; + case "upload-progress-event": + _updateProgress(targetId,properties["progress"]) + break; + default: + _debug("Event " + type + " unknown"); + break; + } +} + +/* help function - still not ready */ +function showHelp(helptext){ + alert(helptext); + var helpwnd = window.open('','','scrollbars=no,menubar=no,height=400,width=400,resizable=yes,toolbar=no,location=no,status=no'); + helpwnd.document.getElementsByTagName("body")[0].innerHTML = helptext; + +} + +// Calendar. + +/** + * Initializes the calendar component according to the underlying datatype. + */ +function calendarSetup (id, value, type) { + // initialize hidden calendar + // todo: jsCalendar has problems with time part + var dateTime = type == 'dateTime'; + Calendar.setup({ + date: value && value.length > 0 ? value : null, // use null for empty value + firstDay: 1, // use monday as first day of week + showsTime: dateTime, // configure time display + inputField: id + '-value', // hidden input field + displayArea: id + '-' + type + '-display', // formatted display area + button: id + '-' + type + '-button', // date control image button + ifFormat: dateTime ? '%Y-%m-%dT%H:%M:%S' : '%Y-%m-%d', // ISO date/dateTime format + daFormat: dateTime ? DATETIME_DISPLAY_FORMAT : DATE_DISPLAY_FORMAT, // configurable display format + onClose: calendarOnClose, // callback for updating the processor + onSelect: calendarOnSelect, // callback for updating the processor + electric: false // matches xf:incremental, should be a parameter + }); + + // jsCalendar updates the display area only on user interaction, not on + // init/setup nor on internal value updates. + calendarUpdate(id, value, type); +} + +/** + * Updates the calendar component, namely the display area. + */ +function calendarUpdate (id, value, type) { + var element = document.getElementById(id + '-' + type + '-display'); + if (element) { + var date = _parseISODate(value); + var format = type == 'dateTime' ? DATETIME_DISPLAY_FORMAT : DATE_DISPLAY_FORMAT; + + if (element.innerHTML) { + // update ,
et al. + element.innerHTML = date ? date.print(format) : ' '; + } + else { + // update + element.value = date ? date.print(format) : ''; + } + + return true; + } + + return false; +} + +/** + * Calendar callback for select events. + * + * Allows jsCalendar to use form controls as display area too. + */ +function calendarOnSelect (calendar) { + // copied from calendar-setup.js + var p = calendar.params; + var update = (calendar.dateClicked || p.electric); + if (update && p.flat) { + if (typeof p.flatCallback == "function") + p.flatCallback(calendar); + else + alert("No flatCallback given -- doing nothing."); + return false; + } + if (update && p.inputField) { + p.inputField.value = calendar.date.print(p.ifFormat); + if (typeof p.inputField.onchange == "function") + p.inputField.onchange(); + } + if (update && p.displayArea) + // start patch by unl + // check for 'innerHTML' property, otherwise try 'value' property + if (p.displayArea.innerHTML) { + p.displayArea.innerHTML = calendar.date.print(p.daFormat); + } + else { + p.displayArea.value = calendar.date.print(p.daFormat); + } + // end patch by unl + if (update && p.singleClick && calendar.dateClicked) + calendar.callCloseHandler(); + if (update && typeof p.onUpdate == "function") + p.onUpdate(calendar); +} + +/** + * Calendar callback for close events. + * + * Hides the calendar and updates the processor. + */ +function calendarOnClose (calendar) { + calendar.hide(); + + var id = calendar.params.inputField.id; + var value = calendar.params.inputField.value; + + // cut off '-value' + id = id.substring(0, id.length - 6); + Flux.setXFormsValue(updateUI, id, value); +} + +/** + * Parses an ISO date/datetime string. Timezones not supported yet. + */ +function _parseISODate (iso) { + if (!iso || iso.length == 0) { + return null; + } + + var separator = iso.indexOf('T'); + if (separator == -1) { + iso = iso + 'T00:00:00'; + } + var parts = iso.split('T'); + var date = parts[0].split('-'); + var time = parts[1].split(':'); + + return new Date(date[0], date[1] - 1, date[2], time[0], time[1], time[2]); +} diff --git a/source/web/jsp/content/xforms/forms/scripts/PresentationContext.js b/source/web/jsp/content/xforms/forms/scripts/PresentationContext.js new file mode 100644 index 0000000000..fd0b6c46b6 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/PresentationContext.js @@ -0,0 +1,909 @@ +// PresentationContext: UI State updating. +// Author: unl +// Copyright 2005 Chibacon + +/** + * Constructor. + */ +PresentationContext = function() { +}; + +// Static member + +PresentationContext.CHIBA_PSEUDO_ITEM = "chiba-pseudo-item"; +PresentationContext.PROTOTYPE_CLONES = new Array(); +PresentationContext.GENERATED_IDS = new Array(); + +// Event handler + +/** + * Handles chiba-load-uri. + */ +PresentationContext.prototype.handleLoadURI = function(uri, show) { + _debug("PresentationContext.handleLoadURI: uri='" + uri + "', show='" + show + "'"); + window.open(uri, show == "new" ? "_blank" : "_self"); +}; + +/** + * Handles chiba-render-message. + */ +PresentationContext.prototype.handleRenderMessage = function(message, level) { + _debug("PresentationContext.handleRenderMessage: message='" + message + "', level='" + level + "'"); + if (level == "modal") { + alert(message); + } + else { + alert("TODO: PresentationContext.handleRenderMessage: message='" + message + "', level='" + level + "'"); + } +}; + +/** + * Handles chiba-replace-all. + */ +PresentationContext.prototype.handleReplaceAll = function() { + _debug("PresentationContext.handleReplaceAll: ?"); + + window.open("SubmissionResponse", "_self"); +}; + +/** + * Handles chiba-state-changed. + */ +PresentationContext.prototype.handleStateChanged = function(targetId, valid, readonly, required, enabled, value) { + _debug("PresentationContext.handleStateChanged: targetId='" + targetId + "', valid='" + valid + "', readonly='" + readonly + "', required='" + required + "', enabled='" + enabled + "', value='" + value + "'"); + + var target = document.getElementById(targetId); + if (target == null) { + alert("target '" + targetId + "' not found"); + return; + } + + if (value != null) { + PresentationContext._setControlValue(targetId, value); + } + + if (valid != null) { + PresentationContext._setValidProperty(target, eval(valid)); + } + if (readonly != null) { + PresentationContext._setReadonlyProperty(target, eval(readonly)); + } + if (required != null) { + PresentationContext._setRequiredProperty(target, eval(required)); + } + if (enabled != null) { + PresentationContext._setEnabledProperty(target, eval(enabled)); + } +}; + +/** + * Handles chiba-state-changed for helper elements. + */ +PresentationContext.prototype.handleHelperChanged = function(parentId, type, value) { + _debug("PresentationContext.handleHelperChanged: parentId='" + parentId + "', type='" + type + "', value='" + value + "'"); + switch (type) { + case "label": + PresentationContext._setControlLabel(parentId, value); + return; + case "help": + PresentationContext._setControlHelp(parentId, value); + return; + case "hint": + PresentationContext._setControlHint(parentId, value); + return; + case "alert": + PresentationContext._setControlAlert(parentId, value); + return; + case "value": + PresentationContext._setControlValue(parentId, value); + return; + } +}; + +/** + * Handles chiba-prototype-cloned. + */ +PresentationContext.prototype.handlePrototypeCloned = function(targetId, type, originalId, prototypeId) { + _debug("PresentationContext.handlePrototypeCloned: targetId='" + targetId + "', type='" + type + "', originalId='" + originalId + "', prototypeId='" + prototypeId + "'"); + if (type == "itemset") { + PresentationContext._cloneSelectorPrototype(targetId, originalId, prototypeId); + } + else { + PresentationContext._cloneRepeatPrototype(targetId, originalId, prototypeId); + } +}; + +/** + * Handles chiba-id-generated. + */ +PresentationContext.prototype.handleIdGenerated = function(targetId, originalId) { + _debug("PresentationContext.handleIdGenerated: targetId='" + targetId + "', originalId='" + originalId + "'"); + PresentationContext._setGeneratedId(targetId, originalId); +}; + +/** + * Handles chiba-item-inserted. + */ +PresentationContext.prototype.handleItemInserted = function(targetId, type, originalId, position) { + _debug("PresentationContext.handleItemInserted: targetId='" + targetId + "', type='" + type + "', originalId='" + originalId + "', position='" + position + "'"); + if (type == "itemset") { + PresentationContext._insertSelectorItem(targetId, originalId, position); + } + else { + PresentationContext._insertRepeatItem(targetId, originalId, position); + } +}; + +/** + * Handles chiba-item-deleteed. + */ +PresentationContext.prototype.handleItemDeleted = function(targetId, type, originalId, position) { + _debug("PresentationContext.handleItemDeleted: targetId='" + targetId + "', type='" + type + "', originalId='" + originalId + "', position='" + position + "'"); + if (type == "itemset") { + PresentationContext._deleteSelectorItem(targetId, originalId, position); + } + else { + PresentationContext._deleteRepeatItem(targetId, originalId, position); + } +}; + +/** + * Handles chiba-index-changed. + */ +PresentationContext.prototype.handleIndexChanged = function(targetId, originalId, index) { + _debug("PresentationContext.handleIndexChanged: targetId='" + targetId + "', originalId='" + originalId + "', index='" + index + "'"); + PresentationContext._setRepeatIndex(targetId, originalId, index); +}; + +/** + * Handles chiba-switch-toggled. + */ +PresentationContext.prototype.handleSwitchToggled = function(deselectedId, selectedId) { + _debug("PresentationContext.handleSwitchToggled: deselectedId='" + deselectedId + "', selectedId='" + selectedId + "'"); + + if (deselectedId != "switch-toggles") { + var deselected = document.getElementById(deselectedId); + _replaceClass(deselected, "selected-case", "deselected-case"); + var inactive = document.getElementById(deselectedId + "-tab"); + _replaceClass(inactive, "active-tab", "inactive-tab"); + } + if (selectedId != "switch-toggles") { + var selected = document.getElementById(selectedId); + _replaceClass(selected, "deselected-case", "selected-case"); + var active = document.getElementById(selectedId + "-tab"); + _replaceClass(active, "inactive-tab", "active-tab"); + } +}; + +// static utilities + +PresentationContext._setValidProperty = function(target, valid) { +// _debug("PresentationContext._setValidProperty: " + target + "='" + valid + "'"); + + if (valid) { + _replaceClass(target, "invalid", "valid"); + } + else { + _replaceClass(target, "valid", "invalid"); + } +}; + +PresentationContext._setReadonlyProperty = function(target, readonly) { +// _debug("PresentationContext._setReadonlyProperty: " + target + "='" + readonly + "'"); + + if (readonly) { + _replaceClass(target, "readwrite", "readonly"); + } + else { + _replaceClass(target, "readonly", "readwrite"); + } + + var targetId = target.getAttribute("id"); + if (document.getElementById(targetId + "-date-display")) { + // special treatment for calendar + PresentationContext._updateCalendar(targetId, "date", readonly); + return; + } + if (document.getElementById(targetId + "-dateTime-display")) { + // special treatment for calendar + PresentationContext._updateCalendar(targetId, "dateTime", readonly); + return; + } + + var value = document.getElementById(targetId + "-value"); + if (value) { + if (value.nodeName.toLowerCase() == "input" && value.type.toLowerCase() == "hidden") { + // special treatment for radiobuttons/checkboxes + PresentationContext._updateSelectors(value, readonly); + return; + } + + if (readonly) { + value.setAttribute("disabled", "disabled"); + } + else { + value.removeAttribute("disabled"); + } + } +}; + +PresentationContext._setRequiredProperty = function(target, required) { +// _debug("PresentationContext._setRequiredProperty: " + target + "='" + required + "'"); + + if (required) { + _replaceClass(target, "optional", "required"); + } + else { + _replaceClass(target, "required", "optional"); + } +}; + +PresentationContext._setEnabledProperty = function(target, enabled) { +// _debug("PresentationContext._setEnabledProperty: " + target + "='" + enabled + "'"); + + if (enabled) { + _replaceClass(target, "disabled", "enabled"); + } + else { + _replaceClass(target, "enabled", "disabled"); + } + + // handle labels too, they might be rendered elsewhere + var targetId = target.getAttribute("id"); + var label = document.getElementById(targetId + "-label"); + if (label) { + if (enabled) { + _replaceClass(label, "disabled", "enabled"); + } + else { + _replaceClass(label, "enabled", "disabled"); + } + } +}; + +PresentationContext._setControlValue = function(targetId, value) { +// _debug("PresentationContext.setControlValue: " + targetId + "='" + value + "'"); + + var control = document.getElementById(targetId + "-value"); + if (control == null) { + alert("value for '" + targetId + "' not found"); + return; + } + + var listValue = " " + value + " "; + switch (control.nodeName.toLowerCase()) { + case "a": + // + control.href = value; + break; + case "img": + // + control.src = value; + break; + case "input": + if (control.type.toLowerCase() == "hidden") { + // check for date control + if (document.getElementById(targetId + "-date-display") || document.getElementById(targetId + "-date-button")) { + control.value = value; + calendarUpdate(targetId, value, "date"); + break; + } + + // check for dateTime control + if (document.getElementById(targetId + "-dateTime-display") || document.getElementById(targetId + "-dateTime-button")) { + control.value = value; + calendarUpdate(targetId, value, "dateTime"); + break; + } + + // special treatment for radiobuttons/checkboxes + var elements = eval("document.chibaform.elements"); + var box; + var boxValue; + for (var i = 0; i < elements.length; i++) { + if (elements[i].name == control.name && elements[i].type != "hidden") { + box = elements[i]; + boxValue = " " + box.value + " "; + if (listValue.indexOf(boxValue) > -1) { + box.checked = true; + } + else { + box.checked = false; + } + } + } + break; + } + + if (control.type.toLowerCase() == "button") { + // ignore + break; + } + + if (control.type.toLowerCase() == "file") { + // ignore + break; + } + + control.value = value; + break; + case "option": + control.value = value; + break; + case "span": + // + if (_hasClass(control, "colorbox")) { + control.style.backgroundColor = value; + break; + } + + _setElementText(control, value); + break; + case "select": + // special treatment for options + var options = control.options.length; + var option; + var optionValue; + for (var i = 0; i < options; i++) { + option = control.options[i]; + optionValue = " " + option.value + " "; + if (listValue.indexOf(optionValue) > -1) { + option.selected = true; + } + else { + option.selected = false; + } + } + break; + case "table": + if(_hasClass(control,"range-widget")){ + var oldValue = document.getElementsByClassName('rangevalue', document.getElementById(targetId))[0]; + if(oldValue){ + oldValue.className = "step"; + } + var newValue = document.getElementById(targetId + value); + if(newValue){ + newValue.className = "step rangevalue"; + } + } + break; + case "textarea": + control.value = value; + break; + default: + alert("unknown control '" + control.nodeName + "'"); + } +}; + +PresentationContext._setControlLabel = function(parentId, value) { +// _debug("PresentationContext._setControlLabel: " + parentId + "='" + value + "'"); + + var element = document.getElementById(parentId + "-label"); + if (element != null) { + // update label element + _setElementText(element, value); + return; + } + + // heuristics: look for implicit labels + var control = document.getElementById(parentId + "-value"); + switch (control.nodeName.toLowerCase()) { + case "a": + // + _setElementText(control, value); + break; + case "span": + // + _setElementText(control, value); + break; + case "option": + control.text = value; + break; + case "input": + if (control.type.toLowerCase() == "button") { + control.value = value; + break; + } + // fall through + default: + // dirty hack for compact repeats: lookup enclosing table + var td = document.getElementById(parentId); + if (td != null && td.nodeName.toLowerCase() == "td") { + var tr = td.parentNode; + if (tr != null && tr.nodeName.toLowerCase() == "tr") { + var tbody = tr.parentNode; + if (tbody != null && tbody.nodeName.toLowerCase() == "tbody") { + var table = tbody.parentNode; + if (table != null && table.nodeName.toLowerCase() == "table") { + if (_hasClass(table, "compact-repeat")) { + _debug("ignoring label for '" + parentId + "' in compact repeat"); + break; + } + } + } + } + } + + // complain, finally + alert("label for '" + parentId + "' not found"); + } +}; + +PresentationContext._setControlHelp = function(parentId, value) { +// _debug("PresentationContext._setControlHelp: " + parentId + "='" + value + "'"); + + alert("TODO: PresentationContext._setControlHelp: " + parentId + "='" + value + "'"); +}; + +PresentationContext._setControlHint = function(parentId, value) { +// _debug("PresentationContext._setControlHint: " + parentId + "='" + value + "'"); + + var element = document.getElementById(parentId + "-value"); + if (element != null) { + if (element.nodeName.toLowerCase() == "input" && element.type == "hidden") { + // special treatment for radiobuttons/checkboxes + var boxes = eval("document.chibaform." + element.name + ".length;"); + var box; + for (var i = 0; i < boxes; i++) { + box = eval("document.chibaform." + element.name + "[" + i + "]"); + box.title = value; + } + } + else { + element.title = value; + } + } + else { + alert("hint for '" + parentId + "' not found"); + } +}; + +PresentationContext._setControlAlert = function(parentId, value) { +// _debug("PresentationContext._setControlAlert: " + parentId + "='" + value + "'"); + + var element = document.getElementById(parentId + "-alert"); + if (element != null) { + _setElementText(element, value); + } + else { + alert("alert for '" + parentId + "' not found"); + } +}; + +/** + * Clones a repeat prototype. + * + * @param target the repeat id. + * @param value the prototype id (original repeat id). + */ +PresentationContext._cloneRepeatPrototype = function(targetId, originalId, prototypeId) { +// _debug("PresentationContext._cloneRepeatPrototype: [" + targetId + "/" + originalId + "]='" + prototypeId + "'"); + + var clone = document.getElementById(originalId + "-prototype").cloneNode(true); + clone.setAttribute("id", prototypeId); + _replaceClass(clone, "repeat-prototype", "repeat-item"); + PresentationContext.PROTOTYPE_CLONES.push(clone); + + var ids = new Array(); + PresentationContext.GENERATED_IDS.push(ids); +}; + +/** + * Clones a selector prototype. + * + * @param target the selector id. + * @param value the prototype id (original selector id). + */ +PresentationContext._cloneSelectorPrototype = function(targetId, originalId, prototypeId) { +// _debug("PresentationContext._cloneSelectorPrototype: [" + targetId + "/" + originalId + "]='" + prototypeId + "'"); + + // clone prototype and make it an item + var clone; + var proto = document.getElementById(originalId + "-prototype"); + + if (proto.nodeName.toLowerCase() == "select") { + // special handling for option prototypes, since their prototype + // element needs a wrapper element for carrying the prototype id + var optionIndex; + for (var i = 0; i < proto.childNodes.length; i++) { + if (proto.childNodes[i].nodeType == 1) { + optionIndex = i; + break; + } + } + proto = proto.childNodes[optionIndex]; + + // create an option object rather than cloning it, otherwise IE won't + // display it as an additional option !!! + clone = new Option("", ""); + clone.selected = false; + clone.defaultSelected = false; + clone.id = proto.id; + clone.title = proto.title; + } + else { + clone = proto.cloneNode(true); + clone.setAttribute("id", prototypeId); + } + + clone.className = "selector-item"; + PresentationContext.PROTOTYPE_CLONES.push(clone); + + var ids = new Array(); + PresentationContext.GENERATED_IDS.push(ids); +}; + +/** + * Sets a generated id on the current prototype clone. + * + * @param target the generated id. + * @param value the original id. + */ +PresentationContext._setGeneratedId = function(targetId, originalId) { +// _debug("PresentationContext._setGeneratedId: " + targetId + "='" + originalId + "'"); + + var array = PresentationContext.GENERATED_IDS[PresentationContext.GENERATED_IDS.length - 1]; + array[originalId] = targetId; + array[originalId + "-value"] = targetId + "-value"; + array[originalId + "-label"] = targetId + "-label"; + array[originalId + "-alert"] = targetId + "-alert"; + array[originalId + "-required"] = targetId + "-required"; + + if (!array[PresentationContext.CHIBA_PSEUDO_ITEM]) { + // we have to add a special 'chiba-pseudo-item' mapping, since for itemsets + // within repeats there is no item yet at the time the prototype is generated. + // thus, there is no original id in the prototype !!! + array[PresentationContext.CHIBA_PSEUDO_ITEM] = targetId; + array[PresentationContext.CHIBA_PSEUDO_ITEM + "-value"] = targetId + "-value"; + array[PresentationContext.CHIBA_PSEUDO_ITEM + "-label"] = targetId + "-label"; + } +}; + +/** + * Inserts the current prototype clone as a repeat item. + * + * @param target the repeat id. + * @param value the insert position. + */ +PresentationContext._insertRepeatItem = function(targetId, originalId, position) { +// _debug("PresentationContext._insertRepeatItem: [" + targetId + "/" + originalId + "]='" + position + "'"); + + // apply generated ids to prototype + var prototypeClone = PresentationContext.PROTOTYPE_CLONES.pop(); + var generatedIds = PresentationContext.GENERATED_IDS.pop(); + PresentationContext._applyGeneratedIds(prototypeClone, generatedIds); + + // setup indices + var currentPosition = 0; + var targetPosition = parseInt(position); + var insertIndex = -1; + + // lookup repeat + var targetElement; + if (PresentationContext.PROTOTYPE_CLONES.length > 0) { + // nested repeat + var enclosingPrototype = PresentationContext.PROTOTYPE_CLONES[PresentationContext.PROTOTYPE_CLONES.length - 1]; + targetElement = _getElementById(enclosingPrototype, originalId); + } + else { + // top-level repeat + targetElement = document.getElementById(targetId); + } + + var repeatElement = PresentationContext._getRepeatNode(targetElement); + var repeatItems = repeatElement.childNodes; + + for (var i = 0; i < repeatItems.length; i++) { + // lookup elements + if (repeatItems[i].nodeType == 1) { + // lookup repeat item + if (_hasClass(repeatItems[i], "repeat-item")) { + currentPosition++; + + // store insert index (position *at* insert item) + if (currentPosition == targetPosition) { + insertIndex = i; + break; + } + } + } + } + + // detect reference node + var referenceNode = null; + if (insertIndex > -1) { + referenceNode = repeatItems[insertIndex]; + } + + // insert prototype clone + repeatElement.insertBefore(prototypeClone, referenceNode); +}; + +/** + * Inserts the current prototype clone as a selector item. + * + * @param target the selector id. + * @param value the insert position. + */ +PresentationContext._insertSelectorItem = function(targetId, originalId, position) { +// _debug("PresentationContext._insertSelectorItem: [" + targetId + "/" + originalId + "]='" + position + "'"); + + // apply generated ids to prototype + var prototypeClone = PresentationContext.PROTOTYPE_CLONES.pop(); + var generatedIds = PresentationContext.GENERATED_IDS.pop(); + PresentationContext._applyGeneratedIds(prototypeClone, generatedIds); + + // setup indices + var currentPosition = 0; + var targetPosition = parseInt(position); + var insertIndex = -1; + + // lookup itemset + var itemsetElement; + if (PresentationContext.PROTOTYPE_CLONES.length > 0) { + // nested repeat + var enclosingPrototype = PresentationContext.PROTOTYPE_CLONES[PresentationContext.PROTOTYPE_CLONES.length - 1]; + itemsetElement = _getElementById(enclosingPrototype, originalId); + } + else { + // top-level repeat + itemsetElement = document.getElementById(targetId); + } + + var itemsetItems = itemsetElement.childNodes; + for (var i = 0; i < itemsetItems.length; i++) { + // lookup elements + if (itemsetItems[i].nodeType == 1) { + // lookup repeat item + if (_hasClass(itemsetItems[i], "selector-item")) { + currentPosition++; + + // store insert index (position *at* insert item) + if (currentPosition == targetPosition) { + insertIndex = i; + break; + } + } + } + } + + // detect reference node + var referenceNode = null; + if (insertIndex > -1) { + referenceNode = itemsetItems[insertIndex]; + } + + // insert prototype clone + itemsetElement.insertBefore(prototypeClone, referenceNode); +}; + +/** + * Deletes a repeat item. + * + * @param target the repeat id. + * @param value the delete position. + */ +PresentationContext._deleteRepeatItem = function(targetId, originalId, position) { +// _debug("PresentationContext._deleteRepeatItem: [" + targetId + "/" + originalId + "]='" + position + "'"); + + var currentPosition = 0; + var targetPosition = parseInt(position); + var deleteIndex = -1; + var nextIndex = -1; + + var targetElement = document.getElementById(targetId); + var repeatElement = PresentationContext._getRepeatNode(targetElement); + var repeatItems = repeatElement.childNodes; + for (var i = 0; i < repeatItems.length; i++) { + // lookup elements + if (repeatItems[i].nodeType == 1) { + // lookup repeat item + if (_hasClass(repeatItems[i], "repeat-item")) { + currentPosition++; + + // store delete index (position *at* delete item) + if (currentPosition == targetPosition) { + deleteIndex = i; + } + + // check for next item + if (currentPosition > targetPosition) { + nextIndex = i; + break; + } + } + } + } + + // check for next item to be selected + var deleteItem = repeatItems[deleteIndex]; + if (_hasClass(deleteItem, "repeat-index") && nextIndex > -1) { + var nextItem = repeatItems[nextIndex]; + + // reset repeat index manually since it won't change when it is set to + // the item to delete and there is a following item + _removeClass(deleteItem, "repeat-item"); + _addClass(nextItem, "repeat-index"); + } + + // delete item + repeatElement.removeChild(deleteItem); +}; + +/** + * Deletes a selector item. + * + * @param target the selector id. + * @param value the delete position. + */ +PresentationContext._deleteSelectorItem = function(targetId, originalId, position) { +// _debug("PresentationContext._deleteSelectorItem: [" + targetId + "/" + originalId + "]='" + position + "'"); + + var itemset = document.getElementById(targetId); + var items = itemset.childNodes; + var currentPosition = 0; + var targetPosition = parseInt(position); + var deleteIndex = -1; + + for (var i = 0; i < items.length; i++) { + // lookup elements + if (items[i].nodeType == 1) { + // lookup repeat item + if (_hasClass(items[i], "selector-item")) { + currentPosition++; + + // store delete index (position *at* delete item) + if (currentPosition == targetPosition) { + deleteIndex = i; + break; + } + } + } + } + + // delete item + itemset.removeChild(items[deleteIndex]); +}; + +/** + * Sets the index of a repeat. + * + * @param target the repeat id. + * @param value the repeat index. + */ +PresentationContext._setRepeatIndex = function(targetId, originalId, index) { +// _debug("PresentationContext._setRepeatIndex: [" + targetId + "/" + originalId + "]='" + index + "'"); + + var currentPosition = 0; + var targetPosition = parseInt(index); + + if (targetPosition > 0) { + var targetElement; + if (PresentationContext.PROTOTYPE_CLONES.length > 0) { + // nested repeat + var enclosingPrototype = PresentationContext.PROTOTYPE_CLONES[PresentationContext.PROTOTYPE_CLONES.length - 1]; + targetElement = _getElementById(enclosingPrototype, originalId); + } + else { + // top-level repeat + targetElement = document.getElementById(targetId); + } + + var repeatElement = PresentationContext._getRepeatNode(targetElement); + var repeatItems = repeatElement.childNodes; + for (var i = 0; i < repeatItems.length; i++) { + // lookup repeat items + if (repeatItems[i].nodeType == 1 && _hasClass(repeatItems[i], "repeat-item")) { + currentPosition++; + + if (currentPosition == targetPosition) { + // select item + _addClass(repeatItems[i], "repeat-index"); + } + else { + // deselect item + _removeClass(repeatItems[i], "repeat-index"); + } + + // remove preselection + _removeClass(repeatItems[i], "repeat-index-pre"); + } + } + } +}; + +PresentationContext._updateSelectors = function(control, readonly) { + var id = control.id.substring(0, control.id.indexOf("-value")); + var count = eval("document.chibaform." + control.name + ".length;"); + var selector; + var label; + var position + for (var i = 0; i < count; i++) { + position = i + 1; + selector = eval("document.chibaform." + control.name + "[" + i + "]"); + label = document.getElementById(id + "-" + position + "-label"); + if (readonly) { + selector.setAttribute("disabled", "disabled"); + if (label != null) { + label.setAttribute("disabled", "disabled"); + } + } + else { + selector.removeAttribute("disabled"); + if (label != null) { + label.removeAttribute("disabled"); + } + } + } +}; + +PresentationContext._updateCalendar = function(id, type, readonly) { + var display = document.getElementById(id + "-" + type + "-display"); + display.disabled = readonly; + display.readonly = !readonly; + + var button = document.getElementById(id + "-" + type + "-button"); + if (readonly) { + _replaceClass(button, "enabled", "disabled"); + } + else { + _replaceClass(button, "disabled", "enabled"); + } +}; + +PresentationContext._getRepeatNode = function(element) { + var items = element.childNodes; + + for (var i = 0; i < items.length; i++) { + if (items[i].nodeType == 1 && items[i].nodeName.toLowerCase() == "tbody") { + return items[i]; + } + } + + return element; +}; + +PresentationContext._applyGeneratedIds = function(element, ids) { + var id = element.getAttribute("id"); + if (id) { + var generatedId = ids[id]; + if (generatedId) { +// _debug("applying '" + generatedId + "' to '" + id + "'"); + element.setAttribute("id", generatedId); + + // apply to for-attribute of labels + if (element.nodeName.toLowerCase() == "label") { + var generatedFor = generatedId.substring(0, generatedId.length - 6) + "-value"; +// _debug("applying '" + generatedFor + "' for '" + id + "'"); + element.setAttribute("for", generatedFor); + } + } + } + + // hack for hidden inputs and multiple inputs with same name. this doesn't + // work for radiobuttons in IE, since input fields dyamically have to be + // created as follows: + // document.createElement(" + + * skins/aqua/theme.css: *** empty log message *** + + * release-notes.html: updated release notes + + * calendar-setup.js: + use a better approach to initialize the calendar--don't call _init twice, + it's the most time consuming function in the calendar. Instead, determine + the date beforehand if possible and pass it to the calendar at constructor. + + * calendar.js: + avoid keyboard operation when 'multiple dates' is set (very buggy for now) + + * calendar.js: + fixed keyboard handling problems: now it works fine when "showsOtherMonths" + is passed; it also seems to be fine with disabled dates (won't normally + allow selection)--however this area is still likely to be buggy, i.e. in a + month that has all the dates disabled. + + * calendar.js: + some trivial performance improvements in the _init function + Added Date.parseDate (old Calendar.prototype.parseDate now calls this one) + +2005-03-05 Mihai Bazon + + * release-notes.html: updated release notes + + * dayinfo.html: *** empty log message *** + + * calendar-setup.js: + bugfix--update an inputField even if flat calendar is selected + + * calendar.js: + fixed bugs in parseDate function (if for some reason the input string is + totally broken, then check numbers for NaN and use values from the current + date instead) + + * make-release.pl: copy the skins subdirectory and all skins + + * index.html: added Aqua skin + + * skins/aqua/active-bg.gif, skins/aqua/dark-bg.gif, skins/aqua/hover-bg.gif, skins/aqua/menuarrow.gif, skins/aqua/normal-bg.gif, skins/aqua/rowhover-bg.gif, skins/aqua/status-bg.gif, skins/aqua/theme.css, skins/aqua/title-bg.gif, skins/aqua/today-bg.gif: + in the future, skins will go to this directory, each in a separate subdir; for now there's only Aqua, an excellent new skin + + * calendar.js: workaround IE bug, needed in the Aqua theme + don't hide select elements unless browser is IE or Opera + + * lang/calendar-bg.js, lang/calendar-big5-utf8.js, lang/calendar-big5.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-utf8.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-de.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fi.js, lang/calendar-fr.js, lang/calendar-he-utf8.js, lang/calendar-hu.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-lt-utf8.js, lang/calendar-lt.js, lang/calendar-lv.js, lang/calendar-nl.js, lang/calendar-no.js, lang/calendar-pl-utf8.js, lang/calendar-pl.js, lang/calendar-pt.js, lang/calendar-ro.js, lang/calendar-ru.js, lang/calendar-ru_win_.js, lang/calendar-si.js, lang/calendar-sk.js, lang/calendar-sp.js, lang/calendar-sv.js, lang/calendar-zh.js, lang/cn_utf8.js: + updated urls, copyright notices + + * doc/reference.tex: updated documentation + + * calendar.js, index.html: + renamed the global variable to _dynarch_popupCalendar to avoid name clashes + + * multiple-dates.html: start with an empty array + + * calendar.js: + fixed bugs in the time selector (12:XX pm was wrongfully understood as 12:XX am) + + * calendar.js: + using innerHTML instead of text nodes; works better in Safari and also makes + a smaller, cleaner code + +2005-03-04 Mihai Bazon + + * calendar.js: + fixed a performance regression that occurred after adding support for multiple dates + fixed the time selection bug (now it keeps time correctly) + clicking today will close the calendar if "today" is already selected + + * lang/cn_utf8.js: new translation + +2005-02-17 Mihai Bazon + + * lang/calendar-ar-utf8.zip: Added arabic translation + +2004-10-19 Mihai Bazon + + * lang/calendar-zh.js: updated + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-08-11 Mihai Bazon + + * lang/calendar-nl.js: updated language file (thanks to Arjen Duursma) + + * lang/calendar-sp.js: updated (thanks to Rafael Velasco) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-04 Mihai Bazon + + * lang/calendar-lv.js: + added LV translation (thanks to Juris Valdovskis) + +2004-06-25 Mihai Bazon + + * calendar.js: + fixed bug in IE (el.calendar.tooltips is null or not an object) + +2004-06-24 Mihai Bazon + + * doc/reference.tex: fixed latex compilation + + * index.html: linking other sample files + + * calendar-setup.js, calendar.js, dayinfo.html: + ability to display day info (dateText parameter) + sample file + +2004-06-23 Mihai Bazon + + * doc/reference.tex, lang/calendar-bg.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-nl.js, lang/calendar-sv.js, README, calendar.js, index.html: + email address changed + +2004-06-14 Mihai Bazon + + * lang/calendar-cs-utf8.js, lang/calendar-cs-win.js: + updated translations + + * calendar-system.css: added z-index to drop downs + + * lang/calendar-en.js: + first day of week can now be part of the language file + + * lang/calendar-es.js: + updated language file (thanks to Servilio Afre Puentes) + + * calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar-blue.css: + added z-index property to drop downs (fixes bug) + +2004-06-13 Mihai Bazon + + * calendar-setup.js: fixed bug (apply showOthers to flat calendars too) + +2004-06-06 Mihai Bazon + + * calendar-setup.js: + firstDay defaults to "null", in which case the value in the language file + will be used + + * calendar.js: + firstDayOfWeek can now default to a value specified in the language definition file + + * index.html: first day of week is now numeric + +2004-06-02 Mihai Bazon + + * calendar.js: added date tooltip function + +2004-05-28 Mihai Bazon + + * lang/calendar-br.js: updated (thanks to Marcos Pont) + + * calendar-setup.js: fixed small bug + +2004-05-01 Mihai Bazon + + * calendar-setup.js: returns the calendar object + +2004-04-28 Mihai Bazon + + * calendar-setup.js: + patch to read the date value from the inputField, according to ifFormat (if + both are passed), for flat calendars. (thanks Colin T. Hill) + +2004-04-20 Mihai Bazon + + * calendar-setup.js, calendar.js, multiple-dates.html: + added support for multiple dates selection + + * lang/calendar-nl.js: + updated Dutch translation, thanks to Jeroen Wolsink + + * lang/calendar-big5-utf8.js, lang/calendar-big5.js: + Traditional Chinese language (thanks GaryFu) + +2004-03-26 Mihai Bazon + + * lang/calendar-fr.js, lang/calendar-pt.js: updated + + * lang/calendar-ru_win_.js, lang/calendar-ru.js: + updated, thanks to Sly Golovanov + +2004-03-25 Mihai Bazon + + * lang/calendar-fr.js: updated (thanks to David Duret) + +2004-03-24 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Michael Thingmand Henriksen) + +2004-03-21 Mihai Bazon + + * lang/calendar-ca.js: updated (thanks to David Valls) + +2004-03-17 Mihai Bazon + + * lang/calendar-de.js: updated to UTF8 (thanks to Jack (tR)) + +2004-03-09 Mihai Bazon + + * lang/calendar-bg.js: Bulgarian translation + +2004-03-08 Mihai Bazon + + * lang/calendar-he-utf8.js: Hebrew translation (thanks to Idan Sofer) + + * lang/calendar-hu.js: updated (thanks to Istvan Karaszi) + +2004-02-27 Mihai Bazon + + * lang/calendar-it.js: updated (thanks to Fabio Di Bernardini) + +2004-02-25 Mihai Bazon + + * calendar.js: fix for Safari (thanks to Olivier Chirouze / XPWeb) + +2004-02-22 Mihai Bazon + + * lang/calendar-al.js: Albanian language file + +2004-02-17 Mihai Bazon + + * lang/calendar-fr.js: fixed + + * lang/calendar-fr.js: + FR translation updated (thanks to SIMON Alexandre) + + * lang/calendar-es.js: ES translation updated, thanks to David Gonzales + +2004-02-10 Mihai Bazon + + * lang/calendar-pt.js: + updated Portugese translation, thanks to Elcio Ferreira + +2004-02-09 Mihai Bazon + + * TODO: updated + +2004-02-06 Mihai Bazon + + * README: describe the PHP files + + * make-release.pl: includes php files + + * make-release.pl: ChangeLog included in the distribution (if found) + + * calendar.js, doc/reference.tex, index.html: switched to version 0.9.6 + + * doc/Calendar.setup.tex, doc/reference.tex: updated documentation + + * release-notes.html: updated release notes + + * calendar.js: Fixed bug: Feb/29 and year change now keeps Feb in view + + * calendar.js: fixed the "ESC" problem (call the close handler) + + * calendar.js: fixed day of year range (1 to 366 instead of 0 to 365) + + * calendar.js: fixed week number calculations + + * doc/reference.tex: fixed (date input format) + + * calendar.php: removed comment + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js: + workaround for IE bug (you can't normally specify through CSS the style for + an element having two classes or more; we had to change a classname) + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + smaller fonts on days that are in neighbor months + +2004-02-04 Mihai Bazon + + * index.html: first demo shows the "showOtherMonths" capability + + * calendar-setup.js: support new parameters in the calendar. + added: firstDay, showOthers, cache. + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, lang/calendar-en.js, lang/calendar-ro.js: + new parameters: firstDayOfWeek, showsOtherMonths; removed mondayFirst. + This adds support for setting any day to be the first day of week (by just + clicking the day name in the display); also, if showsOtherMonths is enabled + then dates belonging to adjacent months that are in the current view will be + displayed and the calendar will have a fixed height. + + all themes updated. + + * test.php: test for calendar.php + + * calendar.php: fixed bug (pass numeric values as numbers) + +2004-02-01 Mihai Bazon + + * calendar.php: added PHP wrapper + + * img.gif: icon updated + + * TODO: updated TODO list + +2004-01-27 Mihai Bazon + + * calendar.js: + Janusz Piwowarski sent over a patch for IE5 compatibility which is much more + elegant than the atrocities that I had wrote :-D I'm gettin' old.. Thanks Janusz! + + * lang/calendar-fi.js: updated + +2004-01-15 Mihai Bazon + + * TODO: updated TODO list + + * calendar-setup.js: default align changed to "Br" + + * doc/reference.tex: changed default value for "align" + + * calendar-setup.js: calling onchange event handler, if available + + * calendar-setup.js: added "position" option + + * simple-1.html: demonstrates "step" option + + * calendar-setup.js: added "step" option + + * calendar.js: added yearStep config parameter + + * calendar.js: + fixed parseDate routine (the NaN bug which occurred when there was a space + after the date and no time) + +2004-01-14 Mihai Bazon + + * lang/calendar-en.js: added "Time:" + + * test-position.html: test for the new position algorithm + + * index.html: do not destroy() the calendar + avoid bug in parseDate (%p must be separated by non-word characters) + + * menuarrow2.gif: for calendar-blue2.css + + * calendar-setup.js: honor "date" parameter if passed + + * calendar.js: IE5 support is back + performance improvements in IE6 (mouseover combo boxes) + display "Time:" beside the clock area, if defined in the language file + new positioning algorithm (try to keep the calendar in page) + rewrote parseDate a little cleaner + + * lang/calendar-el.js: + updated Greek translation (thanks Alexandros Pappas) + +2004-01-13 Mihai Bazon + + * index.html: added style blue2, using utf-8 instead of iso-8859-2 + + * calendar.js: performance under IE (which sucks, by the way) + + * doc/reference.tex: Sunny added to sponsor list + + * doc/Calendar.setup.tex: documenting parameter 'electric' + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + fixed IE text size problems + +2004-01-08 Mihai Bazon + + * lang/calendar-pl.js: + Polish translation updated to UTF-8 (thanks to Artur Filipiak) + +2004-01-07 Mihai Bazon + + * lang/calendar-si.js: updated (David Milost) + + * lang/calendar-si.js: Slovenian translation (thanks to David Milost) + +2003-12-21 Mihai Bazon + + * TODO: updated TODO list + + * lang/calendar-de.js: German translation (thanks to Peter Strotmann) + +2003-12-19 Mihai Bazon + + * doc/reference.tex: Thank you, Ian Barrak + +2003-12-18 Mihai Bazon + + * doc/reference.tex: fixed documentation bug (thanks Mike) + +2003-12-05 Mihai Bazon + + * lang/calendar-ko-utf8.js: + UTF8 version of the Korean language (hopefully correct) + + * lang/calendar-pl-utf8.js, lang/calendar-pl.js: + updated Polish translation (thanks to Janusz Piwowarski) + +2003-12-04 Mihai Bazon + + * lang/calendar-fr.js: + French translation updated (thanks to Angiras Rama) + +2003-11-22 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Jesper M. Christensen) + +2003-11-20 Mihai Bazon + + * calendar-blue2.css, calendar-tas.css: + new styles (thanks to Wendall Mosemann for blue2, Mark Lynch for tas) + + * lang/calendar-lt-utf8.js, lang/calendar-lt.js: + Lithuanian translation (thanks to Martynas Majeris) + + * lang/calendar-sp.js: updated + +2003-11-17 Mihai Bazon + + * TODO: added TODO list + +2003-11-14 Mihai Bazon + + * lang/calendar-ko.js: Korean translation (thanks to Yourim Yi) + +2003-11-12 Mihai Bazon + + * lang/calendar-jp.js: small bug fixed (thanks to TAHARA Yusei) + +2003-11-10 Mihai Bazon + + * lang/calendar-fr.js: translation updated, thanks to Florent Ramiere + + * calendar-setup.js: + added new parameter: electric (if false then the field will not get updated on each move) + + * index.html: fixed DOCTYPE + +2003-11-07 Mihai Bazon + + * calendar-setup.js: + fixed minor problem (maybe we're passing object reference instead of ID for + the flat calendar parent) + +2003-11-06 Mihai Bazon + + * lang/calendar-fi.js: + added Finnish translation (thanks to Antti Tuppurainen) + +2003-11-05 Mihai Bazon + + * release-notes.html: fixed typo + + * doc/reference.tex, index.html, calendar.js: 0.9.5 + + * README: fixed license statement + + * release-notes.html: updated release notes (0.9.5) + +2003-11-03 Mihai Bazon + + * lang/calendar-de.js: + updated German translation (thanks to Gerhard Neiner) + + * calendar-setup.js: fixed license statement + + * calendar.js: whitespace + + * calendar.js: fixed license statement + + * calendar.js: + fixed positioning problem when input field is inside scrolled divs + +2003-11-01 Mihai Bazon + + * lang/calendar-af.js: Afrikaan language (thanks to Derick Olivier) + +2003-10-31 Mihai Bazon + + * lang/calendar-it.js: + updated IT translation (thanks to Christian Blaser) + + * lang/calendar-es.js: updated ES translation, thanks to Raul + +2003-10-30 Mihai Bazon + + * lang/calendar-hu.js: updated thanks to Istvan Karaszi + + * index.html, simple-1.html, simple-2.html, simple-3.html: + switched to utf-8 all encodings + + * lang/calendar-sk.js: + added Slovak translation (thanks to Peter Valach) + + * lang/calendar-ro.js: switched to utf-8 + +2003-10-29 Mihai Bazon + + * lang/calendar-es.js: + updated translation, thanks to Jose Ma. Martinez Miralles + + * doc/reference.tex: + fixed the footnote problem (thanks Dominique de Waleffe for the tip) + + * lang/calendar-ro.js: fixed typo + + * lang/calendar-sv.js: oops, license should be LGPL + + * lang/calendar-sw.js: new swedish translation is calendar-sv.js + + * menuarrow.gif, menuarrow.png: + oops, forgot little drop-down menu arrows + + * lang/calendar-sv.js: swedish translation thanks to Leonard Norrgard + + * index.html: oops, some other minor changes + + * index.html, release-notes.html: + latest changes in release-notes and index page for 0.9.4 + + * doc/reference.tex, calendar.js: + added %s date format (# of seconds since Epoch) + + * calendar.js: + A click on TODAY will not close the calendar, even in single-click mode + +2003-10-28 Mihai Bazon + + * index.html: previous cal.html + + * cal.html: moved to index.html + + * README, cal.html, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, release-notes.html: + LGPL license, forever. + + * doc/Calendar.setup.tex, simple-1.html: + doc updated for the onUpdate parameter to Calendar.setup + +2003-10-26 Mihai Bazon + + * calendar.js: fixed bug (correct display of the dropdown menus) + + * doc/Calendar.setup.tex, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-setup.js, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, release-notes.html, simple-1.html, simple-3.html: + lots of changes for the 0.9.4 release (see the release-notes.html) + +2003-10-15 Mihai Bazon + + * doc/reference.tex: + documentation updated for 0.9.4 (not yet finished though) + +2003-10-07 Mihai Bazon + + * calendar.js, doc/reference.tex, release-notes.html, README, cal.html, calendar-setup.js: + modified project website + +2003-10-06 Mihai Bazon + + * calendar-setup.js: + added some properties (onSelect, onClose, date) (thanks altblue) + +2003-09-24 Mihai Bazon + + * simple-3.html: dateIsSpecial does not need the "date" argument ;-) + +2003-09-24 fsoft + + * calendar.js, simple-3.html: + added year, month, day to getDateStatus() function + +2003-09-24 Mihai Bazon + + * simple-3.html: example on how to use special dates + + * calendar-setup.js, calendar.js, simple-1.html: + support for special dates (thanks fabio) + +2003-09-17 Mihai Bazon + + * doc/reference.tex: fixed error in section 3. + +2003-08-01 Mihai Bazon + + * lang/calendar-jp.js: added Japanese translation + +2003-07-16 Mihai Bazon + + * simple-1.html: fixed problem with first example [IE,Opera] + +2003-07-09 Mihai Bazon + + * doc/Calendar.setup.tex: fixed typo (closing parenthesis) + + * lang/calendar-de.js: + added German translation, thanks to Hartwig Weinkauf + +2003-07-08 Mihai Bazon + + * cal.html: added link to release-notes + + * release-notes.html: 0.9.3 release notes + + * make-release.pl: + Script to create distribution archive. It needs some additional packages: + + - LaTeX + - tex2page + - jscrunch (JS compressor) + + * doc/html/makedoc.sh, doc/html/reference.css, doc/reference.tex, doc/makedoc.sh: + documentation updates... + + * calendar.js: added semicolon to make the code "compressible" + +2003-07-06 Mihai Bazon + + * doc/reference.tex: spell checked + + * doc/reference.tex: [minor] changed credits order + + * doc/reference.tex: various improvements and additions + + * doc/html/reference.css: minor eye-candy tweaks + +2003-07-05 Mihai Bazon + + * doc/html/Calendar.setup.html.tex, doc/html/makedoc.sh, doc/html/reference.css, doc/html/reference.t2p, doc/hyperref.cfg, doc/makedoc.sh, doc/reference.tex, doc/Calendar.setup.tex, doc/Calendar.setup.pdf.tex: + full documentation in LaTeX, for PDF and HTML formats + + * simple-2.html: + added demonstration of flat calendar with Calendar.setup + + * simple-1.html: + modified some links, added link to documentation, added demonstration of + disableFunc property + + * calendar-setup.js: added the ability to create flat calendar too + + * cal.html: added links to documentation and simple-[12].html pages + + * README: up-to-date... + + * calendar-setup.html: removed: the documentation is unified + +2003-07-03 Mihai Bazon + + * cal.html: some links to newly added files + + * calendar-setup.html, calendar-setup.js, img.gif, simple-1.html: + added some files to simplify calendar creation for non-(JS)-programmers + + * lang/calendar-zh.js: added simplified chinese (thanks ATang) + +2003-07-02 Mihai Bazon + + * calendar.js: * "yy"-related... [small fix] + + * calendar.js: + * #721833 fixed (yy format will understand years prior to 29 as 20xx) + + * calendar.js: * added refresh() function + + * calendar.js: * fixed bug when in single click mode + * added alignment options to "showAtElement" member function + +2003-06-25 Mihai Bazon + + * lang/calendar-pt.js: + added portugese translation (thanks Nuno Barreto) + +2003-06-24 Mihai Bazon + + * calendar.js: + call user handler when the date was changed using the keyboard + + * bugtest-hidden-selects.html: + file to test bug with hidden select-s (thanks Ying Zhang for reporting and for this test file) + + * lang/calendar-hr-utf8.js: + added croatian translation in utf8 (thanks Krunoslav Zubrinic) + +2003-06-23 Mihai Bazon + + * lang/calendar-hu.js: added hungarian translation + + * lang/calendar-hr.js: + added croatian translation (thanks to Krunoslav Zubrinic) + +2003-06-22 Mihai Bazon + + * calendar.js: + * #723335 fixed (clicking TODAY will not select the today date if the + disabledHandler rejects it) + + * cal.html: * new code for to work with fix for bug #703238 + * switch to new version + + * calendar.js: + * some patches to make code compatible with Opera 7 (well, almost compatible) + * bug #703238 fixed (fix breaks compatibility with older code that uses + calendar in single-click mode) + * bug #703814 fixed + +2003-04-09 Mihai Bazon + + * lang/calendar-tr.js: added turkish lang file + +2003-03-19 Mihai Bazon + + * lang/calendar-ru.js: russian translation added + + * lang/calendar-no.js: norwegian translation added + +2003-03-15 Mihai Bazon + + * lang/calendar-no.js: norwegian translation + +2003-03-12 Mihai Bazon + + * lang/calendar-pl.js: added polish translation + +2003-03-11 Mihai Bazon + + * calendar.js: + bugfix in parseDate (added base to parseInt, thanks Alan!) + +2003-03-05 Mihai Bazon + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + New file. + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + New file. + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/README b/source/web/jsp/content/xforms/forms/scripts/jscalendar/README new file mode 100644 index 0000000000..455ab3d420 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/README @@ -0,0 +1,33 @@ +The DHTML Calendar +------------------- + + Author: Mihai Bazon, + http://dynarch.com/mishoo/ + + This program is free software published under the + terms of the GNU Lesser General Public License. + + For the entire license text please refer to + http://www.gnu.org/licenses/lgpl.html + +Contents +--------- + + calendar.js -- the main program file + lang/*.js -- internalization files + *.css -- color themes + cal.html -- example usage file + doc/ -- documentation, in PDF and HTML + simple-1.html -- quick setup examples [popup calendars] + simple-2.html -- quick setup example for flat calendar + calendar.php -- PHP wrapper + test.php -- test file for the PHP wrapper + +Homepage +--------- + + For details and latest versions please refer to calendar + homepage, located on my website: + + http://dynarch.com/mishoo/calendar.epl + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/bugtest-hidden-selects.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/bugtest-hidden-selects.html new file mode 100644 index 0000000000..900bc17e8b --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/bugtest-hidden-selects.html @@ -0,0 +1,108 @@ + + + +Bug + + + + + + + + + + + + + +
+Date: +
+ + +

+
+
Visible <select>, hides and unhides as expected +
+ + +

+
Hidden <select>, it should stay hidden (but doesn't) +
+ + +

+
Hidden textbox below, it stays hidden as expected +
+ +

+ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue.css new file mode 100644 index 0000000000..ca33cde007 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue.css @@ -0,0 +1,232 @@ +/* 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 containing navigation buttons */ + background: #778; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #bdf; +} + +.calendar thead .name { /* Cells 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 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 */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + 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 in footer (only one right now) */ + text-align: center; + background: #556; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue2.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue2.css new file mode 100644 index 0000000000..47128ecb0f --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-blue2.css @@ -0,0 +1,236 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #206A9B; + font-size: 11px; + color: #000; + cursor: default; + background: #F1F8FC; + 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: #007ED1 url(menuarrow2.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: #000; + color: #fff; + padding: 2px; +} + +.calendar thead tr { /* Row containing navigation buttons */ + background: #007ED1; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #C7E1F3; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #206A9B; + 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: #34ABFA; + color: #000; + border: 1px solid #016DC5; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #006AA9; + border: 1px solid #008AFF; + padding: 2px 0px 0px 2px; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells 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: #C7E1F3; +} + +.calendar tbody .rowhilite td { + background: #def; +} + +.calendar tbody .rowhilite td.wn { + background: #F1F8FC; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #8FC4E8; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + 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: #D50000; +} + +.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 in footer (only one right now) */ + text-align: center; + background: #206A9B; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #000; + color: #fff; + border-top: 1px solid #206A9B; + padding: 1px; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #B8DAF0; + border: 1px solid #178AEB; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #006AA9; + 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: #34ABFA; + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + font-weight: bold; +} + +.calendar .combo .active { + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + background: #F1F8FC; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #E3F0F9; +} + +.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: #F1F8FC; +} + +.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: #267DB7; + color: #fff; +} + +.calendar td.time span.active { + border-color: red; + background-color: #000; + color: #A5FF00; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-brown.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-brown.css new file mode 100644 index 0000000000..c42da5e0d9 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-brown.css @@ -0,0 +1,225 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + 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: #edc 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: #654; + color: #fed; + padding: 2px; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + background: #edc; + color: #000; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #faa; + color: #000; + border: 1px solid #f40; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + 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: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + 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: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.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 in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #840; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + 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: #ffe; + 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: #fc8; +} + +.calendar .combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + 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: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-green.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-green.css new file mode 100644 index 0000000000..e5bcf3af9c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-green.css @@ -0,0 +1,269 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { + position: relative; +} + +.calendar, .calendar table { + border: 1px solid #565; + font-size: 11px; + color: #000; + cursor: default; + /*background: #efe;*/ + background: rgb(240, 244, 234); + 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 */ +/*background: #676;*/ + background: #564; + + color: rgb(240, 244, 234); + font-size: 90%; +} + +.calendar .nav { + background: #564 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; + padding: 2px; + background: rgb( 188, 216, 132 ); + color: #564; +} + +.calendar thead .headrow { +/* Row containing navigation buttons */ +} + +.calendar thead .name { +/* Cells containing the day names */ + border-bottom: 1px solid #565; + padding: 2px; + text-align: center; + color: #000; + background: rgb( 218, 233, 187 ); +} + +.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: #afa;*/ + background-color: rgb(218, 233, 187); + color: #000; + border: 1px solid #084; + padding: 1px; +} + +.calendar thead .active { +/* Active (pressed) buttons in header */ + /*background-color: #7c7;*/ + color: #564; + background-color: rgb(218, 233, 187); + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { +/* Row containing the day names */ + background: #dfb; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { +/* Cells containing month days dates */ + width: 2em; + color: #564; + 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 #8a8; + /*background: #dfb;*/ + background:rgb(218, 233, 187); +} + +.calendar tbody .rowhilite td { + /*background: #dfd;*/ + background: rgb(218, 233, 187); +} + +.calendar tbody .rowhilite td.wn { + /*background: #efe;*/ + background:rgb(240, 244, 234); +} + +.calendar tbody td.hilite { +/* Hovered cells */ + background: #efd; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { +/* Active (pressed) cells */ + background: #dec; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { +/* Cell showing today date */ + font-weight: bold; + border: 1px solid #565; + padding: 1px 3px 1px 1px; + background: #f8fff8; + color: #565; +} + +.calendar tbody td.weekend { +/* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { + font-weight: bold; + color: #0a0; +} + +.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 in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { +/* Tooltip (status bar) cell */ + padding: 2px; + background: rgb(218, 233, 187); + color: #564; + border-top:solid 1px; +} + +.calendar tfoot .hilite { +/* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { +/* Active (pressed) style for buttons in footer */ + background: #7c7; + 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 #565; + background: #f8fff8; + 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: #af8;*/ + background: rgb(218, 233, 187); +} + +.calendar .combo .active { + border-top: 1px solid #6a4; + border-bottom: 1px solid #6a4; + background: rgb(218, 233, 187); + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #8a8; + padding: 1px 0px; + text-align: center; + background-color: #dfb; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #898; + 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: #686; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup.js new file mode 100644 index 0000000000..12fa06832e --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup.js @@ -0,0 +1,200 @@ +/* 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 2005/09/27 10:34:34 joernt 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup_stripped.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup_stripped.js new file mode 100644 index 0000000000..91c927f82e --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-setup_stripped.js @@ -0,0 +1,21 @@ +/* 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-system.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-system.css new file mode 100644 index 0000000000..b22488572e --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-system.css @@ -0,0 +1,251 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: ButtonFace; +} + +.calendar .nav { + background: ButtonFace url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: ActiveCaption; + color: CaptionText; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid ButtonShadow; + padding: 2px; + text-align: center; + background: ButtonFace; + color: ButtonText; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border: 2px solid; + padding: 0px; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + border-width: 1px; + padding: 2px 0px 0px 2px; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid ButtonShadow; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody .rowhilite td { + background: Highlight; + color: HighlightText; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + padding: 2px 2px 0px 2px; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody td.disabled { color: GrayText; } + +.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 in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: ButtonFace; + padding: 1px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + color: ButtonText; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: Menu; + color: MenuText; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + padding: 0px; + border: 1px solid #000; +} + +.calendar .combo .hilite { + background: Highlight; + color: HighlightText; +} + +.calendar td.time { + border-top: 1px solid ButtonShadow; + padding: 1px 0px; + text-align: center; + background-color: ButtonFace; +} + +.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: Menu; +} + +.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: Highlight; + color: HighlightText; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-tas.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-tas.css new file mode 100644 index 0000000000..c2f872168c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-tas.css @@ -0,0 +1,239 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + font-family: tahoma,verdana,sans-serif; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +/* 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 */ + color:#363636; +} + +.calendar .nav { + background: #edc 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: #654; + color: #363636; + padding: 2px; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#dddccc); +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + /*background: #3B86A0;*/ + color: #363636; + font-weight: bold; +filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0); +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #363636; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #ffcc86; + color: #000; + border: 1px solid #b59345; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; + +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + 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: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.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 in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; + +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #363636; + font-weight: bold; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC); +} +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #ffe; + color: #000; + font-size: smaller; + z-index: 100; +} + +.combo .label, +.combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.combo .label-IEfix { + width: 4em; +} + +.combo .hilite { + background: #fc8; +} + +.combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + 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: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-1.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-1.css new file mode 100644 index 0000000000..8c5d026657 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-1.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4f0e8; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4e0d8; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4c0b8; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4f0e8; +} + +.calendar tbody .rowhilite td { + background: #e4e0d8; +} + +.calendar tbody .rowhilite td.wn { + background: #d4d0c8; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4e0d8; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today 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 in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4f0e8; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4e0d8; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c4c0b8; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #fea; +} + +.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: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-2.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-2.css new file mode 100644 index 0000000000..6f37b7dcd7 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4e8f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4d8e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4b8c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4e8f0; +} + +.calendar tbody .rowhilite td { + background: #e4d8e0; +} + +.calendar tbody .rowhilite td.wn { + background: #d4c8d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4d8e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today 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 in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4e8f0; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4d8e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4d8e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #d4c8d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #408; + color: #fea; +} + +.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: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-1.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-1.css new file mode 100644 index 0000000000..fa5c093217 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-1.css @@ -0,0 +1,265 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f0f4; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e0e4; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c0c4; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border: 1px solid; + border-color: #fff #000 #000 #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; + background: #d8e0e4; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today 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 in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f0f4; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e0e4; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e0e4; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d0d4; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-2.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-2.css new file mode 100644 index 0000000000..8e930c8f4f --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar-win2k-cold-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f4f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e4e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c4c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #d8e4e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today 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 in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f4f0; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e4e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e4e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d4d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.js new file mode 100644 index 0000000000..b266155f80 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.js @@ -0,0 +1,1806 @@ +/* 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 2005/09/27 10:34:34 joernt 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 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 = "
" + text + "
"; + 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.php b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.php new file mode 100644 index 0000000000..5b9120d67c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar.php @@ -0,0 +1,119 @@ +calendar_file = 'calendar_stripped.js'; + $this->calendar_setup_file = 'calendar-setup_stripped.js'; + } else { + $this->calendar_file = 'calendar.js'; + $this->calendar_setup_file = 'calendar-setup.js'; + } + $this->calendar_lang_file = 'lang/calendar-' . $lang . '.js'; + $this->calendar_theme_file = $theme.'.css'; + $this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path); + $this->calendar_options = array('ifFormat' => '%Y/%m/%d', + 'daFormat' => '%Y/%m/%d'); + } + + function set_option($name, $value) { + $this->calendar_options[$name] = $value; + } + + function load_files() { + echo $this->get_load_files_code(); + } + + function get_load_files_code() { + $code = ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' ); + return $code; + } + + function _make_calendar($other_options = array()) { + $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options)); + $code = ( '' ); + return $code; + } + + function make_input_field($cal_options = array(), $field_attributes = array()) { + $id = $this->_gen_id(); + $attrstr = $this->_make_html_attr(array_merge($field_attributes, + array('id' => $this->_field_id($id), + 'type' => 'text'))); + echo ''; + echo '' . + ''; + + $options = array_merge($cal_options, + array('inputField' => $this->_field_id($id), + 'button' => $this->_trigger_id($id))); + echo $this->_make_calendar($options); + } + + /// PRIVATE SECTION + + function _field_id($id) { return 'f-calendar-field-' . $id; } + function _trigger_id($id) { return 'f-calendar-trigger-' . $id; } + function _gen_id() { static $id = 0; return ++$id; } + + function _make_js_hash($array) { + $jstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + if (is_bool($val)) + $val = $val ? 'true' : 'false'; + else if (!is_numeric($val)) + $val = '"'.$val.'"'; + if ($jstr) $jstr .= ','; + $jstr .= '"' . $key . '":' . $val; + } + return $jstr; + } + + function _make_html_attr($array) { + $attrstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + $attrstr .= $key . '="' . $val . '" '; + } + return $attrstr; + } +}; + +?> \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar_stripped.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar_stripped.js new file mode 100644 index 0000000000..4fe03f1ea9 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/calendar_stripped.js @@ -0,0 +1,14 @@ +/* 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 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=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="
"+text+"
";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;i0;--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(++ythis.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)||(CX2EY2)||(CY229)?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;i31&&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 + +How to include additional info in day cells + + + + + + + + +

How to include additional info in day cells

+ +
+ + + +

The idea is simple:

+ +
    +
  1. +

    Define a callback that takes two parameters like this:

    +
    function getDateText(date, d)
    +

    + This function will receive the date object as the first + parameter and the current date number (1..31) as the second (you + can get it as well by calling date.getDate() but since it's very + probably useful I thought I'd pass it too so that we can avoid a + function call). +

    +

    + This function must return the text to be inserted in + the cell of the passed date. That is, one should at least + "return d;". +

    +
  2. +
  3. + Pass the above function as the "dateText" parameter to + Calendar.setup. +
  4. +
+ +

+ The function could simply look like: +

+ +
  function getDateText(date, d) {
+    if (d == 12) {
+      return "12th";
+    } else if (d == 13) {
+      return "bad luck";
+    } /* ... etc ... */
+  }
+ +

+ but it's easy to imagine that this approach sucks. For a better + way, see the source of this page and note the usage of an externally + defined "dateText" object which maps "date" to "date info", also + taking into account the year and month. This object can be easily + generated from a database, and the getDateText function becomes + extremely simple (and static). +

+ +

+ Cheers! +

+ +
+
mishoo
+ Last modified: Sat Mar 5 17:18:06 EET 2005 + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/field-button.jpg b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/field-button.jpg new file mode 100644 index 0000000000..ecbe9d8d45 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/field-button.jpg differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference-Z-S.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference-Z-S.css new file mode 100644 index 0000000000..02a6f88f5a --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference-Z-S.css @@ -0,0 +1,193 @@ + + body { + color: black; + /* background-color: #e5e5e5;*/ + background-color: #ffffff; + /*background-color: beige;*/ + margin-top: 2em; + margin-left: 8%; + margin-right: 8%; + } + + h1,h2,h3,h4,h5,h6 { + margin-top: .5em; + } + + .title { + font-size: 200%; + font-weight: normal; + } + + .partheading { + font-size: 100%; + } + + .chapterheading { + font-size: 100%; + } + + .beginsection { + font-size: 110%; + } + + .tiny { + font-size: 40%; + } + + .scriptsize { + font-size: 60%; + } + + .footnotesize { + font-size: 75%; + } + + .small { + font-size: 90%; + } + + .normalsize { + font-size: 100%; + } + + .large { + font-size: 120%; + } + + .largecap { + font-size: 150%; + } + + .largeup { + font-size: 200%; + } + + .huge { + font-size: 300%; + } + + .hugecap { + font-size: 350%; + } + + pre { + margin-left: 2em; + } + + blockquote { + margin-left: 2em; + } + + ol { + list-style-type: decimal; + } + + ol ol { + list-style-type: lower-alpha; + } + + ol ol ol { + list-style-type: lower-roman; + } + + ol ol ol ol { + list-style-type: upper-alpha; + } + + /* + .verbatim { + color: #4d0000; + } + */ + + tt i { + font-family: serif; + } + + .verbatim em { + font-family: serif; + } + + .scheme em { + font-family: serif; + color: black; + } + + .scheme { + color: brown; + } + + .scheme .keyword { + color: #990000; + font-weight: bold; + } + + .scheme .builtin { + color: #990000; + } + + .scheme .variable { + color: navy; + } + + .scheme .global { + color: purple; + } + + .scheme .selfeval { + color: green; + } + + .scheme .comment { + color: teal; + } + + .schemeresponse { + color: green; + } + + .navigation { + color: red; + text-align: right; + font-size: medium; + font-style: italic; + } + + .disable { + /* color: #e5e5e5; */ + color: gray; + } + + .smallcaps { + font-size: 75%; + } + + .smallprint { + color: gray; + font-size: 75%; + text-align: right; + } + + /* + .smallprint hr { + text-align: left; + width: 40%; + } + */ + + .footnoterule { + text-align: left; + width: 40%; + } + + .colophon { + color: gray; + font-size: 80%; + text-align: right; + } + + .colophon a { + color: gray; + } + + \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.css new file mode 100644 index 0000000000..42e9283536 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.css @@ -0,0 +1,34 @@ +html { margin: 0px; padding: 0px; background-color: #08f; color: #444; font-family: georgia,serif; } +body { margin: 2em 8%; background-color: #fff; padding: 1em; border: 2px ridge #048; } + +a:link, a:visited { text-decoration: none; color: #00f; } +a:hover { color: #f00; text-decoration: underline; } +a:active { color: #f84; } + +h1, h2, h3, h4, h5, h6 { font-family: tahoma,verdana,sans-serif; } + +h2, h3 { font-weight: normal; } + +h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { text-decoration: none; } + +h1 { font-size: 170%; border: 2px ridge #048; letter-spacing: 2px; color: #000; margin-left: -2em; margin-right: -2em; +background-color: #fff; padding: 2px 1em; background-color: #def; } +h2 { font-size: 140%; color: #222; } +h3 { font-size: 120%; color: #444; } + +h1.title { font-size: 300%; font-family: georgia,serif; font-weight: normal; color: #846; letter-spacing: -1px; +border: none; +padding: none; +background-color: #fff; +border-bottom: 3px double #624; padding-bottom: 2px; margin-left: 8%; margin-right: 8%; } + +.colophon { padding-top: 2em; color: #999; font-size: 90%; font-family: georgia,"times new roman",serif; } +.colophon a:link, .colophon a:visited { color: #755; } +.colophon a:hover { color: #422; text-decoration: underline; } + +.footnote { font-size: 90%; font-style: italic; font-family: georgia,"times new roman",serif; margin: 0px 3em; } +.footnote sup { font-size: 120%; padding: 0px 0.3em; position: relative; top: -0.2em; } + +.small { font-size: 90%; } + +.verbatim { background-color: #eee; padding: 0.2em 1em; border: 1px solid #aaa; } diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.html new file mode 100644 index 0000000000..9604866f33 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/html/reference.html @@ -0,0 +1,1738 @@ + + + + + +DHTML Calendar Widget + + + + + + +

+

+

+

+

+

+

+

+

+

+

+

+

+ + + + +

+

+ + +

+

+

+

+

+



DHTML Calendar Widget

+

+
+Mihai Bazon, <mihai_bazon@yahoo.com>
+© Dynarch.com 2002-2005, www.dynarch.com

March 7, 2005

+

+

+calendar version: 1.0 ``It is happening again'' +

+
+

+

+$Id: reference.html,v 1.1 2005/09/27 10:34:33 joernt Exp $ +

+
+
+ +
+ +
+ +

Contents

+

+

+    1  Overview
+        1.1  How does this thing work?
+        1.2  Project files
+        1.3  License
+

+

+    2  Quick startup
+        2.1  Installing a popup calendar
+        2.2  Installing a flat calendar
+        2.3  Calendar.setup in detail
+

+

+    3  Recipes
+        3.1  Popup calendars
+            3.1.1  Simple text field with calendar attached to a button
+            3.1.2  Simple field with calendar attached to an image
+            3.1.3  Hidden field, plain text triggers
+            3.1.4  2 Linked fields, no trigger buttons
+        3.2  Flat calendars
+        3.3  Highlight special dates
+        3.4  Select multiple dates
+

+

+    4  The Calendar object overview
+        4.1  Creating a calendar
+        4.2  Order does matter ;-)
+        4.3  Caching the object
+        4.4  Callback functions
+

+

+    5  The Calendar object API reference
+        5.1  Calendar constructor
+        5.2  Useful member variables (properties)
+        5.3  Public methods
+            5.3.1  Calendar.create
+            5.3.2  Calendar.callHandler
+            5.3.3  Calendar.callCloseHandler
+            5.3.4  Calendar.hide
+            5.3.5  Calendar.setDateFormat
+            5.3.6  Calendar.setTtDateFormat
+            5.3.7  Calendar.setDisabledHandler
+            5.3.8  Calendar.setDateStatusHandler
+            5.3.9  Calendar.show
+            5.3.10  Calendar.showAt
+            5.3.11  Calendar.showAtElement
+            5.3.12  Calendar.setDate
+            5.3.13  Calendar.setFirstDayOfWeek
+            5.3.14  Calendar.parseDate
+            5.3.15  Calendar.setRange
+

+

+    6  Side effects
+

+

+    7  Credits
+

+

+

+

+

+ +

1  Overview

+

The DHTML Calendar widget1 +is an (HTML) user interface element that gives end-users a friendly way to +select date and time. It works in a web browser. The first versions only provided +support for popup calendars, while starting with version 0.9 it also supports +``flat'' display. A ``flat'' calendar is a calendar that stays visible in the +page all the time. In this mode it could be very useful for ``blog'' pages and +other pages that require the calendar to be always present.

+

+The calendar is compatible with most popular browsers nowadays. While it's +created using web standards and it should generally work with any compliant +browser, the following browsers were found to work: Mozilla/Firefox (the +development platform), Netscape 6.0 or better, all other Gecko-based browsers, +Internet Explorer 5.0 or better for Windows2, Opera 73, Konqueror 3.1.2 and Apple Safari for +MacOSX.

+

+You can find the latest info and version at the calendar homepage:

+

+

+ +

+

+ +

1.1  How does this thing work?

+

DHTML is not ``another kind of HTML''. It's merely a naming convention. DHTML +refers to the combination of HTML, CSS, JavaScript and DOM. DOM (Document +Object Model) is a set of interfaces that glues the other three together. In +other words, DOM allows dynamic modification of an HTML page through a program. +JavaScript is our programming language, since that's what browsers like. CSS +is a way to make it look good ;-). So all this soup is generically known as +DHTML.

+

+Using DOM calls, the program dynamically creates a <table> element +that contains a calendar for the given date and then inserts it in the document +body. Then it shows this table at a specified position. Usually the position +is related to some element in which the date needs to be displayed/entered, +such as an input field.

+

+By assigning a certain CSS class to the table we can control the look of the +calendar through an external CSS file; therefore, in order to change the +colors, backgrounds, rollover effects and other stuff, you can only change a +CSS file -- modification of the program itself is not necessary.

+

+

+ +

1.2  Project files

+

Here's a description of the project files, excluding documentation and example +files.

+

+

+

    +

    +
  • the main program file (calendar.js). This defines all the logic +behind the calendar widget.

    +

    +

    +
  • the CSS files (calendar-*.css). Loading one of them is +necessary in order to see the calendar as intended.

    +

    +

    +
  • the language definition files (lang/calendar-*.js). They are +plain JavaScript files that contain all texts that are displayed by the +calendar. Loading one of them is necessary.

    +

    +

    +
  • helper functions for quick setup of the calendar +(calendar-setup.js). You can do fine without it, but starting with +version 0.9.3 this is the recommended way to setup a calendar.

    +

    +

    +

+

+

+ +

1.3  License

+

+
+ +© Dynarch.com 2002-2005, +www.dynarch.com +Author: Mihai Bazon +
+

+The calendar is released under the +GNU Lesser General Public License.

+

+

+ +

2  Quick startup

+

+

+Installing the calendar used to be quite a task until version 0.9.3. Starting +with 0.9.3 I have included the file calendar-setup.js whose goal is to +assist you to setup a popup or flat calendar in minutes. You are +encouraged to modify this file and not calendar.js if you need +extra customization, but you're on your own.

+

+First you have to include the needed scripts and style-sheet. Make sure you do +this in your document's <head> section, also make sure you put the +correct paths to the scripts.

+

+

+
<style type="text/css">@import url(calendar-win2k-1.css);</style>
+<script type="text/javascript" src="calendar.js"></script>
+<script type="text/javascript" src="lang/calendar-en.js"></script>
+<script type="text/javascript" src="calendar-setup.js"></script>
+

+

+

+ +

2.1  Installing a popup calendar

+

+

+Now suppose you have the following HTML:

+

+

+
<form ...>
+  <input type="text" id="data" name="data" />
+  <button id="trigger">...</button>
+</form>
+

+

+You want the button to popup a calendar widget when clicked? Just +insert the following code immediately after the HTML form:

+

+

+
<script type="text/javascript">
+  Calendar.setup(
+    {
+      inputField  : "data",         // ID of the input field
+      ifFormat    : "%m %d, %Y",    // the date format
+      button      : "trigger"       // ID of the button
+    }
+  );
+</script>
+

+

+The Calendar.setup function, defined in calendar-setup.js +takes care of ``patching'' the button to display a calendar when clicked. The +calendar is by default in single-click mode and linked with the given input +field, so that when the end-user selects a date it will update the input field +with the date in the given format and close the calendar. If you are a +long-term user of the calendar you probably remember that for doing this you +needed to write a couple functions and add an ``onclick'' handler for the +button by hand.

+

+By looking at the example above we can see that the function +Calendar.setup receives only one parameter: a JavaScript object. +Further, that object can have lots of properties that tell to the setup +function how would we like to have the calendar. For instance, if we would +like a calendar that closes at double-click instead of single-click we would +also include the following: singleClick:false.

+

+For a list of all supported parameters please see the section +2.3.

+

+

+ +

2.2  Installing a flat calendar

+

+

+Here's how to configure a flat calendar, using the same Calendar.setup +function. First, you should have an empty element with an ID. This element +will act as a container for the calendar. It can be any block-level element, +such as DIV, TABLE, etc. We will use a DIV in this example.

+

+

+
<div id="calendar-container"></div>
+

+

+Then there is the JavaScript code that sets up the calendar into the +``calendar-container'' DIV. The code can occur anywhere in HTML +after the DIV element.

+

+

+
<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

2.3  Calendar.setup in detail

+

+

+Following there is the complete list of properties interpreted by +Calendar.setup. All of them have default values, so you can pass only those +which you would like to customize. Anyway, you must pass at least one +of inputField, displayArea or button, for a popup +calendar, or flat for a flat calendar. Otherwise you will get a +warning message saying that there's nothing to setup.

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
property type description default +
inputField +string The ID of your input field. +null +
displayArea +string This is the ID of a <span>, <div>, or any other element that you would like to use to display the current date. This is generally useful only if the input field is hidden, as an area to display the date. +null +
button +string The ID of the calendar ``trigger''. This is an element (ordinarily a button or an image) that will dispatch a certain event (usually ``click'') to the function that creates and displays the calendar. +null +
eventName +string The name of the event that will trigger the calendar. The name should be without the ``on'' prefix, such as ``click'' instead of ``onclick''. Virtually all users will want to let this have the default value (``click''). Anyway, it could be useful if, say, you want the calendar to appear when the input field is focused and have no trigger button (in this case use ``focus'' as the event name). +``click'' +
ifFormat +string The format string that will be used to enter the date in the input field. This format will be honored even if the input field is hidden. +``%Y/%m/%d'' +
daFormat +string Format of the date displayed in the displayArea (if specified). +``%Y/%m/%d'' +
singleClick +boolean Wether the calendar is in ``single-click mode'' or ``double-click mode''. If true (the default) the calendar will be created in single-click mode. +true +
disableFunc +function A function that receives a JS Date object. It should return +true if that date has to be disabled, false otherwise. +DEPRECATED (see below). +null +
dateStatusFunc +function A function that receives a JS Date object and returns a boolean +or a string. This function allows one to set a certain CSS class to some +date, therefore making it look different. If it returns true then +the date will be disabled. If it returns false nothing special +happens with the given date. If it returns a string then that will be taken +as a CSS class and appended to the date element. If this string is +``disabled'' then the date is also disabled (therefore is like returning +true). For more information please also refer to section +5.3.8. +null +
firstDay +integer Specifies which day is to be displayed as the first day of +week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6 +means Saturday. The end user can easily change this too, by clicking on the +day name in the calendar header. +0 +
weekNumbers +boolean If ``true'' then the calendar will display week numbers. +true +
align +string Alignment of the calendar, relative to the reference element. The +reference element is dynamically chosen like this: if a displayArea is +specified then it will be the reference element. Otherwise, the input field +is the reference element. For the meaning of the alignment characters +please section 5.3.11. +``Bl'' +
range +array An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow. +[1900, 2999] +
flat +string If you want a flat calendar, pass the ID of the parent object in +this property. If not, pass null here (or nothing at all as +null is the default value). +null +
flatCallback +function You should provide this function if the calendar is flat. It +will be called when the date in the calendar is changed with a reference to +the calendar object. See section 2.2 for an example +of how to setup a flat calendar. +null +
onSelect +function If you provide a function handler here then you have to manage +the ``click-on-date'' event by yourself. Look in the calendar-setup.js and +take as an example the onSelect handler that you can see there. +null +
onClose +function This handler will be called when the calendar needs to close. +You don't need to provide one, but if you do it's your responsibility to +hide/destroy the calendar. You're on your own. Check the calendar-setup.js +file for an example. +null +
onUpdate +function If you supply a function handler here, it will be called right +after the target field is updated with a new date. You can use this to +chain 2 calendars, for instance to setup a default date in the second just +after a date was selected in the first. +null +
date +date This allows you to setup an initial date where the calendar will be +positioned to. If absent then the calendar will open to the today date. +null +
showsTime +boolean If this is set to true then the calendar will also +allow time selection. +false +
timeFormat +string Set this to ``12'' or ``24'' to configure the way that the +calendar will display time. +``24'' +
electric +boolean Set this to ``false'' if you want the calendar to update the +field only when closed (by default it updates the field at each date change, +even if the calendar is not closed) true +
position +array Specifies the [x, y] position, relative to page's top-left corner, +where the calendar will be displayed. If not passed then the position will +be computed based on the ``align'' parameter. Defaults to ``null'' (not +used). null +
cache +boolean Set this to ``true'' if you want to cache the calendar object. +This means that a single calendar object will be used for all fields that +require a popup calendar false +
showOthers +boolean If set to ``true'' then days belonging to months overlapping +with the currently displayed month will also be displayed in the calendar +(but in a ``faded-out'' color) false + +
+ +

+

+ +

3  Recipes

+

This section presents some common ways to setup a calendar using the +Calendar.setup function detailed in the previous section.

+

+We don't discuss here about loading the JS or CSS code -- so make sure you +add the proper <script> and <style> or <link> elements in your +HTML code. Also, when we present input fields, please note that they should +be embedded in some form in order for data to be actually sent to server; we +don't discuss these things here because they are not related to our +calendar.

+

+

+ +

3.1  Popup calendars

+

These samples can be found in the file “simple-1.html†from the +calendar package.

+

+

+ +

3.1.1  Simple text field with calendar attached to a button

+

+

+This piece of code will create a calendar for a simple input field with a +button that will open the calendar when clicked.

+

+

+
<input type="text" name="date" id="f_date_b"
+       /><button type="reset" id="f_trigger_b"
+       >...</button>
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_b",           //*
+        ifFormat       :    "%m/%d/%Y %I:%M %p",
+        showsTime      :    true,
+        button         :    "f_trigger_b",        //*
+        step           :    1
+    });
+</script>
+

+

+Note that this code does more actually; the only required fields are +those marked with “//*†-- that is, the ID of the input field and the ID of +the button need to be passed to Calendar.setup in order for the +calendar to be properly assigned to this input field. As one can easily +guess from the argument names, the other arguments configure a certain date +format, instruct the calendar to also include a time selector and display +every year in the drop-down boxes (the “step†parameter) -- instead of showing +every other year as the default calendar does.

+

+

+ +

3.1.2  Simple field with calendar attached to an image

+

Same as the above, but the element that triggers the calendar is this time +an image, not a button.

+

+

+
<input type="text" name="date" id="f_date_c" readonly="1" />
+<img src="img.gif" id="f_trigger_c"
+     style="cursor: pointer; border: 1px solid red;"
+     title="Date selector"
+     onmouseover="this.style.background='red';"
+     onmouseout="this.style.background=''" />
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_c",
+        ifFormat       :    "%B %e, %Y",
+        button         :    "f_trigger_c",
+        align          :    "Tl",
+        singleClick    :    false
+    });
+</script>
+

+

+Note that the same 2 parameters are required as in the previous case; the +difference is that the 'button' parameter now gets the ID of the image +instead of the ID of the button. But the event is the same: at 'onclick' on +the element that is passed as 'button', the calendar will be shown.

+

+The above code additionally sets an alignment mode -- the parameters are +described in 5.3.11.

+

+

+ +

3.1.3  Hidden field, plain text triggers

+

Sometimes, to assure that the date is well formatted, you might want not to +allow the end user to write a date manually. This can easily be achieved +with an input field by setting its readonly attribute, which is +defined by the HTML4 standard; however, here's an even nicer approach: our +calendar widget allows you to use a hidden field as the way to pass data to +server, and a “display area†to show the end user the selected date. The +“display area†can be any HTML element, such as a DIV or a SPAN or +whatever -- we will use a SPAN in our sample.

+

+

+
<input type="hidden" name="date" id="f_date_d" />
+
+<p>Your birthday:
+   <span style="background-color: #ff8; cursor: default;"
+         onmouseover="this.style.backgroundColor='#ff0';"
+         onmouseout="this.style.backgroundColor='#ff8';"
+         id="show_d"
+   >Click to open date selector</span>.</p>
+
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_d",
+        ifFormat       :    "%Y/%d/%m",
+        displayArea    :    "show_d",
+        daFormat       :    "%A, %B %d, %Y",
+    });
+</script>
+

+

+The above code will configure a calendar attached to the hidden field and to +the SPAN having the id=“show_dâ€. When the SPAN element is clicked, the +calendar opens and allows the end user to chose a date. When the date is +chosen, the input field will be updated with the value in the format +“%Y/%d/%mâ€, and the SPAN element will display the date in a +friendlier format (defined by “daFormatâ€).

+

+Beware that using this approach will make your page unfunctional in browsers +that do not support JavaScript or our calendar.

+

+

+ +

3.1.4  2 Linked fields, no trigger buttons

+

Supposing you want to create 2 fields that hold an interval of exactly one +week. The first is the starting date, and the second is the ending date. +You want the fields to be automatically updated when some date is clicked in +one or the other, in order to keep exactly one week difference between them.

+

+

+
<input type="text" name="date" id="f_date_a" />
+<input type="text" name="date" id="f_calcdate" />
+
+<script type="text/javascript">
+    function catcalc(cal) {
+        var date = cal.date;
+        var time = date.getTime()
+        // use the _other_ field
+        var field = document.getElementById("f_calcdate");
+        if (field == cal.params.inputField) {
+            field = document.getElementById("f_date_a");
+            time -= Date.WEEK; // substract one week
+        } else {
+            time += Date.WEEK; // add one week
+        }
+        var date2 = new Date(time);
+        field.value = date2.print("%Y-%m-%d %H:%M");
+    }
+    Calendar.setup({
+        inputField     :    "f_date_a",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+    Calendar.setup({
+        inputField     :    "f_calcdate",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+</script>
+

+

+The above code will configure 2 input fields with calendars attached, as +usual. The first thing to note is that there's no trigger button -- in such +case, the calendar will popup when one clicks into the input field. Using +the onUpdate parameter, we pass a reference to a function of ours +that will get called after a date was selected. In that function we +determine what field was updated and we compute the date in the other input +field such that it keeps a one week difference between the two. Enjoy! :-)

+

+

+ +

3.2  Flat calendars

+

This sample can be found in “simple-2.htmlâ€. It will configure a +flat calendar that is always displayed in the page, in the DIV having the +id=“calendar-containerâ€. When a date is clicked our function hander gets +called (dateChanged) and it will compute an URL to jump to based on +the selected date, then use window.location to visit the new link.

+

+

+
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

3.3  Highlight special dates

+

So you want to display certain dates in a different color, or with bold +font, or whatever, right? Well, no problem -- our calendar can do this as +well. It doesn't matter if it's a flat or popup calendar -- we'll use a flat +one for this sample. The idea, however, is that you need to have the dates +in an array or a JavaScript object -- whatever is suitable for your way of +thinking -- and use it from a function that returns a value, telling the +calendar what kind of date is the passed one.

+

+Too much talking, here's the code ;-)

+

+

+
<!-- this goes into the <head> tag -->
+<style type="text/css">
+  .special { background-color: #000; color: #fff; }
+</style>
+
+<!-- and the rest inside the <body> -->
+<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],		// special days in January
+    2 : [ 1, 6, 8, 12, 18 ],	// special days in March
+    8 : [ 21, 11 ]		// special days in September
+  };
+
+  function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+  };
+
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  function ourDateStatusFunc(date, y, m, d) {
+    if (dateIsSpecial(y, m, d))
+      return "special";
+    else
+      return false; // other dates are enabled
+      // return true if you want to disable other dates
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged,          // our callback function
+      dateStatusFunc : ourDateStatusFunc
+    }
+  );
+</script>
+

+

+So the above code creates a normal flat calendar, like in the previous +sample. We hook into it with the function “ourDateStatusFuncâ€, +which receives a date object as the first argument, and also the year, +month, date as the next 3 arguments (normally, you can extract year, month, +date from the first parameter too, but we pass them separately for +convenience, as it's very likely that they are going to be used in this +function).

+

+So, this function receives a date. It can return false if you want +no special action to be taken on that date, true if that date +should be disabled (unselectable), or a string if you want to assign a +special CSS class to that date. We return “special†for the dates that we +want to highlight -- and note that we defined a “special†look for them in +the CSS section.

+

+I used a simple approach here to define what dates are special. There's a +JavaScript object (the SPECIAL_DAYS global variable) which holds an array +of dates for each month. Month numbers start at zero (January). Months +that don't contain special dates can be absent from this object. Note that +the way to implement this is completely separated from the calendar +code -- therefore, feel free to use your imagination if you have better +ideas. :-)

+

+

+ +

3.4  Select multiple dates

+

Starting version 1.0, the calendar is able to handle multiple dates +selection. You just need to pass the “multiple†parameter to +Calendar.setup and add some special code that interprets the +selection once the calendar is closed.

+

+

+
<a id="trigger" href="#">[open calendar...]</a>
+<div id="output"></div>
+<script type="text/javascript">//<![CDATA[
+    // the default multiple dates selected,
+    // first time the calendar is displayed
+    var MA = [];
+
+    function closed(cal) {
+
+      // here we'll write the output; this is only for example.  You
+      // will normally fill an input field or something with the dates.
+      var el = document.getElementById("output");
+
+      // reset initial content.
+      el.innerHTML = "";
+
+      // Reset the "MA", in case one triggers the calendar again.
+      // CAREFUL!  You don't want to do "MA = [];".  We need to modify
+      // the value of the current array, instead of creating a new one.
+      // Calendar.setup is called only once! :-)  So be careful.
+      MA.length = 0;
+
+      // walk the calendar's multiple dates selection hash
+      for (var i in cal.multiple) {
+        var d = cal.multiple[i];
+        // sometimes the date is not actually selected,
+        // so let's check
+        if (d) {
+          // OK, selected.  Fill an input field or something.
+          el.innerHTML += d.print("%A, %Y %B %d") + "<br />";
+          // and push it in the "MA", in case one triggers the calendar again.
+          MA[MA.length] = d;
+        }
+      }
+      cal.hide();
+      return true;
+    };
+
+    Calendar.setup({
+      align      : "BR",
+      showOthers : true,
+      multiple   : MA, // pass the initial or computed array of multiple dates
+      onClose    : closed,
+      button     : "trigger"
+    });
+//]]></script>
+

+

+The above code creates a popup calendar and passes to it an array of dates, +which is initially empty, in the “multiple†argument. When the calendar is +closed it will call our “closed†function handler; in this handler +we determine what dates were actually selected, inspecting the +“cal.multiple†property, we display them in a DIV element right +next to the <a> element that opens the calendar, and we reinitialize the +global array of selected dates (which will be used if the end user opens the +calendar again). I guess the code speaks for itself, right? :-)

+

+

+ +

4  The Calendar object overview

+

+

+Basically you should be able to setup the calendar with the function presented +in the previous section. However, if for some reason Calendar.setup +doesn't provide all the functionality that you need and you want to tweak into +the process of creating and configuring the calendar ``by hand'', then this +section is the way to go.

+

+The file calendar.js implements the functionality of the calendar. +All (well, almost all) functions and variables are embedded in the JavaScript +object ``Calendar''.

+

+You can instantiate a Calendar object by calling the constructor, like +this: var cal = new Calendar(...). We will discuss the parameters +later. After creating the object, the variable cal will contain a +reference to it. You can use this reference to access further options of the +calendar, for instance:

+

+

+
cal.weekNumbers = false; // do not display week numbers
+cal.showsTime = true;    // include a time selector
+cal.setDateFormat("%Y.%m.%d %H:%M"); // set this format: 2003.12.31 23:59
+cal.setDisabledHandler(function(date, year, month, day) {
+  // verify date and return true if it has to be disabled
+  // ``date'' is a JS Date object, but if you only need the
+  // year, month and/or day you can get them separately as
+  // next 3 parameters, as you can see in the declaration
+  if (year == 2004) {
+    // disable all dates from 2004
+    return true;
+  }
+  return false;
+});
+

+

+etc. Prior to version +0.9.3 this was the only way to configure it. The Calendar.setup +function, documented in section 2, basically does the same +things (actually more) in order to setup the calendar, based on the parameters +that you provided.

+

+

+ +

4.1  Creating a calendar

+

The calendar is created by following some steps (even the function +Calendar.setup, described in section 2, does the +same). While you can skip optional (marked ``opt'') steps if you're happy with +the defaults, please respect the order below.

+

+

+

    +

    +
  1. Instantiate a Calendar object. Details about this in +section 5.1.

    +

    +

    +
  2. opt   Set the weekNumbers property to false if you don't want +the calendar to display week numbers.

    +

    +

    +
  3. opt   Set the showsTime property to true if you +want the calendar to also provide a time selector.

    +

    +

    +
  4. opt   Set the time24 property to false if you want +the time selector to be in 12-hour format. Default is 24-hour format. This +property only has effect if you also set showsTime to +true.

    +

    +

    +
  5. opt   Set the range of years available for selection (see section +5.3.15). The default range is [1970..2050].

    +

    +

    +
  6. opt   Set the getDateStatus property. You should pass +here a function that receives a JavaScript Date object and returns +true if the given date should be disabled, false otherwise (details in +section 5.3.7).

    +

    +

    +
  7. opt   Set a date format. Your handler function, passed to the +calendar constructor, will be called when a date is selected with a reference +to the calendar and a date string in this format.

    +

    +

    +
  8. Create the HTML elements related to the calendar. This step +practically puts the calendar in your HTML page. You simply call +Calendar.create(). You can give an optional parameter if you wanna +create a flat calendar (details in section 5.3.1).

    +

    +

    +
  9. opt   Initialize the calendar to a certain date, for instance from +the input field.

    +

    +

    +
  10. Show the calendar (details in section 5.3.9).

    +

    +

    +

+

+

+ +

4.2  Order does matter ;-)

+

As you could see in the previous section, there are more steps to be followed +in order to setup the calendar. This happens because there are two different +things that need to be accomplished: first there is the JavaScript object, that +is created with new Calendar(...). Secondly there are the HTML +elements that actually lets you see and manipulate the calendar.

+

+

+[ Those that did UI4 programming, no matter in what +language and on what platform, may be familiar with this concept. First there +is the object in memory that lets you manipulate the UI element, and secondly +there is the UI element (known as ``control'', ``window'', ``widget'', etc.), +also in memory but you don't usually access it directly. ] +

+By instantiating the calendar we create the JavaScript object. It lets us +configure some properties and it also knows how to create the UI element (the +HTML elements actually) that will eventually be what the end-user sees on +screen. Creation of the HTML element is accomplished by the function +Calendar.create. It knows how to create popup or flat calendars. +This function is described in section 5.3.1.

+

+Some properties need to be set prior to creating the HTML elements, because +otherwise they wouldn't have any effect. Such a property is +weekNumbers -- it has the default value ``true'', and if you don't +want the calendar to display the week numbers you have to set it to false. If, +however, you do that after calling Calendar.create the calendar +would still display the week numbers, because the HTML elements are already +created (including the <td>-s in the <table> element that +should contain the week numbers). For this reason the order of the steps above +is important.

+

+Another example is when you want to show the calendar. The ``create'' function +does create the HTML elements, but they are initially hidden (have the style +``display: none'') unless the calendar is a flat calendar that should be always +visible in the page. Obviously, the Calendar.show function should be +called after calling Calendar.create.

+

+

+ +

4.3  Caching the object

+

Suppose the end-user has popped up a calendar and selects a date. The calendar +then closes. What really happens now?

+

+There are two approaches. The first (used in very old versions of the +calendar) was to drop completely the Calendar object and when the end-user pops +up the calendar again to create another one. This approach is bad for more +reasons:

+

+

+

    +

    +
  • creating the JavaScript object and HTML elements is time-consuming

    +

    +

    +
  • we may loose some end-user preferences (i.e. he might prefer to have +Monday for the first day of week and probably already clicked it the first time +when the calendar was opened, but now he has to do it again)

    +

    +

    +

+

+The second approach, implemented by the Calendar.setup function, is to +cache the JavaScript object. It does this by checking the global variable +window.calendar and if it is not null it assumes it is the created +Calendar object. When the end-user closes the calendar, our code will only +call ``hide'' on it, therefore keeping the JavaScript object and the +HTML elements in place.

+

+CAVEAT:     Since time selection support was introduced, this +``object caching'' mechanism has the following drawback: if you once created +the calendar with the time selection support, then other items that may not +require this functionality will still get a calendar with the time selection +support enabled. And reciprocal. ;-) Hopefully this will be corrected in a +later version, but for now it doesn't seem such a big problem.

+

+

+ +

4.4  Callback functions

+

You might rightfully wonder how is the calendar related to the input field? +Who tells it that it has to update that input field when a date is +selected, or that it has to jump to that URL when a date is clicked in +flat mode?

+

+All this magic is done through callback functions. The calendar doesn't know +anything about the existence of an input field, nor does it know where to +redirect the browser when a date is clicked in flat mode. It just calls your +callback when a particular event is happening, and you're responsible to handle +it from there. For a general purpose library I think this is the best model of +making a truly reusable thing.

+

+The calendar supports the following user callbacks:

+

+

+

    +

    +
  • onSelect   -- this gets called when the end-user changes the date in the +calendar. Documented in section 5.1.

    +

    +

    +
  • onClose   -- this gets called when the calendar should close. It's +user's responsibility to close the calendar. Details in section +5.1.

    +

    +

    +
  • getDateStatus   -- this function gets called for any day in a month, +just before displaying the month. It is called with a JavaScript Date +object and should return true if that date should be disabled, false +if it's an ordinary date and no action should be taken, or it can return a +string in which case the returned value will be appended to the element's CSS +class (this way it provides a powerful way to make some dates ``special'', +i.e. highlight them differently). Details in section +5.3.8.

    +

    +

    +

+

+

+ +

5  The Calendar object API reference

+

+

+

+ +

5.1  Calendar constructor

+

+

+Synopsis:

+

+

+
var calendar = Calendar(firstDayOfWeek, date, onSelect, onClose);
+

+

+Parameters are as follows:

+

+

+

    +

    +
  • firstDayOfWeek   -- specifies which day is to be displayed as the first +day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, +..., 6 means Saturday.

    +

    +

    +
  • date   -- a JavaScript Date object or null. If null +is passed then the calendar will default to today date. Otherwise it will +initialize on the given date.

    +

    +

    +
  • onSelect   -- your callback for the ``onChange'' event. See above.

    +

    +

    +
  • onClose   -- your callback for the ``onClose'' event. See above.

    +

    +

    +

+

+

+ +

The onSelect event

+

+

+Here is a typical implementation of this function:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+};
+

+

+date is in the format selected with calendar.setDateFormat +(see section 5.3.5). This code simply updates the +input field. If you want the calendar to be in single-click mode then you +should also close the calendar after you updated the input field, so we come to +the following version:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+  if (calendar.dateClicked) {
+    calendar.callCloseHandler(); // this calls "onClose" (see above)
+  }
+};
+

+

+Note that we checked the member variable dateClicked and +only hide the calendar if it's true. If this variable is false it +means that no date was actually selected, but the user only changed the +month/year using the navigation buttons or the menus. We don't want to hide +the calendar in that case.

+

+

+ +

The onClose event

+

+

+This event is triggered when the calendar should close. It should hide or +destroy the calendar object -- the calendar itself just triggers the event, but +it won't close itself.

+

+A typical implementation of this function is the following:

+

+

+
function onClose(calendar) {
+  calendar.hide();
+  // or calendar.destroy();
+};
+

+

+

+ +

5.2  Useful member variables (properties)

+

+

+After creating the Calendar object you can access the following properties:

+

+

+

    +

    +
  • date -- is a JavaScript Date object. It will always +reflect the date shown in the calendar (yes, even if the calendar is hidden).

    +

    +

    +
  • isPopup -- if this is true then the current Calendar object is +a popup calendar. Otherwise (false) we have a flat calendar. This variable is +set from Calendar.create and has no meaning before this function was +called.

    +

    +

    +
  • dateClicked -- particularly useful in the onSelect +handler, this variable tells us if a date was really clicked. That's because +the onSelect handler is called even if the end-user only changed the +month/year but did not select a date. We don't want to close the calendar in +that case.

    +

    +

    +
  • weekNumbers -- if true (default) then the calendar +displays week numbers. If you don't want week numbers you have to set this +variable to false before calling Calendar.create.

    +

    +

    +
  • showsTime - if you set this to true (it is +false by default) then the calendar will also include a time selector.

    +

    +

    +
  • time24 - if you set this to false then the time +selector will be in 12-hour format. It is in 24-hour format by default.

    +

    +

    +
  • firstDayOfWeek -- specifies the first day of week (0 to 6, pass +0 for Sunday, 1 for Monday, ..., 6 for Saturday). This variable is set from +constructor, but you still have a chance to modify it before calling +Calendar.create.

    +

    +

    +

+

+There are lots of other member variables, but one should access them only +through member functions so I won't document them here.

+

+

+ +

5.3  Public methods

+

+ +

5.3.1  Calendar.create

+

+

+This function creates the afferent HTML elements that are needed to display the +calendar. You should call it after setting the calendar properties. Synopsis: +

+
calendar.create(); // creates a popup calendar
+  // -- or --
+calendar.create(document.getElementById(parent_id)); // makes a flat calendar
+

+

+It can create a popup calendar or a flat calendar. If the ``parent'' argument +is present (it should be a reference -- not ID -- to an HTML element) then +a flat calendar is created and it is inserted in the given element.

+

+At any moment, given a reference to a calendar object, we can inspect if it's a +popup or a flat calendar by checking the boolean member variable +isPopup:

+

+

+
if (calendar.isPopup) {
+   // this is a popup calendar
+} else {
+   // this is a flat calendar
+}
+

+

+

+ +

5.3.2  Calendar.callHandler

+

+

+This function calls the first user callback (the +onSelect handler) with the required parameters.

+

+

+ +

5.3.3  Calendar.callCloseHandler

+

+

+This function calls the second user callback (the +onClose handler). It's useful when you want to have a +``single-click'' calendar -- just call this in your onSelect handler, +if a date was clicked.

+

+

+ +

5.3.4  Calendar.hide

+

+

+Call this function to hide the calendar. The calendar object and HTML elements +will not be destroyed, thus you can later call one of the show +functions on the same element.

+

+

+ +

5.3.5  Calendar.setDateFormat

+

+

+This function configures the format in which the calendar reports the date to +your ``onSelect'' handler. Call it like this:

+

+

+
calendar.setDateFormat("%y/%m/%d");
+

+

+As you can see, it receives only one parameter, the required format. The magic +characters are the following:

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%C century number
%d the day of the month ( 00 .. 31 )
%e the day of the month ( 0 .. 31 )
%H hour ( 00 .. 23 )
%I hour ( 01 .. 12 )
%j day of the year ( 000 .. 366 )
%k hour ( 0 .. 23 )
%l hour ( 1 .. 12 )
%m month ( 01 .. 12 )
%M minute ( 00 .. 59 )
%n a newline character
%p ``PM'' or ``AM''
%P ``pm'' or ``am''
%S second ( 00 .. 59 )
%s number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)
%t a tab character
%U, %W, %V the week number
%u the day of the week ( 1 .. 7, 1 = MON )
%w the day of the week ( 0 .. 6, 0 = SUN )
%y year without the century ( 00 .. 99 )
%Y year including the century ( ex. 1979 )
%% a literal % character +

+There are more algorithms for computing the week number. All +three specifiers currently implement the same one, as defined by ISO 8601: +``the week 01 is the week that has the Thursday in the current year, which is +equivalent to the week that contains the fourth day of January. Weeks start on +Monday.''

+

+

+ +

5.3.6  Calendar.setTtDateFormat

+

+

+Has the same prototype as Calendar.setDateFormat, but refers to the +format of the date displayed in the ``status bar'' when the mouse is over some +date.

+

+

+ +

5.3.7  Calendar.setDisabledHandler

+

+

+This function allows you to specify a callback function that checks if a +certain date must be disabled by the calendar. You are responsible to write +the callback function. Synopsis:

+

+

+
function disallowDate(date) {
+  // date is a JS Date object
+  if (  date.getFullYear() == 2003 &&
+        date.getMonth()    == 6 /* July, it's zero-based */ &&
+        date.getDate()     == 5  ) {
+    return true; // disable July 5 2003
+  }
+  return false; // enable other dates
+};
+
+calendar.setDisabledHandler(disallowDate);
+

+

+If you change this function in ``real-time'', meaning, without creating a new +calendar, then you have to call calendar.refresh() to make it +redisplay the month and take into account the new disabledHandler. +Calendar.setup does this, so you have no such trouble with it.

+

+Note that disallowDate should be very fast, as it is called for each +date in the month. Thus, it gets called, say, 30 times before displaying the +calendar, and 30 times when the month is changed. Tests I've done so far show +that it's still good, but in the future I might switch it to a different design +(for instance, to call it once per month and to return an array of dates that +must be disabled).

+

+This function should be considered deprecated in the favor of +Calendar.setDateStatusHandler, described below.

+

+

+ +

5.3.8  Calendar.setDateStatusHandler

+

+

+This function obsoletes Calendar.setDisabledHandler. You call it with +a function parameter, but this function can return a boolean +or a string. If the return value is a boolean (true or +false) then it behaves just like setDisabledHandler, +therefore disabling the date if the return value is true.

+

+If the returned value is a string then the given date will gain an additional +CSS class, namely the returned value. You can use this to highlight some dates +in some way. Note that you are responsible for defining the CSS class that you +return. If you return the string ``disabled'' then that date will be disabled, +just as if you returned true.

+

+Here is a simple scenario that shows what you can do with this function. The +following should be present in some of your styles, or in the document head in +a STYLE tag (but put it after the place where the calendar styles were +loaded):

+

+

+
.special { background-color: #000; color: #fff; }
+

+

+And you would use the following code before calling Calendar.create():

+

+

+
// this table holds your special days, so that we can automatize
+// things a bit:
+var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],             // special days in January
+    2 : [ 1, 6, 8, 12, 18 ],    // special days in March
+    8 : [ 21, 11 ],             // special days in September
+   11 : [ 25, 28 ]              // special days in December
+};
+
+// this function returns true if the passed date is special
+function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+}
+
+// this is the actual date status handler.  Note that it receives the
+// date object as well as separate values of year, month and date, for
+// your confort.
+function dateStatusHandler(date, y, m, d) {
+    if (dateIsSpecial(y, m, d)) return ``special'';
+    else return false;
+    // return true above if you want to disable other dates
+}
+
+// configure it to the calendar
+calendar.setDateStatusHandler(dateStatusHandler);
+

+

+The above code adds the ``special'' class name to some dates that are defined +in the SPECIAL_DAYS table. Other dates will simply be displayed as default, +enabled.

+

+

+ +

5.3.9  Calendar.show

+

+

+Call this function do show the calendar. It basically sets the CSS ``display'' +property to ``block''. It doesn't modify the calendar position.

+

+This function only makes sense when the calendar is in popup mode.

+

+

+ +

5.3.10  Calendar.showAt

+

+

+Call this to show the calendar at a certain (x, y) position. Prototype:

+

+

+
calendar.showAt(x, y);
+

+

+The parameters are absolute coordinates relative to the top left +corner of the page, thus they are page coordinates not screen +coordinates.

+

+After setting the given coordinates it calls Calendar.show. This function only +makes sense when the calendar is in popup mode.

+

+

+ +

5.3.11  Calendar.showAtElement

+

+

+This function is useful if you want to display the calendar near some element. +You call it like this:

+

+

+
calendar.showAtElement(element, align);
+

+

+where element is a reference to your element (for instance it can be the input +field that displays the date) and align is an optional parameter, of type string, +containing one or two characters. For instance, if you pass "Br" as +align, the calendar will appear below the element and with its right +margin continuing the element's right margin.

+

+As stated above, align may contain one or two characters. The first character +dictates the vertical alignment, relative to the element, and the second +character dictates the horizontal alignment. If the second character is +missing it will be assumed "l" (the left margin of the calendar will +be at the same horizontal position as the left margin of the element).

+

+The characters given for the align parameters are case sensitive. This +function only makes sense when the calendar is in popup mode. After computing +the position it uses Calendar.showAt to display the calendar there.

+

+

+ +

Vertical alignment

+

The first character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • T -- completely above the reference element (bottom margin of +the calendar aligned to the top margin of the element).

    +

    +

    +
  • t -- above the element but may overlap it (bottom margin of the calendar aligned to +the bottom margin of the element).

    +

    +

    +
  • c -- the calendar displays vertically centered to the reference +element. It might overlap it (that depends on the horizontal alignment).

    +

    +

    +
  • b -- below the element but may overlap it (top margin of the calendar aligned to +the top margin of the element).

    +

    +

    +
  • B -- completely below the element (top margin of the calendar +aligned to the bottom margin of the element).

    +

    +

    +

+

+

+ +

Horizontal alignment

+

The second character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • L -- completely to the left of the reference element (right +margin of the calendar aligned to the left margin of the element).

    +

    +

    +
  • l -- to the left of the element but may overlap it (left margin +of the calendar aligned to the left margin of the element).

    +

    +

    +
  • c -- horizontally centered to the element. Might overlap it, +depending on the vertical alignment.

    +

    +

    +
  • r -- to the right of the element but may overlap it (right +margin of the calendar aligned to the right margin of the element).

    +

    +

    +
  • R -- completely to the right of the element (left margin of the +calendar aligned to the right margin of the element).

    +

    +

    +

+

+

+ +

Default values

+

If the ``align'' parameter is missing the calendar will choose +``Br''.

+

+

+ +

5.3.12  Calendar.setDate

+

+

+Receives a JavaScript Date object. Sets the given date in the +calendar. If the calendar is visible the new date is displayed immediately.

+

+

+
calendar.setDate(new Date()); // go today
+

+

+

+ +

5.3.13  Calendar.setFirstDayOfWeek

+

+

+Changes the first day of week. The parameter has to be a numeric value ranging +from 0 to 6. Pass 0 for Sunday, 1 for Monday, ..., 6 for Saturday.

+

+

+
calendar.setFirstDayOfWeek(5); // start weeks on Friday
+

+

+

+ +

5.3.14  Calendar.parseDate

+

+

+Use this function to parse a date given as string and to move the calendar to +that date.

+

+The algorithm tries to parse the date according to the format that was +previously set with Calendar.setDateFormat; if that fails, it still +tries to get some valid date out of it (it doesn't read your thoughts, though).

+

+

+
calendar.parseDate("2003/07/06");
+

+

+

+ +

5.3.15  Calendar.setRange

+

+

+Sets the range of years that are allowed in the calendar. Synopsis:

+

+

+
calendar.setRange(1970, 2050);
+

+

+

+ +

6  Side effects

+

The calendar code was intentionally embedded in an object to make it have as +less as possible side effects. However, there are some -- not harmful, after +all. Here is a list of side effects; you can count they already happened after +calendar.js was loaded.

+

+

+

    +

    +
  1. The global variable window.calendar will be set to null. This +variable is used by the calendar code, especially when doing drag & drop for +moving the calendar. In the future I might get rid of it, but for now it +didn't harm anyone.

    +

    +

    +
  2. The JavaScript Date object is modified. We add some properties +and functions that are very useful to our calendar. It made more sense to add +them directly to the Date object than to the calendar itself. +Complete list:

    +

    +

    +

      +

      +
    1. Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); +

      +
    2. Date.SECOND = 1000 /* milliseconds */; +

      +
    3. Date.MINUTE = 60 * Date.SECOND; +

      +
    4. Date.HOUR = 60 * Date.MINUTE; +

      +
    5. Date.DAY = 24 * Date.HOUR; +

      +
    6. Date.WEEK = 7 * Date.DAY;

      +

      +

      +
    7. Date.prototype.getMonthDays(month) -- returns the number of days +of the given month, or of the current date object if no month was given.

      +

      +

      +
    8. Date.prototype.getWeekNumber() -- returns the week number of the +date in the current object.

      +

      +

      +
    9. Date.prototype.equalsTo(other_date) -- compare the current date +object with other_date and returns true if the dates are +equal. It ignores time.

      +

      +

      +
    10. Date.prototype.print(format) -- returns a string with the +current date object represented in the given format. It implements the format +specified in section 5.3.5.

      +

      +

      +

    +

    +

    +

+

+

+ +

7  Credits

+

The following people either sponsored, donated money to the project or bought +commercial licenses (listed in reverse chronological order). Your name could +be here too! If you wish to sponsor the project (for instance request a +feature and pay me for implementing it) or donate some money please +please contact me at mihai_bazon@yahoo.com.

+

+

+

+

+

+
+ +Thank you!
+ -- mihai_bazon@yahoo.com +
+

+

+

+

1 +by the term ``widget'' I understand a single element of user interface. +But that's in Linux world. For those that did lots of Windows +programming the term ``control'' might be more familiar +

+

2 people report that the calendar does +not work with IE5/Mac. However, this browser was discontinued and we +believe that supporting it doesn't worth the efforts, given the fact that +it has the worst, buggiest implementation for DOM I've ever seen.

+

3 under Opera 7 the calendar still lacks some functionality, such as +keyboard navigation; also Opera doesn't seem to allow disabling text +selection when one drags the mouse on the page; despite all that, the +calendar is still highly functional under Opera 7 and looks as good as +in other supported browsers.

+

4 user interface

+
+
+Last modified: Saturday, March 5th, 2005
+HTML conversion by TeX2page 2004-09-11
+
+ + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/reference.pdf b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/reference.pdf new file mode 100644 index 0000000000..a09497f579 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/doc/reference.pdf differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/img.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/img.gif new file mode 100644 index 0000000000..cd2c4a5217 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/img.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/index.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/index.html new file mode 100644 index 0000000000..1ae1f8ec7a --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/index.html @@ -0,0 +1,330 @@ + + + + + + + +The Coolest DHTML Calendar - Online Demo + + + + + + + + + + + + + + + + + + + + + + + + + + + +

jscalendar-1.0 +"It is happening again"

+ +

+

+Theme:
+Aqua +| +winter +| +blue +| +summer +| +green +
+win2k-1 +| +win2k-2 +| +win2k-cold-1 +| +win2k-cold-2 +
+system + +
+Release notes. +
+Set it up in minutes: + popup calendar, + flat calendar. +Other samples: + special days, + day info, + multiple dates selection +
+Documentation: + HTML, + PDF. +
+

+ +
+ +
+ + + + + + + + +
+ +
+
+Popup examples +
+ +
+ +Date #1: %Y-%m-%d [%W] %H:%M -- single +click
+ +Date #2: %a, %b %e, %Y [%I:%M %p] +-- double click + +

+ + +this select should hide when the calendar is above it. +

+ +Date #3: %d/%m/%Y +-- single click +
+ +Date #4: %A, %B %e, %Y -- +double click + +
+ +

This is release 1.0. Works on MSIE/Win 5.0 or better (really), +Opera 7+, Mozilla, Firefox, Netscape 6.x, 7.0 and all other Gecko-s, +Konqueror and Safari.

+ +

Keyboard navigation

+ +

Starting with version 0.9.2, you can also use the keyboard to select +dates (only for popup calendars; does not work with Opera +7 or Konqueror/Safari). The following keys are available:

+ +
    + +
  • , , + , -- select date
  • +
  • CTRL + , + -- select month
  • +
  • CTRL + , + -- select year
  • +
  • SPACE -- go to today date
  • +
  • ENTER -- accept the currently selected date
  • +
  • ESC -- cancel selection
  • + +
+ +
+ +
+ Flat calendar +
+ +

A non-popup version will appear below as soon + as the page is loaded. Note that it doesn't show the week number.

+ + +
+
 
+ +

+ The example above uses the setDisabledHandler() member function + to setup a handler that would only enable days withing a range of 10 days, + forward or backward, from the current date. +

+ + + +
+ +
dynarch.com 2002-2005
+Author: Mihai +Bazon
Distributed under the GNU LGPL.
+ +

If you use this script on a public page we +would love it if you would let us +know.

+ + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-af.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-af.js new file mode 100644 index 0000000000..aeda58197b --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-af.js @@ -0,0 +1,39 @@ +// ** I18N Afrikaans +Calendar._DN = new Array +("Sondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrydag", + "Saterdag", + "Sondag"); +Calendar._MN = new Array +("Januarie", + "Februarie", + "Maart", + "April", + "Mei", + "Junie", + "Julie", + "Augustus", + "September", + "Oktober", + "November", + "Desember"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Verander eerste dag van die week"; +Calendar._TT["PREV_YEAR"] = "Vorige jaar (hou vir keuselys)"; +Calendar._TT["PREV_MONTH"] = "Vorige maand (hou vir keuselys)"; +Calendar._TT["GO_TODAY"] = "Gaan na vandag"; +Calendar._TT["NEXT_MONTH"] = "Volgende maand (hou vir keuselys)"; +Calendar._TT["NEXT_YEAR"] = "Volgende jaar (hou vir keuselys)"; +Calendar._TT["SEL_DATE"] = "Kies datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te skuif"; +Calendar._TT["PART_TODAY"] = " (vandag)"; +Calendar._TT["MON_FIRST"] = "Vertoon Maandag eerste"; +Calendar._TT["SUN_FIRST"] = "Display Sunday first"; +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-al.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-al.js new file mode 100644 index 0000000000..4f701cf72d --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-al.js @@ -0,0 +1,101 @@ +// Calendar ALBANIAN language +//author Rigels Gordani rige@hotmail.com + +// ditet +Calendar._DN = new Array +("E Diele", +"E Hene", +"E Marte", +"E Merkure", +"E Enjte", +"E Premte", +"E Shtune", +"E Diele"); + +//ditet shkurt +Calendar._SDN = new Array +("Die", +"Hen", +"Mar", +"Mer", +"Enj", +"Pre", +"Sht", +"Die"); + +// muajt +Calendar._MN = new Array +("Janar", +"Shkurt", +"Mars", +"Prill", +"Maj", +"Qeshor", +"Korrik", +"Gusht", +"Shtator", +"Tetor", +"Nentor", +"Dhjetor"); + +// muajte shkurt +Calendar._SMN = new Array +("Jan", +"Shk", +"Mar", +"Pri", +"Maj", +"Qes", +"Kor", +"Gus", +"Sht", +"Tet", +"Nen", +"Dhj"); + +// ndihmesa +Calendar._TT = {}; +Calendar._TT["INFO"] = "Per kalendarin"; + +Calendar._TT["ABOUT"] = +"Zgjedhes i ores/dates ne DHTML \n" + +"\n\n" +"Zgjedhja e Dates:\n" + +"- Perdor butonat \xab, \xbb per te zgjedhur vitin\n" + +"- Perdor butonat" + String.fromCharCode(0x2039) + ", " + +String.fromCharCode(0x203a) + +" per te zgjedhur muajin\n" + +"- Mbani shtypur butonin e mousit per nje zgjedje me te shpejte."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Zgjedhja e kohes:\n" + +"- Kliko tek ndonje nga pjeset e ores per ta rritur ate\n" + +"- ose kliko me Shift per ta zvogeluar ate\n" + +"- ose cliko dhe terhiq per zgjedhje me te shpejte."; + +Calendar._TT["PREV_YEAR"] = "Viti i shkuar (prit per menune)"; +Calendar._TT["PREV_MONTH"] = "Muaji i shkuar (prit per menune)"; +Calendar._TT["GO_TODAY"] = "Sot"; +Calendar._TT["NEXT_MONTH"] = "Muaji i ardhshem (prit per menune)"; +Calendar._TT["NEXT_YEAR"] = "Viti i ardhshem (prit per menune)"; +Calendar._TT["SEL_DATE"] = "Zgjidh daten"; +Calendar._TT["DRAG_TO_MOVE"] = "Terhiqe per te levizur"; +Calendar._TT["PART_TODAY"] = " (sot)"; + +// "%s" eshte dita e pare e javes +// %s do te zevendesohet me emrin e dite +Calendar._TT["DAY_FIRST"] = "Trego te %s te paren"; + + +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Mbyll"; +Calendar._TT["TODAY"] = "Sot"; +Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar +vleren"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Java"; +Calendar._TT["TIME"] = "Koha:"; + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-bg.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-bg.js new file mode 100644 index 0000000000..4f4fd863e5 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-bg.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar BG language +// Author: Mihai Bazon, +// Translator: Valentin Sheiretsky, +// Encoding: Windows-1251 +// 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 +("Íåäåëÿ", + "Ïîíåäåëíèê", + "Âòîðíèê", + "Ñðÿäà", + "×åòâúðòúê", + "Ïåòúê", + "Ñúáîòà", + "Íåäåëÿ"); + +// 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 +("Íåä", + "Ïîí", + "Âòî", + "Ñðÿ", + "×åò", + "Ïåò", + "Ñúá", + "Íåä"); + +// full month names +Calendar._MN = new Array +("ßíóàðè", + "Ôåâðóàðè", + "Ìàðò", + "Àïðèë", + "Ìàé", + "Þíè", + "Þëè", + "Àâãóñò", + "Ñåïòåìâðè", + "Îêòîìâðè", + "Íîåìâðè", + "Äåêåìâðè"); + +// short month names +Calendar._SMN = new Array +("ßíó", + "Ôåâ", + "Ìàð", + "Àïð", + "Ìàé", + "Þíè", + "Þëè", + "Àâã", + "Ñåï", + "Îêò", + "Íîå", + "Äåê"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Èíôîðìàöèÿ çà êàëåíäàðà"; + +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"] = "Ïðåäíà ãîäèíà (çàäðúæòå çà ìåíþ)"; +Calendar._TT["PREV_MONTH"] = "Ïðåäåí ìåñåö (çàäðúæòå çà ìåíþ)"; +Calendar._TT["GO_TODAY"] = "Èçáåðåòå äíåñ"; +Calendar._TT["NEXT_MONTH"] = "Ñëåäâàù ìåñåö (çàäðúæòå çà ìåíþ)"; +Calendar._TT["NEXT_YEAR"] = "Ñëåäâàùà ãîäèíà (çàäðúæòå çà ìåíþ)"; +Calendar._TT["SEL_DATE"] = "Èçáåðåòå äàòà"; +Calendar._TT["DRAG_TO_MOVE"] = "Ïðåìåñòâàíå"; +Calendar._TT["PART_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"] = "%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"] = "Çàòâîðåòå"; +Calendar._TT["TODAY"] = "Äíåñ"; +Calendar._TT["TIME_PART"] = "(Shift-)Click èëè drag çà äà ïðîìåíèòå ñòîéíîñòòà"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A - %e %B %Y"; + +Calendar._TT["WK"] = "Ñåäì"; +Calendar._TT["TIME"] = "×àñ:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5-utf8.js new file mode 100644 index 0000000000..14e0d5ddee --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5-utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar big5-utf8 language +// Author: Gary Fu, +// Encoding: utf8 +// 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 +("星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + "星期日"); + +// 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 +("æ—¥", + "一", + "二", + "三", + "å››", + "五", + "å…­", + "æ—¥"); + +// full month names +Calendar._MN = new Array +("一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "乿œˆ", + "åæœˆ", + "å一月", + "å二月"); + +// short month names +Calendar._SMN = new Array +("一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "乿œˆ", + "åæœˆ", + "å一月", + "å二月"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "關於"; + +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" + +"æ—¥æœŸé¸æ“‡æ–¹æ³•:\n" + +"- 使用 \xab, \xbb 按鈕å¯é¸æ“‡å¹´ä»½\n" + +"- 使用 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按鈕å¯é¸æ“‡æœˆä»½\n" + +"- 按ä½ä¸Šé¢çš„æŒ‰éˆ•å¯ä»¥åŠ å¿«é¸å–"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"æ™‚é–“é¸æ“‡æ–¹æ³•:\n" + +"- 點擊任何的時間部份å¯å¢žåР其值\n" + +"- åŒæ™‚按Shiftéµå†é»žæ“Šå¯æ¸›å°‘其值\n" + +"- 點擊並拖曳å¯åŠ å¿«æ”¹è®Šçš„å€¼"; + +Calendar._TT["PREV_YEAR"] = "上一年 (按ä½é¸å–®)"; +Calendar._TT["PREV_MONTH"] = "下一年 (按ä½é¸å–®)"; +Calendar._TT["GO_TODAY"] = "到今日"; +Calendar._TT["NEXT_MONTH"] = "上一月 (按ä½é¸å–®)"; +Calendar._TT["NEXT_YEAR"] = "下一月 (按ä½é¸å–®)"; +Calendar._TT["SEL_DATE"] = "鏿“‡æ—¥æœŸ"; +Calendar._TT["DRAG_TO_MOVE"] = "拖曳"; +Calendar._TT["PART_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"] = "å°‡ %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"] = "關閉"; +Calendar._TT["TODAY"] = "今日"; +Calendar._TT["TIME_PART"] = "點擊oræ‹–æ›³å¯æ”¹è®Šæ™‚é–“(åŒæ™‚按Shift為減)"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "週"; +Calendar._TT["TIME"] = "Time:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5.js new file mode 100644 index 0000000000..a58935873f --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-big5.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar big5 language +// Author: Gary Fu, +// Encoding: big5 +// 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 +("¬P´Á¤é", + "¬P´Á¤@", + "¬P´Á¤G", + "¬P´Á¤T", + "¬P´Á¥|", + "¬P´Á¤­", + "¬P´Á¤»", + "¬P´Á¤é"); + +// 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 +("¤é", + "¤@", + "¤G", + "¤T", + "¥|", + "¤­", + "¤»", + "¤é"); + +// full month names +Calendar._MN = new Array +("¤@¤ë", + "¤G¤ë", + "¤T¤ë", + "¥|¤ë", + "¤­¤ë", + "¤»¤ë", + "¤C¤ë", + "¤K¤ë", + "¤E¤ë", + "¤Q¤ë", + "¤Q¤@¤ë", + "¤Q¤G¤ë"); + +// short month names +Calendar._SMN = new Array +("¤@¤ë", + "¤G¤ë", + "¤T¤ë", + "¥|¤ë", + "¤­¤ë", + "¤»¤ë", + "¤C¤ë", + "¤K¤ë", + "¤E¤ë", + "¤Q¤ë", + "¤Q¤@¤ë", + "¤Q¤G¤ë"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Ãö©ó"; + +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" + +"¤é´Á¿ï¾Ü¤èªk:\n" + +"- ¨Ï¥Î \xab, \xbb «ö¶s¥i¿ï¾Ü¦~¥÷\n" + +"- ¨Ï¥Î " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " «ö¶s¥i¿ï¾Ü¤ë¥÷\n" + +"- «ö¦í¤W­±ªº«ö¶s¥i¥H¥[§Ö¿ï¨ú"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"®É¶¡¿ï¾Ü¤èªk:\n" + +"- ÂIÀ»¥ô¦óªº®É¶¡³¡¥÷¥i¼W¥[¨ä­È\n" + +"- ¦P®É«öShiftÁä¦AÂIÀ»¥i´î¤Ö¨ä­È\n" + +"- ÂIÀ»¨Ã©ì¦²¥i¥[§Ö§ïÅܪº­È"; + +Calendar._TT["PREV_YEAR"] = "¤W¤@¦~ («ö¦í¿ï³æ)"; +Calendar._TT["PREV_MONTH"] = "¤U¤@¦~ («ö¦í¿ï³æ)"; +Calendar._TT["GO_TODAY"] = "¨ì¤µ¤é"; +Calendar._TT["NEXT_MONTH"] = "¤W¤@¤ë («ö¦í¿ï³æ)"; +Calendar._TT["NEXT_YEAR"] = "¤U¤@¤ë («ö¦í¿ï³æ)"; +Calendar._TT["SEL_DATE"] = "¿ï¾Ü¤é´Á"; +Calendar._TT["DRAG_TO_MOVE"] = "©ì¦²"; +Calendar._TT["PART_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"] = "±N %s Åã¥Ü¦b«e"; + +// 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"] = "Ãö³¬"; +Calendar._TT["TODAY"] = "¤µ¤é"; +Calendar._TT["TIME_PART"] = "ÂIÀ»or©ì¦²¥i§ïÅܮɶ¡(¦P®É«öShift¬°´î)"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "¶g"; +Calendar._TT["TIME"] = "Time:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-br.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-br.js new file mode 100644 index 0000000000..bfb074717c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-br.js @@ -0,0 +1,108 @@ +// ** I18N + +// Calendar pt-BR language +// Author: Fernando Dourado, +// 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 +("Domingo", + "Segunda", + "Terça", + "Quarta", + "Quinta", + "Sexta", + "Sabádo", + "Domingo"); + +// 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 +// [No changes using default values] + +// full month names +Calendar._MN = new Array +("Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro"); + +// short month names +// [No changes using default values] + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre o calendário"; + +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" + +"Translate to portuguese Brazil (pt-BR) by Fernando Dourado (fernando.dourado@ig.com.br)\n" + +"Tradução para o português Brasil (pt-BR) por Fernando Dourado (fernando.dourado@ig.com.br)" + +"\n\n" + +"Selecionar data:\n" + +"- Use as teclas \xab, \xbb para selecionar o ano\n" + +"- Use as teclas " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mês\n" + +"- Clique e segure com o mouse em qualquer botão para selecionar rapidamente."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selecionar hora:\n" + +"- Clique em qualquer uma das partes da hora para aumentar\n" + +"- ou Shift-clique para diminuir\n" + +"- ou clique e arraste para selecionar rapidamente."; + +Calendar._TT["PREV_YEAR"] = "Ano anterior (clique e segure para menu)"; +Calendar._TT["PREV_MONTH"] = "Mês anterior (clique e segure para menu)"; +Calendar._TT["GO_TODAY"] = "Ir para a data atual"; +Calendar._TT["NEXT_MONTH"] = "Próximo mês (clique e segure para menu)"; +Calendar._TT["NEXT_YEAR"] = "Próximo ano (clique e segure para menu)"; +Calendar._TT["SEL_DATE"] = "Selecione uma data"; +Calendar._TT["DRAG_TO_MOVE"] = "Clique e segure para mover"; +Calendar._TT["PART_TODAY"] = " (hoje)"; + +// 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"] = "Exibir %s primeiro"; + +// 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"] = "Fechar"; +Calendar._TT["TODAY"] = "Hoje"; +Calendar._TT["TIME_PART"] = "(Shift-)Clique ou arraste para mudar o valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%d de %B de %Y"; + +Calendar._TT["WK"] = "sem"; +Calendar._TT["TIME"] = "Hora:"; + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ca.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ca.js new file mode 100644 index 0000000000..a2121bcb40 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ca.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar CA language +// Author: Mihai Bazon, +// 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 +("Diumenge", + "Dilluns", + "Dimarts", + "Dimecres", + "Dijous", + "Divendres", + "Dissabte", + "Diumenge"); + +// 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 +("Diu", + "Dil", + "Dmt", + "Dmc", + "Dij", + "Div", + "Dis", + "Diu"); + +// full month names +Calendar._MN = new Array +("Gener", + "Febrer", + "Març", + "Abril", + "Maig", + "Juny", + "Juliol", + "Agost", + "Setembre", + "Octubre", + "Novembre", + "Desembre"); + +// short month names +Calendar._SMN = new Array +("Gen", + "Feb", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Oct", + "Nov", + "Des"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre el calendari"; + +Calendar._TT["ABOUT"] = +"DHTML Selector de Data/Hora\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" + +"Sel.lecció de Dates:\n" + +"- Fes servir els botons \xab, \xbb per sel.leccionar l'any\n" + +"- Fes servir els botons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per se.lecciconar el mes\n" + +"- Manté el ratolí apretat en qualsevol dels anteriors per sel.lecció ràpida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- claca en qualsevol de les parts de la hora per augmentar-les\n" + +"- o Shift-click per decrementar-la\n" + +"- or click and arrastra per sel.lecció ràpida."; + +Calendar._TT["PREV_YEAR"] = "Any anterior (Mantenir per menu)"; +Calendar._TT["PREV_MONTH"] = "Mes anterior (Mantenir per menu)"; +Calendar._TT["GO_TODAY"] = "Anar a avui"; +Calendar._TT["NEXT_MONTH"] = "Mes següent (Mantenir per menu)"; +Calendar._TT["NEXT_YEAR"] = "Any següent (Mantenir per menu)"; +Calendar._TT["SEL_DATE"] = "Sel.leccionar data"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar per moure"; +Calendar._TT["PART_TODAY"] = " (avui)"; + +// 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"] = "Mostra %s primer"; + +// 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"] = "Tanca"; +Calendar._TT["TODAY"] = "Avui"; +Calendar._TT["TIME_PART"] = "(Shift-)Click a arrastra per canviar el valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "st"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-utf8.js new file mode 100644 index 0000000000..f6bbbeba14 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-utf8.js @@ -0,0 +1,65 @@ +/* + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) +*/ + +// ** I18N +Calendar._DN = new Array('NedÄ›le','PondÄ›lí','Úterý','StÅ™eda','ÄŒtvrtek','Pátek','Sobota','NedÄ›le'); +Calendar._SDN = new Array('Ne','Po','Út','St','ÄŒt','Pá','So','Ne'); +Calendar._MN = new Array('Leden','Únor','BÅ™ezen','Duben','KvÄ›ten','ÄŒerven','ÄŒervenec','Srpen','Září','Říjen','Listopad','Prosinec'); +Calendar._SMN = new Array('Led','Úno','BÅ™e','Dub','KvÄ›','ÄŒrv','ÄŒvc','Srp','Zář','Říj','Lis','Pro'); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O komponentÄ› kalendář"; +Calendar._TT["TOGGLE"] = "ZmÄ›na prvního dne v týdnu"; +Calendar._TT["PREV_YEAR"] = "PÅ™edchozí rok (pÅ™idrž pro menu)"; +Calendar._TT["PREV_MONTH"] = "PÅ™edchozí mÄ›síc (pÅ™idrž pro menu)"; +Calendar._TT["GO_TODAY"] = "DneÅ¡ní datum"; +Calendar._TT["NEXT_MONTH"] = "Další mÄ›síc (pÅ™idrž pro menu)"; +Calendar._TT["NEXT_YEAR"] = "Další rok (pÅ™idrž pro menu)"; +Calendar._TT["SEL_DATE"] = "Vyber datum"; +Calendar._TT["DRAG_TO_MOVE"] = "ChyÅ¥ a táhni, pro pÅ™esun"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "Ukaž jako první PondÄ›lí"; +//Calendar._TT["SUN_FIRST"] = "Ukaž jako první NedÄ›li"; + +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" + +"VýbÄ›r datumu:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Použijte tlaÄítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výbÄ›ru mÄ›síce\n" + +"- Podržte tlaÄítko myÅ¡i na jakémkoliv z tÄ›ch tlaÄítek pro rychlejší výbÄ›r."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"VýbÄ›r Äasu:\n" + +"- KliknÄ›te na jakoukoliv z Äástí výbÄ›ru Äasu pro zvýšení.\n" + +"- nebo Shift-click pro snížení\n" + +"- nebo kliknÄ›te a táhnÄ›te pro rychlejší výbÄ›r."; + +// 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"] = "Zobraz %s první"; + +// 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"] = "Zavřít"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro zmÄ›nu hodnoty"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "ÄŒas:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-win.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-win.js new file mode 100644 index 0000000000..140dff318c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-cs-win.js @@ -0,0 +1,65 @@ +/* + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) +*/ + +// ** I18N +Calendar._DN = new Array('Nedìle','Pondìlí','Úterý','Støeda','Ètvrtek','Pátek','Sobota','Nedìle'); +Calendar._SDN = new Array('Ne','Po','Út','St','Èt','Pá','So','Ne'); +Calendar._MN = new Array('Leden','Únor','Bøezen','Duben','Kvìten','Èerven','Èervenec','Srpen','Záøí','Øíjen','Listopad','Prosinec'); +Calendar._SMN = new Array('Led','Úno','Bøe','Dub','Kvì','Èrv','Èvc','Srp','Záø','Øíj','Lis','Pro'); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O komponentì kalendáø"; +Calendar._TT["TOGGLE"] = "Zmìna prvního dne v týdnu"; +Calendar._TT["PREV_YEAR"] = "Pøedchozí rok (pøidrž pro menu)"; +Calendar._TT["PREV_MONTH"] = "Pøedchozí mìsíc (pøidrž pro menu)"; +Calendar._TT["GO_TODAY"] = "Dnešní datum"; +Calendar._TT["NEXT_MONTH"] = "Další mìsíc (pøidrž pro menu)"; +Calendar._TT["NEXT_YEAR"] = "Další rok (pøidrž pro menu)"; +Calendar._TT["SEL_DATE"] = "Vyber datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Chy a táhni, pro pøesun"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "Ukaž jako první Pondìlí"; +//Calendar._TT["SUN_FIRST"] = "Ukaž jako první Nedìli"; + +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" + +"Výbìr datumu:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Použijte tlaèítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výbìru mìsíce\n" + +"- Podržte tlaèítko myši na jakémkoliv z tìch tlaèítek pro rychlejší výbìr."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Výbìr èasu:\n" + +"- Kliknìte na jakoukoliv z èástí výbìru èasu pro zvýšení.\n" + +"- nebo Shift-click pro snížení\n" + +"- nebo kliknìte a táhnìte pro rychlejší výbìr."; + +// 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"] = "Zobraz %s první"; + +// 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"] = "Zavøít"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro zmìnu hodnoty"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Èas:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-da.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-da.js new file mode 100644 index 0000000000..a99b598f03 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-da.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar DA language +// Author: Michael Thingmand Henriksen, +// 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 +("Søndag", +"Mandag", +"Tirsdag", +"Onsdag", +"Torsdag", +"Fredag", +"Lørdag", +"Søndag"); + +// 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 +("Søn", +"Man", +"Tir", +"Ons", +"Tor", +"Fre", +"Lør", +"Søn"); + +// full month names +Calendar._MN = new Array +("Januar", +"Februar", +"Marts", +"April", +"Maj", +"Juni", +"Juli", +"August", +"September", +"Oktober", +"November", +"December"); + +// short month names +Calendar._SMN = new Array +("Jan", +"Feb", +"Mar", +"Apr", +"Maj", +"Jun", +"Jul", +"Aug", +"Sep", +"Okt", +"Nov", +"Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om Kalenderen"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For den seneste version besøg: http://www.dynarch.com/projects/calendar/\n"; + +"Distribueret under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detajler." + +"\n\n" + +"Valg af dato:\n" + +"- Brug \xab, \xbb knapperne for at vælge Ã¥r\n" + +"- Brug " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knapperne for at vælge mÃ¥ned\n" + +"- Hold knappen pÃ¥ musen nede pÃ¥ knapperne ovenfor for hurtigere valg."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Valg af tid:\n" + +"- Klik pÃ¥ en vilkÃ¥rlig del for større værdi\n" + +"- eller Shift-klik for for mindre værdi\n" + +"- eller klik og træk for hurtigere valg."; + +Calendar._TT["PREV_YEAR"] = "Ét Ã¥r tilbage (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Én mÃ¥ned tilbage (hold for menu)"; +Calendar._TT["GO_TODAY"] = "GÃ¥ til i dag"; +Calendar._TT["NEXT_MONTH"] = "Én mÃ¥ned frem (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Ét Ã¥r frem (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Vælg dag"; +Calendar._TT["DRAG_TO_MOVE"] = "Træk vinduet"; +Calendar._TT["PART_TODAY"] = " (i dag)"; + +// 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"] = "Vis %s først"; + +// 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"] = "Luk"; +Calendar._TT["TODAY"] = "I dag"; +Calendar._TT["TIME_PART"] = "(Shift-)klik eller træk for at ændre værdi"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Uge"; +Calendar._TT["TIME"] = "Tid:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-de.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-de.js new file mode 100644 index 0000000000..4bc1137cc1 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-de.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar DE language +// Author: Jack (tR), +// 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"); + +// 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-du.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-du.js new file mode 100644 index 0000000000..2200448051 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-du.js @@ -0,0 +1,45 @@ +// ** I18N +Calendar._DN = new Array +("Zondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrijdag", + "Zaterdag", + "Zondag"); +Calendar._MN = new Array +("Januari", + "Februari", + "Maart", + "April", + "Mei", + "Juni", + "Juli", + "Augustus", + "September", + "Oktober", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Toggle startdag van de week"; +Calendar._TT["PREV_YEAR"] = "Vorig jaar (indrukken voor menu)"; +Calendar._TT["PREV_MONTH"] = "Vorige month (indrukken voor menu)"; +Calendar._TT["GO_TODAY"] = "Naar Vandaag"; +Calendar._TT["NEXT_MONTH"] = "Volgende Maand (indrukken voor menu)"; +Calendar._TT["NEXT_YEAR"] = "Volgend jaar (indrukken voor menu)"; +Calendar._TT["SEL_DATE"] = "Selecteer datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te verplaatsen"; +Calendar._TT["PART_TODAY"] = " (vandaag)"; +Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; +Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; +Calendar._TT["CLOSE"] = "Sluiten"; +Calendar._TT["TODAY"] = "Vandaag"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; + +Calendar._TT["WK"] = "wk"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-el.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-el.js new file mode 100644 index 0000000000..fee5575eab --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-el.js @@ -0,0 +1,89 @@ +// ** I18N +Calendar._DN = new Array +("ΚυÏιακή", + "ΔευτέÏα", + "ΤÏίτη", + "ΤετάÏτη", + "Πέμπτη", + "ΠαÏασκευή", + "Σάββατο", + "ΚυÏιακή"); + +Calendar._SDN = new Array +("Κυ", + "Δε", + "TÏ", + "Τε", + "Πε", + "Πα", + "Σα", + "Κυ"); + +Calendar._MN = new Array +("ΙανουάÏιος", + "ΦεβÏουάÏιος", + "ΜάÏτιος", + "ΑπÏίλιος", + "Μάϊος", + "ΙοÏνιος", + "ΙοÏλιος", + "ΑÏγουστος", + "ΣεπτέμβÏιος", + "ΟκτώβÏιος", + "ÎοέμβÏιος", + "ΔεκέμβÏιος"); + +Calendar._SMN = new Array +("Ιαν", + "Φεβ", + "ΜαÏ", + "ΑπÏ", + "Μαι", + "Ιουν", + "Ιουλ", + "Αυγ", + "Σεπ", + "Οκτ", + "Îοε", + "Δεκ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Για το ημεÏολόγιο"; + +Calendar._TT["ABOUT"] = +"Επιλογέας ημεÏομηνίας/ÏŽÏας σε DHTML\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Για τελευταία έκδοση: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Επιλογή ημεÏομηνίας:\n" + +"- ΧÏησιμοποιείστε τα κουμπιά \xab, \xbb για επιλογή έτους\n" + +"- ΧÏησιμοποιείστε τα κουμπιά " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " για επιλογή μήνα\n" + +"- ΚÏατήστε κουμπί Ï€Î¿Î½Ï„Î¹ÎºÎ¿Ï Ï€Î±Ï„Î·Î¼Î­Î½Î¿ στα παÏαπάνω κουμπιά για πιο γÏήγοÏη επιλογή."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Επιλογή ÏŽÏας:\n" + +"- Κάντε κλικ σε ένα από τα μέÏη της ÏŽÏας για αÏξηση\n" + +"- ή Shift-κλικ για μείωση\n" + +"- ή κλικ και μετακίνηση για πιο γÏήγοÏη επιλογή."; +Calendar._TT["TOGGLE"] = "ΜπάÏα Ï€Ïώτης ημέÏας της εβδομάδας"; +Calendar._TT["PREV_YEAR"] = "ΠÏοηγ. έτος (κÏατήστε για το μενοÏ)"; +Calendar._TT["PREV_MONTH"] = "ΠÏοηγ. μήνας (κÏατήστε για το μενοÏ)"; +Calendar._TT["GO_TODAY"] = "ΣήμεÏα"; +Calendar._TT["NEXT_MONTH"] = "Επόμενος μήνας (κÏατήστε για το μενοÏ)"; +Calendar._TT["NEXT_YEAR"] = "Επόμενο έτος (κÏατήστε για το μενοÏ)"; +Calendar._TT["SEL_DATE"] = "Επιλέξτε ημεÏομηνία"; +Calendar._TT["DRAG_TO_MOVE"] = "ΣÏÏτε για να μετακινήσετε"; +Calendar._TT["PART_TODAY"] = " (σήμεÏα)"; +Calendar._TT["MON_FIRST"] = "Εμφάνιση ΔευτέÏας Ï€Ïώτα"; +Calendar._TT["SUN_FIRST"] = "Εμφάνιση ΚυÏιακής Ï€Ïώτα"; +Calendar._TT["CLOSE"] = "Κλείσιμο"; +Calendar._TT["TODAY"] = "ΣήμεÏα"; +Calendar._TT["TIME_PART"] = "(Shift-)κλικ ή μετακίνηση για αλλαγή"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "D, d M"; + +Calendar._TT["WK"] = "εβδ"; + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-en.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-en.js new file mode 100644 index 0000000000..0dbde793d8 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-en.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// 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 --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-es.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-es.js new file mode 100644 index 0000000000..19c1b30bdc --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-es.js @@ -0,0 +1,129 @@ +// ** I18N + +// Calendar ES (spanish) language +// Author: Mihai Bazon, +// Updater: Servilio Afre Puentes +// Updated: 2004-06-03 +// Encoding: utf-8 +// 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 +("Domingo", + "Lunes", + "Martes", + "Miércoles", + "Jueves", + "Viernes", + "Sábado", + "Domingo"); + +// 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 +("Dom", + "Lun", + "Mar", + "Mié", + "Jue", + "Vie", + "Sáb", + "Dom"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 1; + +// full month names +Calendar._MN = new Array +("Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre"); + +// short month names +Calendar._SMN = new Array +("Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Acerca del calendario"; + +Calendar._TT["ABOUT"] = +"Selector DHTML de Fecha/Hora\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Para conseguir la última versión visite: http://www.dynarch.com/projects/calendar/\n" + +"Distribuido bajo licencia GNU LGPL. Visite http://gnu.org/licenses/lgpl.html para más detalles." + +"\n\n" + +"Selección de fecha:\n" + +"- Use los botones \xab, \xbb para seleccionar el año\n" + +"- Use los botones " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" + +"- Mantenga pulsado el ratón en cualquiera de estos botones para una selección rápida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selección de hora:\n" + +"- Pulse en cualquiera de las partes de la hora para incrementarla\n" + +"- o pulse las mayúsculas mientras hace clic para decrementarla\n" + +"- o haga clic y arrastre el ratón para una selección más rápida."; + +Calendar._TT["PREV_YEAR"] = "Año anterior (mantener para menú)"; +Calendar._TT["PREV_MONTH"] = "Mes anterior (mantener para menú)"; +Calendar._TT["GO_TODAY"] = "Ir a hoy"; +Calendar._TT["NEXT_MONTH"] = "Mes siguiente (mantener para menú)"; +Calendar._TT["NEXT_YEAR"] = "Año siguiente (mantener para menú)"; +Calendar._TT["SEL_DATE"] = "Seleccionar fecha"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar para mover"; +Calendar._TT["PART_TODAY"] = " (hoy)"; + +// 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"] = "Hacer %s primer día de la semana"; + +// 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"] = "Cerrar"; +Calendar._TT["TODAY"] = "Hoy"; +Calendar._TT["TIME_PART"] = "(Mayúscula-)Clic o arrastre para cambiar valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y"; + +Calendar._TT["WK"] = "sem"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fi.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fi.js new file mode 100644 index 0000000000..328eabb3bd --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fi.js @@ -0,0 +1,98 @@ +// ** I18N + +// Calendar FI language (Finnish, Suomi) +// Author: Jarno Käyhkö, +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("Sunnuntai", + "Maanantai", + "Tiistai", + "Keskiviikko", + "Torstai", + "Perjantai", + "Lauantai", + "Sunnuntai"); + +// short day names +Calendar._SDN = new Array +("Su", + "Ma", + "Ti", + "Ke", + "To", + "Pe", + "La", + "Su"); + +// full month names +Calendar._MN = new Array +("Tammikuu", + "Helmikuu", + "Maaliskuu", + "Huhtikuu", + "Toukokuu", + "Kesäkuu", + "Heinäkuu", + "Elokuu", + "Syyskuu", + "Lokakuu", + "Marraskuu", + "Joulukuu"); + +// short month names +Calendar._SMN = new Array +("Tam", + "Hel", + "Maa", + "Huh", + "Tou", + "Kes", + "Hei", + "Elo", + "Syy", + "Lok", + "Mar", + "Jou"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Tietoja kalenterista"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Uusin versio osoitteessa: http://www.dynarch.com/projects/calendar/\n" + +"Julkaistu GNU LGPL lisenssin alaisuudessa. Lisätietoja osoitteessa http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Päivämäärä valinta:\n" + +"- Käytä \xab, \xbb painikkeita valitaksesi vuosi\n" + +"- Käytä " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " painikkeita valitaksesi kuukausi\n" + +"- Pitämällä hiiren painiketta minkä tahansa yllä olevan painikkeen kohdalla, saat näkyviin valikon nopeampaan siirtymiseen."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Ajan valinta:\n" + +"- Klikkaa kellonajan numeroita lisätäksesi aikaa\n" + +"- tai pitämällä Shift-näppäintä pohjassa saat aikaa taaksepäin\n" + +"- tai klikkaa ja pidä hiiren painike pohjassa sekä liikuta hiirtä muuttaaksesi aikaa nopeasti eteen- ja taaksepäin."; + +Calendar._TT["PREV_YEAR"] = "Edell. vuosi (paina hetki, näet valikon)"; +Calendar._TT["PREV_MONTH"] = "Edell. kuukausi (paina hetki, näet valikon)"; +Calendar._TT["GO_TODAY"] = "Siirry tähän päivään"; +Calendar._TT["NEXT_MONTH"] = "Seur. kuukausi (paina hetki, näet valikon)"; +Calendar._TT["NEXT_YEAR"] = "Seur. vuosi (paina hetki, näet valikon)"; +Calendar._TT["SEL_DATE"] = "Valitse päivämäärä"; +Calendar._TT["DRAG_TO_MOVE"] = "Siirrä kalenterin paikkaa"; +Calendar._TT["PART_TODAY"] = " (tänään)"; +Calendar._TT["MON_FIRST"] = "Näytä maanantai ensimmäisenä"; +Calendar._TT["SUN_FIRST"] = "Näytä sunnuntai ensimmäisenä"; +Calendar._TT["CLOSE"] = "Sulje"; +Calendar._TT["TODAY"] = "Tänään"; +Calendar._TT["TIME_PART"] = "(Shift-) Klikkaa tai liikuta muuttaaksesi aikaa"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%d.%m.%Y"; + +Calendar._TT["WK"] = "Vko"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fr.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fr.js new file mode 100644 index 0000000000..2a9e0b20bb --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-fr.js @@ -0,0 +1,125 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// 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. + +// Translator: David Duret, from previous french version + +// full day names +Calendar._DN = new Array +("Dimanche", + "Lundi", + "Mardi", + "Mercredi", + "Jeudi", + "Vendredi", + "Samedi", + "Dimanche"); + +// 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 +("Dim", + "Lun", + "Mar", + "Mar", + "Jeu", + "Ven", + "Sam", + "Dim"); + +// full month names +Calendar._MN = new Array +("Janvier", + "Février", + "Mars", + "Avril", + "Mai", + "Juin", + "Juillet", + "Août", + "Septembre", + "Octobre", + "Novembre", + "Décembre"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Fev", + "Mar", + "Avr", + "Mai", + "Juin", + "Juil", + "Aout", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "A propos du calendrier"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Heure Selecteur\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Pour la derniere version visitez : http://www.dynarch.com/projects/calendar/\n" + +"Distribué par GNU LGPL. Voir http://gnu.org/licenses/lgpl.html pour les details." + +"\n\n" + +"Selection de la date :\n" + +"- Utiliser les bouttons \xab, \xbb pour selectionner l\'annee\n" + +"- Utiliser les bouttons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pour selectionner les mois\n" + +"- Garder la souris sur n'importe quels boutons pour une selection plus rapide"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selection de l\'heure :\n" + +"- Cliquer sur heures ou minutes pour incrementer\n" + +"- ou Maj-clic pour decrementer\n" + +"- ou clic et glisser-deplacer pour une selection plus rapide"; + +Calendar._TT["PREV_YEAR"] = "Année préc. (maintenir pour menu)"; +Calendar._TT["PREV_MONTH"] = "Mois préc. (maintenir pour menu)"; +Calendar._TT["GO_TODAY"] = "Atteindre la date du jour"; +Calendar._TT["NEXT_MONTH"] = "Mois suiv. (maintenir pour menu)"; +Calendar._TT["NEXT_YEAR"] = "Année suiv. (maintenir pour menu)"; +Calendar._TT["SEL_DATE"] = "Sélectionner une date"; +Calendar._TT["DRAG_TO_MOVE"] = "Déplacer"; +Calendar._TT["PART_TODAY"] = " (Aujourd'hui)"; + +// 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"] = "Afficher %s en premier"; + +// 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"] = "Fermer"; +Calendar._TT["TODAY"] = "Aujourd'hui"; +Calendar._TT["TIME_PART"] = "(Maj-)Clic ou glisser pour modifier la valeur"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Sem."; +Calendar._TT["TIME"] = "Heure :"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-he-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-he-utf8.js new file mode 100644 index 0000000000..7861217bae --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-he-utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar EN language +// Author: Idan Sofer, +// Encoding: UTF-8 +// 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 +("ר×שון", + "שני", + "שלישי", + "רביעי", + "חמישי", + "שישי", + "שבת", + "ר×שון"); + +// 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 +("×", + "ב", + "×’", + "ד", + "×”", + "ו", + "ש", + "×"); + +// full month names +Calendar._MN = new Array +("ינו×ר", + "פברו×ר", + "מרץ", + "×פריל", + "מ××™", + "יוני", + "יולי", + "×וגוסט", + "ספטמבר", + "×וקטובר", + "נובמבר", + "דצמבר"); + +// short month names +Calendar._SMN = new Array +("×™× ×", + "פבר", + "מרץ", + "×פר", + "מ××™", + "יונ", + "יול", + "×וג", + "ספט", + "×וק", + "נוב", + "דצמ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "×ודות השנתון"; + +Calendar._TT["ABOUT"] = +"בחרן ת×ריך/שעה DHTML\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"×”×’×™×¨×¡× ×”×חרונה זמינה ב: http://www.dynarch.com/projects/calendar/\n" + +"מופץ תחת זיכיון ×” GNU LGPL. עיין ב http://gnu.org/licenses/lgpl.html ×œ×¤×¨×˜×™× × ×•×¡×¤×™×." + +"\n\n" + +בחירת ת×ריך:\n" + +"- השתמש ×‘×›×¤×ª×•×¨×™× \xab, \xbb לבחירת שנה\n" + +"- השתמש ×‘×›×¤×ª×•×¨×™× " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " לבחירת חודש\n" + +"- ×”×—×–×§ העכבר לחוץ מעל ×”×›×¤×ª×•×¨×™× ×”×ž×•×–×›×¨×™× ×œ×¢×™×œ לבחירה מהירה יותר."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"בחירת זמן:\n" + +"- לחץ על כל ×חד מחלקי הזמן כדי להוסיף\n" + +"- ×ו shift בשילוב ×¢× ×œ×—×™×¦×” כדי להחסיר\n" + +"- ×ו לחץ וגרור לפעולה מהירה יותר."; + +Calendar._TT["PREV_YEAR"] = "שנה קודמת - ×”×—×–×§ לקבלת תפריט"; +Calendar._TT["PREV_MONTH"] = "חודש ×§×•×“× - ×”×—×–×§ לקבלת תפריט"; +Calendar._TT["GO_TODAY"] = "עבור להיו×"; +Calendar._TT["NEXT_MONTH"] = "חודש ×”×‘× - ×”×—×–×§ לתפריט"; +Calendar._TT["NEXT_YEAR"] = "שנה הב××” - ×”×—×–×§ לתפריט"; +Calendar._TT["SEL_DATE"] = "בחר ת×ריך"; +Calendar._TT["DRAG_TO_MOVE"] = "גרור להזזה"; +Calendar._TT["PART_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"] = "הצג %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"] = "6"; + +Calendar._TT["CLOSE"] = "סגור"; +Calendar._TT["TODAY"] = "היו×"; +Calendar._TT["TIME_PART"] = "(שיפט-)לחץ וגרור כדי לשנות ערך"; + +// 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"] = "שעה::"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr-utf8.js new file mode 100644 index 0000000000..baf01b179c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr-utf8.js @@ -0,0 +1,49 @@ +/* Croatian language file for the DHTML Calendar version 0.9.2 +* Author Krunoslav Zubrinic , June 2003. +* Feel free to use this script under the terms of the GNU Lesser General +* Public License, as long as you do not remove or alter this notice. +*/ +Calendar._DN = new Array +("Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "ÄŒetvrtak", + "Petak", + "Subota", + "Nedjelja"); +Calendar._MN = new Array +("SijeÄanj", + "VeljaÄa", + "Ožujak", + "Travanj", + "Svibanj", + "Lipanj", + "Srpanj", + "Kolovoz", + "Rujan", + "Listopad", + "Studeni", + "Prosinac"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Promjeni dan s kojim poÄinje tjedan"; +Calendar._TT["PREV_YEAR"] = "Prethodna godina (dugi pritisak za meni)"; +Calendar._TT["PREV_MONTH"] = "Prethodni mjesec (dugi pritisak za meni)"; +Calendar._TT["GO_TODAY"] = "Idi na tekući dan"; +Calendar._TT["NEXT_MONTH"] = "Slijedeći mjesec (dugi pritisak za meni)"; +Calendar._TT["NEXT_YEAR"] = "Slijedeća godina (dugi pritisak za meni)"; +Calendar._TT["SEL_DATE"] = "Izaberite datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Pritisni i povuci za promjenu pozicije"; +Calendar._TT["PART_TODAY"] = " (today)"; +Calendar._TT["MON_FIRST"] = "Prikaži ponedjeljak kao prvi dan"; +Calendar._TT["SUN_FIRST"] = "Prikaži nedjelju kao prvi dan"; +Calendar._TT["CLOSE"] = "Zatvori"; +Calendar._TT["TODAY"] = "Danas"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "DD, dd.mm.y"; + +Calendar._TT["WK"] = "Tje"; \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr.js new file mode 100644 index 0000000000..be9a021bed Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hr.js differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hu.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hu.js new file mode 100644 index 0000000000..f5bf057ecf --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-hu.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar HU language +// Author: ??? +// Modifier: KARASZI Istvan, +// 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 +("Vasárnap", + "Hétfõ", + "Kedd", + "Szerda", + "Csütörtök", + "Péntek", + "Szombat", + "Vasárnap"); + +// 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 +("v", + "h", + "k", + "sze", + "cs", + "p", + "szo", + "v"); + +// full month names +Calendar._MN = new Array +("január", + "február", + "március", + "április", + "május", + "június", + "július", + "augusztus", + "szeptember", + "október", + "november", + "december"); + +// short month names +Calendar._SMN = new Array +("jan", + "feb", + "már", + "ápr", + "máj", + "jún", + "júl", + "aug", + "sze", + "okt", + "nov", + "dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "A kalendáriumról"; + +Calendar._TT["ABOUT"] = +"DHTML dátum/idõ kiválasztó\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"a legfrissebb verzió megtalálható: http://www.dynarch.com/projects/calendar/\n" + +"GNU LGPL alatt terjesztve. Lásd a http://gnu.org/licenses/lgpl.html oldalt a részletekhez." + +"\n\n" + +"Dátum választás:\n" + +"- használja a \xab, \xbb gombokat az év kiválasztásához\n" + +"- használja a " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gombokat a hónap kiválasztásához\n" + +"- tartsa lenyomva az egérgombot a gyors választáshoz."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Idõ választás:\n" + +"- kattintva növelheti az idõt\n" + +"- shift-tel kattintva csökkentheti\n" + +"- lenyomva tartva és húzva gyorsabban kiválaszthatja."; + +Calendar._TT["PREV_YEAR"] = "Elõzõ év (tartsa nyomva a menühöz)"; +Calendar._TT["PREV_MONTH"] = "Elõzõ hónap (tartsa nyomva a menühöz)"; +Calendar._TT["GO_TODAY"] = "Mai napra ugrás"; +Calendar._TT["NEXT_MONTH"] = "Köv. hónap (tartsa nyomva a menühöz)"; +Calendar._TT["NEXT_YEAR"] = "Köv. év (tartsa nyomva a menühöz)"; +Calendar._TT["SEL_DATE"] = "Válasszon dátumot"; +Calendar._TT["DRAG_TO_MOVE"] = "Húzza a mozgatáshoz"; +Calendar._TT["PART_TODAY"] = " (ma)"; + +// 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"] = "%s legyen a hét elsõ napja"; + +// 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"] = "Bezár"; +Calendar._TT["TODAY"] = "Ma"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikk vagy húzás az érték változtatásához"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b %e, %a"; + +Calendar._TT["WK"] = "hét"; +Calendar._TT["TIME"] = "idõ:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-it.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-it.js new file mode 100644 index 0000000000..7f84cde01f --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-it.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translator: Fabio Di Bernardini, +// 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 +("Domenica", + "Lunedì", + "Martedì", + "Mercoledì", + "Giovedì", + "Venerdì", + "Sabato", + "Domenica"); + +// 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 +("Dom", + "Lun", + "Mar", + "Mer", + "Gio", + "Ven", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Gennaio", + "Febbraio", + "Marzo", + "Aprile", + "Maggio", + "Giugno", + "Luglio", + "Augosto", + "Settembre", + "Ottobre", + "Novembre", + "Dicembre"); + +// short month names +Calendar._SMN = new Array +("Gen", + "Feb", + "Mar", + "Apr", + "Mag", + "Giu", + "Lug", + "Ago", + "Set", + "Ott", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Informazioni sul calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Per gli aggiornamenti: http://www.dynarch.com/projects/calendar/\n" + +"Distribuito sotto licenza GNU LGPL. Vedi http://gnu.org/licenses/lgpl.html per i dettagli." + +"\n\n" + +"Selezione data:\n" + +"- Usa \xab, \xbb per selezionare l'anno\n" + +"- Usa " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per i mesi\n" + +"- Tieni premuto a lungo il mouse per accedere alle funzioni di selezione veloce."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selezione orario:\n" + +"- Clicca sul numero per incrementarlo\n" + +"- o Shift+click per decrementarlo\n" + +"- o click e sinistra o destra per variarlo."; + +Calendar._TT["PREV_YEAR"] = "Anno prec.(clicca a lungo per il menù)"; +Calendar._TT["PREV_MONTH"] = "Mese prec. (clicca a lungo per il menù)"; +Calendar._TT["GO_TODAY"] = "Oggi"; +Calendar._TT["NEXT_MONTH"] = "Pross. mese (clicca a lungo per il menù)"; +Calendar._TT["NEXT_YEAR"] = "Pross. anno (clicca a lungo per il menù)"; +Calendar._TT["SEL_DATE"] = "Seleziona data"; +Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostarlo"; +Calendar._TT["PART_TODAY"] = " (oggi)"; + +// 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"] = "Mostra prima %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"] = "Chiudi"; +Calendar._TT["TODAY"] = "Oggi"; +Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per cambiare il valore"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a:%b:%e"; + +Calendar._TT["WK"] = "set"; +Calendar._TT["TIME"] = "Ora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-jp.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-jp.js new file mode 100644 index 0000000000..3bca7ebf60 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-jp.js @@ -0,0 +1,45 @@ +// ** I18N +Calendar._DN = new Array +("“ú", + "ŒŽ", + "‰Î", + "…", + "–Ø", + "‹à", + "“y", + "“ú"); +Calendar._MN = new Array +("1ŒŽ", + "2ŒŽ", + "3ŒŽ", + "4ŒŽ", + "5ŒŽ", + "6ŒŽ", + "7ŒŽ", + "8ŒŽ", + "9ŒŽ", + "10ŒŽ", + "11ŒŽ", + "12ŒŽ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "T‚Ìʼn‚Ì—j“ú‚ðØ‚è‘Ö‚¦"; +Calendar._TT["PREV_YEAR"] = "‘O”N"; +Calendar._TT["PREV_MONTH"] = "‘OŒŽ"; +Calendar._TT["GO_TODAY"] = "¡“ú"; +Calendar._TT["NEXT_MONTH"] = "—‚ŒŽ"; +Calendar._TT["NEXT_YEAR"] = "—‚”N"; +Calendar._TT["SEL_DATE"] = "“ú•t‘I‘ð"; +Calendar._TT["DRAG_TO_MOVE"] = "ƒEƒBƒ“ƒhƒE‚̈ړ®"; +Calendar._TT["PART_TODAY"] = " (¡“ú)"; +Calendar._TT["MON_FIRST"] = "ŒŽ—j“ú‚ðæ“ª‚É"; +Calendar._TT["SUN_FIRST"] = "“ú—j“ú‚ðæ“ª‚É"; +Calendar._TT["CLOSE"] = "•‚¶‚é"; +Calendar._TT["TODAY"] = "¡“ú"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "%mŒŽ %d“ú (%a)"; + +Calendar._TT["WK"] = "T"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko-utf8.js new file mode 100644 index 0000000000..035dd748d3 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko-utf8.js @@ -0,0 +1,120 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translation: Yourim Yi +// Encoding: EUC-KR +// lang : ko +// 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 +("ì¼ìš”ì¼", + "월요ì¼", + "화요ì¼", + "수요ì¼", + "목요ì¼", + "금요ì¼", + "토요ì¼", + "ì¼ìš”ì¼"); + +// 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 +("ì¼", + "ì›”", + "í™”", + "수", + "목", + "금", + "토", + "ì¼"); + +// full month names +Calendar._MN = new Array +("1ì›”", + "2ì›”", + "3ì›”", + "4ì›”", + "5ì›”", + "6ì›”", + "7ì›”", + "8ì›”", + "9ì›”", + "10ì›”", + "11ì›”", + "12ì›”"); + +// short month names +Calendar._SMN = new Array +("1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "calendar ì— ëŒ€í•´ì„œ"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"\n"+ +"최신 ë²„ì „ì„ ë°›ìœ¼ì‹œë ¤ë©´ http://www.dynarch.com/projects/calendar/ ì— ë°©ë¬¸í•˜ì„¸ìš”\n" + +"\n"+ +"GNU LGPL ë¼ì´ì„¼ìŠ¤ë¡œ ë°°í¬ë©ë‹ˆë‹¤. \n"+ +"ë¼ì´ì„¼ìŠ¤ì— ëŒ€í•œ ìžì„¸í•œ ë‚´ìš©ì€ http://gnu.org/licenses/lgpl.html ì„ ì½ìœ¼ì„¸ìš”." + +"\n\n" + +"ë‚ ì§œ ì„ íƒ:\n" + +"- ì—°ë„를 ì„ íƒí•˜ë ¤ë©´ \xab, \xbb ë²„íŠ¼ì„ ì‚¬ìš©í•©ë‹ˆë‹¤\n" + +"- ë‹¬ì„ ì„ íƒí•˜ë ¤ë©´ " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ë²„íŠ¼ì„ ëˆ„ë¥´ì„¸ìš”\n" + +"- ê³„ì† ëˆ„ë¥´ê³  있으면 위 ê°’ë“¤ì„ ë¹ ë¥´ê²Œ ì„ íƒí•˜ì‹¤ 수 있습니다."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"시간 ì„ íƒ:\n" + +"- 마우스로 누르면 ì‹œê°„ì´ ì¦ê°€í•©ë‹ˆë‹¤\n" + +"- Shift 키와 함께 누르면 ê°ì†Œí•©ë‹ˆë‹¤\n" + +"- 누른 ìƒíƒœì—서 마우스를 움ì§ì´ë©´ 좀 ë” ë¹ ë¥´ê²Œ ê°’ì´ ë³€í•©ë‹ˆë‹¤.\n"; + +Calendar._TT["PREV_YEAR"] = "지난 í•´ (길게 누르면 목ë¡)"; +Calendar._TT["PREV_MONTH"] = "지난 달 (길게 누르면 목ë¡)"; +Calendar._TT["GO_TODAY"] = "오늘 날짜로"; +Calendar._TT["NEXT_MONTH"] = "ë‹¤ìŒ ë‹¬ (길게 누르면 목ë¡)"; +Calendar._TT["NEXT_YEAR"] = "ë‹¤ìŒ í•´ (길게 누르면 목ë¡)"; +Calendar._TT["SEL_DATE"] = "날짜를 ì„ íƒí•˜ì„¸ìš”"; +Calendar._TT["DRAG_TO_MOVE"] = "마우스 드래그로 ì´ë™ 하세요"; +Calendar._TT["PART_TODAY"] = " (오늘)"; +Calendar._TT["MON_FIRST"] = "월요ì¼ì„ 한 ì£¼ì˜ ì‹œìž‘ ìš”ì¼ë¡œ"; +Calendar._TT["SUN_FIRST"] = "ì¼ìš”ì¼ì„ 한 ì£¼ì˜ ì‹œìž‘ ìš”ì¼ë¡œ"; +Calendar._TT["CLOSE"] = "닫기"; +Calendar._TT["TODAY"] = "오늘"; +Calendar._TT["TIME_PART"] = "(Shift-)í´ë¦­ ë˜ëŠ” 드래그 하세요"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]"; + +Calendar._TT["WK"] = "주"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko.js new file mode 100644 index 0000000000..8cddf58645 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ko.js @@ -0,0 +1,120 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translation: Yourim Yi +// Encoding: EUC-KR +// lang : ko +// 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 +("ÀÏ¿äÀÏ", + "¿ù¿äÀÏ", + "È­¿äÀÏ", + "¼ö¿äÀÏ", + "¸ñ¿äÀÏ", + "±Ý¿äÀÏ", + "Åä¿äÀÏ", + "ÀÏ¿äÀÏ"); + +// 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 +("ÀÏ", + "¿ù", + "È­", + "¼ö", + "¸ñ", + "±Ý", + "Åä", + "ÀÏ"); + +// full month names +Calendar._MN = new Array +("1¿ù", + "2¿ù", + "3¿ù", + "4¿ù", + "5¿ù", + "6¿ù", + "7¿ù", + "8¿ù", + "9¿ù", + "10¿ù", + "11¿ù", + "12¿ù"); + +// short month names +Calendar._SMN = new Array +("1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "calendar ¿¡ ´ëÇØ¼­"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"\n"+ +"ÃֽйöÀüÀ» ¹ÞÀ¸½Ã·Á¸é http://www.dynarch.com/projects/calendar/ ¿¡ ¹æ¹®Çϼ¼¿ä\n" + +"\n"+ +"GNU LGPL ¶óÀ̼¾½º·Î ¹èÆ÷µË´Ï´Ù. \n"+ +"¶óÀ̼¾½º¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº http://gnu.org/licenses/lgpl.html À» ÀÐÀ¸¼¼¿ä." + +"\n\n" + +"³¯Â¥ ¼±ÅÃ:\n" + +"- ¿¬µµ¸¦ ¼±ÅÃÇÏ·Á¸é \xab, \xbb ¹öưÀ» »ç¿ëÇÕ´Ï´Ù\n" + +"- ´ÞÀ» ¼±ÅÃÇÏ·Á¸é " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ¹öưÀ» ´©¸£¼¼¿ä\n" + +"- °è¼Ó ´©¸£°í ÀÖÀ¸¸é À§ °ªµéÀ» ºü¸£°Ô ¼±ÅÃÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"½Ã°£ ¼±ÅÃ:\n" + +"- ¸¶¿ì½º·Î ´©¸£¸é ½Ã°£ÀÌ Áõ°¡ÇÕ´Ï´Ù\n" + +"- Shift Ű¿Í ÇÔ²² ´©¸£¸é °¨¼ÒÇÕ´Ï´Ù\n" + +"- ´©¸¥ »óÅ¿¡¼­ ¸¶¿ì½º¸¦ ¿òÁ÷À̸é Á» ´õ ºü¸£°Ô °ªÀÌ º¯ÇÕ´Ï´Ù.\n"; + +Calendar._TT["PREV_YEAR"] = "Áö³­ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["PREV_MONTH"] = "Áö³­ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["GO_TODAY"] = "¿À´Ã ³¯Â¥·Î"; +Calendar._TT["NEXT_MONTH"] = "´ÙÀ½ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["NEXT_YEAR"] = "´ÙÀ½ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["SEL_DATE"] = "³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä"; +Calendar._TT["DRAG_TO_MOVE"] = "¸¶¿ì½º µå·¡±×·Î À̵¿ Çϼ¼¿ä"; +Calendar._TT["PART_TODAY"] = " (¿À´Ã)"; +Calendar._TT["MON_FIRST"] = "¿ù¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î"; +Calendar._TT["SUN_FIRST"] = "ÀÏ¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î"; +Calendar._TT["CLOSE"] = "´Ý±â"; +Calendar._TT["TODAY"] = "¿À´Ã"; +Calendar._TT["TIME_PART"] = "(Shift-)Ŭ¸¯ ¶Ç´Â µå·¡±× Çϼ¼¿ä"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]"; + +Calendar._TT["WK"] = "ÁÖ"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt-utf8.js new file mode 100644 index 0000000000..d39653be27 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt-utf8.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar LT language +// Author: Martynas Majeris, +// Encoding: UTF-8 +// 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 +("Sekmadienis", + "Pirmadienis", + "Antradienis", + "TreÄiadienis", + "Ketvirtadienis", + "Pentadienis", + "Å eÅ¡tadienis", + "Sekmadienis"); + +// 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 +("Sek", + "Pir", + "Ant", + "Tre", + "Ket", + "Pen", + "Å eÅ¡", + "Sek"); + +// full month names +Calendar._MN = new Array +("Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Gegužė", + "Birželis", + "Liepa", + "RugpjÅ«tis", + "RugsÄ—jis", + "Spalis", + "Lapkritis", + "Gruodis"); + +// short month names +Calendar._SMN = new Array +("Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spa", + "Lap", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Apie kalendorių"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"NaujausiÄ… versijÄ… rasite: http://www.dynarch.com/projects/calendar/\n" + +"Platinamas pagal GNU LGPL licencijÄ…. Aplankykite http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Datos pasirinkimas:\n" + +"- Metų pasirinkimas: \xab, \xbb\n" + +"- MÄ—nesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- Nuspauskite ir laikykite pelÄ—s klavišą greitesniam pasirinkimui."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laiko pasirinkimas:\n" + +"- Spustelkite ant valandų arba minuÄių - skaiÄius padidÄ—s vienetu.\n" + +"- Jei spausite kartu su Shift, skaiÄius sumažės.\n" + +"- Greitam pasirinkimui spustelkite ir pajudinkite pelÄ™."; + +Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)"; +Calendar._TT["PREV_MONTH"] = "Ankstesnis mÄ—nuo (laikykite, jei norite meniu)"; +Calendar._TT["GO_TODAY"] = "Pasirinkti Å¡iandienÄ…"; +Calendar._TT["NEXT_MONTH"] = "Kitas mÄ—nuo (laikykite, jei norite meniu)"; +Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)"; +Calendar._TT["SEL_DATE"] = "Pasirinkite datÄ…"; +Calendar._TT["DRAG_TO_MOVE"] = "Tempkite"; +Calendar._TT["PART_TODAY"] = " (Å¡iandien)"; +Calendar._TT["MON_FIRST"] = "Pirma savaitÄ—s diena - pirmadienis"; +Calendar._TT["SUN_FIRST"] = "Pirma savaitÄ—s diena - sekmadienis"; +Calendar._TT["CLOSE"] = "Uždaryti"; +Calendar._TT["TODAY"] = "Å iandien"; +Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d"; + +Calendar._TT["WK"] = "sav"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt.js new file mode 100644 index 0000000000..43b93d6810 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lt.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar LT language +// Author: Martynas Majeris, +// Encoding: Windows-1257 +// 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 +("Sekmadienis", + "Pirmadienis", + "Antradienis", + "Treèiadienis", + "Ketvirtadienis", + "Pentadienis", + "Ðeðtadienis", + "Sekmadienis"); + +// 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 +("Sek", + "Pir", + "Ant", + "Tre", + "Ket", + "Pen", + "Ðeð", + "Sek"); + +// full month names +Calendar._MN = new Array +("Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Geguþë", + "Birþelis", + "Liepa", + "Rugpjûtis", + "Rugsëjis", + "Spalis", + "Lapkritis", + "Gruodis"); + +// short month names +Calendar._SMN = new Array +("Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spa", + "Lap", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Apie kalendoriø"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Naujausià versijà rasite: http://www.dynarch.com/projects/calendar/\n" + +"Platinamas pagal GNU LGPL licencijà. Aplankykite http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Datos pasirinkimas:\n" + +"- Metø pasirinkimas: \xab, \xbb\n" + +"- Mënesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- Nuspauskite ir laikykite pelës klaviðà greitesniam pasirinkimui."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laiko pasirinkimas:\n" + +"- Spustelkite ant valandø arba minuèiø - skaièus padidës vienetu.\n" + +"- Jei spausite kartu su Shift, skaièius sumaþës.\n" + +"- Greitam pasirinkimui spustelkite ir pajudinkite pelæ."; + +Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)"; +Calendar._TT["PREV_MONTH"] = "Ankstesnis mënuo (laikykite, jei norite meniu)"; +Calendar._TT["GO_TODAY"] = "Pasirinkti ðiandienà"; +Calendar._TT["NEXT_MONTH"] = "Kitas mënuo (laikykite, jei norite meniu)"; +Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)"; +Calendar._TT["SEL_DATE"] = "Pasirinkite datà"; +Calendar._TT["DRAG_TO_MOVE"] = "Tempkite"; +Calendar._TT["PART_TODAY"] = " (ðiandien)"; +Calendar._TT["MON_FIRST"] = "Pirma savaitës diena - pirmadienis"; +Calendar._TT["SUN_FIRST"] = "Pirma savaitës diena - sekmadienis"; +Calendar._TT["CLOSE"] = "Uþdaryti"; +Calendar._TT["TODAY"] = "Ðiandien"; +Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d"; + +Calendar._TT["WK"] = "sav"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lv.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lv.js new file mode 100644 index 0000000000..407699d36d --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-lv.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar LV language +// Author: Juris Valdovskis, +// Encoding: cp1257 +// 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 +("Svçtdiena", + "Pirmdiena", + "Otrdiena", + "Treðdiena", + "Ceturdiena", + "Piektdiena", + "Sestdiena", + "Svçtdiena"); + +// 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 +("Sv", + "Pr", + "Ot", + "Tr", + "Ce", + "Pk", + "Se", + "Sv"); + +// full month names +Calendar._MN = new Array +("Janvâris", + "Februâris", + "Marts", + "Aprîlis", + "Maijs", + "Jûnijs", + "Jûlijs", + "Augusts", + "Septembris", + "Oktobris", + "Novembris", + "Decembris"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jûn", + "Jûl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Par kalendâru"; + +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" + +"Datuma izvçle:\n" + +"- Izmanto \xab, \xbb pogas, lai izvçlçtos gadu\n" + +"- Izmanto " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "pogas, lai izvçlçtos mçnesi\n" + +"- Turi nospiestu peles pogu uz jebkuru no augstâk minçtajâm pogâm, lai paâtrinâtu izvçli."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laika izvçle:\n" + +"- Uzklikðíini uz jebkuru no laika daïâm, lai palielinâtu to\n" + +"- vai Shift-klikðíis, lai samazinâtu to\n" + +"- vai noklikðíini un velc uz attiecîgo virzienu lai mainîtu âtrâk."; + +Calendar._TT["PREV_YEAR"] = "Iepr. gads (turi izvçlnei)"; +Calendar._TT["PREV_MONTH"] = "Iepr. mçnesis (turi izvçlnei)"; +Calendar._TT["GO_TODAY"] = "Ðodien"; +Calendar._TT["NEXT_MONTH"] = "Nâkoðais mçnesis (turi izvçlnei)"; +Calendar._TT["NEXT_YEAR"] = "Nâkoðais gads (turi izvçlnei)"; +Calendar._TT["SEL_DATE"] = "Izvçlies datumu"; +Calendar._TT["DRAG_TO_MOVE"] = "Velc, lai pârvietotu"; +Calendar._TT["PART_TODAY"] = " (ðodien)"; + +// 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"] = "Attçlot %s kâ pirmo"; + +// 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"] = "1,7"; + +Calendar._TT["CLOSE"] = "Aizvçrt"; +Calendar._TT["TODAY"] = "Ðodien"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikðíis vai pârvieto, lai mainîtu"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Laiks:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-nl.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-nl.js new file mode 100644 index 0000000000..a1dea94bdb --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-nl.js @@ -0,0 +1,73 @@ +// ** I18N +Calendar._DN = new Array +("Zondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrijdag", + "Zaterdag", + "Zondag"); + +Calendar._SDN_len = 2; + +Calendar._MN = new Array +("Januari", + "Februari", + "Maart", + "April", + "Mei", + "Juni", + "Juli", + "Augustus", + "September", + "Oktober", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Info"; + +Calendar._TT["ABOUT"] = +"DHTML Datum/Tijd Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + +"Ga voor de meest recente versie naar: http://www.dynarch.com/projects/calendar/\n" + +"Verspreid onder de GNU LGPL. Zie http://gnu.org/licenses/lgpl.html voor details." + +"\n\n" + +"Datum selectie:\n" + +"- Gebruik de \xab \xbb knoppen om een jaar te selecteren\n" + +"- Gebruik de " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knoppen om een maand te selecteren\n" + +"- Houd de muis ingedrukt op de genoemde knoppen voor een snellere selectie."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Tijd selectie:\n" + +"- Klik op een willekeurig onderdeel van het tijd gedeelte om het te verhogen\n" + +"- of Shift-klik om het te verlagen\n" + +"- of klik en sleep voor een snellere selectie."; + +//Calendar._TT["TOGGLE"] = "Selecteer de eerste week-dag"; +Calendar._TT["PREV_YEAR"] = "Vorig jaar (ingedrukt voor menu)"; +Calendar._TT["PREV_MONTH"] = "Vorige maand (ingedrukt voor menu)"; +Calendar._TT["GO_TODAY"] = "Ga naar Vandaag"; +Calendar._TT["NEXT_MONTH"] = "Volgende maand (ingedrukt voor menu)"; +Calendar._TT["NEXT_YEAR"] = "Volgend jaar (ingedrukt voor menu)"; +Calendar._TT["SEL_DATE"] = "Selecteer datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Klik en sleep om te verplaatsen"; +Calendar._TT["PART_TODAY"] = " (vandaag)"; +//Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; +//Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; + +Calendar._TT["DAY_FIRST"] = "Toon %s eerst"; + +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Sluiten"; +Calendar._TT["TODAY"] = "(vandaag)"; +Calendar._TT["TIME_PART"] = "(Shift-)Klik of sleep om de waarde te veranderen"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b %Y"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Tijd:"; \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-no.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-no.js new file mode 100644 index 0000000000..d9297d179a --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-no.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar NO language +// Author: Daniel Holmen, +// Encoding: UTF-8 +// 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 +("Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag", + "Søndag"); + +// 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 +("Søn", + "Man", + "Tir", + "Ons", + "Tor", + "Fre", + "Lør", + "Søn"); + +// full month names +Calendar._MN = new Array +("Januar", + "Februar", + "Mars", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Desember"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om kalenderen"; + +Calendar._TT["ABOUT"] = +"DHTML Dato-/Tidsvelger\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For nyeste versjon, gÃ¥ til: http://www.dynarch.com/projects/calendar/\n" + +"Distribuert under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detaljer." + +"\n\n" + +"Datovalg:\n" + +"- Bruk knappene \xab og \xbb for Ã¥ velge Ã¥r\n" + +"- Bruk knappene " + String.fromCharCode(0x2039) + " og " + String.fromCharCode(0x203a) + " for Ã¥ velge mÃ¥ned\n" + +"- Hold inne musknappen eller knappene over for raskere valg."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Tidsvalg:\n" + +"- Klikk pÃ¥ en av tidsdelene for Ã¥ øke den\n" + +"- eller Shift-klikk for Ã¥ senke verdien\n" + +"- eller klikk-og-dra for raskere valg.."; + +Calendar._TT["PREV_YEAR"] = "Forrige. Ã¥r (hold for meny)"; +Calendar._TT["PREV_MONTH"] = "Forrige. mÃ¥ned (hold for meny)"; +Calendar._TT["GO_TODAY"] = "GÃ¥ til idag"; +Calendar._TT["NEXT_MONTH"] = "Neste mÃ¥ned (hold for meny)"; +Calendar._TT["NEXT_YEAR"] = "Neste Ã¥r (hold for meny)"; +Calendar._TT["SEL_DATE"] = "Velg dato"; +Calendar._TT["DRAG_TO_MOVE"] = "Dra for Ã¥ flytte"; +Calendar._TT["PART_TODAY"] = " (idag)"; +Calendar._TT["MON_FIRST"] = "Vis mandag først"; +Calendar._TT["SUN_FIRST"] = "Vis søndag først"; +Calendar._TT["CLOSE"] = "Lukk"; +Calendar._TT["TODAY"] = "Idag"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikk eller dra for Ã¥ endre verdi"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "uke"; \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl-utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl-utf8.js new file mode 100644 index 0000000000..6b8ca67aa2 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl-utf8.js @@ -0,0 +1,93 @@ +// ** I18N + +// Calendar PL language +// Author: Dariusz Pietrzak, +// Author: Janusz Piwowarski, +// Encoding: utf-8 +// Distributed under the same terms as the calendar itself. + +Calendar._DN = new Array +("Niedziela", + "PoniedziaÅ‚ek", + "Wtorek", + "Åšroda", + "Czwartek", + "PiÄ…tek", + "Sobota", + "Niedziela"); +Calendar._SDN = new Array +("Nie", + "Pn", + "Wt", + "Åšr", + "Cz", + "Pt", + "So", + "Nie"); +Calendar._MN = new Array +("StyczeÅ„", + "Luty", + "Marzec", + "KwiecieÅ„", + "Maj", + "Czerwiec", + "Lipiec", + "SierpieÅ„", + "WrzesieÅ„", + "Październik", + "Listopad", + "GrudzieÅ„"); +Calendar._SMN = new Array +("Sty", + "Lut", + "Mar", + "Kwi", + "Maj", + "Cze", + "Lip", + "Sie", + "Wrz", + "Paź", + "Lis", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendarzu"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Aby pobrać najnowszÄ… wersjÄ™, odwiedź: http://www.dynarch.com/projects/calendar/\n" + +"DostÄ™pny na licencji GNU LGPL. Zobacz szczegóły na http://gnu.org/licenses/lgpl.html." + +"\n\n" + +"Wybór daty:\n" + +"- Użyj przycisków \xab, \xbb by wybrać rok\n" + +"- Użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " by wybrać miesiÄ…c\n" + +"- Przytrzymaj klawisz myszy nad jednym z powyższych przycisków dla szybszego wyboru."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Wybór czasu:\n" + +"- Kliknij na jednym z pól czasu by zwiÄ™kszyć jego wartość\n" + +"- lub kliknij trzymajÄ…c Shift by zmiejszyć jego wartość\n" + +"- lub kliknij i przeciÄ…gnij dla szybszego wyboru."; + +//Calendar._TT["TOGGLE"] = "ZmieÅ„ pierwszy dzieÅ„ tygodnia"; +Calendar._TT["PREV_YEAR"] = "Poprzedni rok (przytrzymaj dla menu)"; +Calendar._TT["PREV_MONTH"] = "Poprzedni miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["GO_TODAY"] = "Idź do dzisiaj"; +Calendar._TT["NEXT_MONTH"] = "NastÄ™pny miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["NEXT_YEAR"] = "NastÄ™pny rok (przytrzymaj dla menu)"; +Calendar._TT["SEL_DATE"] = "Wybierz datÄ™"; +Calendar._TT["DRAG_TO_MOVE"] = "PrzeciÄ…gnij by przesunąć"; +Calendar._TT["PART_TODAY"] = " (dzisiaj)"; +Calendar._TT["MON_FIRST"] = "WyÅ›wietl poniedziaÅ‚ek jako pierwszy"; +Calendar._TT["SUN_FIRST"] = "WyÅ›wietl niedzielÄ™ jako pierwszÄ…"; +Calendar._TT["CLOSE"] = "Zamknij"; +Calendar._TT["TODAY"] = "Dzisiaj"; +Calendar._TT["TIME_PART"] = "(Shift-)Kliknij lub przeciÄ…gnij by zmienić wartość"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %B, %A"; + +Calendar._TT["WK"] = "ty"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl.js new file mode 100644 index 0000000000..76e0551ab6 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pl.js @@ -0,0 +1,56 @@ +// ** I18N +// Calendar PL language +// Author: Artur Filipiak, +// January, 2004 +// Encoding: UTF-8 +Calendar._DN = new Array +("Niedziela", "PoniedziaÅ‚ek", "Wtorek", "Åšroda", "Czwartek", "PiÄ…tek", "Sobota", "Niedziela"); + +Calendar._SDN = new Array +("N", "Pn", "Wt", "Åšr", "Cz", "Pt", "So", "N"); + +Calendar._MN = new Array +("StyczeÅ„", "Luty", "Marzec", "KwiecieÅ„", "Maj", "Czerwiec", "Lipiec", "SierpieÅ„", "WrzesieÅ„", "Październik", "Listopad", "GrudzieÅ„"); + +Calendar._SMN = new Array +("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendarzu"; + +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" + +"Wybór daty:\n" + +"- aby wybrać rok użyj przycisków \xab, \xbb\n" + +"- aby wybrać miesiÄ…c użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- aby przyspieszyć wybór przytrzymaj wciÅ›niÄ™ty przycisk myszy nad ww. przyciskami."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Wybór czasu:\n" + +"- aby zwiÄ™kszyć wartość kliknij na dowolnym elemencie selekcji czasu\n" + +"- aby zmniejszyć wartość użyj dodatkowo klawisza Shift\n" + +"- możesz również poruszać myszkÄ™ w lewo i prawo wraz z wciÅ›niÄ™tym lewym klawiszem."; + +Calendar._TT["PREV_YEAR"] = "Poprz. rok (przytrzymaj dla menu)"; +Calendar._TT["PREV_MONTH"] = "Poprz. miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["GO_TODAY"] = "Pokaż dziÅ›"; +Calendar._TT["NEXT_MONTH"] = "Nast. miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["NEXT_YEAR"] = "Nast. rok (przytrzymaj dla menu)"; +Calendar._TT["SEL_DATE"] = "Wybierz datÄ™"; +Calendar._TT["DRAG_TO_MOVE"] = "PrzesuÅ„ okienko"; +Calendar._TT["PART_TODAY"] = " (dziÅ›)"; +Calendar._TT["MON_FIRST"] = "Pokaż PoniedziaÅ‚ek jako pierwszy"; +Calendar._TT["SUN_FIRST"] = "Pokaż NiedzielÄ™ jako pierwszÄ…"; +Calendar._TT["CLOSE"] = "Zamknij"; +Calendar._TT["TODAY"] = "DziÅ›"; +Calendar._TT["TIME_PART"] = "(Shift-)klik | drag, aby zmienić wartość"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y.%m.%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pt.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pt.js new file mode 100644 index 0000000000..deee8a19ed --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-pt.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar pt_BR language +// Author: Adalberto Machado, +// 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 +("Domingo", + "Segunda", + "Terca", + "Quarta", + "Quinta", + "Sexta", + "Sabado", + "Domingo"); + +// 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 +("Dom", + "Seg", + "Ter", + "Qua", + "Qui", + "Sex", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Janeiro", + "Fevereiro", + "Marco", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre o calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Ultima versao visite: http://www.dynarch.com/projects/calendar/\n" + +"Distribuido sobre GNU LGPL. Veja http://gnu.org/licenses/lgpl.html para detalhes." + +"\n\n" + +"Selecao de data:\n" + +"- Use os botoes \xab, \xbb para selecionar o ano\n" + +"- Use os botoes " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mes\n" + +"- Segure o botao do mouse em qualquer um desses botoes para selecao rapida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selecao de hora:\n" + +"- Clique em qualquer parte da hora para incrementar\n" + +"- ou Shift-click para decrementar\n" + +"- ou clique e segure para selecao rapida."; + +Calendar._TT["PREV_YEAR"] = "Ant. ano (segure para menu)"; +Calendar._TT["PREV_MONTH"] = "Ant. mes (segure para menu)"; +Calendar._TT["GO_TODAY"] = "Hoje"; +Calendar._TT["NEXT_MONTH"] = "Prox. mes (segure para menu)"; +Calendar._TT["NEXT_YEAR"] = "Prox. ano (segure para menu)"; +Calendar._TT["SEL_DATE"] = "Selecione a data"; +Calendar._TT["DRAG_TO_MOVE"] = "Arraste para mover"; +Calendar._TT["PART_TODAY"] = " (hoje)"; + +// 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"] = "Mostre %s primeiro"; + +// 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"] = "Fechar"; +Calendar._TT["TODAY"] = "Hoje"; +Calendar._TT["TIME_PART"] = "(Shift-)Click ou arraste para mudar valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b"; + +Calendar._TT["WK"] = "sm"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ro.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ro.js new file mode 100644 index 0000000000..116e358ba2 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ro.js @@ -0,0 +1,66 @@ +// ** I18N +Calendar._DN = new Array +("Duminică", + "Luni", + "MarÅ£i", + "Miercuri", + "Joi", + "Vineri", + "Sâmbătă", + "Duminică"); +Calendar._SDN_len = 2; +Calendar._MN = new Array +("Ianuarie", + "Februarie", + "Martie", + "Aprilie", + "Mai", + "Iunie", + "Iulie", + "August", + "Septembrie", + "Octombrie", + "Noiembrie", + "Decembrie"); + +// tooltips +Calendar._TT = {}; + +Calendar._TT["INFO"] = "Despre calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Pentru ultima versiune vizitaÅ£i: http://www.dynarch.com/projects/calendar/\n" + +"Distribuit sub GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"SelecÅ£ia datei:\n" + +"- FolosiÅ£i butoanele \xab, \xbb pentru a selecta anul\n" + +"- FolosiÅ£i butoanele " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pentru a selecta luna\n" + +"- TineÅ£i butonul mouse-ului apăsat pentru selecÅ£ie mai rapidă."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"SelecÅ£ia orei:\n" + +"- Click pe ora sau minut pentru a mări valoarea cu 1\n" + +"- Sau Shift-Click pentru a micÅŸora valoarea cu 1\n" + +"- Sau Click ÅŸi drag pentru a selecta mai repede."; + +Calendar._TT["PREV_YEAR"] = "Anul precedent (lung pt menu)"; +Calendar._TT["PREV_MONTH"] = "Luna precedentă (lung pt menu)"; +Calendar._TT["GO_TODAY"] = "Data de azi"; +Calendar._TT["NEXT_MONTH"] = "Luna următoare (lung pt menu)"; +Calendar._TT["NEXT_YEAR"] = "Anul următor (lung pt menu)"; +Calendar._TT["SEL_DATE"] = "Selectează data"; +Calendar._TT["DRAG_TO_MOVE"] = "Trage pentru a miÅŸca"; +Calendar._TT["PART_TODAY"] = " (astăzi)"; +Calendar._TT["DAY_FIRST"] = "AfiÅŸează %s prima zi"; +Calendar._TT["WEEKEND"] = "0,6"; +Calendar._TT["CLOSE"] = "ÃŽnchide"; +Calendar._TT["TODAY"] = "Astăzi"; +Calendar._TT["TIME_PART"] = "(Shift-)Click sau drag pentru a selecta"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %d %B"; + +Calendar._TT["WK"] = "spt"; +Calendar._TT["TIME"] = "Ora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru.js new file mode 100644 index 0000000000..9f75a6a432 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar RU language +// Translation: Sly Golovanov, http://golovanov.net, +// 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 +("воÑкреÑенье", + "понедельник", + "вторник", + "Ñреда", + "четверг", + "пÑтница", + "Ñуббота", + "воÑкреÑенье"); + +// 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 +("вÑк", + "пон", + "втр", + "Ñрд", + "чет", + "пÑÑ‚", + "Ñуб", + "вÑк"); + +// full month names +Calendar._MN = new Array +("Ñнварь", + "февраль", + "март", + "апрель", + "май", + "июнь", + "июль", + "авгуÑÑ‚", + "ÑентÑбрь", + "октÑбрь", + "ноÑбрь", + "декабрь"); + +// short month names +Calendar._SMN = new Array +("Ñнв", + "фев", + "мар", + "апр", + "май", + "июн", + "июл", + "авг", + "Ñен", + "окт", + "ноÑ", + "дек"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "О календаре..."; + +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" + +"Как выбрать дату:\n" + +"- При помощи кнопок \xab, \xbb можно выбрать год\n" + +"- При помощи кнопок " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " можно выбрать меÑÑц\n" + +"- Подержите Ñти кнопки нажатыми, чтобы поÑвилоÑÑŒ меню быÑтрого выбора."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Как выбрать времÑ:\n" + +"- При клике на чаÑах или минутах они увеличиваютÑÑ\n" + +"- при клике Ñ Ð½Ð°Ð¶Ð°Ñ‚Ð¾Ð¹ клавишей Shift они уменьшаютÑÑ\n" + +"- еÑли нажать и двигать мышкой влево/вправо, они будут менÑтьÑÑ Ð±Ñ‹Ñтрее."; + +Calendar._TT["PREV_YEAR"] = "Ðа год назад (удерживать Ð´Ð»Ñ Ð¼ÐµÐ½ÑŽ)"; +Calendar._TT["PREV_MONTH"] = "Ðа меÑÑц назад (удерживать Ð´Ð»Ñ Ð¼ÐµÐ½ÑŽ)"; +Calendar._TT["GO_TODAY"] = "СегоднÑ"; +Calendar._TT["NEXT_MONTH"] = "Ðа меÑÑц вперед (удерживать Ð´Ð»Ñ Ð¼ÐµÐ½ÑŽ)"; +Calendar._TT["NEXT_YEAR"] = "Ðа год вперед (удерживать Ð´Ð»Ñ Ð¼ÐµÐ½ÑŽ)"; +Calendar._TT["SEL_DATE"] = "Выберите дату"; +Calendar._TT["DRAG_TO_MOVE"] = "ПеретаÑкивайте мышкой"; +Calendar._TT["PART_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"] = "Первый день недели будет %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"] = "Закрыть"; +Calendar._TT["TODAY"] = "СегоднÑ"; +Calendar._TT["TIME_PART"] = "(Shift-)клик или нажать и двигать"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a"; + +Calendar._TT["WK"] = "нед"; +Calendar._TT["TIME"] = "ВремÑ:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru_win_.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru_win_.js new file mode 100644 index 0000000000..de455afa08 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-ru_win_.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar RU language +// Translation: Sly Golovanov, http://golovanov.net, +// 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 +("âîñêðåñåíüå", + "ïîíåäåëüíèê", + "âòîðíèê", + "ñðåäà", + "÷åòâåðã", + "ïÿòíèöà", + "ñóááîòà", + "âîñêðåñåíüå"); + +// 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 +("âñê", + "ïîí", + "âòð", + "ñðä", + "÷åò", + "ïÿò", + "ñóá", + "âñê"); + +// full month names +Calendar._MN = new Array +("ÿíâàðü", + "ôåâðàëü", + "ìàðò", + "àïðåëü", + "ìàé", + "èþíü", + "èþëü", + "àâãóñò", + "ñåíòÿáðü", + "îêòÿáðü", + "íîÿáðü", + "äåêàáðü"); + +// short month names +Calendar._SMN = new Array +("ÿíâ", + "ôåâ", + "ìàð", + "àïð", + "ìàé", + "èþí", + "èþë", + "àâã", + "ñåí", + "îêò", + "íîÿ", + "äåê"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Î êàëåíäàðå..."; + +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" + +"Êàê âûáðàòü äàòó:\n" + +"- Ïðè ïîìîùè êíîïîê \xab, \xbb ìîæíî âûáðàòü ãîä\n" + +"- Ïðè ïîìîùè êíîïîê " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ìîæíî âûáðàòü ìåñÿö\n" + +"- Ïîäåðæèòå ýòè êíîïêè íàæàòûìè, ÷òîáû ïîÿâèëîñü ìåíþ áûñòðîãî âûáîðà."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Êàê âûáðàòü âðåìÿ:\n" + +"- Ïðè êëèêå íà ÷àñàõ èëè ìèíóòàõ îíè óâåëè÷èâàþòñÿ\n" + +"- ïðè êëèêå ñ íàæàòîé êëàâèøåé Shift îíè óìåíüøàþòñÿ\n" + +"- åñëè íàæàòü è äâèãàòü ìûøêîé âëåâî/âïðàâî, îíè áóäóò ìåíÿòüñÿ áûñòðåå."; + +Calendar._TT["PREV_YEAR"] = "Íà ãîä íàçàä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["PREV_MONTH"] = "Íà ìåñÿö íàçàä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["GO_TODAY"] = "Ñåãîäíÿ"; +Calendar._TT["NEXT_MONTH"] = "Íà ìåñÿö âïåðåä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["NEXT_YEAR"] = "Íà ãîä âïåðåä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["SEL_DATE"] = "Âûáåðèòå äàòó"; +Calendar._TT["DRAG_TO_MOVE"] = "Ïåðåòàñêèâàéòå ìûøêîé"; +Calendar._TT["PART_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"] = "Ïåðâûé äåíü íåäåëè áóäåò %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"] = "Çàêðûòü"; +Calendar._TT["TODAY"] = "Ñåãîäíÿ"; +Calendar._TT["TIME_PART"] = "(Shift-)êëèê èëè íàæàòü è äâèãàòü"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a"; + +Calendar._TT["WK"] = "íåä"; +Calendar._TT["TIME"] = "Âðåìÿ:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-si.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-si.js new file mode 100644 index 0000000000..100c522e4d --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-si.js @@ -0,0 +1,94 @@ +/* Slovenian language file for the DHTML Calendar version 0.9.2 +* Author David Milost , January 2004. +* Feel free to use this script under the terms of the GNU Lesser General +* Public License, as long as you do not remove or alter this notice. +*/ + // full day names +Calendar._DN = new Array +("Nedelja", + "Ponedeljek", + "Torek", + "Sreda", + "ÄŒetrtek", + "Petek", + "Sobota", + "Nedelja"); + // short day names + Calendar._SDN = new Array +("Ned", + "Pon", + "Tor", + "Sre", + "ÄŒet", + "Pet", + "Sob", + "Ned"); +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec"); + // full month names +Calendar._MN = new Array +("Januar", + "Februar", + "Marec", + "April", + "Maj", + "Junij", + "Julij", + "Avgust", + "September", + "Oktober", + "November", + "December"); + +// tooltips +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O koledarju"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Za zadnjo verzijo pojdine na naslov: http://www.dynarch.com/projects/calendar/\n" + +"Distribuirano pod GNU LGPL. Poglejte http://gnu.org/licenses/lgpl.html za podrobnosti." + +"\n\n" + +"Izbor datuma:\n" + +"- Uporabite \xab, \xbb gumbe za izbor leta\n" + +"- Uporabite " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gumbe za izbor meseca\n" + +"- Zadržite klik na kateremkoli od zgornjih gumbov za hiter izbor."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Izbor ćasa:\n" + +"- Kliknite na katerikoli del ćasa za poveć. le-tega\n" + +"- ali Shift-click za zmanj. le-tega\n" + +"- ali kliknite in povlecite za hiter izbor."; + +Calendar._TT["TOGGLE"] = "Spremeni dan s katerim se prićne teden"; +Calendar._TT["PREV_YEAR"] = "Predhodnje leto (dolg klik za meni)"; +Calendar._TT["PREV_MONTH"] = "Predhodnji mesec (dolg klik za meni)"; +Calendar._TT["GO_TODAY"] = "Pojdi na tekoći dan"; +Calendar._TT["NEXT_MONTH"] = "Naslednji mesec (dolg klik za meni)"; +Calendar._TT["NEXT_YEAR"] = "Naslednje leto (dolg klik za meni)"; +Calendar._TT["SEL_DATE"] = "Izberite datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Pritisni in povleci za spremembo pozicije"; +Calendar._TT["PART_TODAY"] = " (danes)"; +Calendar._TT["MON_FIRST"] = "Prikaži ponedeljek kot prvi dan"; +Calendar._TT["SUN_FIRST"] = "Prikaži nedeljo kot prvi dan"; +Calendar._TT["CLOSE"] = "Zapri"; +Calendar._TT["TODAY"] = "Danes"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Ted"; \ No newline at end of file diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sk.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sk.js new file mode 100644 index 0000000000..4fe6a3c8bb --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sk.js @@ -0,0 +1,99 @@ +// ** I18N + +// Calendar SK language +// Author: Peter Valach (pvalach@gmx.net) +// Encoding: utf-8 +// Last update: 2003/10/29 +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("NedeÄľa", + "Pondelok", + "Utorok", + "Streda", + "Ĺ tvrtok", + "Piatok", + "Sobota", + "NedeÄľa"); + +// short day names +Calendar._SDN = new Array +("Ned", + "Pon", + "Uto", + "Str", + "Ĺ tv", + "Pia", + "Sob", + "Ned"); + +// full month names +Calendar._MN = new Array +("Január", + "Február", + "Marec", + "AprĂ­l", + "Máj", + "JĂşn", + "JĂşl", + "August", + "September", + "OktĂłber", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Máj", + "JĂşn", + "JĂşl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendári"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + +"PoslednĂş verziu nájdete na: http://www.dynarch.com/projects/calendar/\n" + +"DistribuovanĂ© pod GNU LGPL. ViÄŹ http://gnu.org/licenses/lgpl.html pre detaily." + +"\n\n" + +"VÄ‚Ëber dátumu:\n" + +"- PouĹľite tlaÄŤidlá \xab, \xbb pre vÄ‚Ëber roku\n" + +"- PouĹľite tlaÄŤidlá " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pre vÄ‚Ëber mesiaca\n" + +"- Ak ktorĂ©koÄľvek z tÄ‚Ëchto tlaÄŤidiel podržíte dlhšie, zobrazĂ­ sa rÄ‚Ëchly vÄ‚Ëber."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"VÄ‚Ëber ÄŤasu:\n" + +"- Kliknutie na niektorĂş poloĹľku ÄŤasu ju zvĂ˚i\n" + +"- Shift-klik ju znĂ­Ĺľi\n" + +"- Ak podržíte tlaÄŤĂ­tko stlaÄŤenĂ©, posĂşvanĂ­m menĂ­te hodnotu."; + +Calendar._TT["PREV_YEAR"] = "PredošlÄ‚Ë rok (podrĹľte pre menu)"; +Calendar._TT["PREV_MONTH"] = "PredošlÄ‚Ë mesiac (podrĹľte pre menu)"; +Calendar._TT["GO_TODAY"] = "PrejsĹĄ na dnešok"; +Calendar._TT["NEXT_MONTH"] = "Nasl. mesiac (podrĹľte pre menu)"; +Calendar._TT["NEXT_YEAR"] = "Nasl. rok (podrĹľte pre menu)"; +Calendar._TT["SEL_DATE"] = "ZvoÄľte dátum"; +Calendar._TT["DRAG_TO_MOVE"] = "PodrĹľanĂ­m tlaÄŤĂ­tka zmenĂ­te polohu"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "ZobraziĹĄ pondelok ako prvÄ‚Ë"; +Calendar._TT["SUN_FIRST"] = "ZobraziĹĄ nedeÄľu ako prvĂş"; +Calendar._TT["CLOSE"] = "ZavrieĹĄ"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)klik/ĹĄahanie zmenĂ­ hodnotu"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "$d. %m. %Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e. %b"; + +Calendar._TT["WK"] = "tÄ‚ËĹľ"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sp.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sp.js new file mode 100644 index 0000000000..239d1b3be9 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sp.js @@ -0,0 +1,110 @@ +// ** I18N + +// Calendar SP language +// Author: Rafael Velasco +// 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 +("Domingo", + "Lunes", + "Martes", + "Miercoles", + "Jueves", + "Viernes", + "Sabado", + "Domingo"); + +Calendar._SDN = new Array +("Dom", + "Lun", + "Mar", + "Mie", + "Jue", + "Vie", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre"); + +// short month names +Calendar._SMN = new Array +("Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Información del Calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Nuevas versiones en: http://www.dynarch.com/projects/calendar/\n" + +"Distribuida bajo licencia GNU LGPL. Para detalles vea http://gnu.org/licenses/lgpl.html ." + +"\n\n" + +"Selección de Fechas:\n" + +"- Use \xab, \xbb para seleccionar el año\n" + +"- Use " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" + +"- Mantenga presionado el botón del ratón en cualquiera de las opciones superiores para un acceso rapido ."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selección del Reloj:\n" + +"- Seleccione la hora para cambiar el reloj\n" + +"- o presione Shift-click para disminuirlo\n" + +"- o presione click y arrastre del ratón para una selección rapida."; + +Calendar._TT["PREV_YEAR"] = "Año anterior (Presione para menu)"; +Calendar._TT["PREV_MONTH"] = "Mes Anterior (Presione para menu)"; +Calendar._TT["GO_TODAY"] = "Ir a Hoy"; +Calendar._TT["NEXT_MONTH"] = "Mes Siguiente (Presione para menu)"; +Calendar._TT["NEXT_YEAR"] = "Año Siguiente (Presione para menu)"; +Calendar._TT["SEL_DATE"] = "Seleccione fecha"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastre y mueva"; +Calendar._TT["PART_TODAY"] = " (Hoy)"; + +// 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"] = "Mostrar %s primero"; + +// 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"] = "Cerrar"; +Calendar._TT["TODAY"] = "Hoy"; +Calendar._TT["TIME_PART"] = "(Shift-)Click o arrastra para cambar el valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%dd-%mm-%yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y"; + +Calendar._TT["WK"] = "Sm"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sv.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sv.js new file mode 100644 index 0000000000..db1f4b84c3 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-sv.js @@ -0,0 +1,93 @@ +// ** I18N + +// Calendar SV language (Swedish, svenska) +// Author: Mihai Bazon, +// Translation team: +// Translator: Leonard Norrgård +// Last translator: Leonard Norrgård +// Encoding: iso-latin-1 +// 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 +("söndag", + "måndag", + "tisdag", + "onsdag", + "torsdag", + "fredag", + "lördag", + "söndag"); + +// 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. +Calendar._SDN_len = 2; +Calendar._SMN_len = 3; + +// full month names +Calendar._MN = new Array +("januari", + "februari", + "mars", + "april", + "maj", + "juni", + "juli", + "augusti", + "september", + "oktober", + "november", + "december"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om kalendern"; + +Calendar._TT["ABOUT"] = +"DHTML Datum/tid-väljare\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"För senaste version gå till: http://www.dynarch.com/projects/calendar/\n" + +"Distribueras under GNU LGPL. Se http://gnu.org/licenses/lgpl.html för detaljer." + +"\n\n" + +"Val av datum:\n" + +"- Använd knapparna \xab, \xbb för att välja år\n" + +"- Använd knapparna " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " för att välja månad\n" + +"- Håll musknappen nedtryckt på någon av ovanstående knappar för snabbare val."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Val av tid:\n" + +"- Klicka på en del av tiden för att öka den delen\n" + +"- eller skift-klicka för att minska den\n" + +"- eller klicka och drag för snabbare val."; + +Calendar._TT["PREV_YEAR"] = "Föregående år (håll för menu)"; +Calendar._TT["PREV_MONTH"] = "Föregående månad (håll för menu)"; +Calendar._TT["GO_TODAY"] = "Gå till dagens datum"; +Calendar._TT["NEXT_MONTH"] = "Följande månad (håll för menu)"; +Calendar._TT["NEXT_YEAR"] = "Följande år (håll för menu)"; +Calendar._TT["SEL_DATE"] = "Välj datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag för att flytta"; +Calendar._TT["PART_TODAY"] = " (idag)"; +Calendar._TT["MON_FIRST"] = "Visa måndag först"; +Calendar._TT["SUN_FIRST"] = "Visa söndag först"; +Calendar._TT["CLOSE"] = "Stäng"; +Calendar._TT["TODAY"] = "Idag"; +Calendar._TT["TIME_PART"] = "(Skift-)klicka eller drag för att ändra tid"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A %d %b %Y"; + +Calendar._TT["WK"] = "vecka"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-tr.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-tr.js new file mode 100644 index 0000000000..f2c906c46c --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-tr.js @@ -0,0 +1,58 @@ +////////////////////////////////////////////////////////////////////////////////////////////// +// Turkish Translation by Nuri AKMAN +// Location: Ankara/TURKEY +// e-mail : nuriakman@hotmail.com +// Date : April, 9 2003 +// +// Note: if Turkish Characters does not shown on you screen +// please include falowing line your html code: +// +// +// +////////////////////////////////////////////////////////////////////////////////////////////// + +// ** I18N +Calendar._DN = new Array +("Pazar", + "Pazartesi", + "Salý", + "Çarþamba", + "Perþembe", + "Cuma", + "Cumartesi", + "Pazar"); +Calendar._MN = new Array +("Ocak", + "Þubat", + "Mart", + "Nisan", + "Mayýs", + "Haziran", + "Temmuz", + "Aðustos", + "Eylül", + "Ekim", + "Kasým", + "Aralýk"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Haftanýn ilk gününü kaydýr"; +Calendar._TT["PREV_YEAR"] = "Önceki Yýl (Menü için basýlý tutunuz)"; +Calendar._TT["PREV_MONTH"] = "Önceki Ay (Menü için basýlý tutunuz)"; +Calendar._TT["GO_TODAY"] = "Bugün'e git"; +Calendar._TT["NEXT_MONTH"] = "Sonraki Ay (Menü için basýlý tutunuz)"; +Calendar._TT["NEXT_YEAR"] = "Sonraki Yýl (Menü için basýlý tutunuz)"; +Calendar._TT["SEL_DATE"] = "Tarih seçiniz"; +Calendar._TT["DRAG_TO_MOVE"] = "Taþýmak için sürükleyiniz"; +Calendar._TT["PART_TODAY"] = " (bugün)"; +Calendar._TT["MON_FIRST"] = "Takvim Pazartesi gününden baþlasýn"; +Calendar._TT["SUN_FIRST"] = "Takvim Pazar gününden baþlasýn"; +Calendar._TT["CLOSE"] = "Kapat"; +Calendar._TT["TODAY"] = "Bugün"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "d MM y, DD"; + +Calendar._TT["WK"] = "Hafta"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-zh.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-zh.js new file mode 100644 index 0000000000..4a0feb6b73 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/calendar-zh.js @@ -0,0 +1,119 @@ +// ** I18N + +// Calendar ZH language +// Author: muziq, +// Encoding: GB2312 or GBK +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("ÐÇÆÚÈÕ", + "ÐÇÆÚÒ»", + "ÐÇÆÚ¶þ", + "ÐÇÆÚÈý", + "ÐÇÆÚËÄ", + "ÐÇÆÚÎå", + "ÐÇÆÚÁù", + "ÐÇÆÚÈÕ"); + +// 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 +("ÈÕ", + "Ò»", + "¶þ", + "Èý", + "ËÄ", + "Îå", + "Áù", + "ÈÕ"); + +// full month names +Calendar._MN = new Array +("Ò»ÔÂ", + "¶þÔÂ", + "ÈýÔÂ", + "ËÄÔÂ", + "ÎåÔÂ", + "ÁùÔÂ", + "ÆßÔÂ", + "°ËÔÂ", + "¾ÅÔÂ", + "Ê®ÔÂ", + "ʮһÔÂ", + "Ê®¶þÔÂ"); + +// short month names +Calendar._SMN = new Array +("Ò»ÔÂ", + "¶þÔÂ", + "ÈýÔÂ", + "ËÄÔÂ", + "ÎåÔÂ", + "ÁùÔÂ", + "ÆßÔÂ", + "°ËÔÂ", + "¾ÅÔÂ", + "Ê®ÔÂ", + "ʮһÔÂ", + "Ê®¶þÔÂ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "°ïÖú"; + +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" + +"Ñ¡ÔñÈÕÆÚ:\n" + +"- µã»÷ \xab, \xbb °´Å¥Ñ¡ÔñÄê·Ý\n" + +"- µã»÷ " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " °´Å¥Ñ¡ÔñÔ·Ý\n" + +"- ³¤°´ÒÔÉϰ´Å¥¿É´Ó²Ëµ¥ÖпìËÙÑ¡ÔñÄê·Ý»òÔ·Ý"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Ñ¡Ôñʱ¼ä:\n" + +"- µã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼ÓÒ»\n" + +"- °´×¡Shift¼üµã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼õÒ»\n" + +"- µã»÷Í϶¯Êó±ê¿É½øÐпìËÙÑ¡Ôñ"; + +Calendar._TT["PREV_YEAR"] = "ÉÏÒ»Äê (°´×¡³ö²Ëµ¥)"; +Calendar._TT["PREV_MONTH"] = "ÉÏÒ»Ô (°´×¡³ö²Ëµ¥)"; +Calendar._TT["GO_TODAY"] = "תµ½½ñÈÕ"; +Calendar._TT["NEXT_MONTH"] = "ÏÂÒ»Ô (°´×¡³ö²Ëµ¥)"; +Calendar._TT["NEXT_YEAR"] = "ÏÂÒ»Äê (°´×¡³ö²Ëµ¥)"; +Calendar._TT["SEL_DATE"] = "Ñ¡ÔñÈÕÆÚ"; +Calendar._TT["DRAG_TO_MOVE"] = "Í϶¯"; +Calendar._TT["PART_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"] = "×î×ó±ßÏÔʾ%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"] = "¹Ø±Õ"; +Calendar._TT["TODAY"] = "½ñÈÕ"; +Calendar._TT["TIME_PART"] = "(Shift-)µã»÷Êó±ê»òÍ϶¯¸Ä±äÖµ"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %b %eÈÕ"; + +Calendar._TT["WK"] = "ÖÜ"; +Calendar._TT["TIME"] = "ʱ¼ä:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/cn_utf8.js b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/cn_utf8.js new file mode 100644 index 0000000000..de61b4618d --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/lang/cn_utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Translator : Niko +// 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 +("\u5468\u65e5",//\u5468\u65e5 + "\u5468\u4e00",//\u5468\u4e00 + "\u5468\u4e8c",//\u5468\u4e8c + "\u5468\u4e09",//\u5468\u4e09 + "\u5468\u56db",//\u5468\u56db + "\u5468\u4e94",//\u5468\u4e94 + "\u5468\u516d",//\u5468\u516d + "\u5468\u65e5");//\u5468\u65e5 + +// 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 +("\u5468\u65e5", + "\u5468\u4e00", + "\u5468\u4e8c", + "\u5468\u4e09", + "\u5468\u56db", + "\u5468\u4e94", + "\u5468\u516d", + "\u5468\u65e5"); + +// full month names +Calendar._MN = new Array +("\u4e00\u6708", + "\u4e8c\u6708", + "\u4e09\u6708", + "\u56db\u6708", + "\u4e94\u6708", + "\u516d\u6708", + "\u4e03\u6708", + "\u516b\u6708", + "\u4e5d\u6708", + "\u5341\u6708", + "\u5341\u4e00\u6708", + "\u5341\u4e8c\u6708"); + +// short month names +Calendar._SMN = new Array +("\u4e00\u6708", + "\u4e8c\u6708", + "\u4e09\u6708", + "\u56db\u6708", + "\u4e94\u6708", + "\u516d\u6708", + "\u4e03\u6708", + "\u516b\u6708", + "\u4e5d\u6708", + "\u5341\u6708", + "\u5341\u4e00\u6708", + "\u5341\u4e8c\u6708"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "\u5173\u4e8e"; + +Calendar._TT["ABOUT"] = +" DHTML \u65e5\u8d77/\u65f6\u95f4\u9009\u62e9\u63a7\u4ef6\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: \u6700\u65b0\u7248\u672c\u8bf7\u767b\u9646http://www.dynarch.com/projects/calendar/\u5bdf\u770b\n" + +"\u9075\u5faaGNU LGPL. \u7ec6\u8282\u53c2\u9605 http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"\u65e5\u671f\u9009\u62e9:\n" + +"- \u70b9\u51fb\xab(\xbb)\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e00\u5e74\u5ea6.\n" + +"- \u70b9\u51fb" + String.fromCharCode(0x2039) + "(" + String.fromCharCode(0x203a) + ")\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e2a\u6708\u4efd.\n" + +"- \u957f\u65f6\u95f4\u6309\u7740\u6309\u94ae\u5c06\u51fa\u73b0\u66f4\u591a\u9009\u62e9\u9879."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"\u65f6\u95f4\u9009\u62e9:\n" + +"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u589e\u52a0\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\n" + +"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u6309\u4f4fShift\u952e\u540e\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u51cf\u5c11\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)."; + +Calendar._TT["PREV_YEAR"] = "\u4e0a\u4e00\u5e74"; +Calendar._TT["PREV_MONTH"] = "\u4e0a\u4e2a\u6708"; +Calendar._TT["GO_TODAY"] = "\u5230\u4eca\u5929"; +Calendar._TT["NEXT_MONTH"] = "\u4e0b\u4e2a\u6708"; +Calendar._TT["NEXT_YEAR"] = "\u4e0b\u4e00\u5e74"; +Calendar._TT["SEL_DATE"] = "\u9009\u62e9\u65e5\u671f"; +Calendar._TT["DRAG_TO_MOVE"] = "\u62d6\u52a8"; +Calendar._TT["PART_TODAY"] = " (\u4eca\u5929)"; + +// 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"] = "%s\u4e3a\u8fd9\u5468\u7684\u7b2c\u4e00\u5929"; + +// 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"] = "\u5173\u95ed"; +Calendar._TT["TODAY"] = "\u4eca\u5929"; +Calendar._TT["TIME_PART"] = "(\u6309\u7740Shift\u952e)\u5355\u51fb\u6216\u62d6\u52a8\u6539\u53d8\u503c"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e\u65e5"; + +Calendar._TT["WK"] = "\u5468"; +Calendar._TT["TIME"] = "\u65f6\u95f4:"; diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow.gif new file mode 100644 index 0000000000..ed2dee0e63 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow2.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow2.gif new file mode 100644 index 0000000000..40c0aadfc6 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/menuarrow2.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/multiple-dates.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/multiple-dates.html new file mode 100644 index 0000000000..caf1920d29 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/multiple-dates.html @@ -0,0 +1,82 @@ + + + Sample for the multiple dates feature + + + + + + + + + + + + + + +

Sample for the multiple dates feature

+ +

+ Starting version 0.9.7, + the calendar is able to handle multiple dates selection, in either + flat or popup form. For this to happen one needs to pass the + "multiple: true" parameter to + Calendar.setup and to install an onUpdate + handler that watches for modifications. +

+ + [open calendar...] + +
+ + + +
+
mishoo
+ Last modified: Thu Mar 3 20:17:42 EET 2005 + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/release-notes.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/release-notes.html new file mode 100644 index 0000000000..9addddbe2e --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/release-notes.html @@ -0,0 +1,435 @@ + + + + jscalendar release notes + + + + + +
+ The Coolest DHTML Calendar
+ © Dynarch.com 2002 and later. +
+

jscalendar release notes

+ +

This release compiled at Monday, 7 Mar 2005 (19:06).

+ +

1.0

+ +
    + +
  • + Added support for multiple dates selection. In this mode the + calendar will allow the user to select more than one date, and + will maintain an array of selected dates that can be + investigated from your custom handlers. Sample in multiple-dates.html. +
  • + +
  • + Support for “day infoâ€. Using this feature you can display + custom information for certain dates. Sample in dayinfo.html. Note that if the text + is really big the calendar layout might appear somehow broken; + this is something that should be easy to fix in the CSS file. +
  • + +
  • + Clicking on “Today†will now close the calendar if the current + date is already selected. +
  • + +
  • + The “first day of week†setting can now be defined in the + language file--after all, it is locale-specific. The new + parameter is “Calendar._FDâ€. Language files should be + updated, but the calendar will not complain nor fail to + function if the parameter is not present. +
  • + +
  • + Some fixes to make the thing work in Safari. It now seems to + be properly supported, please let me know if you encounter any + problems. +
  • + +
  • + New skin: Aqua theme, appropriate for MacOSX fan sites :-) + This theme is located in “skins/aqua/theme.css†(in the + future, all themes will go to this directory). +
  • + +
  • + Bug fixes. +
      +
    • + Keyboard operation now functions normally when the + calendar is displaying days from adjacent months; it might + even work correctly for months containing disabled dates + :). This fix was originally developed under contract for + The + Zapatec Calendar. Zapatec kindly allowed us to + include the bugfixes back in the open source calendar. +
    • +
    • + Fixed the time selection bug: the previous version would + reset the time to current time when a new date was + clicked. +
    • +
    • + Parsing hours like "12:XX pm" would wrongfully replace + "pm" with "am"--fixed. +
    • +
    • + Fixed critical bugs in parseDate function that would + initialize the calendar with 'NaN' values in all cells if + the string to be parsed is not a valid date. +
    • +
    • + The golbal variable that we are using was renamed to + “_dynarch_popupCalendar†to minimize the risk of name + clashes. It's still difficult to get rid of it. +
    • +
    • + Added z-index property to drop-down menus style. +
    • +
    • + The calendar will update an input field even in flat mode, + if an input field was passed. Also, the “showOthers†+ parameter will be effective in both popup and flat mode. +
    • +
    • + Others, probably. +
    • +
    +
  • + +
  • + Documentation & sample files updated. +
  • + +
+ +

0.9.6

+ +
    + +
  • + "Smart" (TM :-) positioning algorithm. The new algorithm will + try to keep the calendar in the browser view, which is helpful + in situations when the input field is near the bottom or the + right edge. This code is only tested with IE and Mozilla, but + it should work with other browsers too. Many thanks to Sunny Chowdhury for sponsoring + this feature! +
  • + +
  • + Support for IE5/Win is back. I also want to thank Janusz + Piwowarski for keeping his eye on the CVS ;-) He reviewed my + IE5-related changes and sent me a much cleaner patch. +
  • + +
  • + The calendar will now allow any day of week to be "the first + day of week". This was requested long time ago, by someone + whose name I forgot (sorry). The reason was that in certain + countries weeks start on Saturday. So I thought that instead + of having a "mondayFirst" and a "saturdayFirst" parameter, + :-), it's better to have a "firstDayOfWeek" parameter; now + it's present and its meaning is: "0 for Sunday", "1 for + Monday", "2 for Tuesday", etc. The equivalent parameter for + Calendar.setup is "firstDay". The end user can also change + it very easy: click on the day name in the calendar display. +
  • + +
  • + The above feature triggered one important change: the + notion of "weekend" is now defined in the language file. + Added parameters: + +
    +          Calendar._TT["WEEKEND"] = "0,6";
    +          Calendar._TT["DAY_FIRST"] = "Display %s first";
    + + "WEEKEND" specifies a string with comma-separated numbers from + 0 to 7; they define what days are marked as "weekend". 5 and + 6 mean, of course, "Sunday" and "Saturday". Day first is the + tooltip displayed when a day name is hovered; "%s" will get + replaced with the day name. Updated languages are "en" and + "ro", which I maintain. Please note that languages wich are + not updated will not work. If yours is one of them, + please consider fixing it and sending me the fix so that I can + include it in the distro. +
  • + +
  • + The calendar can now display days from the months adjacent to + the currently displayed one. This is optional, of course, and + the parameter name is "showsOtherMonths" (or "showOthers" in + Calendar.setup). All theme files were updated. +
  • + +
  • + Displays "Time:" near the time selector, only if defined in + the language file. +
  • + +
  • + Some bugs fixed in the date parsing code (which has also been + rewritten a little bit cleaner). +
  • + +
  • + Calendar.setup will now configure the calendar to trigger the + input fields' "onchange" event, if specified, when a date is + selected. +
  • + +
  • + New parameter in Calendar.setup: "cache" (defaults to + false). If set to true then the popup calendar object + will be "cached", meaning, it will be created only once, no + matter how many input fields are there in the page. Sometimes + this is not desirable, which is why I've added this + parameter. Please note that it defaults to "false" (thus the + default behavior has changed). +
  • + +
  • + Added a simple PHP wrapper. It provides code which loads all + the required scripts and theme file, and one function which + creates and configures an input field for date input. It + takes care of creating and assigning unique ID-s for the + calendar fields and it also creates the "Calendar.setup" code. + Functions to create more specialized fields can be added very + easily. This feature was requested by the FreeMED.org project + (thanks for donating!). +
  • + +
+ +

Wow, there were quite some changes :-D Enjoy it!

+ +

0.9.5

+ +

+ This release's primary goal is to fix a wrong license statement which + can be found in some files from 0.9.4. For instance in README or + calendar.js, the statement was that the code is distributed under the + GNU GPL; that's because I had plans to change the license, then + changed my mind but unfortunately I committed files so. I am sorry + for this inconvenience, please use the latest (0.9.5) release which is + fully covered by LGPL. +

+ +

Other changes:

+ +
    + +
  • + Fixed an annoying bug that prevented the calendar to display + correctly when it was configured for an input field inside a + scrolling area. Many thanks to Ian Barrack (Simban.com) who pointed it up and + donated quite some money for the Calendar project! +
  • + +
  • + All examples use UTF-8 now; the translations may not be all + up-to-date, but I strongly suggest everyone to use + UTF-8; other encodings are a plain mess. So far I know for sure + that Romanian translation will work with UTF-8 and not + anymore with ISO-8859-2. Other translations are probably + usable under UTF-8, but if your preferred language isn't... ;-) + please make it and send it to me for inclusion. +
  • + +
  • + Fixed small bug in the documentation (one footnote didn't appear + where it should have). +
  • + +
  • + Updated translations: DE, ES, HU, IT, RO. Thanks to everyone who + sent translations! +
  • + +
+ +

0.9.4

+ +

New stuff

+ +
    + +
  • Supports time selection. Yes. ;-) This work has been largely + sponsored by Himanshukumar Shah (thank you!). See + the docs and example files for details on how to setup.
  • + +
  • Easy to link 2 or more fields by using the new + onUpdate parameter of Calendar.setup. This + is useful, say, to automatically set a value in a second field based + on the value selected in the first field. See the documentation and + first sample in simple-1.html.
  • + +
  • Other Calendar.setup low-level parameters, for those + wanting to have the complete control: onSelect and + onClose. The handlers are called when something is + selected in the calendar or when the calendar is closed.
  • + +
  • The translation files can optionally include the short day names + and the short month names. That's because in some languages, like + German, the short form is not the first 3 letters of the entire name + but only the first 2. Also in other languages short names can't be + as easily derived from the full name by just calling substr, so this + patch solves the problem.
  • + +
  • Implemented a nice way to make some dates "special" (look + different). Specifically, the setDisabledHandler method + was replaced with the more general setDateStatusHandler + method (the old one is still available for backwards compatibility but + will be removed). More details about this in the + documentation. Also see simple-3.html + for a live sample.
  • + +
  • Date parsing and formatting engine is now rewritten and supports a + subset of strftime format specifiers from ANSI C. This + makes it possible to use dates like "YYYYMMDD" (the corresponding + format for this would be "%Y%m%d"). Details in the documentation. + Please note that the new engine is not compatibile with older + calendar releases!
  • + +
  • Along with the new date parser I workarounded an unpleasant crash + that occurred in IE when certain accented characters appeared in the + texts. I think German was one of the language with such problems, and + the workaround was to use the letter without an accent. Well, now you + can translate to whatever you want.
  • + +
  • "Fixes" (I mean, "horrible workarounds") for Konqueror (and + hopefully Safari). Unfortunately, this otherwise excellent browser + still has some bugs that keep the calendar from working + exactly as it should.. But they're going to be fixed, + right? ;-)
  • + +
  • CSS themes got pretty much modified too so if you wrote your theme + you need to update it. Aside for the time selector support, the CSS + themes contain a simple hack that makes the navigation buttons show + a little arrow in the lower-right corner which indicates that if one + holds the mouse a menu will appear.
  • + +
+ +

Translation files

+ +

The translation files need to be updated in order for the calendar to + work properly. Currently the only updated files are calendar-en.js + (main file) and calendar-ro.js (well, yes, I am a Romanian ;-).

+ +

Specifically, they need the following:

+ +
    + +
  • Correct date format, according with the new format specifiers + introduced in 0.9.4. Details about the available format specifiers + in the documentation
  • + +
  • Short day or month names, if required. If they can be + derived by taking the first N letters of the full name then a simple + Calendar._SDN_len = N or Calendar._SMN_len = N will suffice. If N + is 3 then nothing needs to be done as we take it for granted if no + other option is offered ;-)
  • + +
  • We have some new texts that shows short usage information as well + as copyright information.
  • + +
+ +

If your favorite language is not there yet, or it is but not updated + according to the main calendar-en.js file, then please consider + translating calendar-en.js and send the translation back to me so that + I include it in the official distribution.

+ +

Bug status

+ +

Check SourceForge, + I didn't keep track. However, there were a lot of bugfixes.

+ +

0.9.3

+ +

New stuff

+ +
    + +
  • Opera 7 compatibility — keyboard navigation is + still not available; text selection can't be disabled, leading to an + ugly effect when walking through the month/year menus.
  • + +
  • Ability to align the calendar relative to the input field (or any + other element). Vertical: top, center, bottom. Horizontal: left, + center, right. This is established as a new parameter for + showAtElement.
  • + +
  • Added dateClicked property (boolean). This can be + inspected in the "onSelect" handler to determine if a date was + really clicked or the user only changed month/year using the menus. + You need to check this for "single-click" calendars and + only close/hide the calendar if it's true.
  • + +
  • Full documentation in HTML + and PDF format is now available in the + distribution archive.
  • + +
  • New language definition files: HU, HR, PT, ZH. Thanks those who + submitted!
  • + +
+ +

Bug status

+ +

This covers only those bugs that have been reported at SourceForge.

+ +
    + +
  1. #703,238 — fixed
  2. +
  3. #703,814 — fixed
  4. +
  5. #716,777 — closed (was fixed already in 0.9.2-1)
  6. +
  7. #723,335 — fixed
  8. +
  9. #715,122 — feature request; implemented.
  10. +
  11. #721,206 — fixed (added "refresh()" function)
  12. +
  13. #721,833 — fixed (bug concerning the "yy" format + parsing)
  14. +
  15. #721,833 — won't fix (we won't set the time to + midnight; time might actually be useful when we implement support + for time selection). + +
+ +
+
Mihai Bazon
+ + +Last modified on Wed Oct 29 02:37:07 2003 + + + + + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-1.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-1.html new file mode 100644 index 0000000000..c2a944a1f7 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-1.html @@ -0,0 +1,244 @@ + + + + + +Simple calendar setups [popup calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page lists some common setups for the popup calendar. In + order to see how to do any of them please see the source of this + page. For each example it's structured like this: there's the + <form> that contains the input field, and following there is + the JavaScript snippet that setups that form. An example of + flat calendar is available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +

Basic setup: one input per calendar. Clicking in the input field +activates the calendar. The date format is "%m/%d/%Y %I:%M %p". The +calendar defaults to "single-click mode".

+ +

The example below has been updated to show you how to create "linked" +fields. Basically, when some field is filled with a date, the other +is updated so that the difference between them remains one week. The +property useful here is "onUpdate".

+ +
+ + +
+ + + + + +
+ +

Input field with a trigger button. Clicking the button activates +the calendar. Note that this one needs double-click (singleClick parameter +is explicitely set to false). Also demonstrates the "step" parameter +introduced in 0.9.6 (show all years in drop-down boxes, instead of every +other year as default).

+ +
+ +
+ + + + + +
+ +

Input field with a trigger image. Note that the Calendar.setup +function doesn't care if the trigger is a button, image, or anything else. +Also in this example we setup a different alignment, just to show how it's +done. The input field is read-only (that is set from HTML).

+ +
+ + + +
+
+ + + + + +
+ +

Hidden field, display area. The calendar now puts the date into 2 +elements: one is an input field of type "hidden"—so that the user +can't directly see or modify it— and one is a <span> element in +which the date is displayed. Note that if the trigger is not specified the +calendar will use the displayArea (or inputField as in the first example). +The display area can have it's own format. This is useful if, for instance, +we need to store one format in the database (thus pass it in the input +field) but we wanna show a friendlier format to the end-user.

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + +
+ +

Hidden field, display area, trigger image. Very similar to the +previous example. The difference is that we also have a trigger image.

+ +
+ +
+ +

Your birthday: -- not entered -- .

+ + + + + +
+ +

Hidden field, display area. Very much like the previous examples, +but we now disable some dates (all weekends, that is, Saturdays and +Sundays).

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-2.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-2.html new file mode 100644 index 0000000000..b55bae85b8 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-2.html @@ -0,0 +1,108 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-3.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-3.html new file mode 100644 index 0000000000..c096e872bd --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/simple-3.html @@ -0,0 +1,130 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/active-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/active-bg.gif new file mode 100644 index 0000000000..d608c54698 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/active-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/dark-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/dark-bg.gif new file mode 100644 index 0000000000..1dea48a8f6 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/dark-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/hover-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/hover-bg.gif new file mode 100644 index 0000000000..fbf94fc2c1 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/hover-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/menuarrow.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/menuarrow.gif new file mode 100644 index 0000000000..40c0aadfc6 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/menuarrow.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/normal-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/normal-bg.gif new file mode 100644 index 0000000000..bdb506869e Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/normal-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/rowhover-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/rowhover-bg.gif new file mode 100644 index 0000000000..77153424e2 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/rowhover-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/status-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/status-bg.gif new file mode 100644 index 0000000000..857108c429 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/status-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/theme.css b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/theme.css new file mode 100644 index 0000000000..18dd6cf627 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/theme.css @@ -0,0 +1,236 @@ +/* Distributed as part of The Coolest DHTML Calendar + Author: Mihai Bazon, www.bazon.net/mishoo + Copyright Dynarch.com 2005, www.dynarch.com +*/ + +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #bdb2bf; + font-size: 11px; + color: #000; + cursor: default; + background: url("normal-bg.gif"); + font-family: "trebuchet ms",verdana,tahoma,sans-serif; +} + +.calendar { + border-color: #797979; +} + +/* 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 */ + background: url("title-bg.gif") repeat-x 0 100%; color: #000; + font-weight: bold; +} + +.calendar .nav { + font-family: verdana,tahoma,sans-serif; +} + +.calendar .nav div { + background: transparent url("menuarrow.gif") no-repeat 100% 100%; +} + +.calendar thead tr { background: url("title-bg.gif") repeat-x 0 100%; color: #000; } + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + padding: 2px; + background: url("title-bg.gif") repeat-x 0 100%; color: #000; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #797979; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #c44; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background: url("hover-bg.gif"); + border-bottom: 1px solid #797979; + padding: 2px 2px 1px 2px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background: url("active-bg.gif"); color: #fff; + padding: 3px 1px 0px 3px; + border-bottom: 1px solid #797979; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: url("dark-bg.gif"); +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + font-family: verdana,tahoma,sans-serif; + width: 2em; + color: #000; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #999; +} +.calendar tbody .day.othermonth.oweekend { + color: #f99; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #797979; + background: url("dark-bg.gif"); +} + +.calendar tbody .rowhilite td, +.calendar tbody .rowhilite td.wn { + background: url("rowhover-bg.gif"); +} + +.calendar tbody td.today { font-weight: bold; /* background: url("today-bg.gif") no-repeat 70% 50%; */ } + +.calendar tbody td.hilite { /* Hovered cells */ + background: url("hover-bg.gif"); + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #c44; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid #797979; + padding: 1px 3px 1px 1px; + background: url("active-bg.gif"); color: #fff; +} + +.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 in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + padding: 2px; + background: url("status-bg.gif") repeat-x 0 0; color: #000; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #7c7; + 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-width: 0 1px 1px 1px; + border-style: solid; + border-color: #797979; + background: url("normal-bg.gif"); color: #000; + z-index: 100; + font-size: 90%; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: url("hover-bg.gif"); color: #000; +} + +.calendar .combo .active { + background: url("active-bg.gif"); color: #fff; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #797979; + padding: 1px 0px; + text-align: center; + background: url("dark-bg.gif"); +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 5px 0px 6px; + font-weight: bold; + background: url("normal-bg.gif"); color: #000; +} + +.calendar td.time .hour, +.calendar td.time .minute { + font-family: monospace; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + background: url("hover-bg.gif"); color: #000; +} + +.calendar td.time span.active { + background: url("active-bg.gif"); color: #fff; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/title-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/title-bg.gif new file mode 100644 index 0000000000..6a541b3bc1 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/title-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/today-bg.gif b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/today-bg.gif new file mode 100644 index 0000000000..7161538c3d Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/jscalendar/skins/aqua/today-bg.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/test-position.html b/source/web/jsp/content/xforms/forms/scripts/jscalendar/test-position.html new file mode 100644 index 0000000000..5544871622 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/test-position.html @@ -0,0 +1,40 @@ + + + + + JS Calendar (positioning test) + + + + + + + + + + + + +
+ + + + + + + +
+ + + diff --git a/source/web/jsp/content/xforms/forms/scripts/jscalendar/test.php b/source/web/jsp/content/xforms/forms/scripts/jscalendar/test.php new file mode 100644 index 0000000000..c9c2e288da --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/jscalendar/test.php @@ -0,0 +1,116 @@ + + + + + +Test for calendar.php + + + section; it will "echo" code that loads the calendar +// scripts and theme file. +$calendar->load_files(); + +?> + + + + + + + +

Form submitted

+ + $val) { + echo htmlspecialchars($key) . ' = ' . htmlspecialchars($val) . '
'; +} ?> + + + +

Calendar.php test

+ +
+ Select language: +
+ NOTE: as of this release, 0.9.6, only "EN" and "RO", which I + maintain, function correctly. Other language files do not work + because they need to be updated. If you update some language file, + please consider sending it back to me so that I can include it in the + calendar distribution. +
+
+ +
+ + + + + + + +
+ Date 1: + + make_input_field( + // calendar options go here; see the documentation and/or calendar-setup.js + array('firstDay' => 1, // show Monday first + 'showsTime' => true, + 'showOthers' => true, + 'ifFormat' => '%Y-%m-%d %I:%M %P', + 'timeFormat' => '12'), + // field attributes go here + array('style' => 'width: 15em; color: #840; background-color: #ff8; border: 1px solid #000; text-align: center', + 'name' => 'date1', + 'value' => strftime('%Y-%m-%d %I:%M %P', strtotime('now')))); ?> +
+ +
+ + +
+ + + + + diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/BabelFish.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/BabelFish.js new file mode 100644 index 0000000000..7f16320ad6 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/BabelFish.js @@ -0,0 +1,58 @@ +/* + BabelFish.js - Script for using the AltaVista BabelFish translation service. + Adapted by Foteos Macrides for use with the overlibmws code set. + See http://www.macridesweb.com/oltest/BabelFish.html for a demonstration. + Initial: October 26, 2003 - Last Revised: April 17, 2004 +*/ +OLtrans_en = new Image(); +OLtrans_en.src = "http://babelfish.altavista.com/static/i/af/trans_en.gif" +OLtrans_en_off = new Image(); +OLtrans_en_off.src = "http://babelfish.altavista.com/static/i/af/trans_en_off.gif" + +var OLbfURL = location.href; + +if (location.href.indexOf("babelfish.altavista.com") == -1) { +var BabelFish = +'
' ++'

Note: This page can be viewed in a different language by ' ++'selecting the corresponding flag below.

' ++'

' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'' ++'

' ++'

The translations are done via the AltaVista Babel Fish service.

'; +}else{ +var BabelFish = +'

' ++'

'; +} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/arrow.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/arrow.gif new file mode 100644 index 0000000000..71b08c1b54 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/arrow.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws.js new file mode 100644 index 0000000000..cc41ee4aa6 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws.js @@ -0,0 +1,575 @@ +/* + calendermws.js - Script for generating calender popups and selecting dates for form + submissions. See http://www.macridesweb.com/oltest/calendarmws.html for a demonstration. + Initial: November 9, 2003 - Last Revised: July 9, 2005 + +**** + Original: Kedar R. Bhave (softricks@hotmail.com) + Web Site: http://www.softricks.com + (uses window popups) + + Modifications and customizations to work with the overLIB v3.50 + Author: James B. O'Connor (joconnor@nordenterprises.com) + Web Site: http://www.nordenterprises.com + Developed for use with http://home-owners-assoc.com + Note: while overlib works fine with Netscape 4, this function does not work very + well, since portions of the "over" div end up under other fields on the form and + cannot be seen. If you want to use this with NS4, you'll need to change the + positioning in the overlib() call to make sure the "over" div gets positioned + away from all other form fields + The O'Connor script and many more are available free online at: + The JavaScript Source!! http://javascript.internet.com + + Further modifications made by Foteos Macrides (http://www.macridesweb.com/oltest/) + and Bill McCormick (wpmccormick@freeshell.org) for overlibmws +*/ + +var ggPosX = -1; +var ggPosY = -1; +var ggOnChange = null; + +var ggWinContent = ""; + +var weekend = [0,6]; +var weekendColor = "#e0e0e0"; +var fontface = "Verdana"; +var fontsize = 8; // in "pt" units; used with "font-size" style element + +var gNow = new Date(); + +Calendar.Months = ["January", "February", "March", "April", "May", "June", +"July", "August", "September", "October", "November", "December"]; + +// Non-Leap year Month days.. +Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +// Leap year Month days.. +Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +function Calendar(p_item, p_month, p_year, p_format) { + if ((p_month == null) && (p_year == null)) return; + + if (p_month == null) { + this.gMonthName = null; + this.gMonth = null; + this.gYearly = true; + } else { + this.gMonthName = Calendar.get_month(p_month); + this.gMonth = new Number(p_month); + this.gYearly = false; + } + + this.gYear = p_year; + this.gFormat = p_format; + this.gBGColor = "white"; + this.gFGColor = "black"; + this.gTextColor = "black"; + this.gHeaderColor = "black"; + this.gReturnItem = p_item; +} + +Calendar.get_month = Calendar_get_month; +Calendar.get_daysofmonth = Calendar_get_daysofmonth; +Calendar.calc_month_year = Calendar_calc_month_year; + +function Calendar_get_month(monthNo) { + return Calendar.Months[monthNo]; +} + +function Calendar_get_daysofmonth(monthNo, p_year) { + /* + Check for leap year .. + 1.Years evenly divisible by four are normally leap years, except for... + 2.Years also evenly divisible by 100 are not leap years, except for... + 3.Years also evenly divisible by 400 are leap years. + */ + if ((p_year % 4) == 0) { + if ((p_year % 100) == 0 && (p_year % 400) != 0) + return Calendar.DOMonth[monthNo]; + + return Calendar.lDOMonth[monthNo]; + } else + return Calendar.DOMonth[monthNo]; +} + +function Calendar_calc_month_year(p_Month, p_Year, incr) { + /* + Will return an 1-D array with 1st element being the calculated month + and second being the calculated year + after applying the month increment/decrement as specified by 'incr' parameter. + 'incr' will normally have 1/-1 to navigate thru the months. + */ + var ret_arr = new Array(); + + if (incr == -1) { + // B A C K W A R D + if (p_Month == 0) { + ret_arr[0] = 11; + ret_arr[1] = parseInt(p_Year) - 1; + } else { + ret_arr[0] = parseInt(p_Month) - 1; + ret_arr[1] = parseInt(p_Year); + } + } else if (incr == 1) { + // F O R W A R D + if (p_Month == 11) { + ret_arr[0] = 0; + ret_arr[1] = parseInt(p_Year) + 1; + } else { + ret_arr[0] = parseInt(p_Month) + 1; + ret_arr[1] = parseInt(p_Year); + } + } + return ret_arr; +} + +function Calendar_calc_month_year(p_Month, p_Year, incr) { + /* + Will return an 1-D array with 1st element being the calculated month + and second being the calculated year + after applying the month increment/decrement as specified by 'incr' parameter. + 'incr' will normally have 1/-1 to navigate thru the months. + */ + var ret_arr = new Array(); + + if (incr == -1) { + // B A C K W A R D + if (p_Month == 0) { + ret_arr[0] = 11; + ret_arr[1] = parseInt(p_Year) - 1; + } else { + ret_arr[0] = parseInt(p_Month) - 1; + ret_arr[1] = parseInt(p_Year); + } + } else if (incr == 1) { + // F O R W A R D + if (p_Month == 11) { + ret_arr[0] = 0; + ret_arr[1] = parseInt(p_Year) + 1; + } else { + ret_arr[0] = parseInt(p_Month) + 1; + ret_arr[1] = parseInt(p_Year); + } + } + return ret_arr; +} + +// This is for compatibility with Navigator 3, we have to create and discard one object +// before the prototype object exists. +new Calendar(); + +Calendar.prototype.getMonthlyCalendarCode = function() { + var vCode = ""; + var vHeader_Code = ""; + var vData_Code = ""; + + // Begin Table Drawing code here.. + vCode += ('
"); + + vHeader_Code = this.cal_header(); + vData_Code = this.cal_data(); + vCode += (vHeader_Code + vData_Code); + + vCode += '
'; + + return vCode; +} + +Calendar.prototype.show = function() { + var vCode = ""; + + // build content into global var ggWinContent + ggWinContent += ('
'); + ggWinContent += (this.gMonthName + ' ' + this.gYear); + ggWinContent += '
'; + + // Show navigation buttons + var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1); + var prevMM = prevMMYYYY[0]; + var prevYYYY = prevMMYYYY[1]; + + var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1); + var nextMM = nextMMYYYY[0]; + var nextYYYY = nextMMYYYY[1]; + + ggWinContent += ('
'); + ggWinContent += ('[<<Year]'); + ggWinContent += ('[<Mon]'); + ggWinContent += '       '; + ggWinContent += ('[Mon>]'); + ggWinContent += ('[Year>>]
' + +' 
'); + + // Get the complete calendar code for the month, and add it to the content var + vCode = this.getMonthlyCalendarCode(); + ggWinContent += vCode; +} + +Calendar.prototype.showY = function() { + var vCode = ""; + var i; + + ggWinContent += ('
' + this.gYear +'
'); + + // Show navigation buttons + var prevYYYY = parseInt(this.gYear) - 1; + var nextYYYY = parseInt(this.gYear) + 1; + + ggWinContent += ('
'); + ggWinContent += ('[<<Year]'); + ggWinContent += '       '; + ggWinContent += ('[Year>>]
'); + + // Get the complete calendar code for each month. + // start a table and first row in the table + ggWinContent += (''); + for (i=0; i<12; i++) { + // start the table cell + ggWinContent += ''; + if (i == 3 || i == 7) ggWinContent += ''; + } + ggWinContent += '
'; + this.gMonth = i; + this.gMonthName = Calendar.get_month(this.gMonth); + vCode = this.getMonthlyCalendarCode(); + ggWinContent += (this.gMonthName + '/' + this.gYear + '
 
'); + ggWinContent += vCode; + ggWinContent += '
'; +} + +Calendar.prototype.cal_header = function() { + var vCode = ''; + vCode += ('Sun'); + vCode += ('Mon'); + vCode += ('Tue'); + vCode += ('Wed'); + vCode += ('Thu'); + vCode += ('Fri'); + vCode += ('Sat'); + vCode += ''; + return vCode; +} + +Calendar.prototype.cal_data = function() { + var vDate = new Date(); + vDate.setDate(1); + vDate.setMonth(this.gMonth); + vDate.setFullYear(this.gYear); + + var vFirstDay=vDate.getDay(); + var vDay=1; + var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear); + var vOnLastDay=0; + var vCode = ''; + var i,j,k,m; + var orig = eval("document." + this.gReturnItem + ".value").toString(); + /* + Get day for the 1st of the requested month/year.. + Place as many blank cells before the 1st day of the month as necessary. + */ + for (i=0; i '); + } + + // Write rest of the 1st week + for (j=vFirstDay; j<7; j++) { vCode += + ('' + this.format_day(vDay) + ''); + vDay += 1; + } + vCode += ''; + + // Write the rest of the weeks + for (k=2; k<7; k++) { + vCode += ''; + for (j=0; j<7; j++) { vCode += + ('' + this.format_day(vDay) + ''); + vDay += 1; + if (vDay > vLastDay) { + vOnLastDay = 1; + break; + } + } + if (j == 6) vCode += ''; + if (vOnLastDay == 1) break; + } + + // Fill up the rest of last week with proper blanks, so that we get proper square blocks + for (m=1; m<(7-j); m++) { vCode += + (' '); + } + return vCode; +} + +Calendar.prototype.format_day = function(vday) { + var vNowDay = gNow.getDate(); + var vNowMonth = gNow.getMonth(); + var vNowYear = gNow.getFullYear(); + + if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear) + return ('' + vday + ''); + else + return (vday); +} + +Calendar.prototype.write_weekend_string = function(vday) { + var i; + + // Return special formatting for the weekend day. + for (i=0; i' + p_format, + FGCOLOR,'#ffffcc', TEXTSIZE,2, STICKY, NOCLOSE, OFFSETX,-10, OFFSETY,-10, + WIDTH,110, BASE,2); + + Build(p_item, p_month, p_year, p_format); +} + +function show_yearly_calendar() { + var p_item // Return Item. + var p_year // 4-digit year + var p_format // Date format (YYYY-MM-DD, DD/MM/YYYY, ...) + + p_item = arguments[0]; + if (arguments[1] == "" || arguments[1] == null) + p_year = new String(gNow.getFullYear().toString()); + else + p_year = arguments[1]; + if (arguments[2] == "" || arguments[2] == null) + p_format = "YYYY-MM-DD"; + else + p_format = arguments[2]; + + if (OLns4) return overlib('Sorry, your browser does not support this feature. ' + +'Manually enter
' + p_format, + FGCOLOR,'#ffffcc', TEXTSIZE,2, STICKY, NOCLOSE, OFFSETX,-10, OFFSETY,-10, + WIDTH,110, BASE,2); + + Build(p_item, null, p_year, p_format); +} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws_lang.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws_lang.js new file mode 100644 index 0000000000..4c061281cf --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/calendarmws_lang.js @@ -0,0 +1,664 @@ +/* + calendermws_lang.js - Script with multi-language support for generating calender popups + and selecting dates for form submissions. + See http://www.macridesweb.com/oltest/calendarmws_lang.html for a demonstration. + Initial (calendarmws.js): November 9, 2003 - Last Revised: July 9, 2005 + +**** + Original: Kedar R. Bhave (softricks@hotmail.com) + Web Site: http://www.softricks.com + (uses window popups) + + Modifications and customizations to work with the overLIB v3.50 + Author: James B. O'Connor (joconnor@nordenterprises.com) + Web Site: http://www.nordenterprises.com + Developed for use with http://home-owners-assoc.com + Note: while overlib works fine with Netscape 4, this function does not work very + well, since portions of the "over" div end up under other fields on the form and + cannot be seen. If you want to use this with NS4, you'll need to change the + positioning in the overlib() call to make sure the "over" div gets positioned + away from all other form fields + The O'Connor script and many more are available free online at: + The JavaScript Source!! http://javascript.internet.com + + Further modifications made by Foteos Macrides (http://www.macridesweb.com/oltest/), + Bodo Hantschmann (http://www.hantschmann.org) - multi-language support, and + Bill McCormick (wpmccormick@freeshell.org) - draggable support, for overlibmws. + + Requires sprintf.js from the overlibmws distribution. +*/ + +var ggPosX = -1; +var ggPosY = -1; +var ggOnChange = null; +var ggLang = 'eng'; + +var ggWinContent = ""; + +var weekend = [0,6]; +var weekendColor = "#e0e0e0"; +var fontface = "Verdana"; +var fontsize = 8; // in "pt" units; used with "font-size" style element + +var calmsg = new Array(); +var datFormat = new Array(); +var CalendarMonths = new Array(); +var CalendarWeekdays = new Array(); + +/* ----------------------------------------------------------------------------------------- + Languages (set via the value of the ggLang global) + + 'eng' - English + 'ger' - German + 'esp' - Spanish + 'dut' - Dutch / Netherlands + + for more languages: + greetings from babelfish ;-) (Hint: Use always english as base, that gives the best + results. + ----------------------------------------------------------------------------------------- */ + +/* ------------------------------- + English + ------------------------------- */ +calmsg["eng"] = new Array; +calmsg["eng"][0] = "One year backward"; +calmsg["eng"][1] = "One year forward"; +calmsg["eng"][2] = "One month backward"; +calmsg["eng"][3] = "One month forward"; +calmsg["eng"][4] = "Set date"; +calmsg["eng"][5] = "Select date"; +calmsg["eng"][6] = "Your Browser does NOT support this feature. Update asap, please!
"; +calmsg["eng"][7] = "Year"; +calmsg["eng"][8] = "Click to close"; +datFormat["eng"] = "MM/DD/YYYY"; +CalendarMonths["eng"] = new Array("January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December"); +CalendarWeekdays["eng"] = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); + +/* ------------------------------- + German + ------------------------------- */ +calmsg["ger"] = new Array; +calmsg["ger"][0] = "Ein Jahr zurück"; +calmsg["ger"][1] = "Ein Jahr vorwärts"; +calmsg["ger"][2] = "Einen Monat zurück"; +calmsg["ger"][3] = "Einen Monat vorwärts"; +calmsg["ger"][4] = "Datum setzen"; +calmsg["ger"][5] = "Datum wählen"; +calmsg["ger"][6] = "Leider unterstützt Ihr Browser dieses Feature nicht. " + +"Bitte updaten!
"; +calmsg["ger"][7] = "Jahr"; +calmsg["ger"][8] = "Zum schließen klicken"; +datFormat["ger"] = "DD.MM.YYYY"; +CalendarMonths["ger"] = new Array("Januar", "Februar", "März", "April", "Mai", "Juni", + "Juli", "August", "September", "Oktober", "November", "Dezember"); +CalendarWeekdays["ger"] = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"); + +/* ------------------------------- + Spanish + ------------------------------- */ +calmsg["esp"] = new Array; +calmsg["esp"][0] = "Un año atras"; +calmsg["esp"][1] = "Un año adelante"; +calmsg["esp"][2] = "Un mes atras"; +calmsg["esp"][3] = "Un mes adelante"; +calmsg["esp"][4] = "Fije la fecha"; +calmsg["esp"][5] = "Seleccione la fecha"; +calmsg["esp"][6] = "Su browser no apoya esta característica. ¡Actualización cuanto antes, " + +"por favor!
"; +calmsg["esp"][7] = "Año"; +calmsg["esp"][8] = "Tecleo a cerrarse"; +datFormat["esp"] = "DD.MM.YYYY"; +CalendarMonths["esp"] = new Array("Enero", "Febrero", "Marcha", "Abril", "Puede", "Junio", + "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); +CalendarWeekdays["esp"] = new Array("Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"); + +/* ------------------------------- + Dutch + ------------------------------- */ +calmsg["dut"] = new Array; +calmsg["dut"][0] = "Één jaar achteruit"; +calmsg["dut"][1] = "Één jaar voorwaarts"; +calmsg["dut"][2] = "Één maand achteruit"; +calmsg["dut"][3] = "Één maand voorwaarts"; +calmsg["dut"][4] = "Overname datum"; +calmsg["dut"][5] = "Selecteer datum"; +calmsg["dut"][6] = "Uw Browser steunt deze eigenschap niet. Update zo vlug mogelijk, " + +"tevreden!
"; +calmsg["dut"][7] = "Jaar"; +calmsg["dut"][8] = "klik aan het sluiten"; +datFormat["dut"] = "DD.MM.YYYY"; +CalendarMonths["dut"] = new Array("Januari", "Februari", "Maart", "April", "Mei", "Juni", + "Juli", "Augustus", "September", "Oktober", "November", "December"); +CalendarWeekdays["dut"] = new Array("Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"); + +var gNow = new Date(); + +Calendar.CellWidth = ["14%", "14%", "14%", "14%", "14%", "14%", "16%"]; + +// Non-Leap year Month days.. +Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +// Leap year Month days.. +Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +function Calendar(p_item, p_month, p_year, p_format) { + if ((p_month == null) && (p_year == null)) return; + + if (p_month == null) { + this.gMonthName = null; + this.gMonth = null; + this.gYearly = true; + } else { + this.gMonthName = Calendar.get_month(p_month); + this.gMonth = new Number(p_month); + this.gYearly = false; + } + + this.gYear = p_year; + this.gFormat = p_format; + this.gBGColor = "white"; + this.gFGColor = "black"; + this.gTextColor = "black"; + this.gHeaderColor = "black"; + this.gReturnItem = p_item; +} + +Calendar.get_month = Calendar_get_month; +Calendar.get_daysofmonth = Calendar_get_daysofmonth; +Calendar.calc_month_year = Calendar_calc_month_year; + +function Calendar_get_month(monthNo) { + return Calendar.Months[monthNo]; +} + +function Calendar_get_daysofmonth(monthNo, p_year) { + /* + Check for leap year .. + 1.Years evenly divisible by four are normally leap years, except for... + 2.Years also evenly divisible by 100 are not leap years, except for... + 3.Years also evenly divisible by 400 are leap years. + */ + if ((p_year % 4) == 0) { + if ((p_year % 100) == 0 && (p_year % 400) != 0) + return Calendar.DOMonth[monthNo]; + + return Calendar.lDOMonth[monthNo]; + } else + return Calendar.DOMonth[monthNo]; +} + +function Calendar_calc_month_year(p_Month, p_Year, incr) { + /* + Will return an 1-D array with 1st element being the calculated month + and second being the calculated year + after applying the month increment/decrement as specified by 'incr' parameter. + 'incr' will normally have 1/-1 to navigate thru the months. + */ + var ret_arr = new Array(); + + if (incr == -1) { + // B A C K W A R D + if (p_Month == 0) { + ret_arr[0] = 11; + ret_arr[1] = parseInt(p_Year) - 1; + } else { + ret_arr[0] = parseInt(p_Month) - 1; + ret_arr[1] = parseInt(p_Year); + } + } else if (incr == 1) { + // F O R W A R D + if (p_Month == 11) { + ret_arr[0] = 0; + ret_arr[1] = parseInt(p_Year) + 1; + } else { + ret_arr[0] = parseInt(p_Month) + 1; + ret_arr[1] = parseInt(p_Year); + } + } + return ret_arr; +} + +function Calendar_calc_month_year(p_Month, p_Year, incr) { + /* + Will return an 1-D array with 1st element being the calculated month + and second being the calculated year + after applying the month increment/decrement as specified by 'incr' parameter. + 'incr' will normally have 1/-1 to navigate thru the months. + */ + var ret_arr = new Array(); + + if (incr == -1) { + // B A C K W A R D + if (p_Month == 0) { + ret_arr[0] = 11; + ret_arr[1] = parseInt(p_Year) - 1; + } else { + ret_arr[0] = parseInt(p_Month) - 1; + ret_arr[1] = parseInt(p_Year); + } + } else if (incr == 1) { + // F O R W A R D + if (p_Month == 11) { + ret_arr[0] = 0; + ret_arr[1] = parseInt(p_Year) + 1; + } else { + ret_arr[0] = parseInt(p_Month) + 1; + ret_arr[1] = parseInt(p_Year); + } + } + return ret_arr; +} + +// This is for compatibility with Navigator 3, we have to create and discard one object +// before the prototype object exists. +new Calendar(); + +Calendar.prototype.getMonthlyCalendarCode = function() { + var vCode = ""; + var vHeader_Code = ""; + var vData_Code = ""; + + // Begin Table Drawing code here.. + vCode += ('
'); + + vHeader_Code = this.cal_header(); + vData_Code = this.cal_data(); + vCode += (vHeader_Code + vData_Code); + + vCode += '
'; + + return vCode; +} + +Calendar.prototype.show = function() { + var vCode = ""; + + // build content into global var ggWinContent + ggWinContent += sprintf('
%s %s
', + fontface, fontsize, this.gMonthName, this.gYear); + + // Show navigation buttons + var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1); + var prevMM = prevMMYYYY[0]; + var prevYYYY = prevMMYYYY[1]; + + var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1); + var nextMM = nextMMYYYY[0]; + var nextYYYY = nextMMYYYY[1]; + + var nav_cell = ' [%s%s%s<\/a>] '; + + ggWinContent += ''; + ggWinContent += ''; + ggWinContent += sprintf(nav_cell, + 'left', calmsg[ggLang][0], calmsg[ggLang][0], + this.gReturnItem, this.gMonth, (parseInt(this.gYear)-1), this.gFormat, + '<<', (parseInt(this.gYear)-1), ''); + ggWinContent += sprintf(nav_cell, + 'right', calmsg[ggLang][1], calmsg[ggLang][1], + this.gReturnItem, this.gMonth, (parseInt(this.gYear)+1), this.gFormat, + '', (parseInt(this.gYear)+1), '>>'); + ggWinContent += ''; + ggWinContent += sprintf(nav_cell, + 'left', calmsg[ggLang][2], calmsg[ggLang][2], + this.gReturnItem, prevMM, prevYYYY, this.gFormat, '<', + Calendar.Months[prevMM], ''); + ggWinContent += sprintf(nav_cell, + 'right', calmsg[ggLang][3], calmsg[ggLang][3], + this.gReturnItem, nextMM, nextYYYY, this.gFormat, '', + Calendar.Months[nextMM], '>'); + ggWinContent += '
 
'; + + // Get the complete calendar code for the month, and add it to the content var + vCode = this.getMonthlyCalendarCode(); + ggWinContent += vCode; +} + +Calendar.prototype.showY = function() { + var vCode = ""; + var i; + + ggWinContent += sprintf( + '
%s
', fontface, fontsize+1, this.gYear); + // Show navigation buttons + var prevYYYY = parseInt(this.gYear) - 1; + var nextYYYY = parseInt(this.gYear) + 1; + + ggWinContent += '', '#e0e0e0', fontsize); + ggWinContent += ''; + ggWinContent += sprintf( + '', + calmsg[ggLang][0], calmsg[ggLang][0], this.gReturnItem, + prevYYYY, this.gFormat, (parseInt(this.gYear)-1)); + ggWinContent += ''; + ggWinContent += sprintf( + '', + calmsg[ggLang][1], calmsg[ggLang][1], this.gReturnItem, + nextYYYY, this.gFormat, (parseInt(this.gYear)+1)); + ggWinContent += '
[<<%s]       [%s>>]
'; + + // Get the complete calendar code for each month. + // start a table and first row in the table + ggWinContent += ''; + for (i=0; i<12; i++) { + // start the table cell + ggWinContent += ''; + if (i == 3 || i == 7) ggWinContent += ''; + } + ggWinContent += '
'; + this.gMonth = i; + this.gMonthName = Calendar.get_month(this.gMonth); + vCode = this.getMonthlyCalendarCode(); + ggWinContent += (this.gMonthName + '/' + this.gYear+ '
 
'); + ggWinContent += vCode; + ggWinContent += '
'; +} + +Calendar.prototype.cal_header = function() { + var vCode = ''; + for (i=0; i<7; i++) { vCode += sprintf( + '%s', + Calendar.CellWidth[i], fontface, this.gHeaderColor, Calendar.Weekdays[i]); + } + return (vCode + ''); +} + +Calendar.prototype.cal_data = function() { + var vDate = new Date(); + vDate.setDate(1); + vDate.setMonth(this.gMonth); + vDate.setFullYear(this.gYear); + + var vFirstDay=vDate.getDay(); + var vDay=1; + var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear); + var vOnLastDay=0; + var vCode = ''; + var i,j,k,m; + var orig = eval("document." + this.gReturnItem + ".value").toString(); + /* + Get day for the 1st of the requested month/year.. + Place as many blank cells before the 1st day of the month as necessary. + */ + for (i=0; i ', + Calendar.CellWidth[0], this.write_weekend_string(i),fontface); + } + // Write rest of the 1st week + for (j=vFirstDay; j<7; j++) { vCode += sprintf( + '
%s', + Calendar.CellWidth[j+1], this.write_weekend_string(j), fontface, + calmsg[ggLang][4], this.format_data(vDay), calmsg[ggLang][4], + this.format_data(vDay), this.gReturnItem, this.format_data(vDay), OLfnRef, + this.gReturnItem, orig, this.format_day(vDay)); + vDay += 1; + } + vCode += ''; + + // Write the rest of the weeks + for (k=2; k<7; k++) { + vCode += ''; + for (j=0; j<7; j++) { vCode += sprintf( + '%s', + Calendar.CellWidth[j+1], this.write_weekend_string(j), fontface, + calmsg[ggLang][4], this.format_data(vDay),calmsg[ggLang][4], + this.format_data(vDay), this.gReturnItem, this.format_data(vDay), + OLfnRef, this.gReturnItem, orig, this.format_day(vDay)); + vDay += 1; + if (vDay > vLastDay) { + vOnLastDay = 1; + break; + } + } + if (j == 6) vCode += ''; + if (vOnLastDay == 1) break; + } + + // Fill up the rest of last week with proper blanks, so that we get proper square blocks + for (m=1; m<(7-j); m++) { vCode += sprintf( + ' ', + Calendar.CellWidth[m+1], this.write_weekend_string(j+m), fontface); + } + return vCode; +} + +Calendar.prototype.format_day = function(vday) { + var vNowDay = gNow.getDate(); + var vNowMonth = gNow.getMonth(); + var vNowYear = gNow.getFullYear(); + + if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear) + return ('' + vday + ''); + else + return (vday); +} + +Calendar.prototype.write_weekend_string = function(vday) { + var i; + + // Return special formatting for the weekend day. + for (i=0; i X ', MIDX,0, RELY,10); + // Otherwise use FIXX and FIXY + } else { + // Make sure popup is on screen + var X = ((ggPosX < 10)?0:ggPosX - 10), Y = ((ggPosY < 10)?0:ggPosY - 10); + window.scroll(X, Y); + // Put up the calendar + overlib(ggWinContent, AUTOSTATUSCAP, STICKY, EXCLUSIVE, DRAGGABLE, + CLOSECLICK, TEXTSIZE,'8pt', CAPTIONSIZE,'8pt', CLOSESIZE,'8pt', + CAPTION,calmsg[ggLang][5], CLOSETITLE,calmsg[ggLang][8],CLOSETEXT, + ' X ', FIXX,ggPosX, FIXY,ggPosY); + // Reset the position variables + ggPosX = -1; ggPosY = -1; + } +} + +function show_calendar() { + var p_item // Return Item. + var p_month // 0-11 for Jan-Dec; 12 for All Months. + var p_year // 4-digit year + var p_format // Date format (YYYY-MM-DD, DD/MM/YYYY, ...) + fontsize = 8; + + Calendar.Months = CalendarMonths[ggLang]; + Calendar.Weekdays = CalendarWeekdays[ggLang]; + + p_item = arguments[0]; + if (arguments[1] == "" || arguments[1] == null || arguments[1] == '12') + p_month = new String(gNow.getMonth()); + else + p_month = arguments[1]; + if (arguments[2] == "" || arguments[2] == null) + p_year = new String(gNow.getFullYear().toString()); + else + p_year = arguments[2]; + if (arguments[3] == "" || arguments[3] == null) + p_format = datFormat[ggLang]; + else + p_format = arguments[3]; + + if (OLns4) return overlib(calmsg[ggLang][6]+p_format, + FGCOLOR,'#ffffcc', TEXTSIZE,2, STICKY, NOCLOSE, OFFSETX,-10, OFFSETY,-10, + WIDTH,110, BASE,2); + + Build(p_item, p_month, p_year, p_format); +} + +function show_yearly_calendar() { + var p_item // Return Item. + var p_year // 4-digit year + var p_format // Date format (YYYY-MM-DD, DD/MM/YYYY, ...) + + Calendar.Months = CalendarMonths[ggLang]; + Calendar.Weekdays = CalendarWeekdays[ggLang]; + + p_item = arguments[0]; + if (arguments[1] == "" || arguments[1] == null) + p_year = new String(gNow.getFullYear().toString()); + else + p_year = arguments[1]; + if (arguments[2] == "" || arguments[2] == null) + p_format = datFormat[ggLang]; + else + p_format = arguments[2]; + + if (OLns4) return overlib(calmsg[ggLang][6]+p_format, + FGCOLOR,'#ffffcc', TEXTSIZE,2, STICKY, NOCLOSE, OFFSETX,-10, OFFSETY,-10, + WIDTH,110, BASE,2); + + Build(p_item, null, p_year, p_format); +} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBL.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBL.gif new file mode 100644 index 0000000000..e5af971f72 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBL.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBR.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBR.gif new file mode 100644 index 0000000000..7f970708bd Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerBR.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTL.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTL.gif new file mode 100644 index 0000000000..242b06f7df Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTL.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTR.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTR.gif new file mode 100644 index 0000000000..9d7cc784c1 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/cornerTR.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeB.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeB.gif new file mode 100644 index 0000000000..cef34c0f93 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeB.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeL.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeL.gif new file mode 100644 index 0000000000..592c1b1fcd Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeL.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeR.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeR.gif new file mode 100644 index 0000000000..d3d6635121 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeR.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeT.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeT.gif new file mode 100644 index 0000000000..416a31d04e Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/edgeT.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/exit.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/exit.gif new file mode 100644 index 0000000000..9f9bc80ebc Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/exit.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/flower.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/flower.gif new file mode 100644 index 0000000000..101275eb76 Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/flower.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/iframecontentmws.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/iframecontentmws.js new file mode 100644 index 0000000000..5a1fe10d19 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/iframecontentmws.js @@ -0,0 +1,20 @@ +/* + iframecontentmws.js - Foteos Macrides + Initial: October 10, 2004 - Last Revised: May 9, 2005 + Simple script for using an HTML file as iframe content in overlibmws popups. + Include WRAP and TEXTPADDING,0 in the overlib call to ensure that the width + arg is respected (unless the CAPTION plus CLOSETEXT widths add up to more than + the width arg, in which case you should increase the width arg). The name arg + should be a unique string for each popup with iframe content in the document. + The frameborder arg should be 1 (browser default if omitted) or 0. + + See http://www.macridesweb.com/oltest/IFRAME.html for demonstration. +*/ + +function OLiframeContent(src, width, height, name, frameborder) { + return (''); +} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/license.html b/source/web/jsp/content/xforms/forms/scripts/overlibmws/license.html new file mode 100644 index 0000000000..80714a7368 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/license.html @@ -0,0 +1,261 @@ + + + + + + + +overLIB - License for the overlibmws package + + + + + + + + + + + + + + + + + + + + + + +
+ Open Source License for the overlibmws Package +
+
+ 1. License coverage +

+ Note that this license only covers the script library (javascript core and plugin modules) + and not any supporting material such as the overlibmws website or its online documentation and support files. You may not + reproduce the website or its online material without explicit written permission from the + author, but can freely incorporate scripts and procedures which are demonstrated in that + material into your own HTML or XML documents. +

+ 2. License (Artistic) +
    +
  • + Preamble
    + The intent of this document is to state the conditions under which a Package may be + copied, such that the Copyright Holder maintains some semblance of artistic control over + the development of the package, while giving the users of the package the right to use + and distribute the Package in a more-or-less customary fashion, plus the right to make + reasonable modifications. +
  • +
+
    +
  • + Definitions:
    + "Package" refers to the collection of files distributed by the Copyright Holder, and + derivatives of that collection of files created through textual modification. +

    + "Standard Version" refers to such a Package if it has not been modified, or has been + modified in accordance with the wishes of the Copyright Holder. +

    + "Copyright Holder" is whoever is named in the copyright or copyrights for the package. +

    + "You" is you, if you're thinking about copying or distributing this Package. +

    + "Reasonable copying fee" is whatever you can justify on the basis of media cost, + duplication charges, time of people involved, and so on. (You will not be required to + justify it to the Copyright Holder, but only to the computing community at large as a + market that must bear the fee.) +

    + "Freely Available" means that no fee is charged for the item itself, though there may be + fees involved in handling the item. It also means that recipients of the item may + redistribute it under the same conditions they received it. +
  • +
+
    +
  1. + You may make and give away verbatim copies of the source form of the Standard Version + of this Package without restriction, provided that you duplicate all of the original + copyright notices and associated disclaimers. +
  2. +
  3. + You may apply bug fixes, portability fixes and other modifications derived from the + Public Domain or from the Copyright Holder. A Package modified in such a way shall still + be considered the Standard Version. +
  4. +
  5. + You may otherwise modify your copy of this Package in any way, provided that you insert + a prominent notice in each changed file stating how and when you changed that file, and + provided that you do at least ONE of the following: +
      +
    1. + place your modifications in the Public Domain or otherwise make them Freely Available, + such as by posting said modifications to Usenet or an equivalent medium, or placing the + modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright + Holder to include your modifications in the Standard Version of the Package. +
    2. +
    3. + use the modified Package only within your corporation or organization. +
    4. +
    5. + rename any non-standard executables so the names do not conflict with standard + executables, which must also be provided, and provide a separate manual page for each + non-standard executable that clearly documents how it differs from the Standard Version. +
    6. +
    7. + make other distribution arrangements with the Copyright Holder. +
    8. +
    +
  6. +
  7. + You may distribute the programs of this Package in object code or executable form, + provided that you do at least ONE of the following: +
      +
    1. + distribute a Standard Version of the executables and library files, together with + instructions (in the manual page or equivalent) on where to get the Standard Version. +
    2. +
    3. + accompany the distribution with the machine-readable source of the Package with your + modifications. +
    4. +
    5. + accompany any non-standard executables with their corresponding Standard Version + executables, giving the non-standard executables non-standard names, and clearly + documenting the differences in manual pages (or equivalent), together with instructions + on where to get the Standard Version. +
    6. +
    7. + make other distribution arrangements with the Copyright Holder. +
    8. +
    +
  8. +
  9. + You may charge a reasonable copying fee for any distribution of this Package. You may + charge any fee you choose for support of this Package. You may not charge a fee for this + Package itself. However, you may distribute this Package in aggregate with other (possibly + commercial) programs as part of a larger (possibly commercial) software distribution + provided that you do not advertise this Package as a product of your own. +
  10. +
  11. + The scripts and library files supplied as input to or produced as output from the programs + of this Package do not automatically fall under the copyright of this Package, but belong + to whomever generated them, and may be sold commercially, and may be aggregated with this + Package. +
  12. +
  13. + C or perl subroutines supplied by you and linked into this Package shall not be considered + part of this Package. +
  14. +
  15. + The name of the Copyright Holder may not be used to endorse or promote products derived + from this software without specific prior written permission. +
  16. +
  17. + THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + PURPOSE. +
  18. +
+
+
+ + + + + + + + +
+
+
+ Copyright Foteos Macrides
+   2002-2005.
+   All rights reserved.
+
+
+
+
+
+
+ + + diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/objectcontentmws.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/objectcontentmws.js new file mode 100644 index 0000000000..30b7402c68 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/objectcontentmws.js @@ -0,0 +1,16 @@ +/* + objectcontentmws.js - Foteos Macrides + Initial: October 10, 2004 - Last Revised: November 22, 2004 + Simple script for using an HTML file as object content in overlibmws popups. + Include WRAP and TEXTPADDING,0 in the overlib call to ensure that the width + argument is respected (unless the CAPTION plus CLOSETEXT widths add up to more + than the width argument, in which case you should increase the width argument). + + See http://www.macridesweb.com/oltest/overflow.html for demonstrations. +*/ + +function OLobjectContent(data, width, height, name) { + return ('' + +'
[object not supported]
'); +} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/oval.gif b/source/web/jsp/content/xforms/forms/scripts/overlibmws/oval.gif new file mode 100644 index 0000000000..7e1af22f1c Binary files /dev/null and b/source/web/jsp/content/xforms/forms/scripts/overlibmws/oval.gif differ diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibCompat.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibCompat.js new file mode 100644 index 0000000000..fe86abbf28 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibCompat.js @@ -0,0 +1,30 @@ +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 2 COMPATABILITY FUNCTIONS +// Include this if you are upgrading from overlib v2.x. Otherwise, forget it. +//////////////////////////////////////////////////////////////////////////////////// +// Converts old 0=left, 1=right and 2=center into constants. +function vpos_convert(d){if(d==0){d=LEFT;}else{if(d==1){d=RIGHT;}else{d=CENTER;}}return d;} +// Simple popup +function dts(d,text){o3_hpos=vpos_convert(d);overlib(text,o3_hpos,CAPTION,"");} +// Caption popup +function dtc(d,text,title){o3_hpos=vpos_convert(d);overlib(text,CAPTION,title,o3_hpos);} +// Sticky +function stc(d,text,title){o3_hpos=vpos_convert(d);overlib(text,CAPTION,title,o3_hpos,STICKY);} +// Simple popup right +function drs(text){dts(1,text);} +// Caption popup right +function drc(text,title){dtc(1,text,title);} +// Sticky caption right +function src(text,title){stc(1,text,title);} +// Simple popup left +function dls(text){dts(0,text);} +// Caption popup left +function dlc(text,title){dtc(0,text,title);} +// Sticky caption left +function slc(text,title){stc(0,text,title);} +// Simple popup center +function dcs(text){dts(2,text);} +// Caption popup center +function dcc(text,title){dtc(2,text,title);} +// Sticky caption center +function scc(text,title){stc(2,text,title);} diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibConfig.txt b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibConfig.txt new file mode 100644 index 0000000000..7e45a0f5bf --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibConfig.txt @@ -0,0 +1,615 @@ + +Below are described the configuration variables and arrays associated with the +overlib commands, and their defaults as set in the + overlibmws.js +core module and the + overlibmws_bubble.js, overlibmws_crossframe.js, overlibmws_debug.js, + overlibmws_draggable.js, overlibmws_exclusive.js, overlib_filter.js, + overlibmws_function.js, overlibmws_hide.js, overlibmws_overtwo.js, + overlibmws_print.js, overlibmws_scroll.js and overlibmws_shadow.js +plugin modules. The + overlibmws_iframe.js and overlib_regCore.js +plugin modules do not have configuration variables or arrays. + +You can change any of the configuration default values for all pages by making +the modifications in overlibmws.js or the plugin modules, or for individual HTML +pages by declaring any of these variables with the values you prefer in a SCRIPT +block or imported js file for those pages. + +You instead can change the configuration default values for individual HTML pages by +calling the OLpageDefaults(arguments) function in a SCRIPT block or imported js file +with "arguments" consisting of a comma-separated list of uppercase command names and +their parameters if any, homologously to the arguments for an overlib() call. + +The overlibmws_overtwo.js module is used by calling overlib2() and nd2() from within +an overlib() call that invokes a primary popup, to invoke and close secondary popups. +Its LABLE2 command and its configuration variable are specific to the secondary popups, +and are complementary to the core module's LABLEL command and its configuration variable +for primary popups. + +The overlibmws_iframe.js module has no additional commands, and thus no configuration +variables. It should be imported when a page has system controls (e.g., some form +elements, flash objects, applets) which obscure overlib popups. It corrects this +problem for IE v5.5 or higher. For versions of IE lower than v5.5 and for other browsers, +you can use commands in the overlibmws_hide.js plugin module. See the examples in +http://www.macridesweb.com/oltest/hide.html and http://www.macridesweb.com/oltest/flash.html +on how to use those command to hide the system controls when overlib popups are invoked. + +The overlibmws_regCore.js module has no overlib() or overlib2() commands, and thus +no configuration variables. It should be imported in frames which will not themselves +import the core module and any plugin modules, but instead will use those in another +frame. See its header for more information. Examples of its use are in +http://www.macridesweb.com/oltest/testFrame.html + +See the overlibmws Command Reference (http://www.macridesweb.com/oltest/commandRef.html) +for more information about the commands, configuration variables, and plugin modules. + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR CORE MODULE overlibmws.js +//////////////////////////////////////////////////////////////////////////////////// + +// FGCOLOR - Main background color (the large area). +// Usually a bright color (white, yellow etc). +var ol_fgcolor = "#CCCCFF"; + +// BGCOLOR - Border color. +// Usually a dark color (black, brown etc). +var ol_bgcolor = "#333399"; + +// CGCOLOR - Caption background color (typically same as border color). +// Usually a dark color (black, brown etc). +var ol_cgcolor = "#333399"; + +// TEXTCOLOR - Text color. +// Usually a dark color. +var ol_textcolor = "#000000"; + +// CAPCOLOR - Color of the caption text. +// Usually a bright color +var ol_capcolor = "#FFFFFF"; + +// CLOSECOLOR - Color of "Close" when using Sticky. +// Usually a semi-bright color. +var ol_closecolor = "#9999FF"; + +// TEXTFONT - Font face for the main text. +var ol_textfont = "Verdana,Arial,Helvetica"; + +// CAPTIONFONT - Font face for the caption. +var ol_captionfont = "Verdana,Arial,Helvetica"; + +// CLOSEFONT - Font face for the close text. +var ol_closefont = "Verdana,Arial,Helvetica"; + +// TEXTSIZE - Font size for the main text. +var ol_textsize = "1"; + +// CAPTIONSIZE - Font size for the caption. +var ol_captionsize = "1"; + +// CLOSESIZE - Font size for the close text. +var ol_closesize = "1"; + +// FGCLASS - Main background class. +var ol_fgclass = ""; + +// BGCLASS - Frame background class. +var ol_bgclass = ""; + +// CGCLASS - Caption background class. +var ol_cgclass = ""; + +// TEXTPADDING - Padding for main text. +var ol_textpadding = "2"; + +// TEXTFONTCLASS - Main font class. +var ol_textfontclass = ""; + +// CAPTIONPADDING - Padding for caption (including Close text if present). +var ol_captionpadding = "2"; + +// CAPTIONFONTCLASS - Caption font class. +var ol_captionfontclass = ""; + +// CLOSEFONTCLASS - Close font class. +var ol_closefontclass = ""; + +// CLOSECLICK - If the user has to click to close stickies. +var ol_closeclick = 0; + +// CLOSETEXT - Text for the closing sticky popups. Normal is "Close". +var ol_close = "Close"; + +// CLOSETITLE - Text to use as value of TITLE attribute for browser-generated TooTips +// with the "Close" link in captions of stickies when CLOSECLICK is changed to 1; +var ol_closetitle = "Click to Close"; + +// Default text for popups +// Should you forget to pass something to overLIB this will be displayed. +var ol_text = "Default Text"; + +// Default caption +// You should leave this blank or you will have problems making non caps popups. +var ol_cap = ""; + +// CAPBELOW - Whether the caption should appear below the main text area. Default is +// off (0) such that the caption appears above. +var ol_capbelow=0; + +// BACKGROUND - Default background image. Better left empty unless you always want one. +var ol_background = ""; + +// WIDTH - Default width of the popups in pixels. 100-300 pixels is typical. +// This value is simply a suggestion to the browser, which may change the +// actual width depending on the content. +var ol_width = "200"; + +// WRAP - Intended to keep the popup no wider than its content plus normal padding, but +// to wrap the content if it would exceed the window width, or if it would exceed WRAPMAX +// when that has been set to a value greater than zero. +// Overrides the o3_width setting. Default is no wrap (0). +var ol_wrap = 0; + +// WRAPMAX - If set to a value greater than 0, sets the maximum width of the popup, up to +// the window width, before wrapping occurs when the WRAP command is set. +var ol_wrapmax = 0; + +// HEIGHT - Default height for popup. Often best left alone. +var ol_height = -1; + +// BORDER - How thick the ol_border should be in pixels. +// 1-3 pixels is typical. +var ol_border = "1"; + +// BASE - Any additional thickening of the border's base in pixels. +var ol_base = "0"; + +// OFFSETX - How many pixels to the right (positive values) or left (negative values) +// of the cursor to show the popup. Values between 3 and 12 are best. +var ol_offsetx = 10; + +// OFFSETY - How many pixels below (positive values) or above (negative values) the +// cursor to show the popup. Values between 3 and 20 are best. +var ol_offsety = 10; + +// STICKY - Decides if sticky popups are default. 0 for non, 1 for stickies. +var ol_sticky = 0; + +// NOFOLLOW - Should non-sticky popups not follow cursor movements (i.e., remain +// stationary where initially positioned on invocation, like title-based tooltips). +var ol_nofollow = 0; + +// NOCLOSE - Omit Close text in stickies with captions, for all stickies use mouse off +// after mouse over sticky to close, and cancel any timeout while over sticky. +var ol_noclose = 0; + +// MOUSEOFF - For stickies which do have a caption with a CLOSETEXT, also use mouse off +// after mouse over sticky to close, and cancel any timeout while over sticky. +var ol_mouseoff = 0; + +// OFFDELAY - Default delay for closing NOCLOSE or MOUSEOFF popups. If a mouse over the +// sticky occurs during this delay, the close is cancelled. +var ol_delay = 300; + +// RIGHT - Default vertical alignment for popups. +// It's best to leave RIGHT here. Other options are LEFT and CENTER. +var ol_hpos = RIGHT; + +// BELOW - Default vertical position of the popups. +// It's best to leave BELOW here. Other options are ABOVE and VCENTER. +var ol_vpos = BELOW; + +// Default status bar text when a popup is invoked. +var ol_status = ""; + +// AUTOSTATUS, AUTOSTATUSCAP - If the status bar automatically should load either +// text or caption. 0=nothing, 1=text, 2=caption +var ol_autostatus = 0; + +// SNAPX - Horizontal grid spacing that popups will snap to. +// 0 makes no grid, anything else will cause a snap to that grid spacing. +var ol_snapx = 0; + +// SNAPY - Vertical grid spacing that popups will snap to. +// 0 makes no grid, anything else will cause a snap to that grid spacing. +var ol_snapy = 0; + +// FIXX - Sets the popup horizontal position to a fixed column. +// Numbers greater than -1 will cause fixed position. +var ol_fixx = -1; + +// FIXY - Sets the popup vertical position to a fixed row. +// Numbers greater than -1 will cause fixed position. +var ol_fixy = -1; + +// RELX - Sets the popup horizontal position to a column relative to the window display. +// Anything numeric (non-null) will cause relative position. Positive and 0 is to +// the right from left window margin for left margin of popup. Negative is to the +// left from right window margin for right margin of popup. +var ol_relx = null; + +// RELY - Sets the popup vertical position to a row relative to the window display. +// Anything numeric (non-null) will cause relative position. Positive and 0 is down +// from top window margin for top margin of popup. Negaive is up from bottom window +// margin for bottom margin of popup. +var ol_rely = null; + +// MIDX - Sets the popup horizontal midpoint to a column relative to the window horizontal +// midpoint. Anything numeric (non-null) will cause midpoint position. Positive and +// 0 is to the right from the window midpoint. Negative is to the left. +var ol_midx = null; + +// MIDY - Sets the popup vertical midpoint to a row relative to the window vertical midpoint. +// Anything numeric (non-null) will cause midpoint position. Positive and 0 is down from +// the window midpoint. Negative is up. +var ol_midy = null; + +// REF - The NAME of an anchor or image, or ID of a layer, to serve as a reference object such +// that a corner of the popup will be positioned relative to a corner of the object. +var ol_ref = ""; + +// REFC - Corner of the reference object for positioning. +// Value can be: 'UL' (Upper Left), 'UR', 'LR', or 'LL'. +var ol_refc = 'UL'; + +// REFP - Corner of the popup for positioning. +// Value can be: 'UL' (Upper Left), 'UR', 'LR', or 'LL'. +var ol_refp = 'UL'; + +// REFX - X displacement from the reference point. Positive to the right, +// negative left. +var ol_refx = 0; + +// REFY - Y displacement from the reference point. Positive down, negative up. +var ol_refy = 0; + +// FGBACKGROUND - Background image for the popup's inside. +var ol_fgbackground = ""; + +// BGBACKGROUND - Background image for the popup's frame (border). +var ol_bgbackground = ""; + +// CGBACKGROUND - Background image for the caption. +var ol_cgbackground = ""; + +// PADX +// How much horizontal left padding text should get by default when BACKGROUND is used. +var ol_padxl = 1; +// How much horizontal right padding text should get by default when BACKGROUND is used. +var ol_padxr = 1; + +// PADY +// How much vertical top padding text should get by default when BACKGROUND is used. +var ol_padyt = 1; +// How much vertical bottom padding text should get by default when BACKGROUND is used. +var ol_padyb = 1; + +// FULLHTML - If the user by default must supply all html for complete control of popup content. +// Set to 1 to activate, 0 otherwise. +var ol_fullhtml = 0; + +// CAPICON - Default icon to place next to the popups caption. +var ol_capicon = ""; + +// FRAME - Default frame. We default to current frame if there is no frame defined. +var ol_frame = self; + +// TIMEOUT - Default timeout. By default there is no timeout. +var ol_timeout = 0; + +// DELAY - Default delay for onset of popup. By default there is no delay. +var ol_delay = 0; + +// HAUTO - If overLIB should decide the horizontal placement. +var ol_hauto = 0; + +// VAUTO - If overLIB should decide the vertical placement. +var ol_vauto = 0; + +// NOJUSTX - If overLIB should let popups overrun the left or right window margins. +var ol_nojustx = 0; + +// NOJUSTY - If overLIB should let popups overrun the top or bottom window margins. +var ol_nojusty = 0; + +// LABEL - A labeling string for the primary popup while it is displayed (visible). +var ol_label = ""; + +// DECODE - If overLIB should automatically decode any URL-encoded characters in +// lead argument and/or caption. +var ol_decode = ""; + +//////////////////////////////////////////////////////////////////////////////////// +// ARRAY CONFIGURATION FOR CORE MODULE overlibmws.js +//////////////////////////////////////////////////////////////////////////////////// + +// INARRAY - Array with texts. +var ol_texts = new Array( + "Text 0", + "Text 1"); + +// CAPARRAY - Array with captions. +var ol_caps = new Array( + "Caption 0", + "Caption 1"); + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_bubble.js +//////////////////////////////////////////////////////////////////////////////////// + +// BUBBLE - Whether to use a bubble type popup. Default is no (0). +var ol_bubble = 0; + +// BUBBLETYPE - Type of bubble image to use. Default is 'flower'. Other options are +// 'oval', 'square', 'pushpin', 'quotation', or 'roundedcorners'. Specify directory +// for images via the last parameter of registerImages() near the top of the plugin +// module (default value is './'). +var ol_bubbletype = 'flower'; + +// ADJBUBBLE - Whether to resize the image in relation to the content. +// Default is no (0). +var ol_adjbubble = 0; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_bubble.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_crossframe.js +//////////////////////////////////////////////////////////////////////////////////// + +You must import this plugin module to use the FRAME command, but its configuration +variable, ol_frame, is set in the core module. + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_crossframe.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_debug.js +//////////////////////////////////////////////////////////////////////////////////// + +// ALLOWDEBUG - The ID or a comma-separated list of IDs for debug layers which, if +// invoked following an overlib call and then made hidden via the close link at +// upper right, should be made visible again whenever that overlib call occurs. +var ol_allowdebug = ""; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_debug.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_draggable.js +//////////////////////////////////////////////////////////////////////////////////// + +// DRAGGABLE - If sticky should be draggable. +var ol_draggable = 0; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_draggable.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_exclusive.js +//////////////////////////////////////////////////////////////////////////////////// + +// EXCLUSIVE - Decides if a sticky primary popup should be exclusive, such that no other +// primry popup can be invoked and replace it before the sticky is closed by the user or +// a timeout (secondary popups can still be invoked from within the exclusive primary). +var ol_exclusive = 0; + +// EXCLUSIVESTATUS - Status line string to use for exclusive stickies +var ol_exclusivestatus = 'Please act on or close the open popup.'; + +// EXCLUSIVEOVERRIDE = If a displayed exclusive sticky should be overridden by the +// current overlib call for a popup. +var ol_exclusiveoverride=0; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_exclusive.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_filter.js +//////////////////////////////////////////////////////////////////////////////////// + +// FILTER - Toggles on the filter feature set for IE v5.5+ browsers. Defualt is off. +var ol_filter=0; + +// FADEIN - Filter type for stylinzed fadein. Value can be 0 - 50 for the 51 types, +// or 51 (default) for random selections of the type across successive occurrences +// of the popup. +var ol_fadein=51; + +// FADETIME - Duration of fadein (millisec). +var ol_fadetime=800; + +// FILTEROPACITY - Opacity of entire popup. The higher the number in the range of 1-99, +// the more more opaque (less transparent) the popup will be. But 0 is handled as +// equivalent to 100 (no transparency). This feature also is implemented for Mozilla +// and Netscape v6+ browsers. +var ol_filteropacity=100; + +// FILTERSHADOW - Type of filter-based shadow. Default is off (0). +// Dropshadow is 1. Shadow (tapers from corners) is 2. +var ol_filtershadow=0; + +// FILTERSHADOWCOLOR - Color of filter-based shadow. +var ol_filtershadowcolor="#cccccc"; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_filter.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_function.js +//////////////////////////////////////////////////////////////////////////////////// + +// FUNCTION - Default javascript function. By default there is none. +var ol_function = null; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_function.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_hide.js +//////////////////////////////////////////////////////////////////////////////////// + +// HIDESELECTBOXES - Whether to hide any select boxes which overlap the popup +// while the popup is being displayed. +var ol_hideselectboxes=0; + +// HIDEBYID - An id or comma-separated list of id's to be hidden while the popup +// is displayed. Is intended for form elements and is ignored for any browsers +// using HIDESELECTBOXES and for Opera v7+. +var ol_hidebyid=''; + +// HIDEBYIDALL - An id or comma=separated list of id's to be hidden while the popup +// is displayed. Is intended for non-form elements with system controls, e.g., +// flash objects and applets. +var ol_hidebyidall=''; + +// HIDEBYIDNS4 - An id or comma-separated list of id's for positioned div's to be +// hidden while the popup is being displayed by Netscape v4.x browsers. +var ol_hidebyidns4=''; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_hide.js +//////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_overtwo.js +//////////////////////////////////////////////////////////////////////////////////// + +// LABEL - A labeling string for the secondary popup while it is displayed (visible). +var ol_label = ""; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_overtwo.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_print.js +//////////////////////////////////////////////////////////////////////////////////// + +// PRINT - Whether sticky should include a Print link or button. +var ol_print = 0; + +// PRINTBUTTON - Whether to use button in main text area even if caption area is present. +var ol_printbutton=0; + +// NOAUTOPRINT - Whether to block automatic printing and deletion of temporary printing window. +var ol_noautoprint=0; + +// PRINTCOLOR - Color of "Print" link in caption area of sticky. +var ol_printcolor="#eeeeff"; + +// PRINTFONT - Font face for the print text. +var ol_printfont="Verdana,Arial,Helvetica"; + +// PRINTSIZE - Font size for the print text. +var ol_printsize=1; + +// PRINTTEXT - Text for the sticky popup print link. Normal is "Print". +var ol_printtext='Print'; + +// PRINTBUTTONTEXT - Text for the sticky popup print button. Normal is "Print". +var ol_printbuttontext='Print'; + +// PRINTTITLE - Text to use as value of TITLE attribute for browser-generated TooTips +// with the "Print" link in captions of stickies or "Print" button in main text area. +var ol_printtitle="Click to Print"; + +// PRINTFONTCLASS - Print font class. +var ol_printfontclass=""; + +// PRINTCSSFILE - URL for .ccs file with CSS rules for styling the popup. +var ol_printcssfile=""; + +// PRINTXML - String for (optional) xml tag for temporary printing window. +var ol_printxml=""; + +// PRINTDOCTYPE - String for DOCTYPE declaration for temporary printing window. +var ol_printdoctype= + ''; + +// PRINTROOT - String for root tag for temporary printing window. +var ol_printroot=""; + +// PRINTTYPE - String for MIME type for temporary printing window. +var ol_printtype="text/html"; + +// PRINTCHARSET - String for charset for temporary printing window. +var ol_printcharset="iso-8859-1"; + +// PRINTURL - URL for a document to be printed via the temporary printing window. +var ol_printurl=""; + +// PRINTJOB - string for an external function to be used for the temporary printing window. +var ol_printjob=""; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_print.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_scroll.js +//////////////////////////////////////////////////////////////////////////////////// + +// SCROLL - Whether sticky should scroll with the document when positioned via +// RELX or MIDX, and RELY or MIDY. +var ol_scroll = 0; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_scroll.js +//////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION FOR PLUGIN MODULE overlibmws_shadow.js +//////////////////////////////////////////////////////////////////////////////////// + +// SHADOW - Whether to add a dropshadow. Default is no (0). +var ol_shadow = 0; + +// SHADOWX - Horizontal dropshadow displacement in pixels. +// Positive is to the right and negative is to the left. +var ol_shadowx = 5; + +// SHADOWY - Vertical dropshadow displacement in pixels. +// Positive is downward and negative is upward. +var ol_shadowy = 5; + +// SHADOWCOLOR - Dropshadow color. +var ol_shadowcolor = "#666666"; + +// SHADOWIMAGE - Dropshadow background image. Default is none. +var ol_shadowimage = ""; + +// SHADOWOPACITY - Dropshadow opacity (100 is solid; 0 turns off this feature and +// thus also yields a solid shadow). Default is 60. +var ol_shadowopacity = 60; + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION FOR overlibmws_shadow.js +//////////////////////////////////////////////////////////////////////////////////// + diff --git a/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibmws.js b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibmws.js new file mode 100644 index 0000000000..1e0ed37960 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/scripts/overlibmws/overlibmws.js @@ -0,0 +1,694 @@ +/* + Do not remove or change this notice. + overlibmws.js core module - Copyright Foteos Macrides 2002-2005. All rights reserved. + Initial: August 18, 2002 - Last Revised: June 8, 2005 + This module is subject to the same terms of usage as for Erik Bosrup's overLIB, + though only a minority of the code and API now correspond with Erik's version. + See the overlibmws Change History and Command Reference via: + + http://www.macridesweb.com/oltest/ + + Published under an open source license: http://www.macridesweb.com/oltest/license.html + Give credit on sites that use overlibmws and submit changes so others can use them as well. + You can get Erik's version via: http://www.bosrup.com/web/overlib/ +*/ + +// PRE-INIT -- Ignore these lines, configuration is below. +var OLloaded=0,pmCnt=1,pMtr=new Array(),OLcmdLine=new Array(),OLrunTime=new Array(),OLv,OLudf, +OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%"),OLrefXY, +OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0, +OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0,OLprintPI=0; +if(typeof OLgateOK=='undefined')var OLgateOK=1; +var OLp1or2c='inarray,caparray,caption,closetext,right,left,center,autostatuscap,padx,pady,' ++'below,above,vcenter,donothing',OLp1or2co='nofollow,background,offsetx,offsety,fgcolor,' ++'bgcolor,cgcolor,textcolor,capcolor,width,wrap,wrapmax,height,border,base,status,autostatus,' ++'snapx,snapy,fixx,fixy,relx,rely,midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,' ++'cgbackground,fullhtml,capicon,textfont,captionfont,textsize,captionsize,timeout,delay,hauto,' ++'vauto,nojustx,nojusty,fgclass,bgclass,cgclass,capbelow,textpadding,textfontclass,' ++'captionpadding,captionfontclass,sticky,noclose,mouseoff,offdelay,closecolor,closefont,' ++'closesize,closeclick,closetitle,closefontclass,decode',OLp1or2o='text,cap,close,hpos,vpos,' ++'padxl,padxr,padyt,padyb',OLp1co='label',OLp1or2=OLp1or2co+','+OLp1or2o,OLp1=OLp1co+','+'frame'; +OLregCmds(OLp1or2c+','+OLp1or2co+','+OLp1co); +function OLud(v){return eval('typeof ol_'+v+'=="undefined"')?1:0;} + +// DEFAULT CONFIGURATION -- See overlibConfig.txt for descriptions +if(OLud('fgcolor'))var ol_fgcolor="#ccccff"; +if(OLud('bgcolor'))var ol_bgcolor="#333399"; +if(OLud('cgcolor'))var ol_cgcolor="#333399"; +if(OLud('textcolor'))var ol_textcolor="#000000"; +if(OLud('capcolor'))var ol_capcolor="#ffffff"; +if(OLud('closecolor'))var ol_closecolor="#eeeeff"; +if(OLud('textfont'))var ol_textfont="Verdana,Arial,Helvetica"; +if(OLud('captionfont'))var ol_captionfont="Verdana,Arial,Helvetica"; +if(OLud('closefont'))var ol_closefont="Verdana,Arial,Helvetica"; +if(OLud('textsize'))var ol_textsize=1; +if(OLud('captionsize'))var ol_captionsize=1; +if(OLud('closesize'))var ol_closesize=1; +if(OLud('fgclass'))var ol_fgclass=""; +if(OLud('bgclass'))var ol_bgclass=""; +if(OLud('cgclass'))var ol_cgclass=""; +if(OLud('textpadding'))var ol_textpadding=2; +if(OLud('textfontclass'))var ol_textfontclass=""; +if(OLud('captionpadding'))var ol_captionpadding=2; +if(OLud('captionfontclass'))var ol_captionfontclass=""; +if(OLud('closefontclass'))var ol_closefontclass=""; +if(OLud('close'))var ol_close="Close"; +if(OLud('closeclick'))var ol_closeclick=0; +if(OLud('closetitle'))var ol_closetitle="Click to Close"; +if(OLud('text'))var ol_text="Default Text"; +if(OLud('cap'))var ol_cap=""; +if(OLud('capbelow'))var ol_capbelow=0; +if(OLud('background'))var ol_background=""; +if(OLud('width'))var ol_width=200; +if(OLud('wrap'))var ol_wrap=0; +if(OLud('wrapmax'))var ol_wrapmax=0; +if(OLud('height'))var ol_height= -1; +if(OLud('border'))var ol_border=1; +if(OLud('base'))var ol_base=0; +if(OLud('offsetx'))var ol_offsetx=10; +if(OLud('offsety'))var ol_offsety=10; +if(OLud('sticky'))var ol_sticky=0; +if(OLud('nofollow'))var ol_nofollow=0; +if(OLud('noclose'))var ol_noclose=0; +if(OLud('mouseoff'))var ol_mouseoff=0; +if(OLud('offdelay'))var ol_offdelay=300; +if(OLud('hpos'))var ol_hpos=RIGHT; +if(OLud('vpos'))var ol_vpos=BELOW; +if(OLud('status'))var ol_status=""; +if(OLud('autostatus'))var ol_autostatus=0; +if(OLud('snapx'))var ol_snapx=0; +if(OLud('snapy'))var ol_snapy=0; +if(OLud('fixx'))var ol_fixx= -1; +if(OLud('fixy'))var ol_fixy= -1; +if(OLud('relx'))var ol_relx=null; +if(OLud('rely'))var ol_rely=null; +if(OLud('midx'))var ol_midx=null; +if(OLud('midy'))var ol_midy=null; +if(OLud('ref'))var ol_ref=""; +if(OLud('refc'))var ol_refc='UL'; +if(OLud('refp'))var ol_refp='UL'; +if(OLud('refx'))var ol_refx=0; +if(OLud('refy'))var ol_refy=0; +if(OLud('fgbackground'))var ol_fgbackground=""; +if(OLud('bgbackground'))var ol_bgbackground=""; +if(OLud('cgbackground'))var ol_cgbackground=""; +if(OLud('padxl'))var ol_padxl=1; +if(OLud('padxr'))var ol_padxr=1; +if(OLud('padyt'))var ol_padyt=1; +if(OLud('padyb'))var ol_padyb=1; +if(OLud('fullhtml'))var ol_fullhtml=0; +if(OLud('capicon'))var ol_capicon=""; +if(OLud('frame'))var ol_frame=self; +if(OLud('timeout'))var ol_timeout=0; +if(OLud('delay'))var ol_delay=0; +if(OLud('hauto'))var ol_hauto=0; +if(OLud('vauto'))var ol_vauto=0; +if(OLud('nojustx'))var ol_nojustx=0; +if(OLud('nojusty'))var ol_nojusty=0; +if(OLud('label'))var ol_label=""; +if(OLud('decode'))var ol_decode=0; +// ARRAY CONFIGURATION - See overlibConfig.txt for descriptions. +if(OLud('texts'))var ol_texts=new Array("Text 0","Text 1"); +if(OLud('caps'))var ol_caps=new Array("Caption 0","Caption 1"); +// END CONFIGURATION -- Don't change anything below, all configuration is above. + +// INIT -- Runtime variables. +var o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0, +o3_offdelay=300,o3_hpos=RIGHT,o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="", +o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=200,o3_wrap=0, +o3_wrapmax=0,o3_height= -1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0, +o3_snapy=0,o3_fixx= -1,o3_fixy= -1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null,o3_ref="", +o3_refc='UL',o3_refp='UL',o3_refx=0,o3_refy=0,o3_fgbackground="",o3_bgbackground="", +o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,o3_vpos=BELOW, +o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="",o3_closefont="", +o3_textsize=1,o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0,o3_hauto=0, +o3_vauto=0,o3_nojustx=0,o3_nojusty=0,o3_close="",o3_closeclick=0,o3_closetitle="",o3_fgclass="", +o3_bgclass="",o3_cgclass="",o3_textpadding=2,o3_textfontclass="",o3_captionpadding=2, +o3_captionfontclass="",o3_closefontclass="",o3_capbelow=0,o3_label="",o3_decode=0, +CSSOFF=DONOTHING,CSSCLASS=DONOTHING,OLdelayid=0,OLtimerid=0,OLshowid=0,OLndt=0,over=null, +OLfnRef="",OLhover=0,OLx=0,OLy=0,OLshowingsticky=0,OLallowmove=0,OLcC=null, +OLua=navigator.userAgent.toLowerCase(), +OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4), +OLns6=(document.getElementById)?1:0, +OLie4=(document.all)?1:0, +OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0, +OLmac=(OLua.indexOf('mac')>=0)?1:0, +OLsaf=(OLua.indexOf('safari')>=0)?1:0, +OLkon=(OLua.indexOf('konqueror')>=0)?1:0, +OLkht=(OLsaf||OLkon)?1:0, +OLopr=(OLua.indexOf('opera')>=0)?1:0, +OLop7=(OLopr&&document.createTextNode)?1:0; +if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;} +var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0, +OLie5=0,OLie55=0;if(OLie4&&!OLop7){ +if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){ +OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;}if(OLns6)OLie4=0;} +if(OLns4)window.onresize=function(){location.reload();} +var OLchkMh=1,OLdw; +if(OLns4||OLie4||OLns6)OLmh(); +else{overlib=nd=cClick=OLpageDefaults=no_overlib;} + +/* + PUBLIC FUNCTIONS +*/ +// Loads defaults then args into runtime variables. +function overlib(){ +if(!(OLloaded&&OLgateOK))return; +if((OLexclusivePI)&&OLisExclusive(arguments))return true; +if(OLchkMh)OLmh(); +if(OLndt&&!OLtimerid)OLndt=0;if(over)cClick(); +OLload(OLp1or2);OLload(OLp1); +OLfnRef="";OLhover=0; +OLsetRunTimeVar(); +OLparseTokens('o3_',arguments); +if(!(over=OLmkLyr()))return false; +if(o3_decode)OLdecode(); +if(OLprintPI)OLchkPrint(); +if(OLbubblePI)OLchkForBubbleEffect(); +if(OLdebugPI)OLsetDebugCanShow(); +if(OLshadowPI)OLinitShadow(); +if(OLiframePI)OLinitIfs(); +if(OLfilterPI)OLinitFilterLyr(); +if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")o3_status=o3_exclusivestatus; +else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap; +else if(o3_autostatus==1&&o3_text!="")o3_status=o3_text; +if(!o3_delay){return OLmain(); +}else{OLdelayid=setTimeout("OLmain()",o3_delay); +if(o3_status!=""){self.status=o3_status;return true;} +else if(!(OLop7&&event&&event.type=='mouseover'))return false;} +} + +// Clears popups if appropriate +function nd(time){ +if(OLloaded&&OLgateOK){if(!((OLexclusivePI)&&OLisExclusive())){ +if(time&&over&&!o3_delay){if(OLtimerid>0)clearTimeout(OLtimerid); +OLtimerid=(OLhover&&o3_frame==self&&!OLcursorOff())?0: +setTimeout("cClick()",(o3_timeout=OLndt=time));}else{ +if(!OLshowingsticky){OLallowmove=0;if(over)OLhideObject(over);}}}} +return false; +} + +// Close function for stickies +function cClick(){ +if(OLloaded&&OLgateOK){OLhover=0;if(over){ +if(OLovertwoPI&&over==over2)cClick2();OLhideObject(over);OLshowingsticky=0;}} +return false; +} + +// Sets page-specific defaults. +function OLpageDefaults(){ +OLparseTokens('ol_',arguments); +} + +// For unsupported browsers. +function no_overlib(){return false;} + +/* + OVERLIB MAIN FUNCTION SET +*/ +function OLmain(){ +o3_delay=0; +if(o3_frame==self){if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);} +if(o3_sticky)OLshowingsticky=1;OLdoLyr();OLallowmove=0;if(o3_timeout>0){ +if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_timeout);} +if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}} +OLdisp(o3_status);if(OLdraggablePI)OLcheckDrag(); +if(o3_status!="")return true;else if(!(OLop7&&event&&event.type=='mouseover'))return false; +} + +// Loads o3_ variables +function OLload(c){var i,m=c.split(',');for(i=0;i
');d=fd.all[id]; +}else{d=fd.createElement('div');if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null; +if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';o.visibility='hidden';o.zIndex=z;}} +return d; +} + +// Creates and writes layer content +function OLdoLyr(){ +if(o3_background==''&&!o3_fullhtml){ +if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"'; +if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"'; +if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"'; +if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"'; +if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"'; +if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"'; +if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';} +if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);var lyrHtml=OLdoLGF(); +if(o3_sticky&&OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;} +if(o3_wrap&&!o3_fullhtml){OLlayerWrite(lyrHtml); +o3_width=(OLns4?over.clip.width:over.offsetWidth); +if(OLns4&&o3_wrapmax<1)o3_wrapmax=o3_frame.innerWidth-40; +o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();} +OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth); +if(OLbubblePI)OLgenerateBubble(lyrHtml); +} + +/* + LAYER GENERATION FUNCTIONS +*/ +// Makes simple table without caption +function OLcontentSimple(txt){ +var t=OLbgLGF()+OLfgLGF(txt)+OLbaseLGF(); +OLsetBackground('');return t; +} + +// Makes table with caption and optional close link +function OLcontentCaption(txt,title,close){ +var closing=(OLprintPI?OLprintCapLGF():''),closeevent='onmouseover',caption,t, +cC='javascript:return '+OLfnRef+(OLovertwoPI&&over==over2?'cClick2();':'cClick();'); +if(o3_closeclick)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick'; +if(o3_capicon!='')o3_capicon=' '; +if(close){closing+='':'>'+OLlgfUtil(0,'','span',o3_closecolor,o3_closefont,o3_closesize))+close ++(o3_closefontclass?'':OLlgfUtil(1,'','span'))+'';} +caption='':'>')+(o3_captionfontclass?'
':'' ++OLlgfUtil(0,'','div',o3_capcolor,o3_captionfont,o3_captionsize))+o3_capicon+title ++OLlgfUtil(1,'','div')+(o3_captionfontclass?'':'')+''+closing+''; +t=OLbgLGF()+(o3_capbelow?OLfgLGF(txt)+caption:caption+OLfgLGF(txt))+OLbaseLGF(); +OLsetBackground('');return t; +} + +// For BACKGROUND and FULLHTML commands +function OLcontentBackground(txt, image, hasfullhtml){ +var t;if(hasfullhtml){t=txt;}else{t='' ++OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+txt+ +OLlgfUtil(1,'','div')+'';} +OLsetBackground(image);return t; +} + +// LGF utilities +function OLbgLGF(){ +return ''; +} +function OLfgLGF(t){ +return '' ++OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+t ++(OLprintPI?OLprintFgLGF():'')+OLlgfUtil(1,'','div')+''; +} +function OLlgfUtil(end,tfc,ele,col,fac,siz){ +if(end)return ('');else return (tfc?'
': +('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele ++' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';' ++(ele=='span'?'text-decoration:underline;':''))+'">')); +} +function OLquoteMultiNameFonts(f){ +var i,v,pM=f.split(','); +for(i=0;i0&&!o3_wrap)?('
'):'')+''; +} +function OLwd(a){ +return(o3_wrap?'':' width="'+(!a?'100%':(a==1?o3_width:(o3_width-o3_padxl-o3_padxr)))+'"'); +} + +// Loads image into the div. +function OLsetBackground(i){ +if(i==''){if(OLns4)over.background.src=null; +else{if(OLns6)over.style.width='';over.style.backgroundImage='none';} +}else{if(OLns4)over.background.src=i; +else{if(OLns6)over.style.width=o3_width+'px';over.style.backgroundImage='url('+i+')';}} +} + +/* + HANDLING FUNCTIONS +*/ +// Displays layer +function OLdisp(s){ +if(!OLallowmove){if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfs();OLplaceLayer(); +if(OLndt)OLshowObject(over);else OLshowid=setTimeout("OLshowObject(over)",1); +OLallowmove=(o3_sticky||o3_nofollow)?0:1;}OLndt=0;if(s!="")self.status=s; +} + +// Decides placement of layer. +function OLplaceLayer(){ +var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0, +o=OLfd(),nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0; +if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth; +else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth)); +if(SB>20)SB=20;iWd=o3_frame.innerWidth;} +pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset; +if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)SB=CX=5;else +if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0); +LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);} +if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){ +if(o3_ref!=""){X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){ +if(o3_refp=='UR'||o3_refp=='LR')X-=5;} +else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){ +if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X-=o3_shadowx;else +if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X-=o3_shadowx;} +}else{if(o3_midx!=null){ +X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx); +}else{if(o3_relx!=null){ +if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB; +}else{X=o3_fixx+LM;}}} +}else{ +if(o3_hauto){ +if(o3_hpos==LEFT&&OLx-pgLeftiWd/2&&OLx+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;} +X=(o3_hpos==CENTER)?parseInt(OLx-((pWd+CX)/2)+o3_offsetx): +(o3_hpos==LEFT)?OLx-o3_offsetx-pWd:OLx+o3_offsetx; +if(o3_snapx>1){ +snp=X % o3_snapx; +if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}} +if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB) +X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);} +if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){ +if(o3_ref!=""){Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){ +if(o3_refp=='LL'||o3_refp=='LR')Y-=5;}else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){ +if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y-=o3_shadowy;else +if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;} +}else{if(o3_midy!=null){ +Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy); +}else{if(o3_rely!=null){ +if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{ +Y=o3_fixy+TM;}}} +}else{ +if(o3_vauto){ +if(o3_vpos==ABOVE&&OLy-pgTopiHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM) +o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(OLy-((pHt+CY)/2)+o3_offsety): +(o3_vpos==ABOVE)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM; +if(o3_snapy>1){ +snp=Y % o3_snapy; +if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}} +if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM1){ +ob=o[0];rXY[0]+=o[0].x+o[1].pageX;rXY[1]+=o[0].y+o[1].pageY; +}else{if((o.toString().indexOf('Image')!= -1)||(o.toString().indexOf('Anchor')!= -1)){ +rXY[0]+=o.x;rXY[1]+=o.y;}else{rXY[0]+=o.pageX;rXY[1]+=o.pageY;}} +}else{rXY[0]+=OLpageLoc(o,'Left');rXY[1]+=OLpageLoc(o,'Top');} +of=OLgetRefOffsets(ob);rXY[0]+=of[0];rXY[1]+=of[1]; +return rXY; +} +function OLgetRef(l){var r=OLgetRefById(l);return (r)?r:OLgetRefByName(l);} + +// Seeks REFerence by id +function OLgetRefById(l,d){ +var r="",j;l=(l||'overDiv');d=(d||o3_frame.document); +if(OLie4&&d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l); +}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l]; +for(j=0;j0){ +for(j=0;j0)return r;else if(r)return [r,d.layers[j]];}} +return null; +} + +// Gets layer vs REFerence offsets +function OLgetRefOffsets(o){ +var c=o3_refc.toUpperCase(),p=o3_refp.toUpperCase(),W=0,H=0,pW=0,pH=0,of=[0,0]; +pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth; +pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight; +if((!OLop7)&&o.toString().indexOf('Image')!= -1){W=o.width;H=o.height; +}else if((!OLop7)&&o.toString().indexOf('Anchor')!= -1){c=o3_refc='UL';}else{ +W=(OLns4)?o.clip.width:o.offsetWidth;H=(OLns4)?o.clip.height:o.offsetHeight;} +if((OLns4||(OLns6&&OLgek))&&o.border){W+=2*parseInt(o.border);H+=2*parseInt(o.border);} +if(c=='UL'){of=(p=='UR')?[-pW,0]:(p=='LL')?[0,-pH]:(p=='LR')?[-pW,-pH]:[0,0]; +}else if(c=='UR'){of=(p=='UR')?[W-pW,0]:(p=='LL')?[W,-pH]:(p=='LR')?[W-pW,-pH]:[W,0]; +}else if(c=='LL'){of=(p=='UR')?[-pW,H]:(p=='LL')?[0,H-pH]:(p=='LR')?[-pW,H-pH]:[0,H]; +}else if(c=='LR'){of=(p=='UR')?[W-pW,H]:(p=='LL')?[W,H-pH]:(p=='LR')?[W-pW,H-pH]: +[W,H];} +return of; +} + +// Gets x or y location of object +function OLpageLoc(o,t){ +var l=0;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){ +l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t]; +return l; +} + +// Moves layer +function OLmouseMove(e){ +var e=(e||event); +OLcC=(OLovertwoPI&&over2&&over==over2?cClick2:cClick); +OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop); +if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById())){ +OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);} +if(OLhover&&over&&o3_frame==self&&OLcursorOff())if(o3_offdelay<1)OLcC();else +{if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("OLcC()",o3_offdelay);} +} + +// Capture mouse and chain other scripts. +function OLmh(){ +var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/; +OLdw=document;if(document.onmousemove||w){if(w)OLdw=window;f=OLdw.onmousemove.toString(); +fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;return;} +if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);} +s+=';OLmouseMove(e);';mh=new Function('e',s);} +OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE); +} + +/* + PARSING +*/ +function OLparseTokens(pf,ar){ +var i,v,md= -1,par=(pf!='ol_'),p=OLpar,q=OLparQuo,t=OLtoggle;OLudf=(par&&!ar.length?1:0); +for(i=0;i< ar.length;i++){if(md<0){if(typeof ar[i]=='number'){OLudf=(par?1:0);i--;} +else{switch(pf){case 'ol_':ol_text=ar[i];break;default:o3_text=ar[i];}}md=0; +}else{ +if(ar[i]==INARRAY){OLudf=0;eval(pf+'text=ol_texts['+ar[++i]+']');continue;} +if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+']');continue;} +if(ar[i]==CAPTION){q(ar[++i],pf+'cap');continue;} +if(Math.abs(ar[i])==STICKY){t(ar[i],pf+'sticky');continue;} +if(Math.abs(ar[i])==NOFOLLOW){t(ar[i],pf+'nofollow');continue;} +if(ar[i]==BACKGROUND){q(ar[++i],pf+'background');continue;} +if(Math.abs(ar[i])==NOCLOSE){t(ar[i],pf+'noclose');continue;} +if(Math.abs(ar[i])==MOUSEOFF){t(ar[i],pf+'mouseoff');continue;} +if(ar[i]==OFFDELAY){p(ar[++i],pf+'offdelay');continue;} +if(ar[i]==RIGHT||ar[i]==LEFT||ar[i]==CENTER){p(ar[i],pf+'hpos');continue;} +if(ar[i]==OFFSETX){p(ar[++i],pf+'offsetx');continue;} +if(ar[i]==OFFSETY){p(ar[++i],pf+'offsety');continue;} +if(ar[i]==FGCOLOR){q(ar[++i],pf+'fgcolor');continue;} +if(ar[i]==BGCOLOR){q(ar[++i],pf+'bgcolor');continue;} +if(ar[i]==CGCOLOR){q(ar[++i],pf+'cgcolor');continue;} +if(ar[i]==TEXTCOLOR){q(ar[++i],pf+'textcolor');continue;} +if(ar[i]==CAPCOLOR){q(ar[++i],pf+'capcolor');continue;} +if(ar[i]==CLOSECOLOR){q(ar[++i],pf+'closecolor');continue;} +if(ar[i]==WIDTH){p(ar[++i],pf+'width');continue;} +if(Math.abs(ar[i])==WRAP){t(ar[i],pf+'wrap');continue;} +if(ar[i]==WRAPMAX){p(ar[++i],pf+'wrapmax');continue;} +if(ar[i]==HEIGHT){p(ar[++i],pf+'height');continue;} +if(ar[i]==BORDER){p(ar[++i],pf+'border');continue;} +if(ar[i]==BASE){p(ar[++i],pf+'base');continue;} +if(ar[i]==STATUS){q(ar[++i],pf+'status');continue;} +if(Math.abs(ar[i])==AUTOSTATUS){v=pf+'autostatus'; +eval(v+'=('+ar[i]+'<0)?('+v+'==2?2:0):('+v+'==1?0:1)');continue;} +if(Math.abs(ar[i])==AUTOSTATUSCAP){v=pf+'autostatus'; +eval(v+'=('+ar[i]+'<0)?('+v+'==1?1:0):('+v+'==2?0:2)');continue;} +if(ar[i]==CLOSETEXT){q(ar[++i],pf+'close');continue;} +if(ar[i]==SNAPX){p(ar[++i],pf+'snapx');continue;} +if(ar[i]==SNAPY){p(ar[++i],pf+'snapy');continue;} +if(ar[i]==FIXX){p(ar[++i],pf+'fixx');continue;} +if(ar[i]==FIXY){p(ar[++i],pf+'fixy');continue;} +if(ar[i]==RELX){p(ar[++i],pf+'relx');continue;} +if(ar[i]==RELY){p(ar[++i],pf+'rely');continue;} +if(ar[i]==MIDX){p(ar[++i],pf+'midx');continue;} +if(ar[i]==MIDY){p(ar[++i],pf+'midy');continue;} +if(ar[i]==REF){q(ar[++i],pf+'ref');continue;} +if(ar[i]==REFC){q(ar[++i],pf+'refc');continue;} +if(ar[i]==REFP){q(ar[++i],pf+'refp');continue;} +if(ar[i]==REFX){p(ar[++i],pf+'refx');continue;} +if(ar[i]==REFY){p(ar[++i],pf+'refy');continue;} +if(ar[i]==FGBACKGROUND){q(ar[++i],pf+'fgbackground');continue;} +if(ar[i]==BGBACKGROUND){q(ar[++i],pf+'bgbackground');continue;} +if(ar[i]==CGBACKGROUND){q(ar[++i],pf+'cgbackground');continue;} +if(ar[i]==PADX){p(ar[++i],pf+'padxl');p(ar[++i],pf+'padxr');continue;} +if(ar[i]==PADY){p(ar[++i],pf+'padyt');p(ar[++i],pf+'padyb');continue;} +if(Math.abs(ar[i])==FULLHTML){t(ar[i],pf+'fullhtml');continue;} +if(ar[i]==BELOW||ar[i]==ABOVE||ar[i]==VCENTER){p(ar[i],pf+'vpos');continue;} +if(ar[i]==CAPICON){q(ar[++i],pf+'capicon');continue;} +if(ar[i]==TEXTFONT){q(ar[++i],pf+'textfont');continue;} +if(ar[i]==CAPTIONFONT){q(ar[++i],pf+'captionfont');continue;} +if(ar[i]==CLOSEFONT){q(ar[++i],pf+'closefont');continue;} +if(ar[i]==TEXTSIZE){q(ar[++i],pf+'textsize');continue;} +if(ar[i]==CAPTIONSIZE){q(ar[++i],pf+'captionsize');continue;} +if(ar[i]==CLOSESIZE){q(ar[++i],pf+'closesize');continue;} +if(ar[i]==TIMEOUT){p(ar[++i],pf+'timeout');continue;} +if(ar[i]==DELAY){p(ar[++i],pf+'delay');continue;} +if(Math.abs(ar[i])==HAUTO){t(ar[i],pf+'hauto');continue;} +if(Math.abs(ar[i])==VAUTO){t(ar[i],pf+'vauto');continue;} +if(Math.abs(ar[i])==NOJUSTX){t(ar[i],pf+'nojustx');continue;} +if(Math.abs(ar[i])==NOJUSTY){t(ar[i],pf+'nojusty');continue;} +if(Math.abs(ar[i])==CLOSECLICK){t(ar[i],pf+'closeclick');continue;} +if(ar[i]==CLOSETITLE){q(ar[++i],pf+'closetitle');continue;} +if(ar[i]==FGCLASS){q(ar[++i],pf+'fgclass');continue;} +if(ar[i]==BGCLASS){q(ar[++i],pf+'bgclass');continue;} +if(ar[i]==CGCLASS){q(ar[++i],pf+'cgclass');continue;} +if(ar[i]==TEXTPADDING){p(ar[++i],pf+'textpadding');continue;} +if(ar[i]==TEXTFONTCLASS){q(ar[++i],pf+'textfontclass');continue;} +if(ar[i]==CAPTIONPADDING){p(ar[++i],pf+'captionpadding');continue;} +if(ar[i]==CAPTIONFONTCLASS){q(ar[++i],pf+'captionfontclass');continue;} +if(ar[i]==CLOSEFONTCLASS){q(ar[++i],pf+'closefontclass');continue;} +if(Math.abs(ar[i])==CAPBELOW){t(ar[i],pf+'capbelow');continue;} +if(ar[i]==LABEL){q(ar[++i],pf+'label');continue;} +if(Math.abs(ar[i])==DECODE){t(ar[i],pf+'decode');continue;} +if(ar[i]==DONOTHING){continue;} +i=OLparseCmdLine(pf,i,ar);}} +if((OLfunctionPI)&&OLudf&&o3_function)o3_text=o3_function(); +if(pf=='o3_')OLfontSize(); +} +function OLpar(a,v){eval(v+'='+a);} +function OLparQuo(a,v){eval(v+"='"+OLescSglQt(a)+"'");} +function OLescSglQt(s){return s.toString().replace(/'/g,"\\'");} +function OLtoggle(a,v){eval(v+'=('+v+'==0&&'+a+'>=0)?1:0');} +function OLhasDims(s){return /[%\-a-z]+$/.test(s);} +function OLfontSize(){ +var i;if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else +if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else +if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else +if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLprintPI)OLprintDims(); +} +function OLdecode(){ +var re=/%[0-9A-Fa-f]{2,}/,t=o3_text,c=o3_cap,u=unescape,d=!OLns4&&(!OLgek||OLgek>=20020826) +&&typeof decodeURIComponent?decodeURIComponent:u;if(typeof(window.TypeError)=='function'){ +if(re.test(t)){eval(new Array('try{','o3_text=d(t);','}catch(e){','o3_text=u(t);', +'}').join('\n'))};if(c&&re.test(c)){eval(new Array('try{','o3_cap=d(c);','}catch(e){', +'o3_cap=u(c);','}').join('\n'))}}else{if(re.test(t))o3_text=u(t);if(c&&re.test(c))o3_cap=u(c);} +} + +/* + LAYER FUNCTIONS +*/ +// Writes to layer +function OLlayerWrite(t){ +t+="\n"; +if(OLns4){over.document.write(t);over.document.close(); +}else if(typeof over.innerHTML!='undefined'){if(OLieM)over.innerHTML='';over.innerHTML=t; +}else{range=o3_frame.document.createRange();range.setStartAfter(over); +domfrag=range.createContextualFragment(t); +while(over.hasChildNodes()){over.removeChild(over.lastChild);} +over.appendChild(domfrag);} +if(OLprintPI)over.print=o3_print?t:null; +} + +// Makes object visible +function OLshowObject(o){ +OLshowid=0;o=(OLns4)?o:o.style; +if(((OLfilterPI)&&!OLchkFilter(o))||!OLfilterPI)o.visibility="visible"; +if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfs();if(OLhidePI)OLhideUtil(1,1,0); +} + +// Hides object +function OLhideObject(o){ +if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;} +if(OLtimerid>0)clearTimeout(OLtimerid);if(OLdelayid>0)clearTimeout(OLdelayid); +OLtimerid=0;OLdelayid=0;self.status="";o3_label=ol_label; +if(o3_frame!=self)o=OLgetRefById(); +if(o){if(o.onmouseover)o.onmouseover=null; +if(OLscrollPI&&o==over)OLclearScroll(); +if(OLdraggablePI)OLclearDrag(); +if(OLfilterPI)OLcleanupFilter(o);if(OLshadowPI)OLhideShadow(); +var os=(OLns4)?o:o.style;os.visibility="hidden"; +if(OLhidePI&&o==over)OLhideUtil(0,0,1);if(OLiframePI)OLhideIfs(o);} +} + +// Moves layer +function OLrepositionTo(o,xL,yL){ +o=(OLns4)?o:o.style; +o.left=(OLns4?xL:xL+'px'); +o.top=(OLns4?yL:yL+'px'); +} + +// Handle NOCLOSE-MOUSEOFF +function OLoptMOUSEOFF(c){ +if(!c)o3_close=""; +over.onmouseover=function(){OLhover=1;if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}} +} +function OLcursorOff(){ +var o=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight, +left=parseInt(o.left),top=parseInt(o.top), +right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt); +if(OLxright||OLybottom)return true; +return false; +} + +/* + REGISTRATION +*/ +function OLsetRunTimeVar(){ +if(OLrunTime.length)for(var k=0;k-1){i=j;break;}}} +return i; +} +function OLregCmds(c){ +if(typeof c!='string')return; +var pM=c.split(',');pMtr=pMtr.concat(pM); +for(var i=0;i0)bPadDiff=(bHtDiff<2)?0:parseInt(0.5*bHtDiff); +Y=(bHtDiff<0)?fc*bTopPad[OLbI]:fc*bTopPad[OLbI]+bPadDiff; +X=fc*bLeftPad[OLbI]; +Y=Math.round(Y); +X=Math.round(X); +o3_width=fc*bWd[OLbI]; +OLbubbleHt=fc*bHt[OLbI]; +txt=''+(OLns4?'
': +'
')+content+'
'; +OLlayerWrite(txt); +if(OLns4){ +bCobj=over.document.layers['bContent']; +if(typeof bCobj=='undefined')return; +bCobj.top=Y; +bCobj.left=X; +bCobj.clip.width=fc*OLbContentWd[OLbI]; +bCobj.zIndex=1;} +if(fc*bArwTipY[OLbI]<0.5*fc*bHt[OLbI])sY=fc*bArwTipY[OLbI]; +else sY= -(fc*bHt[OLbI]+20); +o3_offsetx -=fc*bArwTipX[OLbI]; +o3_offsety +=sY; +} + +function OLdoRoundCorners(content) { +var txt,wd,ht,o=OLbubbleImg[OLbI]; +wd=(OLns4)?over.clip.width:over.offsetWidth; +ht=(OLns4)?over.clip.height:over.offsetHeight; +txt='' ++'' ++''+'
'+content ++'
' ++'
'; +OLlayerWrite(txt); +o3_width=wd+28; +OLbubbleHt=ht+28; +} + +function OLresizeBubble(h1,dF,fold){ +var df,h2,fnew,alpha,cnt=0; +while(cnt<2){ +df= -OLsignOf(h1)*dF; +fnew=fold+df; +h2=OLgetHeightDiff(fnew)[0]; +if(Math.abs(h2)<11)break; +if(OLsignOf(h1)!=OLsignOf(h2)){ +alpha=Math.abs(h1)/(Math.abs(h1)+Math.abs(h2)); +if(h1<0)fnew=alpha*fnew+(1.0-alpha)*fold; +else fnew=(1.0-alpha)*fnew+alpha*fold; +}else{ +alpha=Math.abs(h1)/(Math.abs(h2)-Math.abs(h1)); +if(h1<0)fnew=(1.0+alpha)*fold-alpha*fnew; +else fnew=(1.0+alpha)*fnew-alpha*fold;} +fold=fnew; +h1=h2; +dF*=0.5; +cnt++;} +return fnew; +} + +function OLgetHeightDiff(f){ +var lyrhtml; +o3_width=f*OLcontentWidth[OLbI]; +lyrhtml=OLcontentSimple(o3_text); +OLlayerWrite(lyrhtml) +return [f*OLcontentHeight[OLbI]-((OLns4)?over.clip.height:over.offsetHeight),lyrhtml]; +} + +function OLsignOf(x){ +return (x<0)? -1:1; +} + +OLregRunTimeFunc(OLloadBubble); +OLregCmdLineFunc(OLparseBubble); + +if(OLns4) +document.write( +' + + + + + + + + + + + + + + + + valid + valid + invalid + + + + + + readonly + readwrite + + + + + + required + optional + + + + + + enabled + disabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enabled + disabled + + + + + + + + + + + + + + + + diff --git a/source/web/jsp/content/xforms/forms/xslt/transform-for-validation.xsl b/source/web/jsp/content/xforms/forms/xslt/transform-for-validation.xsl new file mode 100644 index 0000000000..56521d4dbf --- /dev/null +++ b/source/web/jsp/content/xforms/forms/xslt/transform-for-validation.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + http://www.w3.org/2002/xforms xforms.xsd http://chiba.sourceforge.net/xforms chiba.xsd http://www.w3.org/1999/xlink xlink.xsd + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/web/jsp/content/xforms/forms/xslt/ui.xsl b/source/web/jsp/content/xforms/forms/xslt/ui.xsl new file mode 100644 index 0000000000..706c7b3aa8 --- /dev/null +++ b/source/web/jsp/content/xforms/forms/xslt/ui.xsl @@ -0,0 +1,758 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + display:none; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + checked + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + checked + + +
+
+ + + + + + + &nbsp; + + + + + + + + + + + disabled + enabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + checked + + + + + + +
+
+ + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+
+ + + + + + + + + + +
+ +
+
+ + + + + + +
+ +
+
+ + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + repeat-item repeat-index + + + repeat-item + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disabled + + + enabled + + + + + + + + disabled + + + enabled + + + + + + + + readonly + + + readwrite + + + + + + + + required + + + optional + + + + + + + + invalid + + + valid + + + + + + + + + + +
diff --git a/source/web/jsp/content/xforms/forms/xslt/vcard.xsl b/source/web/jsp/content/xforms/forms/xslt/vcard.xsl new file mode 100644 index 0000000000..9696e72e8e --- /dev/null +++ b/source/web/jsp/content/xforms/forms/xslt/vcard.xsl @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + Mozilla style vCard form + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + 2003 Chiba Project + +
+ +
+
+ + +
+ + + + +
+
+ + + + + + + + + + + + +
+ +
+ + + +
+
+ + + + + + + + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + +
diff --git a/source/web/jsp/dialog/edit-xml-inline.jsp b/source/web/jsp/dialog/edit-xml-inline.jsp new file mode 100644 index 0000000000..512f77d825 --- /dev/null +++ b/source/web/jsp/dialog/edit-xml-inline.jsp @@ -0,0 +1,191 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> +<%@ page import="org.alfresco.web.bean.*, + org.alfresco.service.cmr.repository.*, + org.alfresco.web.bean.content.*, + org.alfresco.web.templating.*" %> +<% +CheckinCheckoutBean ccb = (CheckinCheckoutBean)session.getAttribute("CheckinCheckoutBean"); +NodeRef nr = ccb.getDocument().getNodeRef(); +String ttName = (String)ccb.getNodeService().getProperty(nr, CreateContentWizard.TT_QNAME); +TemplatingService ts = TemplatingService.getInstance(); +TemplateType tt = ts.getTemplateType(ttName); +TemplateInputMethod tim = tt.getInputMethods()[0]; +String url = tim.getInputURL(ts.parseXML(ccb.getDocumentContent()), tt); +System.out.println("TTTTTT " + tt); +System.out.println("inputurl " + url); +%> + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- Error Messages --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
''
+
+
+ +
+ + + + + + + + <%-- Inline editor --%> + + + +
+ <%-- Hide the checkout info if this document is already checked out --%> + + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> + + + + + + +
+ + + + + +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> +
+
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+
+ <%-- messages tag to show messages not handled by other specific message tags --%> + +
+
+ +
+ +
+ +
\ No newline at end of file