[Yanel-commits] rev 21055 - in public/yanel/trunk/src/resources: . importsite importsite/src importsite/src/build importsite/src/java importsite/src/java/org importsite/src/java/org/wyona importsite/src/java/org/wyona/yanel importsite/src/java/org/wyona/yanel/impl importsite/src/java/org/wyona/yanel/impl/resources importsite/xml importsite/xslt

michi at wyona.com michi at wyona.com
Thu Dec 21 10:20:11 CET 2006


Author: michi
Date: 2006-12-21 10:20:10 +0100 (Thu, 21 Dec 2006)
New Revision: 21055

Added:
   public/yanel/trunk/src/resources/importsite/
   public/yanel/trunk/src/resources/importsite/build.xml
   public/yanel/trunk/src/resources/importsite/resource.xml
   public/yanel/trunk/src/resources/importsite/src/
   public/yanel/trunk/src/resources/importsite/src/build/
   public/yanel/trunk/src/resources/importsite/src/build/build.properties
   public/yanel/trunk/src/resources/importsite/src/build/dependencies.xml
   public/yanel/trunk/src/resources/importsite/src/java/
   public/yanel/trunk/src/resources/importsite/src/java/org/
   public/yanel/trunk/src/resources/importsite/src/java/org/wyona/
   public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/
   public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/
   public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/resources/
   public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/resources/ImportSiteResource.java
   public/yanel/trunk/src/resources/importsite/xml/
   public/yanel/trunk/src/resources/importsite/xml/input-screen.xml
   public/yanel/trunk/src/resources/importsite/xml/status-screen.xml
   public/yanel/trunk/src/resources/importsite/xslt/
   public/yanel/trunk/src/resources/importsite/xslt/importsite.xsl
Log:
import resource added

Added: public/yanel/trunk/src/resources/importsite/build.xml
===================================================================
--- public/yanel/trunk/src/resources/importsite/build.xml	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/build.xml	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<project name="yanel-resource" default="compile">
+
+  <import file="src/build/dependencies.xml"/>
+
+  <target name="init" description="Initialize build" depends="dependencies">
+    <echo>Initialize build</echo>
+
+    <dirname property="resource.home.dir" file="${ant.file}"/>
+    <echo>Resource Home Directory: ${resource.home.dir}</echo>
+
+    <property file="${resource.home.dir}/src/build/local.build.properties"/>
+    <property file="${resource.home.dir}/src/build/build.properties"/>
+
+    <path id="classpath">
+      <pathelement path="${maven2.cp}"/>
+    </path>
+    <property name="resource.build.dir" value="${resource.home.dir}/build"/>
+    <property name="resource.classes.dir" value="${resource.build.dir}/classes"/>
+    <property name="resource.lib.dir" value="${resource.build.dir}/lib"/>
+    <property name="resource.java.dir" value="${resource.home.dir}/src/java"/>
+  </target>
+
+  <target name="compile" description="Compile Java classes" depends="init">
+
+    <mkdir dir="${resource.classes.dir}"/>
+    <javac srcdir="${resource.java.dir}" destdir="${resource.classes.dir}"
+      classpathref="classpath"
+      debug="true"
+    />
+    <mkdir dir="${resource.lib.dir}"/>
+    <jar destfile="${resource.lib.dir}/yanel-resource-${resource.name}-${resource.version}.jar"
+      basedir="${resource.classes.dir}"
+    />
+  </target>
+
+  <target name="clean" depends="init">
+    <delete dir="${resource.build.dir}"/>
+  </target>
+
+  <target name="copy-dependencies" depends="init">
+    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
+      <fileset refid="maven2.resource.fileset"/>
+      <mapper type="flatten"/>
+    </copy>
+  </target>
+</project>

