click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadr...@apache.org
Subject svn commit: r1538305 - in /click/branches/click-3.0.0/click: extras/src/META-INF/resources/click/ extras/src/org/apache/click/extras/control/ framework/src/META-INF/resources/click/ framework/src/org/apache/click/control/ prototypejs/src/org/apache/cli...
Date Sun, 03 Nov 2013 01:03:25 GMT
Author: aadrian
Date: Sun Nov  3 01:03:25 2013
New Revision: 1538305

URL: http://svn.apache.org/r1538305
Log:
Move javascript functions under the Click namespace: issue #CLK-702

Modified:
    click/branches/click-3.0.0/click/extras/src/META-INF/resources/click/extras-control.js
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/CreditCardField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/DoubleField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/EmailField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/IntegerField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/NumberField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.htm
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/RegexField.java
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TabbedForm.htm
    click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TelephoneField.java
    click/branches/click-3.0.0/click/framework/src/META-INF/resources/click/control.js
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Checkbox.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Field.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FieldSet.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FileField.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Form.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/RadioGroup.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Select.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextArea.java
    click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextField.java
    click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/CheckList.java

Modified: click/branches/click-3.0.0/click/extras/src/META-INF/resources/click/extras-control.js
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/META-INF/resources/click/extras-control.js?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/META-INF/resources/click/extras-control.js
(original)
+++ click/branches/click-3.0.0/click/extras/src/META-INF/resources/click/extras-control.js
Sun Nov  3 01:03:25 2013
@@ -16,22 +16,18 @@
 // under the License.
 
 /*
- * This file is dependend upon /click/control.js functions.
+ * This file depends on /click/control.js.
  */
 
- /* Ensure Click namespace exists */
+/* Ensure Click namespace exists */
 if ( typeof Click == 'undefined' )
   Click = {};
 
 /* Validate Functions */
