From 1c3cc95fdbf2dd99c6673404804de9373e0f476b Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 15 Jul 2016 11:40:42 +0900 Subject: [PATCH] Update form class and edit access table array Form class has new check part for alpha numeric with spaces called "alphanumericspace". edit access table array gets update for making color no longer mandatory (almost never used). And adds alpha numeric with spaces and unique check for the name. --- www/admin/table_arrays/array_edit_access.inc | 6 +++--- www/libs/Class.Form.Generate.inc | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/www/admin/table_arrays/array_edit_access.inc b/www/admin/table_arrays/array_edit_access.inc index b7a2803f..fe92db88 100644 --- a/www/admin/table_arrays/array_edit_access.inc +++ b/www/admin/table_arrays/array_edit_access.inc @@ -10,7 +10,8 @@ "value" => $GLOBALS["name"], "output_name" => $this->l->__("Access Group Name"), "mandatory" => 1, - "type" => "text" + "type" => "text", + "error_check" => "alphanumericspace|unique" ), "description" => array ( "value" => $GLOBALS["description"], @@ -20,7 +21,7 @@ "color" => array ( "value" => $GLOBALS["color"], "output_name" => $this->l->__("Color"), - "mandatory" => 1, + "mandatory" => 0, "type" => "text", "size" => 6, "length" => 6, @@ -28,7 +29,6 @@ "error_regex" => "/[\dA-Fa-f]{6}/", "error_example" => "F6A544" ) - ), "table_name" => "edit_access", "load_query" => "SELECT edit_access_id, name FROM edit_access ORDER BY name", diff --git a/www/libs/Class.Form.Generate.inc b/www/libs/Class.Form.Generate.inc index ba381b27..3a7bb3cc 100644 --- a/www/libs/Class.Form.Generate.inc +++ b/www/libs/Class.Form.Generate.inc @@ -925,6 +925,11 @@ if (!preg_match($this->table_array[$key]["error_regex"], $this->table_array[$key]["value"])) $this->msg .= sprintf($this->l->__("Please enter a valid (%s) input for the %s Field!
"), $this->table_array[$key]["error_example"], $this->table_array[$key]["output_name"]); break; + case "alphanumericspace": +//$this->debug('edit', 'IN Alphanumericspace'); + if (!preg_match("/^[0-9A-Za-z\ ]+$/", $this->table_array[$key]["value"])) + $this->msg .= sprintf($this->l->__("Please enter a valid alphanumeric (Numbers and Letters, spaces allowed) value for the %s Field!
"), $this->table_array[$key]["output_name"]); + break; case "alphanumeric": //$this->debug('edit', 'IN Alphanumeric'); if (!preg_match("/^[0-9A-Za-z_\-]+$/", $this->table_array[$key]["value"])) @@ -932,7 +937,7 @@ break; // this one also allows @ and . case "alphanumericextended": -//$this->debug('edit', 'IN Alphanumeric'); +//$this->debug('edit', 'IN Alphanumericextended'); if (!preg_match("/^[0-9A-Za-z_\-@\.]+$/", $this->table_array[$key]["value"])) $this->msg .= sprintf($this->l->__("Please enter a valid alphanumeric extended (Numbers, Letters, -, _, @ and . only, no spaces) value for the %s Field!
"), $this->table_array[$key]["output_name"]); break;