You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/11/25 03:25:20 UTC
svn commit: r348854 [13/16] - in
/portals/jetspeed-2/trunk/applications/j2-admin: ./
src/java/org/apache/jetspeed/portlets/entityeditor/
src/java/org/apache/jetspeed/portlets/localeselector/
src/java/org/apache/jetspeed/portlets/localeselector/resource...
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-multi-chooser.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-multi-chooser.vm?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-multi-chooser.vm (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-multi-chooser.vm Thu Nov 24 18:24:19 2005
@@ -0,0 +1,93 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+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.
+*#
+
+#**
+
+@author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+@version $Id: user-multi-chooser.vm 348264 2005-11-22 22:06:45Z taylor $
+
+*#
+
+<script language="JavaScript" type="text/javascript">
+ <!--
+ function select(value)
+ {
+ var openerForm = opener.document.forms['securityform'];
+ var openerEl = openerForm.elements['users'];
+ window.close();
+ }
+ function rowHover(row)
+ {
+ row.oldClassName = row.className;
+ row.className = 'jetdbLight';
+ row.onmouseout = function()
+ {
+ this.className = this.oldClassName;
+ }
+ }
+ function sendChecks(form)
+ {
+ var result = "";
+ for(var i = 0; i < form.length; i++)
+ {
+ var e = form.elements[i];
+ if (e.type == "checkbox")
+ {
+ if (e.checked == true)
+ {
+ result = result + "," + e.name;
+ }
+ }
+ }
+ var openerForm = opener.document.forms['securityform'];
+ var openerEl = openerForm.elements['users'];
+ openerEl.value = result;
+ window.close();
+ openerForm.submit();
+ }
+ //-->
+</script>
+
+
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+<form name='userform' onSubmit='sendChecks(this)'/>
+<table cellpadding=0 cellspacing=1 border=0 width='100%' >
+ <tr>
+ #foreach ($column in $title)
+ <td align='center' class="jetdbHeadNoLink" width="90%" nowrap>
+ $column
+ </td>
+ <th class="jetdbHeadNoLink" width="10"></th>
+ #end
+ </tr>
+ #foreach ( $user in $table )
+ <tr>
+ #if ($velocityCount % 2 == 0)
+ #set($rowstyle = "jetdbEven")
+ #else
+ #set($rowstyle = "jetdbOdd")
+ #end
+ <td class="$rowstyle" nowrap width="90%" onmouseover="rowHover(this)">
+ <div align="center">$user</div>
+ </td>
+ <td class="$rowstyle" width="10">
+ <input type="checkbox" name="box_$user"/>
+ </td>
+ </tr>
+ #end
+</table>
+ <input type="submit" name="add.users" value="Add Users" class="jetdbButton" />
+</form>
\ No newline at end of file
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/sql.tld
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/sql.tld?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/sql.tld (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/sql.tld Thu Nov 24 18:24:19 2005
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>sql</short-name>
+ <uri>http://java.sun.com/jstl/sql</uri>
+ <display-name>JSTL sql</display-name>
+ <description>JSTL 1.0 sql library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlSqlTLV
+ </validator-class>
+ <init-param>
+ <param-name>expressionAttributes</param-name>
+ <param-value>
+ transaction:dataSource
+ transaction:isolation
+ query:sql
+ query:dataSource
+ query:startRow
+ query:maxRows
+ update:sql
+ update:dataSource
+ param:value
+ dateParam:value
+ dateParam:type
+ setDataSource:dataSource
+ setDataSource:driver
+ setDataSource:url
+ setDataSource:user
+ setDataSource:password
+ </param-value>
+ <description>
+ Whitespace-separated list of colon-separated token pairs
+ describing tag:attribute combinations that accept expressions.
+ The validator uses this information to determine which
+ attributes need their syntax validated.
+ </description>
+ </init-param>
+ </validator>
+
+ <tag>
+ <name>transaction</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.TransactionTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Provides nested database action elements with a shared Connection,
+ set up to execute all statements as one transaction.
+ </description>
+ <attribute>
+ <name>dataSource</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>isolation</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>query</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.QueryTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Executes the SQL query defined in its body or through the
+ sql attribute.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>sql</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>dataSource</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>startRow</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>maxRows</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>update</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.UpdateTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Executes the SQL update defined in its body or through the
+ sql attribute.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>sql</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>dataSource</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Sets a parameter in an SQL statement to the specified value.
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>dateParam</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.DateParamTag</tag-class>
+ <body-content>empty</body-content>
+ <description>
+ Sets a parameter in an SQL statement to the specified java.util.Date val
+ue.
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>setDataSource</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag</tag-class>
+ <body-content>empty</body-content>
+ <description>
+ Creates a simple DataSource suitable only for prototyping.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>dataSource</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>driver</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>url</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>user</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>password</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+</taglib>
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/struts-config.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/struts-config.xml?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/struts-config.xml (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/struts-config.xml Thu Nov 24 18:24:19 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
+ "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<struts-config>
+ <data-sources/>
+ <form-beans>
+ <form-bean name="AddUserForm" type="org.apache.jetspeed.portlets.security.AddUserForm"/>
+ </form-beans>
+ <global-exceptions/>
+ <global-forwards/>
+ <action-mappings>
+ <action name="AddUserForm" path="/addUser" scope="request"
+ type="org.apache.jetspeed.portlets.security.AddUserAction" validate="false">
+ <forward name="editUser" path="/WEB-INF/security/user-mgt/addUser.jsp"/>
+ </action>
+ </action-mappings>
+ <controller/>
+</struts-config>
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validation.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validation.xml?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validation.xml (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validation.xml Thu Nov 24 18:24:19 2005
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
+
+<form-validation>
+
+<!--
+ This is a blank Validator form file with a commented examples.
+-->
+
+ <global>
+
+ <!-- An example global constant
+ <constant>
+ <constant-name>postalCode</constant-name>
+ <constant-value>^\d{5}\d*$</constant-value>
+ </constant>
+ end example-->
+
+ </global>
+
+ <formset>
+
+ <!-- An example form
+ <form name="logonForm">
+ <field
+ property="username"
+ depends="required">
+ <arg0 key="logonForm.username"/>
+ </field>
+ <field
+ property="password"
+ depends="required,mask">
+ <arg0 key="logonForm.password"/>
+ <var>
+ <var-name>mask</var-name>
+ <var-value>^[0-9a-zA-Z]*$</var-value>
+ </var>
+ </field>
+ </form>
+ end example form -->
+
+ </formset>
+
+ <!-- An example formset for another locale
+ <formset language="fr">
+
+ <constant>
+ <constant-name>postalCode</constant-name>
+ <constant-value>^[0-9a-zA-Z]*$</constant-value>
+ </constant>
+
+ </formset>
+ -->
+
+</form-validation>
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validator-rules.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validator-rules.xml?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validator-rules.xml (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/validator-rules.xml Thu Nov 24 18:24:19 2005
@@ -0,0 +1,988 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
+<!--
+
+ This file contains the default Struts Validator pluggable validator
+ definitions. It should be placed somewhere under /WEB-INF and
+ referenced in the struts-config.xml under the plug-in element
+ for the ValidatorPlugIn.
+
+ <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
+ <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
+ /WEB-INF/validation.xml"/>
+ </plug-in>
+
+ These are the default error messages associated with
+ each validator defined in this file. They should be
+ added to your projects ApplicationResources.properties
+ file or you can associate new ones by modifying the
+ pluggable validators msg attributes in this file.
+
+ # Struts Validator Error Messages
+ errors.required={0} is required.
+ errors.minlength={0} can not be less than {1} characters.
+ errors.maxlength={0} can not be greater than {1} characters.
+ errors.invalid={0} is invalid.
+
+ errors.byte={0} must be a byte.
+ errors.short={0} must be a short.
+ errors.integer={0} must be an integer.
+ errors.long={0} must be a long.
+ errors.float={0} must be a float.
+ errors.double={0} must be a double.
+
+ errors.date={0} is not a date.
+ errors.range={0} is not in the range {1} through {2}.
+ errors.creditcard={0} is an invalid credit card number.
+ errors.email={0} is an invalid e-mail address.
+
+-->
+
+<form-validation>
+
+ <global>
+
+ <validator name="required"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateRequired"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ msg="errors.required">
+
+ <javascript><![CDATA[
+ function validateRequired(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oRequired = new required();
+ for (x in oRequired) {
+ var field = form[oRequired[x][0]];
+
+ if (field.type == 'text' ||
+ field.type == 'textarea' ||
+ field.type == 'file' ||
+ field.type == 'select-one' ||
+ field.type == 'radio' ||
+ field.type == 'password') {
+
+ var value = '';
+ // get field's value
+ if (field.type == "select-one") {
+ var si = field.selectedIndex;
+ if (si >= 0) {
+ value = field.options[si].value;
+ }
+ } else {
+ value = field.value;
+ }
+
+ if (value == '') {
+
+ if (i == 0) {
+ focusField = field;
+ }
+ fields[i++] = oRequired[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+ <validator name="requiredif"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateRequiredIf"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ msg="errors.required">
+ </validator>
+
+ <validator name="minlength"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMinLength"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.minlength">
+
+ <javascript><![CDATA[
+ function validateMinLength(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oMinLength = new minlength();
+ for (x in oMinLength) {
+ if (form[oMinLength[x][0]].type == 'text' ||
+ form[oMinLength[x][0]].type == 'textarea') {
+ var iMin = parseInt(oMinLength[x][2]("minlength"));
+ if (form[oMinLength[x][0]].value.length < iMin) {
+ if (i == 0) {
+ focusField = form[oMinLength[x][0]];
+ }
+ fields[i++] = oMinLength[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="maxlength"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMaxLength"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.maxlength">
+
+ <javascript><![CDATA[
+ function validateMaxLength(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oMaxLength = new maxlength();
+ for (x in oMaxLength) {
+ if (form[oMaxLength[x][0]].type == 'text' ||
+ form[oMaxLength[x][0]].type == 'textarea') {
+ var iMax = parseInt(oMaxLength[x][2]("maxlength"));
+ if (form[oMaxLength[x][0]].value.length > iMax) {
+ if (i == 0) {
+ focusField = form[oMaxLength[x][0]];
+ }
+ fields[i++] = oMaxLength[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="mask"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMask"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.invalid">
+
+ <javascript><![CDATA[
+ function validateMask(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oMasked = new mask();
+ for (x in oMasked) {
+ if ((form[oMasked[x][0]].type == 'text' ||
+ form[oMasked[x][0]].type == 'textarea' ||
+ form[oMasked[x][0]].type == 'password') &&
+ (form[oMasked[x][0]].value.length > 0)) {
+ if (!matchPattern(form[oMasked[x][0]].value, oMasked[x][2]("mask"))) {
+ if (i == 0) {
+ focusField = form[oMasked[x][0]];
+ }
+ fields[i++] = oMasked[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }
+
+ function matchPattern(value, mask) {
+ var bMatched = mask.exec(value);
+ if (!bMatched) {
+ return false;
+ }
+ return true;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="byte"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateByte"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.byte"
+ jsFunctionName="ByteValidations">
+
+ <javascript><![CDATA[
+ function validateByte(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oByte = new ByteValidations();
+ for (x in oByte) {
+ var field = form[oByte[x][0]];
+
+ if (field.type == 'text' ||
+ field.type == 'textarea' ||
+ field.type == 'select-one' ||
+ field.type == 'radio') {
+
+ var value = '';
+ // get field's value
+ if (field.type == "select-one") {
+ var si = field.selectedIndex;
+ if (si >= 0) {
+ value = field.options[si].value;
+ }
+ } else {
+ value = field.value;
+ }
+
+ if (value.length > 0) {
+
+ var iValue = parseInt(value);
+ if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
+ if (i == 0) {
+ focusField = field;
+ }
+ fields[i++] = oByte[x][1];
+ bValid = false;
+ }
+ }
+
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="short"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateShort"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.short"
+ jsFunctionName="ShortValidations">
+
+ <javascript><![CDATA[
+ function validateShort(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oShort = new ShortValidations();
+ for (x in oShort) {
+ var field = form[oShort[x][0]];
+
+ if (field.type == 'text' ||
+ field.type == 'textarea' ||
+ field.type == 'select-one' ||
+ field.type == 'radio') {
+
+ var value = '';
+ // get field's value
+ if (field.type == "select-one") {
+ var si = field.selectedIndex;
+ if (si >= 0) {
+ value = field.options[si].value;
+ }
+ } else {
+ value = field.value;
+ }
+
+ if (value.length > 0) {
+
+ var iValue = parseInt(value);
+ if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
+ if (i == 0) {
+ focusField = field;
+ }
+ fields[i++] = oShort[x][1];
+ bValid = false;
+ }
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="integer"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateInteger"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.integer"
+ jsFunctionName="IntegerValidations">
+
+ <javascript><![CDATA[
+ function validateInteger(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oInteger = new IntegerValidations();
+ for (x in oInteger) {
+ var field = form[oInteger[x][0]];
+
+ if (field.type == 'text' ||
+ field.type == 'textarea' ||
+ field.type == 'select-one' ||
+ field.type == 'radio') {
+
+ var value = '';
+ // get field's value
+ if (field.type == "select-one") {
+ var si = field.selectedIndex;
+ if (si >= 0) {
+ value = field.options[si].value;
+ }
+ } else {
+ value = field.value;
+ }
+
+ if (value.length > 0) {
+
+ if (!isAllDigits(value)) {
+ bValid = false;
+ } else {
+ var iValue = parseInt(value);
+ if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
+ if (i == 0) {
+ focusField = field;
+ }
+ fields[i++] = oInteger[x][1];
+ bValid = false;
+ }
+ }
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }
+
+ function isAllDigits(argvalue) {
+ argvalue = argvalue.toString();
+ var validChars = "0123456789";
+ var startFrom = 0;
+ if (argvalue.substring(0, 2) == "0x") {
+ validChars = "0123456789abcdefABCDEF";
+ startFrom = 2;
+ } else if (argvalue.charAt(0) == "0") {
+ validChars = "01234567";
+ startFrom = 1;
+ }
+ for (var n = 0; n < argvalue.length; n++) {
+ if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
+ }
+ return true;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="long"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateLong"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.long"/>
+
+
+ <validator name="float"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateFloat"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.float"
+ jsFunctionName="FloatValidations">
+
+ <javascript><![CDATA[
+ function validateFloat(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oFloat = new FloatValidations();
+ for (x in oFloat) {
+ var field = form[oFloat[x][0]];
+
+ if (field.type == 'text' ||
+ field.type == 'textarea' ||
+ field.type == 'select-one' ||
+ field.type == 'radio') {
+
+ var value = '';
+ // get field's value
+ if (field.type == "select-one") {
+ var si = field.selectedIndex;
+ if (si >= 0) {
+ value = field.options[si].value;
+ }
+ } else {
+ value = field.value;
+ }
+
+ if (value.length > 0) {
+
+ var iValue = parseFloat(value);
+ if (isNaN(iValue)) {
+ if (i == 0) {
+ focusField = field;
+ }
+ fields[i++] = oFloat[x][1];
+ bValid = false;
+ }
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="double"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateDouble"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.double"/>
+
+
+ <validator name="date"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateDate"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.date"
+ jsFunctionName="DateValidations">
+
+ <javascript><![CDATA[
+ function validateDate(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oDate = new DateValidations();
+ for (x in oDate) {
+ var value = form[oDate[x][0]].value;
+ var datePattern = oDate[x][2]("datePatternStrict");
+ if ((form[oDate[x][0]].type == 'text' ||
+ form[oDate[x][0]].type == 'textarea') &&
+ (value.length > 0) &&
+ (datePattern.length > 0)) {
+ var MONTH = "MM";
+ var DAY = "dd";
+ var YEAR = "yyyy";
+ var orderMonth = datePattern.indexOf(MONTH);
+ var orderDay = datePattern.indexOf(DAY);
+ var orderYear = datePattern.indexOf(YEAR);
+ if ((orderDay < orderYear && orderDay > orderMonth)) {
+ var iDelim1 = orderMonth + MONTH.length;
+ var iDelim2 = orderDay + DAY.length;
+ var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
+ var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
+ if (iDelim1 == orderDay && iDelim2 == orderYear) {
+ dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
+ } else if (iDelim1 == orderDay) {
+ dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
+ } else if (iDelim2 == orderYear) {
+ dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
+ } else {
+ dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
+ }
+ var matched = dateRegexp.exec(value);
+ if(matched != null) {
+ if (!isValidDate(matched[2], matched[1], matched[3])) {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else if ((orderMonth < orderYear && orderMonth > orderDay)) {
+ var iDelim1 = orderDay + DAY.length;
+ var iDelim2 = orderMonth + MONTH.length;
+ var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
+ var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
+ if (iDelim1 == orderMonth && iDelim2 == orderYear) {
+ dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
+ } else if (iDelim1 == orderMonth) {
+ dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
+ } else if (iDelim2 == orderYear) {
+ dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
+ } else {
+ dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
+ }
+ var matched = dateRegexp.exec(value);
+ if(matched != null) {
+ if (!isValidDate(matched[1], matched[2], matched[3])) {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else if ((orderMonth > orderYear && orderMonth < orderDay)) {
+ var iDelim1 = orderYear + YEAR.length;
+ var iDelim2 = orderMonth + MONTH.length;
+ var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
+ var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
+ if (iDelim1 == orderMonth && iDelim2 == orderDay) {
+ dateRegexp = new RegExp("^(\\d{4})(\\d{2})(\\d{2})$");
+ } else if (iDelim1 == orderMonth) {
+ dateRegexp = new RegExp("^(\\d{4})(\\d{2})[" + delim2 + "](\\d{2})$");
+ } else if (iDelim2 == orderDay) {
+ dateRegexp = new RegExp("^(\\d{4})[" + delim1 + "](\\d{2})(\\d{2})$");
+ } else {
+ dateRegexp = new RegExp("^(\\d{4})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{2})$");
+ }
+ var matched = dateRegexp.exec(value);
+ if(matched != null) {
+ if (!isValidDate(matched[3], matched[2], matched[1])) {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ } else {
+ if (i == 0) {
+ focusField = form[oDate[x][0]];
+ }
+ fields[i++] = oDate[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }
+
+ function isValidDate(day, month, year) {
+ if (month < 1 || month > 12) {
+ return false;
+ }
+ if (day < 1 || day > 31) {
+ return false;
+ }
+ if ((month == 4 || month == 6 || month == 9 || month == 11) &&
+ (day == 31)) {
+ return false;
+ }
+ if (month == 2) {
+ var leap = (year % 4 == 0 &&
+ (year % 100 != 0 || year % 400 == 0));
+ if (day>29 || (day == 29 && !leap)) {
+ return false;
+ }
+ }
+ return true;
+ }]]>
+ </javascript>
+
+ </validator>
+
+<!-- range is deprecated use intRange instead -->
+ <validator name="range"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateIntRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends="integer"
+ msg="errors.range">
+
+ <javascript><![CDATA[
+ function validateRange(form) {
+ return validateIntRange(form);
+ }]]>
+ </javascript>
+
+ </validator>
+
+ <validator name="intRange"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateIntRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends="integer"
+ msg="errors.range">
+
+ <javascript><![CDATA[
+ function validateIntRange(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oRange = new intRange();
+ for (x in oRange) {
+ if ((form[oRange[x][0]].type == 'text' ||
+ form[oRange[x][0]].type == 'textarea') &&
+ (form[oRange[x][0]].value.length > 0)) {
+ var iMin = parseInt(oRange[x][2]("min"));
+ var iMax = parseInt(oRange[x][2]("max"));
+ var iValue = parseInt(form[oRange[x][0]].value);
+ if (!(iValue >= iMin && iValue <= iMax)) {
+ if (i == 0) {
+ focusField = form[oRange[x][0]];
+ }
+ fields[i++] = oRange[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+ <validator name="floatRange"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateFloatRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends="float"
+ msg="errors.range">
+
+ <javascript><![CDATA[
+ function validateFloatRange(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oRange = new floatRange();
+ for (x in oRange) {
+ if ((form[oRange[x][0]].type == 'text' ||
+ form[oRange[x][0]].type == 'textarea') &&
+ (form[oRange[x][0]].value.length > 0)) {
+ var fMin = parseFloat(oRange[x][2]("min"));
+ var fMax = parseFloat(oRange[x][2]("max"));
+ var fValue = parseFloat(form[oRange[x][0]].value);
+ if (!(fValue >= fMin && fValue <= fMax)) {
+ if (i == 0) {
+ focusField = form[oRange[x][0]];
+ }
+ fields[i++] = oRange[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }]]>
+ </javascript>
+
+ </validator>
+
+ <validator name="creditCard"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateCreditCard"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.creditcard">
+
+ <javascript><![CDATA[
+ function validateCreditCard(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oCreditCard = new creditCard();
+ for (x in oCreditCard) {
+ if ((form[oCreditCard[x][0]].type == 'text' ||
+ form[oCreditCard[x][0]].type == 'textarea') &&
+ (form[oCreditCard[x][0]].value.length > 0)) {
+ if (!luhnCheck(form[oCreditCard[x][0]].value)) {
+ if (i == 0) {
+ focusField = form[oCreditCard[x][0]];
+ }
+ fields[i++] = oCreditCard[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }
+
+ /**
+ * Reference: http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
+ */
+ function luhnCheck(cardNumber) {
+ if (isLuhnNum(cardNumber)) {
+ var no_digit = cardNumber.length;
+ var oddoeven = no_digit & 1;
+ var sum = 0;
+ for (var count = 0; count < no_digit; count++) {
+ var digit = parseInt(cardNumber.charAt(count));
+ if (!((count & 1) ^ oddoeven)) {
+ digit *= 2;
+ if (digit > 9) digit -= 9;
+ };
+ sum += digit;
+ };
+ if (sum == 0) return false;
+ if (sum % 10 == 0) return true;
+ };
+ return false;
+ }
+
+ function isLuhnNum(argvalue) {
+ argvalue = argvalue.toString();
+ if (argvalue.length == 0) {
+ return false;
+ }
+ for (var n = 0; n < argvalue.length; n++) {
+ if ((argvalue.substring(n, n+1) < "0") ||
+ (argvalue.substring(n,n+1) > "9")) {
+ return false;
+ }
+ }
+ return true;
+ }]]>
+ </javascript>
+
+ </validator>
+
+
+ <validator name="email"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateEmail"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionErrors,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.email">
+
+ <javascript><![CDATA[
+ function validateEmail(form) {
+ var bValid = true;
+ var focusField = null;
+ var i = 0;
+ var fields = new Array();
+ oEmail = new email();
+ for (x in oEmail) {
+ if ((form[oEmail[x][0]].type == 'text' ||
+ form[oEmail[x][0]].type == 'textarea') &&
+ (form[oEmail[x][0]].value.length > 0)) {
+ if (!checkEmail(form[oEmail[x][0]].value)) {
+ if (i == 0) {
+ focusField = form[oEmail[x][0]];
+ }
+ fields[i++] = oEmail[x][1];
+ bValid = false;
+ }
+ }
+ }
+ if (fields.length > 0) {
+ focusField.focus();
+ alert(fields.join('\n'));
+ }
+ return bValid;
+ }
+
+ /**
+ * Reference: Sandeep V. Tamhankar (stamhankar@hotmail.com),
+ * http://javascript.internet.com
+ */
+ function checkEmail(emailStr) {
+ if (emailStr.length == 0) {
+ return true;
+ }
+ var emailPat=/^(.+)@(.+)$/;
+ var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
+ var validChars="\[^\\s" + specialChars + "\]";
+ var quotedUser="(\"[^\"]*\")";
+ var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
+ var atom=validChars + '+';
+ var word="(" + atom + "|" + quotedUser + ")";
+ var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
+ var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
+ var matchArray=emailStr.match(emailPat);
+ if (matchArray == null) {
+ return false;
+ }
+ var user=matchArray[1];
+ var domain=matchArray[2];
+ if (user.match(userPat) == null) {
+ return false;
+ }
+ var IPArray = domain.match(ipDomainPat);
+ if (IPArray != null) {
+ for (var i = 1; i <= 4; i++) {
+ if (IPArray[i] > 255) {
+ return false;
+ }
+ }
+ return true;
+ }
+ var domainArray=domain.match(domainPat);
+ if (domainArray == null) {
+ return false;
+ }
+ var atomPat=new RegExp(atom,"g");
+ var domArr=domain.match(atomPat);
+ var len=domArr.length;
+ if ((domArr[domArr.length-1].length < 2) ||
+ (domArr[domArr.length-1].length > 3)) {
+ return false;
+ }
+ if (len < 2) {
+ return false;
+ }
+ return true;
+ }]]>
+ </javascript>
+
+ </validator>
+
+ </global>
+
+</form-validation>
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/toolbox.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/toolbox.xml?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/toolbox.xml (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/toolbox.xml Thu Nov 24 18:24:19 2005
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<toolbox>
+</toolbox>
\ No newline at end of file
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity-macros.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity-macros.vm?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity-macros.vm (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity-macros.vm Thu Nov 24 18:24:19 2005
@@ -0,0 +1,96 @@
+#macro (headerCell $body)
+ <th class="portlet-section-header">
+ <b>
+ $body
+ </b>
+ </th>
+#end
+
+#macro (entryCell $body)
+ <td class='portlet-section-body'>
+ $body
+ </td>
+#end
+
+#macro (entryCell2 $body $count)
+#if (($count % 2) == 0)
+ <td class='portlet-section-body'>
+#else
+ <td class='portlet-section-alternate'>
+#end
+ $body
+ </td>
+#end
+
+
+#macro (formField $label $value $size $id $MESSAGES $ERRORS)
+#if ($ERRORS)
+#set ($eflag = "$!ERRORS.get($id)")
+#else
+#set ($eflag = "")
+#end
+ <tr colspan="4" align="right">
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ <td nowrap class="portlet-section-alternate" align="right">$!MESSAGES.getString($label): </td>
+ <td class="portlet-section-body" align="left">
+ <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" class="portlet-form-field-label">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+#macro (readField $label $value $size $id $MESSAGES $ERRORS)
+#if ($ERRORS)
+#set ($eflag = "$!ERRORS.get($id)")
+#else
+#set ($eflag = "")
+#end
+ <tr colspan="4" align="right">
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ <td nowrap class="portlet-section-alternate" align="right">$!MESSAGES.getString($label): </td>
+ <td class="portlet-section-body" align="left">
+ <input id="$!id" disabled='true' type="text" name="$!id" size="$!size" value="$!value" class="portlet-form-field-label">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+#macro (ErrorMessages $ERRORS)
+#if ($ERRORS)
+#if ($ERRORS.size() > 0)
+#foreach ($msg in $ERRORS)
+<div class="portlet-msg-error">
+$msg<br/>
+</div>
+#end
+<br/>
+#end
+#end
+#end
+
+#macro (Preference $prefs $name)
+#set ($pall = $prefs.get($name))
+#foreach ($x in $pall)
+#set ($extraction = $x)
+#end
+$extraction
+#end
+
+#macro (form4ColumnCell $label $value $size $id)
+ <tr colspan="4" align="right">
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ <td nowrap class="portlet-form-field-label" align="right">$!label: </td>
+ <td class="portlet-form-input-field" align="left">
+ <input id="$!id" type="text" name="$!id" size="$!size" value="$!value">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity.properties?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity.properties (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/velocity/velocity.properties Thu Nov 24 18:24:19 2005
@@ -0,0 +1,109 @@
+# Copyright 2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+#----------------------------------------------------------------------------
+# These are the default properties for the
+# Velocity Runtime. These values are used when
+# Runtime.init() is called, and when Runtime.init(properties)
+# fails to find the specificed properties file.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# R U N T I M E L O G
+#----------------------------------------------------------------------------
+# This is the location of the Velocity Runtime log.
+#----------------------------------------------------------------------------
+
+runtime.log = velocity.log
+
+#----------------------------------------------------------------------------
+# T E M P L A T E E N C O D I N G
+#----------------------------------------------------------------------------
+
+template.encoding=8859_1
+
+#----------------------------------------------------------------------------
+# C O N T E N T T Y P E
+#----------------------------------------------------------------------------
+# This is the default content type for the VelocityServlet.
+#----------------------------------------------------------------------------
+
+default.contentType=text/html
+
+#----------------------------------------------------------------------------
+# F O R E A C H P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These properties control how the counter is accessed in the #foreach
+# directive. By default the reference $velocityCount will be available
+# in the body of the #foreach directive. The default starting value
+# for this reference is 1.
+#----------------------------------------------------------------------------
+
+counter.name = velocityCount
+counter.initial.value = 1
+
+#----------------------------------------------------------------------------
+# I N C L U D E P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These are the properties that governed the way #include'd content
+# is governed.
+#----------------------------------------------------------------------------
+
+include.path=.
+include.cache = false
+include.output.errormsg.start = <!-- include error :
+include.output.errormsg.end = see error log -->
+
+#----------------------------------------------------------------------------
+# P A R S E P R O P E R T I E S
+#----------------------------------------------------------------------------
+
+parse_directive.maxdepth = 10
+
+#----------------------------------------------------------------------------
+# T E M P L A T E L O A D E R S
+#----------------------------------------------------------------------------
+#
+#
+#----------------------------------------------------------------------------
+
+template.loader.1.public.name = File
+template.loader.1.description = Velocity File Template Loader
+template.loader.1.class = org.apache.velocity.runtime.loader.FileTemplateLoader
+template.loader.1.template.path = .
+template.loader.1.cache = false
+template.loader.1.modificationCheckInterval = 2
+
+velocimacro.library.autoreload = true
+velocimacro.permissions.allow.inline.to.replace.global = true
+velocimacro.library = /WEB-INF/VM_global_library.vm, /WEB-INF/velocity/velocity-macros.vm
+
+#template.loader.2.public.name = URL
+#template.loader.2.description = Velocity URL Template Loader
+#template.loader.2.class = org.apache.velocity.runtime.loader.URLTemplateLoader
+#template.loader.2.template.path = http://localhost/templates/
+#template.loader.2.cache = false
+
+#----------------------------------------------------------------------------
+# E X T E R N A L S E R V I C E I N I T I A L I Z A T I O N
+#----------------------------------------------------------------------------
+# If this property is set to true then an external service will
+# set certain system properties and initialize the Velocity
+# Runtime. This method is used by Turbine to initialize the
+# Velocity Runtime for the TurbineVelocityService.
+#----------------------------------------------------------------------------
+
+external.init = false
+
+
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/locale-list.jsp
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/locale-list.jsp?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/locale-list.jsp (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/locale-list.jsp Thu Nov 24 18:24:19 2005
@@ -0,0 +1,42 @@
+<%--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+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.
+--%>
+<%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
+<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
+<c:set var="currentLocale"><%= request.getAttribute("currentLocale") %></c:set>
+<fmt:setBundle basename="org.apache.jetspeed.portlets.localeselector.resources.LocaleSelectorResources" />
+
+<portlet:actionURL var="changeLocaleAction">
+</portlet:actionURL>
+
+<form action="<%=changeLocaleAction%>" method="POST">
+<table border="0">
+ <tr>
+ <td align="right"><fmt:message key="localeselector.label.language"/></td>
+ <td align="left">
+ <select name="org.apache.jetspeed.prefered.locale">
+ <c:set var="locales"><fmt:message key="localeselector.locales"/></c:set>
+ <c:forTokens var="l" items="${locales}" delims=",">
+ <option value="<c:out value="${l}"/>"
+ <c:if test="${currentLocale == l}">selected</c:if>
+ ><fmt:message>localeselector.locale.<c:out value="${l}"/></fmt:message></option>
+ </c:forTokens>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td align="center" colspan="2"><input type="submit" value="<fmt:message key="localeselector.label.change"/>"/></td>
+ </tr>
+</table>
+</form>
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/metadata-detail.jsp
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/metadata-detail.jsp?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/metadata-detail.jsp (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/metadata-detail.jsp Thu Nov 24 18:24:19 2005
@@ -0,0 +1,77 @@
+<%--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+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.
+--%>
+<form name="Edit_Metatdata_Form" action="<c:out value="${edit_metadata_link}"/>" method="post">
+ <input type="hidden" name="portlet_action" value=""/>
+ <table>
+ <tr>
+ <th class="portlet-section-header"> </th>
+ <th class="portlet-section-header"><fmt:message key="pam.details.name"/></th>
+ <th class="portlet-section-header"><fmt:message key="pam.details.locale"/></th>
+ <th class="portlet-section-header"><fmt:message key="pam.details.value"/></th>
+ </tr>
+ <c:forEach var="field" items="${md.fields}">
+ <tr>
+ <td class="portlet-section-body">
+ <input type="checkbox" name="metadata_id" value="<c:out value="${field.id}"/>"/>
+ </td>
+ <td class="portlet-section-body">
+ <c:out value="${field.name}"/>
+ </td>
+ <td align="center" class="portlet-section-body">
+ <c:out value="${field.locale}"/>
+
+ </td>
+ <td class="portlet-section-body">
+ <%--TODO: value needs to escaped, or use textarea--%>
+ <input type="text" name="<c:out value="${field.id}"/>:value" value="<c:out value="${field.value}"/>" size="50"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </table>
+
+ <input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = '<c:out value="${action_prefix}"/>edit_metadata'" class="portlet-form-button"/>
+ <input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = '<c:out value="${action_prefix}"/>remove_metadata'" class="portlet-form-button"/>
+</form>
+
+<form action="<c:out value="${edit_metadata_link}"/>" method="post">
+ <input type="hidden" name="portlet_action" value="<c:out value="${action_prefix}"/>add_metadata"/>
+ <div>
+ <table>
+ <tr>
+ <td class="portlet-section-alternate">
+ <span class="portlet-form-label"><fmt:message key="pam.details.name"/></span>
+ </td>
+ <td class="portlet-section-body">
+ <input type="text" name="name" value="" class="portlet-form-field-label"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate">
+ <span class="portlet-form-label"><fmt:message key="pam.details.value"/></span>
+ </td>
+ <td class="portlet-section-body">
+ <input type="text" name="value" value="" class="portlet-form-field-label"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate">
+ <span class="portlet-form-label"><fmt:message key="pam.details.locale"/></span>
+ </td>
+ <td class="portlet-section-body">
+ <input type="text" name="locale" value="" class="portlet-form-field-label"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <input type="submit" value="<fmt:message key="pam.details.add_metadata"/>" class="portlet-form-button"/>
+</form>
\ No newline at end of file
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/palm.jsp
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/palm.jsp?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/palm.jsp (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/palm.jsp Thu Nov 24 18:24:19 2005
@@ -0,0 +1,112 @@
+<%--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+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.
+--%>
+<%--
+ @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ @version $Id: palm.jsp 348264 2005-11-22 22:06:45Z taylor $
+--%>
+<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c_rt"%>
+<portlet:defineObjects/>
+<script type="text/javascript">
+ function doSubmit(a,pa) {
+ for (ix = 0; ix < document.forms.length; ix++) {
+ var f = document.forms[ix];
+ if (f.name == "palmForm") {
+ for (iy = 0; iy < f.elements.length; iy++) {
+ var el = f.elements[iy];
+ if (el.name == "action") el.value = a;
+ if (el.name == "value") el.value = pa;
+ }
+ f.submit();
+ }
+ }
+ }
+ function checkSubmit(a,pa,d) { if (confirm("Are you Sure to "+a+" "+pa+"?")) doSubmit(a,pa); return false; }
+</script>
+
+
+<form name="palmForm" action="<portlet:actionURL/>" method="post">
+ <input name="action" type="hidden" value="">
+ <input name="value" type="hidden" value="">
+</form>
+<c:if test="${not empty requestScope.statusMsg}">
+<br/>
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+ <div class="<c:out value="${requestScope.statusMsg.type}"/>"><c:out value="${requestScope.statusMsg.text}"/></div>
+</tr>
+</table>
+</c:if>
+<table cellpadding=0 cellspacing=1 border=0 width="100%">
+ <tr>
+ <th colspan="5" class="portlet-section-header">Portlet Applications</th>
+ </tr>
+ <tr>
+ <th class="portlet-section-subheader">Name</th>
+ <th class="portlet-section-subheader">Version</th>
+ <th class="portlet-section-subheader">Path</th>
+ <th class="portlet-section-subheader">Running</th>
+ <th class="portlet-section-subheader">Commands</th>
+ </tr>
+<c_rt:set var="list" value="<%=renderRequest.getPortletSession().getAttribute("list")%>"/>
+<c:forEach var="pa" items="${list}" varStatus="status">
+ <c:choose>
+ <c:when test="${status.count % 2 != 0}">
+ <c:set var="rowClass" value="portlet-section-body"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="rowClass" value="portlet-section-alternate"/>
+ </c:otherwise>
+ </c:choose>
+ <tr>
+ <td class='<c:out value="${rowClass}"/>'> <c:out value="${pa.name}"/></td>
+ <td class='<c:out value="${rowClass}"/>'> <c:out value="${pa.version}"/></td>
+ <td class='<c:out value="${rowClass}"/>'> <c:out value="${pa.path}"/></td>
+ <td style='text-align:center' class='<c:out value="${rowClass}"/>'><c:out value="${pa.running}"/></td>
+ <td class='<c:out value="${rowClass}"/>'>
+
+ <c:if test="${requestScope.serverManagerAvailable}">
+ <c:choose>
+ <c:when test="${pa.local}">
+ <%-- management of local pa not yet supported --%>
+ start stop undeploy
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="${pa.running}">
+ start <a href="#" onClick='return checkSubmit("stop","<c:out value="${pa.name}"/>")'>stop</a>
+ </c:when>
+ <c:otherwise>
+ <a href="#" onClick='return checkSubmit("start","<c:out value="${pa.name}"/>")'>start</a> stop
+ </c:otherwise>
+ </c:choose>
+ <a href="#" onclick='return checkSubmit("undeploy","<c:out value="${pa.name}"/>")'>undeploy</a>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
+ <c:choose>
+ <c:when test="${pa.running}">
+ delete
+ </c:when>
+ <c:otherwise>
+ <a href="#" onClick='return checkSubmit("delete","<c:out value="${pa.name}"/>")'>delete</a>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+</c:forEach>
+ <tr>
+ <td class='portlet-section-footer' colspan='5'><input type="button" class="portlet-dlg-icon-label" value="refresh" onClick='doSubmit("refresh",null)'></td>
+ </tr>
+</table>
\ No newline at end of file
Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/pam-browser.jsp
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/pam-browser.jsp?rev=348854&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/pam-browser.jsp (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/pam-browser.jsp Thu Nov 24 18:24:19 2005
@@ -0,0 +1,107 @@
+<%--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+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.
+--%>
+<%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
+<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+<%@ taglib uri="/WEB-INF/pam.tld" prefix="pam" %>
+
+<%@ page import="java.util.Collection" %>
+<%@ page import ="java.util.Map" %>
+<%@ page import="org.apache.jetspeed.search.ParsedObject" %>
+
+<portlet:defineObjects/>
+<h2 class="portlet-section-header">Portlet Application Manager</h2>
+
+<h3 class="portlet-section-subheader">Search</h3>
+
+<div class="portlet-section-text">
+
+<portlet:actionURL var="searchLink" />
+<portlet:actionURL var="searchSelectLink"/>
+
+<form action="<c:out value="${searchLink}"/>" method="post">
+
+ <input type="text" name="query" value="" class="portlet-form-field-label"/>
+ <input type="submit" value="Search" class="portlet-form-button"/>
+
+</form>
+
+<c:set var="results" value="${requestScope.search_results}" />
+
+<c:if test="${results != null}">
+ <c:forEach var="result" items="${search_results}">
+
+ <%
+ String name = "";
+ ParsedObject po = (ParsedObject)pageContext.findAttribute("result");
+ Map fields = po.getFields();
+ if(fields != null)
+ {
+ Object id = fields.get("ID");
+
+ if(id != null)
+ {
+ if(id instanceof Collection)
+ {
+ Collection coll = (Collection)id;
+ name = (String) coll.iterator().next();
+ }
+ else
+ {
+ name = (String)id;
+ }
+ }
+
+ if(po.getType().equals("portlet"))
+ {
+ Object pa = fields.get("portlet_application");
+ String paName = "";
+ if(pa != null)
+ {
+ if(id instanceof Collection)
+ {
+ Collection coll = (Collection)pa;
+ paName = (String) coll.iterator().next();
+ }
+ else
+ {
+ paName = (String)pa;
+ }
+ }
+ name = paName + "::" + name;
+ }
+ }
+ %>
+
+ <a href="<c:out value="${searchSelectLink}"/>?select_node=<%=name%>"><c:out value="${result.title}"/></a> <br />
+ <%-- | <c:out value="${result.description}"/> <br /> --%>
+ </c:forEach>
+</c:if>
+
+</div>
+<h3 class="portlet-section-subheader">Application Tree View</h3>
+
+<div class="portlet-section-text">
+
+<portlet:actionURL var="nodeLink" >
+ <portlet:param name="node" value="${name}" />
+</portlet:actionURL>
+
+<pam:tree tree="j2_tree" images="/j2-admin/images" scope="portlet_request"
+ action="<%= nodeLink %>"
+ style="tree-control"
+ styleSelected="portlet-section-alternate"
+
+ />
+
+</div>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org