Added: public/yanel/trunk/src/resources/importsite/resource.xml
===================================================================
--- public/yanel/trunk/src/resources/importsite/resource.xml	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/resource.xml	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+
+<resource xmlns="http://www.wyona.org/yanel/1.0"
+  name="importsite"
+  namespace="http://www.wyona.org/yanel/resource/1.0"
+  class="org.wyona.yanel.impl.resources.ImportSiteResource"
+  >
+<description>
+Import Site Resource
+</description>
+</resource>

Added: public/yanel/trunk/src/resources/importsite/src/build/build.properties
===================================================================
--- public/yanel/trunk/src/resources/importsite/src/build/build.properties	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/src/build/build.properties	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,2 @@
+resource.name=importsite
+resource.version=0.0.1-dev-rXXX

Added: public/yanel/trunk/src/resources/importsite/src/build/dependencies.xml
===================================================================
--- public/yanel/trunk/src/resources/importsite/src/build/dependencies.xml	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/src/build/dependencies.xml	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<project name="wiki-dependencies" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+  <target name="dependencies" description="Dependencies">
+    <!-- INFO: http://maven.apache.org/ant-tasks.html -->
+    <artifact:remoteRepository id="wyona.remote.repository" url="http://www.wyona.org/maven2/"/>
+
+    <artifact:dependencies pathId="maven2.classpath" filesetId="maven2.fileset">
+      <remoteRepository refid="wyona.remote.repository"/>
+      <dependency groupId="javax.servlet" artifactId="servlet-api" 
+                  version="2.3" scope="provided" />
+      <dependency groupId="log4j" artifactId="log4j"
+                  version="1.2.8"/>
+      <dependency groupId="wyona-org-yanel" artifactId="yanel-core"
+                  version="${yanel.source.version}"/>
+<!--
+                  version="0.0.1-dev-r17165"/>
+-->
+      <dependency groupId="yarep" artifactId="yarep"
+                  version="0.0.1-dev-r21033"/>
+      <dependency groupId="wyona-org-commons" artifactId="wyona-org-commons"
+                  version="0.0.1-dev-r19469"/>
+    </artifact:dependencies>
+
+    <artifact:dependencies pathId="maven2.resource.classpath" filesetId="maven2.resource.fileset">
+      <remoteRepository refid="wyona.remote.repository"/>
+      <!-- No resource specific libs yet -->
+    </artifact:dependencies>
+
+    <property name="maven2.cp" refid="maven2.classpath"/>
+    <!--<echo>Maven2 classpath: ${maven2.cp}</echo>-->
+  </target>
+
+</project>