-
-function validateCreditCardField(id, typeId, required, minLength, maxLength, msgs){
-	
-	var msg = validateTextField(id, required, minLength, maxLength, msgs);
-	
+Click.validateCreditCardField = function(id, typeId, required, minLength, maxLength, msgs)
{
+	var msg = Click.validateTextField(id, required, minLength, maxLength, msgs);
 	if(msg){
 		return msg;
-		
 	} else {
 		var field = document.getElementById(id);
 		var value = field.value;
@@ -84,10 +80,10 @@ function validateCreditCardField(id, typ
 		Click.setFieldValidClass(field);
 		return null;
 	}
-}
+};
 
-function validateEmailField (id, required, minLength, maxLength, msgs){
-	var msg = validateTextField(id, required, minLength, maxLength, msgs);
+Click.validateEmailField = function(id, required, minLength, maxLength, msgs) {
+	var msg = Click.validateTextField(id, required, minLength, maxLength, msgs);
 	if (msg) {
 		return msg;
 	} else {
@@ -103,12 +99,12 @@ function validateEmailField (id, require
 				return msgs[3];
 			}
 	
-			if (!isLetterOrDigit(value.charAt(0))) {
+			if (!Click.isLetterOrDigit(value.charAt(0))) {
 				Click.setFieldErrorClass(field);
 				return msgs[3];
 			}
 	
-			if (!isLetterOrDigit(value.charAt(length - 1))) {
+			if (!Click.isLetterOrDigit(value.charAt(length - 1))) {
 				Click.setFieldErrorClass(field);
 				return msgs[3];
 			}
@@ -116,9 +112,9 @@ function validateEmailField (id, require
 	}
 	Click.setFieldValidClass(field);
 	return null;
-}
+};
 
-function validateNumberField(id, required, minValue, maxValue, msgs){
+Click.validateNumberField = function(id, required, minValue, maxValue, msgs) {
 	var field = document.getElementById(id);
 	if(field){
 		var value = field.value;
@@ -143,9 +139,9 @@ function validateNumberField(id, require
 	} else {
 		return 'Field ' + id + ' not found.';
 	}
-}
+};
 
-function validatePickList(id, required, msgs){
+Click.validatePickList = function(id, required, msgs) {
 	var field = document.getElementById(id);
 	if(field){
 		if (field.options.length == 0) {
@@ -161,10 +157,10 @@ function validatePickList(id, required, 
 	} else {
 		return 'Field ' + id + ' not found.';
 	}
-}
+};
 
-function validateRegexField(id, required, minLength, maxLength, regex, msgs){
-	var msg = validateTextField(id, required, minLength, maxLength, msgs);
+Click.validateRegexField = function(id, required, minLength, maxLength, regex, msgs) {
+	var msg = Click.validateTextField(id, required, minLength, maxLength, msgs);
 	if (msg) {
 		return msg;
 	} else {
@@ -178,10 +174,83 @@ function validateRegexField(id, required
 		}
 	}
 	return null;
-}
+};
 
-/* Misc Functions */
+/* Filter */
+Click.noLetterFilter = function(event) {
+    var keyCode;
+    if (document.all) {
+        keyCode = event.keyCode;
+    } else if (document.getElementById) {
+        keyCode = event.which;
+    } else if (document.layers) {
+        keyCode = event.which;
+    }
+
+    if (keyCode >= 33 && keyCode <= 39) {
+        return false;
+
+    } else if (keyCode == 47) {
+        return false;
+
+    } else if (keyCode >= 58 && keyCode <= 126) {
+        return false;
+
+    } else {
+        return true;
+    }
+};
+
+Click.integerFilter = function(event) {
+    var keyCode;
+    if (document.all) {
+        keyCode = event.keyCode;
+    } else if (document.getElementById) {
+        keyCode = event.which;
+    } else if (document.layers) {
+        keyCode = event.which;
+    }
+
+    if (keyCode >= 33 && keyCode <= 44) {
+        return false;
+
+    } else if (keyCode >= 46 && keyCode <= 47) {
+        return false;
+
+    } else if (keyCode >= 58 && keyCode <= 126) {
+        return false;
 
+    } else {
+        return true;
+    }
+};
+
+Click.doubleFilter = function(event) {
+    var keyCode;
+    if (document.all) {
+        keyCode = event.keyCode;
+    } else if (document.getElementById) {
+        keyCode = event.which;
+    } else if (document.layers) {
+        keyCode = event.which;
+    }
+
+    if (keyCode >= 33 && keyCode <= 43) {
+        return false;
+
+    } else if (keyCode == 47) {
+        return false;
+
+    } else if (keyCode >= 58 && keyCode <= 126) {
+        return false;
+
+    } else {
+        return true;
+    }
+};
+
+/* Misc Functions */
+// todo: where is this function used?
 function initMenu() {
 	if (document.all && document.getElementById) {
 		var navRoot = document.getElementById("dmenu");
@@ -191,10 +260,10 @@ function initMenu() {
 				if (node.nodeName == "LI") {
 					node.onmouseover = function() {
 						this.className += " over";
-					}
+					};
 					node.onmouseout = function() {
 						this.className = this.className.replace(" over", "");
-					}
+					};
 				}
 			}
 		}
@@ -202,37 +271,37 @@ function initMenu() {
 }
 
 
-function isLetter (c){
+Click.isLetter = function(c) {
 	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <=
"Z")) )
-}
+};
 
-function isDigit (c){
+Click.isDigit = function(c) {
 	return ((c >= "0") && (c <= "9"))
-}
+};
 
-function isLetterOrDigit (c){
-	return (isLetter(c) || isDigit(c))
-}
+Click.isLetterOrDigit = function(c) {
+	return (Click.isLetter(c) || Click.isDigit(c))
+};
 
-function pickListMove(from, to, hidden, isSelected){
-	var values = new Object();
+Click.pickListMove = function(from, to, hidden, isSelected) {
+	var values = {};
 	for(var i=0;i<from.options.length;i++){
 		if(from.options[i].selected){
 			values[from.options[i].value] = true;
 		}
 	}
-	pickListMoveItem(from, to, values, hidden, isSelected);
-}
+	Click.pickListMoveItem(from, to, values, hidden, isSelected);
+};
 
-function pickListMoveAll(from, to, hidden, isSelected){
-	var values = new Object();
-	for(i=0; i<from.options.length; i++){
+Click.pickListMoveAll = function(from, to, hidden, isSelected) {
+	var values = {};
+	for(var i=0; i<from.options.length; i++){
 		values[from.options[i].value] = true;
 	}
-	pickListMoveItem(from, to, values, hidden, isSelected);
-}
+	Click.pickListMoveItem(from, to, values, hidden, isSelected);
+};
 
-function pickListMoveItem(from, to, values, hidden, isSelected){
+Click.pickListMoveItem = function(from, to, values, hidden, isSelected){
 	for(var i=0; i<hidden.options.length; i++){
 		if(values[hidden.options[i].value]){
 			hidden.options[i].selected = isSelected;
@@ -251,7 +320,7 @@ function pickListMoveItem(from, to, valu
 			toIndex++;
 		}
 	}
-}
+};
 
 /**
  * Define the SubmitLink action. This function creates hidden fields for
@@ -278,7 +347,7 @@ Click.submitLinkAction = function(link, 
   }
   form.submit();
   return false;
-}
+};
 
 /**
  * Return the url parameters as an array of key/value pairs or null
@@ -289,15 +358,15 @@ Click.getUrlParams = function(url) {
     return null;
   }
   url = unescape(url);
-  var start = url.indexOf('?')
+  var start = url.indexOf('?');
   if (start == -1) {
     return null;
   }
   url=url.substring(start + 1);
   var pairs=url.split("&");
-  var params = new Array();
+  var params = [];
   for (var i=0;i<pairs.length;i++) {
-    var param = new Object();
+    var param = {};
     var pos = pairs[i].indexOf('=');
     if (pos >= 0) {
       param.name = pairs[i].substring(0,pos);
@@ -306,7 +375,7 @@ Click.getUrlParams = function(url) {
     }
   }
   return params;
-}
+};
 
 /**
  * Return the tab sheet number for the element with the given ID.
@@ -320,7 +389,7 @@ Click.getTabSheetNumber=function(id) {
     }
     if (parent) return parent.getAttribute("id").substr(10);
     return 1;
-}
+};
 
 /**
  * Return true if the node is a tab sheet, false otherwise.
@@ -332,7 +401,7 @@ Click.isTabSheet=function(node) {
         if(id.indexOf('tab-sheet-')>=0) return true;
     }
     return false;
-}
+};
 
 /**
  * Validate a TabbedForm.
@@ -360,7 +429,7 @@ Click.validateTabbedForm=function(msgs, 
             }
             errorsHtml += '">';
             errorsHtml += '<a class="error" href="javascript:onShowTab(Click.getTabSheetNumber(\''
-                + fieldId + '\'));setFocus(\'';
+                + fieldId + '\'));Click.setFocus(\'';
             errorsHtml += fieldId;
             errorsHtml += '\');">';
             errorsHtml += fieldMsg;
@@ -375,10 +444,10 @@ Click.validateTabbedForm=function(msgs, 
         document.getElementById(id + '-errorsDiv').innerHTML = errorsHtml;
         document.getElementById(id + '-errorsTr').style.display = 'inline';
 
-        setFocus(focusFieldId);
+        Click.setFocus(focusFieldId);
 
         return false;
     } else {
         return true;
     }
-}
+};

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/CreditCardField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/CreditCardField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/CreditCardField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/CreditCardField.java
Sun Nov  3 01:03:25 2013
@@ -177,7 +177,7 @@ public class CreditCardField extends Tex
      */
     protected final static String VALIDATE_CREDITCARD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateCreditCardField(\n"
+        + "   var msg = Click.validateCreditCardField(\n"
         + "         ''{0}'', ''{1}'', {2}, {3}, {4}, [''{5}'',''{6}'',''{7}'', ''{8}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"
@@ -208,7 +208,7 @@ public class CreditCardField extends Tex
         super(name);
         setMaxLength(19);
         setSize(19);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         cardTypeSelect.addAll(CARD_OPTIONS);
     }
 
@@ -222,7 +222,7 @@ public class CreditCardField extends Tex
         super(name, label);
         setMaxLength(19);
         setSize(19);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         cardTypeSelect.addAll(CARD_OPTIONS);
     }
 
@@ -286,7 +286,7 @@ public class CreditCardField extends Tex
         super();
         setMaxLength(19);
         setSize(19);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         cardTypeSelect.addAll(CARD_OPTIONS);
     }
 

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/DoubleField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/DoubleField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/DoubleField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/DoubleField.java
Sun Nov  3 01:03:25 2013
@@ -34,7 +34,7 @@ import java.text.ParseException;
  * DoubleField will validate the number when the control is processed and invoke
  * the control listener if defined.
  * <p/>
- * The DoubleField uses a JavaScript onkeypress() doubleFilter() method to prevent
+ * The DoubleField uses a JavaScript onkeypress() Click.doubleFilter() method to prevent
  * users from entering invalid characters. To enable number key filtering
  * reference the {@link org.apache.click.util.PageImports} object in your page
  * header section. For example:
@@ -70,7 +70,7 @@ public class DoubleField extends NumberF
      */
     public DoubleField(String name) {
         super(name);
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("left");
     }
 
@@ -82,7 +82,7 @@ public class DoubleField extends NumberF
      */
     public DoubleField(String name, String label) {
         super(name, label);
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("left");
     }
 
@@ -141,7 +141,7 @@ public class DoubleField extends NumberF
      * <b>Please note</b> the control's name must be defined before it is valid.
      */
     public DoubleField() {
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("left");
     }
 

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/EmailField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/EmailField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/EmailField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/EmailField.java
Sun Nov  3 01:03:25 2013
@@ -80,7 +80,7 @@ public class EmailField extends TextFiel
      */
     protected final static String VALIDATE_EMAILFIELD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateEmailField(\n"
+        + "   var msg = Click.validateEmailField(\n"
         + "         ''{0}'',{1}, {2}, {3}, [''{4}'',''{5}'',''{6}'', ''{7}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/IntegerField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/IntegerField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/IntegerField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/IntegerField.java
Sun Nov  3 01:03:25 2013
@@ -70,7 +70,7 @@ public class IntegerField extends Number
      */
     public IntegerField(String name) {
         super(name);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         setTextAlign("left");
     }
 
@@ -82,7 +82,7 @@ public class IntegerField extends Number
      */
     public IntegerField(String name, boolean required) {
         super(name, required);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         setTextAlign("left");
     }
 
@@ -94,7 +94,7 @@ public class IntegerField extends Number
      */
     public IntegerField(String name, String label) {
         super(name, label);
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         setTextAlign("left");
     }
 
@@ -143,7 +143,7 @@ public class IntegerField extends Number
      * <b>Please note</b> the control's name must be defined before it is valid.
      */
     public IntegerField() {
-        setAttribute("onkeypress", "javascript:return integerFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.integerFilter(event);");
         setTextAlign("left");
     }
 

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/NumberField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/NumberField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/NumberField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/NumberField.java
Sun Nov  3 01:03:25 2013
@@ -74,7 +74,7 @@ import org.apache.click.util.ClickUtils;
  * <li><tt>click/extras-control.js</tt></li>
  * </ul>
  *
- * The NumberField uses a JavaScript onkeypress() doubleFilter() method to prevent
+ * The NumberField uses a JavaScript onkeypress() Click.doubleFilter() method to prevent
  * users from entering invalid characters.  To enable number key filtering
  * reference the variables <tt class="blue">$jsElements</tt> and
  * <tt class="blue">$headElements</tt> in your page template. For example:
@@ -120,7 +120,7 @@ public class NumberField extends TextFie
      */
     protected final static String VALIDATE_NUMBER_FIELD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateNumberField(\n"
+        + "   var msg = Click.validateNumberField(\n"
         + "         ''{0}'',{1}, {2}, {3}, [''{4}'',''{5}'',''{6}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"
@@ -152,7 +152,7 @@ public class NumberField extends TextFie
      */
     public NumberField(String name) {
         super(name);
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("right");
     }
 
@@ -164,7 +164,7 @@ public class NumberField extends TextFie
      */
     public NumberField(String name, String label) {
         super(name, label);
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("right");
     }
 
@@ -223,7 +223,7 @@ public class NumberField extends TextFie
      * <b>Please note</b> the control's name must be defined before it is valid.
      */
     public NumberField() {
-        setAttribute("onkeypress", "javascript:return doubleFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.doubleFilter(event);");
         setTextAlign("right");
     }
 

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.htm
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.htm?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.htm
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.htm
Sun Nov  3 01:03:25 2013
@@ -44,25 +44,25 @@
 </td>
 <td valign="middle">
   <input id="${id}_add" type="button" value="&gt;" style="width:60px;"
-         onclick="pickListMove(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
+         onclick="Click.pickListMove(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
   <input id="${id}_remove" type="button" value="&lt;" style="width:60px;"
-         onclick="pickListMove(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
+         onclick="Click.pickListMove(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
   <input id="${id}_add_all" type="button" value="&gt;&gt;" style="width:60px;"
-         onclick="pickListMoveAll(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
+         onclick="Click.pickListMoveAll(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
   <input id="${id}_remove_all" type="button" value="&lt;&lt;" style="width:60px;"
-         onclick="pickListMoveAll(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
+         onclick="Click.pickListMoveAll(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/PickList.java
Sun Nov  3 01:03:25 2013
@@ -190,7 +190,7 @@ public class PickList extends Field {
      */
     protected final static String VALIDATE_PICKLIST_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validatePickList(\n"
+        + "   var msg = Click.validatePickList(\n"
         + "         ''{0}'',{1}, [''{2}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/RegexField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/RegexField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/RegexField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/RegexField.java
Sun Nov  3 01:03:25 2013
@@ -105,7 +105,7 @@ public class RegexField extends TextFiel
      */
     protected final static String VALIDATE_REGEXFIELD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateRegexField(\n"
+        + "   var msg = Click.validateRegexField(\n"
         + "         ''{0}'',{1}, {2}, {3}, ''{4}'', [''{5}'',''{6}'',''{7}'', ''{8}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TabbedForm.htm
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TabbedForm.htm?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TabbedForm.htm
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TabbedForm.htm
Sun Nov  3 01:03:25 2013
@@ -38,7 +38,7 @@
 	<tr>
     	<td style="${form.errorsStyle}" class="tf_error">
     		<a class="error" href="#" 
-			  onclick="onShowTab($form.getTabSheetNumber($errorField.name));setFocus('$errorField.id');"
+			  onclick="onShowTab($form.getTabSheetNumber($errorField.name));Click.setFocus('$errorField.id');"
 			  > $errorField.error </a>
     	</td>
 	</tr>

Modified: click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TelephoneField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TelephoneField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TelephoneField.java
(original)
+++ click/branches/click-3.0.0/click/extras/src/org/apache/click/extras/control/TelephoneField.java
Sun Nov  3 01:03:25 2013
@@ -70,7 +70,7 @@ public class TelephoneField extends Text
      */
     public TelephoneField(String name) {
         super(name);
-        setAttribute("onkeypress", "javascript:return noLetterFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.noLetterFilter(event);");
         setMinLength(10);
     }
 
@@ -97,7 +97,7 @@ public class TelephoneField extends Text
      */
     public TelephoneField(String name, String label) {
         super(name, label);
-        setAttribute("onkeypress", "javascript:return noLetterFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.noLetterFilter(event);");
         setMinLength(10);
     }
 
@@ -149,7 +149,7 @@ public class TelephoneField extends Text
      * <b>Please note</b> the control's name must be defined before it is valid.
      */
     public TelephoneField() {
-        setAttribute("onkeypress", "javascript:return noLetterFilter(event);");
+        setAttribute("onkeypress", "javascript:return Click.noLetterFilter(event);");
         setMinLength(10);
     }
 

Modified: click/branches/click-3.0.0/click/framework/src/META-INF/resources/click/control.js
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/META-INF/resources/click/control.js?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/META-INF/resources/click/control.js (original)
+++ click/branches/click-3.0.0/click/framework/src/META-INF/resources/click/control.js Sun
Nov  3 01:03:25 2013
@@ -38,7 +38,7 @@ if ( typeof Click.domready == 'undefined
             }
         }
     }
-};
+}
 
 /**
  * This function is based on work done by Dean Edwards, Diego Perini,
@@ -120,79 +120,8 @@ Click.addLoadEvent = function(func) {
 
 addLoadEvent=Click.addLoadEvent;
 
-function doubleFilter(event) {
-    var keyCode;
-    if (document.all) {
-        keyCode = event.keyCode;
-    } else if (document.getElementById) {
-        keyCode = event.which;
-    } else if (document.layers) {
-        keyCode = event.which;
-    }
-
-    if (keyCode >= 33 && keyCode <= 43) {
-        return false;
-
-    } else if (keyCode == 47) {
-        return false;
-
-    } else if (keyCode >= 58 && keyCode <= 126) {
-        return false;
-
-    } else {
-        return true;
-    }
-}
-
-function integerFilter(event) {
-    var keyCode;
-    if (document.all) {
-        keyCode = event.keyCode;
-    } else if (document.getElementById) {
-        keyCode = event.which;
-    } else if (document.layers) {
-        keyCode = event.which;
-    }
-
-    if (keyCode >= 33 && keyCode <= 44) {
-        return false;
-
-    } else if (keyCode >= 46 && keyCode <= 47) {
-        return false;
-
-    } else if (keyCode >= 58 && keyCode <= 126) {
-        return false;
-
-    } else {
-        return true;
-    }
-}
-
-function noLetterFilter(event) {
-    var keyCode;
-    if (document.all) {
-        keyCode = event.keyCode;
-    } else if (document.getElementById) {
-        keyCode = event.which;
-    } else if (document.layers) {
-        keyCode = event.which;
-    }
-
-    if (keyCode >= 33 && keyCode <= 39) {
-        return false;
-
-    } else if (keyCode == 47) {
-        return false;
-
-    } else if (keyCode >= 58 && keyCode <= 126) {
-        return false;
 
-    } else {
-        return true;
-    }
-}
-
-function setFocus(id) {
+Click.setFocus = function(id) {
     var field = document.getElementById(id);
     if (field && field.focus && field.type != "hidden" && field.disabled
!= true) {
     	try {
@@ -200,9 +129,9 @@ function setFocus(id) {
 		} catch (err) {
 		}
     }
-}
+};
 
-function trim(str) {
+Click.trim = function(str) {
     while (str.charAt(0) == (" ")) {
         str = str.substring(1);
       }
@@ -210,7 +139,7 @@ function trim(str) {
           str = str.substring(0,str.length-1);
       }
       return str;
-}
+};
 
 Click.hasClass=function(element,cls){
     var className=element.className;
@@ -218,13 +147,13 @@ Click.hasClass=function(element,cls){
         return new RegExp('\\b'+cls+'\\b').test(className);
     }
     return false;
-}
+};
 
 Click.addClass=function(element,cls){
     if(!Click.hasClass(element,cls)) {
         element.className += element.className ? ' ' + cls : cls;
     }
-}
+};
 
 Click.removeClass=function(element,cls){
     var className=element.className;
@@ -237,20 +166,20 @@ Click.removeClass=function(element,cls){
 
     var rep = new RegExp('(^|\\s)' + cls + '(?:\\s|$)');
     element.className = className.replace(rep, '$1');
-}
+};
 
 Click.setFieldValidClass=function(field) {
     Click.removeClass(field,'error');
-}
+};
 
 Click.setFieldErrorClass=function(field) {
     Click.addClass(field,'error');
-}
+};
 
-function validateTextField(id, required, minLength, maxLength, msgs) {
+Click.validateTextField = function(id, required, minLength, maxLength, msgs) {
     var field = document.getElementById(id);
     if (field) {
-        var value = trim(field.value);
+        var value = Click.trim(field.value);
         if (required) {
             if (value.length == 0) {
                 Click.setFieldErrorClass(field);
@@ -274,9 +203,9 @@ function validateTextField(id, required,
     } else {
         return 'Field ' + id + ' not found.';
     }
-}
+};
 
-function validateCheckbox(id, required, msgs) {
+Click.validateCheckbox = function(id, required, msgs) {
     var field = document.getElementById(id);
     if (field) {
         if (required) {
@@ -289,9 +218,9 @@ function validateCheckbox(id, required, 
     } else {
         return 'Field ' + id + ' not found.';
     }
-}
+};
 
-function validateSelect(id, defaultValue, required, msgs) {
+Click.validateSelect = function(id, defaultValue, required, msgs) {
     var field = document.getElementById(id);
     if (field) {
         if (required) {
@@ -307,9 +236,9 @@ function validateSelect(id, defaultValue
     } else {
         return 'Field ' + id + ' not found.';
     }
-}
+};
 
-function validateRadioGroup(radioName, formId, required, msgs) {
+Click.validateRadioGroup = function(radioName, formId, required, msgs) {
     if(required){
         var form = document.getElementById(formId);
         if(form){
@@ -322,12 +251,12 @@ function validateRadioGroup(radioName, f
             return msgs[0];
         }
     }
-}
+};
 
-function validateFileField(id, required, msgs) {
+Click.validateFileField = function(id, required, msgs) {
     var field = document.getElementById(id);
     if (field) {
-        var value = trim(field.value);
+        var value = Click.trim(field.value);
         if (required) {
             if (value.length == 0) {
                 Click.setFieldErrorClass(field);
@@ -337,9 +266,9 @@ function validateFileField(id, required,
     } else {
         return 'Field ' + id + ' not found.';
     }
-}
+};
 
-function validateForm(msgs, id, align, style) {
+Click.validateForm = function(msgs, id, align, style) {
     var errorsHtml = '';
     var focusFieldId = null;
 
@@ -361,7 +290,7 @@ function validateForm(msgs, id, align, s
 				errorsHtml += style;
             }
             errorsHtml += '">';
-            errorsHtml += '<a class="error" href="javascript:setFocus(\'';
+            errorsHtml += '<a class="error" href="javascript:Click.setFocus(\'';
             errorsHtml += fieldId;
             errorsHtml += '\');">';
             errorsHtml += fieldMsg;
@@ -377,14 +306,14 @@ function validateForm(msgs, id, align, s
         document.getElementById(id + '-errorsDiv').innerHTML = errorsHtml;
         document.getElementById(id + '-errorsTr').style.display = 'inline';
 
-        setFocus(focusFieldId);
+        Click.setFocus(focusFieldId);
 
         return false;
 
     } else {
         return true;
     }
-}
+};
 
 /**
  * Submit the form and checks that no field or button is called 'submit' as
@@ -398,7 +327,7 @@ Click.submit=function(form) {
         return false;
     }
 
-if (form) {
+    if (form) {
         var formElements = form.elements;
         for (var i=0; i < formElements.length; i++) {
             var el = formElements[i];
@@ -410,4 +339,4 @@ if (form) {
     }
     form.submit();
     return true;
-}
+};

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Checkbox.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Checkbox.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Checkbox.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Checkbox.java
Sun Nov  3 01:03:25 2013
@@ -56,7 +56,7 @@ public class Checkbox extends Field {
      */
     protected final static String VALIDATE_CHECKBOX_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateCheckbox(''{0}'',{1}, [''{2}'']);\n"
+        + "   var msg = Click.validateCheckbox(''{0}'',{1}, [''{2}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"
         + "   '}' else '{'\n"

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Field.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Field.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Field.java (original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Field.java Sun
Nov  3 01:03:25 2013
@@ -417,7 +417,7 @@ public abstract class Field extends Abst
     public String getFocusJavaScript() {
         HtmlStringBuffer buffer = new HtmlStringBuffer(32);
 
-        buffer.append("setFocus('");
+        buffer.append("Click.setFocus('");
         buffer.append(getId());
         buffer.append("');");
 

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FieldSet.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FieldSet.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FieldSet.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FieldSet.java
Sun Nov  3 01:03:25 2013
@@ -43,11 +43,11 @@ import org.apache.click.util.HtmlStringB
  * </tr>
  * <tr class='fields'>
  * <td class='fields' align='left'><label>Card Number</label><font color="red">*</font></td>
- * <td align='left'><input type='text' name='cardNumber' id='form-cardNumber' value=''
size='19' onkeypress='javascript:return integerFilter(event);' maxlength='19'/><select
name='cardtype' id='form-cardtype' size='1'><option selected='selected' value='VISA'>Visa</option><option
value='MASTER'>Master</option><option value='AMEX'>AmEx</option><option
value='DINERS'>Diners</option><option value='DISCOVER'>Discover</option></select></td>
+ * <td align='left'><input type='text' name='cardNumber' id='form-cardNumber' value=''
size='19' onkeypress='javascript:return Click.integerFilter(event);' maxlength='19'/><select
name='cardtype' id='form-cardtype' size='1'><option selected='selected' value='VISA'>Visa</option><option
value='MASTER'>Master</option><option value='AMEX'>AmEx</option><option
value='DINERS'>Diners</option><option value='DISCOVER'>Discover</option></select></td>
  * </tr>
  * <tr class='fields'>
  * <td class='fields' align='left'><label>Expiry</label><font color="red">*</font></td>
- * <td align='left'><input type='text' name='expiry' id='form-expiry' value='' size='4'
onkeypress='javascript:return integerFilter(event);' maxlength='4'/></td>
+ * <td align='left'><input type='text' name='expiry' id='form-expiry' value='' size='4'
onkeypress='javascript:return Click.integerFilter(event);' maxlength='4'/></td>
  * </tr>
  * </table>
  * </fieldset>

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FileField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FileField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FileField.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/FileField.java
Sun Nov  3 01:03:25 2013
@@ -82,7 +82,7 @@ public class FileField extends Field {
      */
     protected final static String VALIDATE_FILEFIELD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateFileField(''{0}'',{1}, [''{2}'']);\n"
+        + "   var msg = Click.validateFileField(''{0}'',{1}, [''{2}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"
         + "   '}' else '{'\n"

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Form.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Form.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Form.java (original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Form.java Sun
Nov  3 01:03:25 2013
@@ -2930,7 +2930,7 @@ public class Form extends AbstractContai
                     buffer.append(functionNames.get(i).toString());
                     buffer.append(";\n");
                 }
-                buffer.append("   return validateForm(msgs, '");
+                buffer.append("   return Click.validateForm(msgs, '");
                 buffer.append(getId());
                 buffer.append("', '");
                 buffer.append(getErrorsAlign());

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/RadioGroup.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/RadioGroup.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/RadioGroup.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/RadioGroup.java
Sun Nov  3 01:03:25 2013
@@ -109,7 +109,7 @@ public class RadioGroup extends Field {
      */
     protected final static String VALIDATE_RADIOGROUP_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateRadioGroup(''{1}'', ''{2}'', {3}, [''{4}'']);\n"
+        + "   var msg = Click.validateRadioGroup(''{1}'', ''{2}'', {3}, [''{4}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{5}'';\n"
         + "   '}' else '{'\n"
@@ -318,7 +318,7 @@ public class RadioGroup extends Field {
         }
 
         HtmlStringBuffer buffer = new HtmlStringBuffer(32);
-        buffer.append("setFocus('");
+        buffer.append("Click.setFocus('");
         buffer.append(id);
         buffer.append("');");
 

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Select.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Select.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Select.java (original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/Select.java Sun
Nov  3 01:03:25 2013
@@ -299,7 +299,7 @@ public class Select extends Field {
      */
     protected final static String VALIDATE_SELECT_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateSelect(''{0}'', ''{3}'', {1}, [''{2}'']);\n"
+        + "   var msg = Click.validateSelect(''{0}'', ''{3}'', {1}, [''{2}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"
         + "   '}' else '{'\n"

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextArea.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextArea.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextArea.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextArea.java
Sun Nov  3 01:03:25 2013
@@ -70,7 +70,7 @@ public class TextArea extends Field {
      */
     protected final static String VALIDATE_TEXTAREA_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateTextField(\n"
+        + "   var msg = Click.validateTextField(\n"
         + "         ''{0}'',{1}, {2}, {3}, [''{4}'',''{5}'',''{6}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"

Modified: click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextField.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextField.java
(original)
+++ click/branches/click-3.0.0/click/framework/src/org/apache/click/control/TextField.java
Sun Nov  3 01:03:25 2013
@@ -77,7 +77,7 @@ public class TextField extends Field {
      */
     protected final static String VALIDATE_TEXTFIELD_FUNCTION =
         "function validate_{0}() '{'\n"
-        + "   var msg = validateTextField(\n"
+        + "   var msg = Click.validateTextField(\n"
         + "         ''{0}'',{1}, {2}, {3}, [''{4}'',''{5}'',''{6}'']);\n"
         + "   if (msg) '{'\n"
         + "      return msg + ''|{0}'';\n"

Modified: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/CheckList.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/CheckList.java?rev=1538305&r1=1538304&r2=1538305&view=diff
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/CheckList.java
(original)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/CheckList.java
Sun Nov  3 01:03:25 2013
@@ -579,7 +579,7 @@ public class CheckList extends Field {
     public String getFocusJavaScript() {
         HtmlStringBuffer buffer = new HtmlStringBuffer();
 
-        buffer.append("setFocus('");
+        buffer.append("Click.setFocus('");
         buffer.append(getName() + "_0");
         buffer.append("');");
 



Mime
View raw message