Added: public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/resources/ImportSiteResource.java
===================================================================
--- public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/resources/ImportSiteResource.java	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/src/java/org/wyona/yanel/impl/resources/ImportSiteResource.java	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2006 Wyona
+ */
+
+package org.wyona.yanel.impl.resources;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.StringReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.log4j.Category;
+import org.wyona.yanel.core.Path;
+import org.wyona.yanel.core.Resource;
+import org.wyona.yanel.core.api.attributes.ViewableV1;
+import org.wyona.yanel.core.attributes.viewable.View;
+import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
+import org.wyona.yarep.core.NoSuchNodeException;
+import org.wyona.yarep.core.Repository;
+import org.wyona.yarep.core.RepositoryException;
+import org.wyona.yarep.core.RepositoryFactory;
+import org.wyona.yanel.core.transformation.I18nTransformer;
+import org.wyona.yarep.util.RepoPath;
+import org.wyona.yarep.util.YarepUtil;
+import org.wyona.yanel.core.util.HttpServletRequestHelper;
+
+/**
+ *
+ */
+public class ImportSiteResource extends Resource implements ViewableV1 {
+
+    private static Category log = Category.getInstance(ImportSiteResource.class);
+    private Repository repository  = null;
+    private RepoPath rp = null;
+    private Path path = null;
+    private String defaultLanguage = "en";
+    private String language = null;
+
+    /**
+     *
+     */
+    public ImportSiteResource() {
+    }
+
+    /**
+     *
+     */
+    public ViewDescriptor[] getViewDescriptors() {
+        return null;
+    }
+    
+    /**
+     * 
+     */
+    public View getView(Path path, String viewId) {
+        return null;
+    }
+
+    /**
+     * 
+     */
+    public View getView(HttpServletRequest request, String viewId) throws Exception {
+        // Get repository
+        path = new Path(request.getServletPath());
+        rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
+        repository = rp.getRepo();
+
+        // Get language
+        try {
+            language = request.getParameter("yanel.meta.language");
+        } catch(Exception e) {
+            log.debug("language param is not found will use default : " + language);
+            language = defaultLanguage;
+        }
+        if(language == null || ("").equals(language)) {
+            log.debug("language param is empty or null : " + language);
+            language = defaultLanguage;
+        }
+
+        Transformer transformer = null;
+        I18nTransformer i18nTransformer = null;
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        View defaultView = new View();
+
+        try {
+
+            // Check if data was sumbitted (realm ID, realm Name, URL to be dumped, depth of crawling, max number of pages)
+            boolean submit = false;
+            Enumeration enumeration = request.getParameterNames();
+            while(enumeration.hasMoreElements()){
+                if(enumeration.nextElement().toString().equals("submit")) 
+                    submit = true;
+            }
+            if(submit) {
+                File statusXSLTFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xslt" + File.separator + "importsite.xsl");
+                File statusXMLFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xml" + File.separator + "input-screen.xml");
+                transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(statusXSLTFile));
+                transformer.setParameter("realm", HttpServletRequestHelper.getParameter(request, "realm"));
+                transformer.setParameter("url", HttpServletRequestHelper.getParameter(request, "url"));
+                transformer.setParameter("crawldepth", HttpServletRequestHelper.getParameter(request, "crawldepth"));
+                transformer.setParameter("maxpages", HttpServletRequestHelper.getParameter(request, "maxpages"));
+            } else {
+                File inputXSLTFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xslt" + File.separator + "importsite.xsl");
+                File inputXMLFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xml" + File.separator + "input-screen.xml");
+                transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(inputXSLTFile));
+
+                transformer.transform(new javax.xml.transform.stream.StreamSource(inputXMLFile), new StreamResult(byteArrayOutputStream));
+            }
+
+            defaultView.setMimeType("application/xhtml+xml");
+
+/*
+            //translate the form
+            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
+            saxParser = SAXParserFactory.newInstance().newSAXParser();
+            saxParser.parse(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), i18nTransformer);
+            transformer = TransformerFactory.newInstance().newTransformer(getXSLTStreamSource(path, repository));
+            transformer.setParameter("yanel.path.name", path.getName());
+            transformer.setParameter("yanel.path", path.toString());
+            transformer.setParameter("yanel.back2context", backToRoot(path, ""));
+            transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+ 
+            byteArrayOutputStream = new ByteArrayOutputStream();
+            transformer.transform(new StreamSource(i18nTransformer.getInputStream()), new StreamResult(byteArrayOutputStream));
+            //tranlate the page
+            i18nTransformer = new I18nTransformer("global", language);
+            saxParser = SAXParserFactory.newInstance().newSAXParser();
+            saxParser.parse(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), i18nTransformer);
+*/
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+
+        defaultView.setInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
+        //defaultView.setInputStream(i18nTransformer.getInputStream());
+        return defaultView;
+    }
+
+    /**
+     * 
+     * @param path
+     * @return
+     * @throws Exception
+     */
+    private RepoPath contentRepo(Path path) throws Exception {
+        return new YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(
+                path.toString()), getRepositoryFactory());
+    }
+
+    /**
+     * 
+     * @param path
+     * @param viewId
+     * @return
+     */
+    private String getMimeType(Path path, String viewId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    /**
+     * 
+     * @param path
+     * @param repo
+     * @return
+     * @throws NoSuchNodeException
+     */
+    private StreamSource getXSLTStreamSource(Path path, Repository repo)
+            throws NoSuchNodeException, RepositoryException {
+        Path xsltPath = getXSLTPath(path);
+        if (xsltPath != null) {
+            return new StreamSource(repo
+                    .getInputStream(new org.wyona.yarep.core.Path(getXSLTPath(
+                            path).toString())));
+        } else {
+            File xsltFile = org.wyona.commons.io.FileUtil.file(rtd
+                    .getConfigFile().getParentFile().getAbsolutePath(), "xslt"
+                    + File.separator + "importsite.xsl");
+            log.error("DEBUG: XSLT file: " + xsltFile);
+            return new StreamSource(xsltFile);
+        }
+    }
+    
+    /**
+     * 
+     * @param path
+     * @return
+     */
+    private Path getXSLTPath(Path path) {
+        String xsltPath = null;
+        try {
+            java.io.BufferedReader br = new java.io.BufferedReader(rp
+                    .getRepo().getReader(
+                            new org.wyona.yarep.core.Path(new Path(rp
+                                    .getPath().toString()).getRTIPath()
+                                    .toString())));
+
+            while ((xsltPath = br.readLine()) != null) {
+                if (xsltPath.indexOf("xslt:") == 0) {
+                    xsltPath = xsltPath.substring(6);
+                    log.debug("XSLT Path: " + xsltPath);
+                    return new Path(xsltPath);
+                }
+            }
+            log.error("No XSLT Path within: " + rp.getPath());
+        } catch (Exception e) {
+            log.warn(e);
+        }
+        return null;
+    }
+    
+    /**
+     * this method reads out the specified key from rti file 
+     * if key cannot be found return null
+     * @param key
+     * @return value
+     */
+    private String getProperty(String key) {
+        try {
+            java.io.BufferedReader bufferedReader = new java.io.BufferedReader(rp.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rp.getPath().toString()).getRTIPath().toString())));
+            String line = null;
+            while((line = bufferedReader.readLine()) != null) {
+                if(line.indexOf(key) == 0) {
+                    return line.substring(key.length() + 1);
+                }
+            }
+        } catch (Exception e) {
+            log.error(e);
+        }
+        return null;
+    }
+    
+    /**
+     * 
+     * @param path
+     * @return
+     */
+    private String getMimeType(Path path) {
+        String mimeType = null;
+        try {
+            java.io.BufferedReader br = new java.io.BufferedReader(rp
+                    .getRepo().getReader(
+                            new org.wyona.yarep.core.Path(new Path(rp
+                                    .getPath().toString()).getRTIPath()
+                                    .toString())));
+
+            while ((mimeType = br.readLine()) != null) {
+                if (mimeType.indexOf("mime-type:") == 0) {
+                    mimeType = mimeType.substring(11);
+                    log.info("*" + mimeType + "*");
+                    return mimeType;
+                }
+            }
+        } catch (Exception e) {
+            log.warn(e);
+        }
+        // NOTE: Assuming fallback re importsite.xsl ...
+        return "application/xhtml+xml";
+    }
+   
+   /**
+    * 
+    * @return
+    */
+   protected RepositoryFactory getRepositoryFactory() {
+       return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+   }
+   
+   /**
+    * 
+    * @param path
+    * @param backToRoot
+    * @return
+    */
+   private String backToRoot(Path path, String backToRoot) {
+       org.wyona.commons.io.Path parent = path.getParent();
+       if (parent != null && !isRoot(parent)) {
+           return backToRoot(new Path(parent.toString()), backToRoot + "../");
+       }
+       return backToRoot;
+   }
+
+   /**
+    * 
+    * @param path
+    * @return
+    */
+   private boolean isRoot(org.wyona.commons.io.Path path) {
+       if (path.toString().equals(File.separator)) return true;
+       return false;
+   }
+
+    
+}

Added: public/yanel/trunk/src/resources/importsite/xml/input-screen.xml
===================================================================
--- public/yanel/trunk/src/resources/importsite/xml/input-screen.xml	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/xml/input-screen.xml	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form name="importsite-input">
+  <inputfields>
+    <input required="true">realm</input>
+    <input required="true">url</input>
+    <input required="true">crawldepth</input>
+    <input required="true">maxpages</input>
+  </inputfields>
+</form>

Added: public/yanel/trunk/src/resources/importsite/xml/status-screen.xml
===================================================================
--- public/yanel/trunk/src/resources/importsite/xml/status-screen.xml	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/xml/status-screen.xml	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form name="importsite-status">
+  <inputfields>
+    <input required="true">realm</input>
+    <input required="true">url</input>
+    <input required="true">crawldepth</input>
+    <input required="true">maxpages</input>
+  </inputfields>
+</form>

Added: public/yanel/trunk/src/resources/importsite/xslt/importsite.xsl
===================================================================
--- public/yanel/trunk/src/resources/importsite/xslt/importsite.xsl	2006-12-21 08:46:20 UTC (rev 21054)
+++ public/yanel/trunk/src/resources/importsite/xslt/importsite.xsl	2006-12-21 09:20:10 UTC (rev 21055)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  xmlns="http://www.w3.org/1999/xhtml"
+>
+
+  <xsl:output method="xhtml" encoding="UTF-8"/>
+
+  <xsl:param name="company" select="''"/>
+  <xsl:param name="firstName" select="''"/>
+  <xsl:param name="lastName" select="''"/>
+  <xsl:param name="email" select="''"/>
+  <xsl:param name="address" select="''"/>
+  <xsl:param name="zipCity" select="''"/>
+  <xsl:param name="message" select="''"/>
+  <xsl:param name="error" select="''"/>
+  
+  <xsl:param name="sent" select="'false'"/>
+
+  <xsl:template match="/">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+      <head>
+        <title><i18n:message key="contact"/></title>
+      </head>
+      
+      <body>
+        <h3><i18n:message key="contact"/></h3>
+        <p><i18n:message key="generalInquiriesPleaseContact"/><a href="mailto:contact at wyona.com">contact at wyona.com</a>.</p>
+        <p><i18n:message key="mailingAddressCanBeFound"/><a href="http://www.wyona.com/contact.html"><i18n:message key="corporateContactPage"/></a>.</p>
+        <div id="contenBody">
+        
+          <xsl:choose>
+            <xsl:when test="$error != ''">
+              <xsl:apply-templates select="form" mode="error"/>
+            </xsl:when>
+            <xsl:when test="$sent = 'true'">
+              <xsl:apply-templates select="form" mode="thankYou"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates select="form" mode="init"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="form" mode="init">
+    <form name="contact-form" method="post" action="#">
+      <table cellpadding="0" cellspacing="0" border="0">
+        <xsl:for-each select="inputfields/input">
+          <xsl:variable name="inputName"><xsl:value-of select="."/></xsl:variable>
+          <tr>
+            <td align="right" valign="top" class="contentfield"><i18n:message><xsl:attribute name="key"><xsl:value-of select="$inputName"/></xsl:attribute></i18n:message>:&#0160;</td>
+            <td>
+              <input type="text" name="{$inputName}" class="box" size="40"/>
+            </td>
+            <td><xsl:if test="@required = 'true'">*</xsl:if></td>
+          </tr>
+        </xsl:for-each>
+        
+        <xsl:for-each select="textAreas">
+          <xsl:variable name="inputName"><xsl:value-of select="textArea"/></xsl:variable>
+          <tr>
+            <td align="right" valign="top" class="contentfield"><i18n:message><xsl:attribute name="key"><xsl:value-of select="$inputName"/></xsl:attribute></i18n:message>:&#0160;</td>
+            <td>
+              <textarea rows="8" name="{$inputName}" cols="30" class="box"></textarea>
+            </td>
+            <td><xsl:if test="@required = 'true'">*</xsl:if></td>
+          </tr>
+        </xsl:for-each>
+        
+        <tr>
+          <td colspan="2">&#160;
+          </td>
+          <td>
+            <input type="submit" name="submit" value="i18n:attr key=send"/>
+          </td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield" colspan="3"><br/><i18n:message key="requiredFields"/></td>
+        </tr>
+      </table>
+    </form>
+  </xsl:template>
+
+  <xsl:template match="form" mode="error">
+    <form name="contact-form" method="post" action="#">
+      <table cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td colspan="3" align="left" valign="top" class="contentfield"><font color="red"><i18n:message key="{$error}"/></font></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="company"/>&#0160;</td>
+          <td>
+            <input type="text" name="company" class="box" size="40" value="{$company}"/>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="firstName"/>:&#0160;</td>
+          <td>
+            <input type="text" name="firstName" class="box" size="40" value="{$firstName}"/>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="lastName"/>:&#0160;</td>
+          <td>
+            <input type="text" name="lastName" class="box" size="40" value="{$lastName}"/>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="address"/>:&#0160;</td>
+          <td>
+            <input type="text" name="address" class="box" size="40" value="{$address}"/>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="zipCity"/>:&#0160;</td>
+          <td>
+            <input type="text" name="zipCity" class="box" size="40" value="{$zipCity}"/>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield">
+            <xsl:if test="starts-with($error, 'email')">
+              <font color="#FF0000"><i18n:message key="email"/>:&#0160;</font>
+            </xsl:if>
+            <xsl:if test="not(starts-with($error, 'email'))">
+              <i18n:message key="email"/>:&#0160;
+            </xsl:if>
+          </td>
+          <td>
+            <input type="text" name="email" class="box" size="40" value="{$email}"/>
+          </td>
+          <td>*</td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield"><i18n:message key="message"/>:&#0160;</td>
+          <td>
+            <textarea rows="8" name="message" cols="30" class="box"><xsl:value-of select="$message"/></textarea>
+          </td>
+          <td></td>
+        </tr>
+        <tr>
+          <td colspan="2">&#160;
+          </td>
+          <td>
+            <input type="submit" name="submit" value="i18n:attr key=send"/>
+          </td>
+        </tr>
+        <tr>
+          <td align="right" valign="top" class="contentfield" colspan="3"><br/><i18n:message key="requiredFields"/></td>
+        </tr>
+      </table>
+    </form>
+  </xsl:template>
+  
+  <xsl:template match="form" mode="thankYou">
+    <table>
+      <tr>
+        <td colspan="3" align="right" valign="top" class="contentfield"><i18n:message key="thankYou"/></td>
+      </tr>
+      <tr>
+        <td colspan="3" align="right" valign="top" class="contentfield"><i18n:message key="inquiryContent"/></td>
+      </tr>
+      
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="company"/>:&#0160;</td>
+        <td><xsl:value-of select="$company"/></td>
+        <td></td>
+      </tr>
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="firstName"/>:&#0160;</td>
+        <td><xsl:value-of select="$firstName"/></td>
+        <td></td>
+      </tr>
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="lastName"/>:&#0160;</td>
+        <td><xsl:value-of select="$lastName"/></td>
+        <td></td>
+      </tr>
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="address"/>:&#0160;</td>
+        <td><xsl:value-of select="$address"/></td>
+        <td></td>
+      </tr>
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="zipCity"/>:&#0160;</td>
+        <td><xsl:value-of select="$zipCity"/></td>
+        <td></td>
+      </tr>
+      <tr>
+        <td align="right" valign="top" class="contentfield"><i18n:message key="message"/>:&#0160;</td>
+        <td><xsl:value-of select="$message"/></td>
+        <td></td>
+      </tr>
+    </table>
+  </xsl:template>
+</xsl:stylesheet>




More information about the Yanel-commits mailing list