Commit 405ee3899d5c5ed1423143a5211e2c44474c4e44
1 parent
185a355a
added support for default values and cleaned up
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1664 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
6 additions
and
15 deletions
lib/visualpatterns/PatternCreate.inc
| @@ -22,7 +22,7 @@ class PatternCreate { | @@ -22,7 +22,7 @@ class PatternCreate { | ||
| 22 | var $aDropDownListValueColumns; | 22 | var $aDropDownListValueColumns; |
| 23 | var $aDropDownListDisplayColumns; | 23 | var $aDropDownListDisplayColumns; |
| 24 | var $sUniqueName; | 24 | var $sUniqueName; |
| 25 | - | 25 | + var $aDefaultValues; |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * Default constructor | 28 | * Default constructor |
| @@ -53,6 +53,10 @@ class PatternCreate { | @@ -53,6 +53,10 @@ class PatternCreate { | ||
| 53 | function setUniqueName($sNewValue) { | 53 | function setUniqueName($sNewValue) { |
| 54 | $this->sUniqueName = $sNewValue; | 54 | $this->sUniqueName = $sNewValue; |
| 55 | } | 55 | } |
| 56 | + | ||
| 57 | + function setDefaultValues($aNewValue) { | ||
| 58 | + $this->aDefaultValues = $aNewValue; | ||
| 59 | + } | ||
| 56 | 60 | ||
| 57 | function render() { | 61 | function render() { |
| 58 | $sToRender = "<table border=\"0\">\n"; | 62 | $sToRender = "<table border=\"0\">\n"; |
| @@ -71,12 +75,7 @@ class PatternCreate { | @@ -71,12 +75,7 @@ class PatternCreate { | ||
| 71 | //write the type (in this case text) | 75 | //write the type (in this case text) |
| 72 | $sToRender .= "<input type=\"hidden\" name=\"" . $this->sUniqueName . "_" . $i . "_type\" value=\"1\" />\n"; | 76 | $sToRender .= "<input type=\"hidden\" name=\"" . $this->sUniqueName . "_" . $i . "_type\" value=\"1\" />\n"; |
| 73 | //write the value | 77 | //write the value |
| 74 | - /*if ($this->aRequired[$i]) { | ||
| 75 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input type=\"text\" name=" . $this->sUniqueName . "_" . $i . "_value value=\"\" onfocus=\"validRequired(" . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "')\" /></td>\n"; | ||
| 76 | - } else { | ||
| 77 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value value=\"\" /></td>\n"; | ||
| 78 | - }*/ | ||
| 79 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input size = \"30\" type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"\" /></td>\n"; | 78 | + $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input size = \"30\" type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"" . (isset($this->aDefaultValues[$i]) ? $this->aDefaultValues[$i] : "") . "\" /></td>\n"; |
| 80 | break; | 79 | break; |
| 81 | case 2: | 80 | case 2: |
| 82 | //write the type (in this case checkbox) | 81 | //write the type (in this case checkbox) |
| @@ -117,7 +116,6 @@ class PatternCreate { | @@ -117,7 +116,6 @@ class PatternCreate { | ||
| 117 | $sToRender .= $this->generateRequiredFieldValidation(); | 116 | $sToRender .= $this->generateRequiredFieldValidation(); |
| 118 | 117 | ||
| 119 | return $sToRender; | 118 | return $sToRender; |
| 120 | - | ||
| 121 | } | 119 | } |
| 122 | 120 | ||
| 123 | function generateRequiredFieldValidation() { | 121 | function generateRequiredFieldValidation() { |
| @@ -127,19 +125,12 @@ class PatternCreate { | @@ -127,19 +125,12 @@ class PatternCreate { | ||
| 127 | if ($this->aRequired[$i]) { | 125 | if ($this->aRequired[$i]) { |
| 128 | $sToRender .= "\tif (!(validRequired(document.MainForm." . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "'))) {\n"; | 126 | $sToRender .= "\tif (!(validRequired(document.MainForm." . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "'))) {\n"; |
| 129 | $sToRender .= "\t\treturn false;\n\t}\n"; | 127 | $sToRender .= "\t\treturn false;\n\t}\n"; |
| 130 | - //$sToRender .= "alert(\"You dumbass\");\n"; | ||
| 131 | - //$sToRender .= "alert(theForm." . $this->sUniqueName . "_" . $i . "_value);\n"; | ||
| 132 | - //$sToRender .= "validRequired(theForm." . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "');\n"; | ||
| 133 | - | ||
| 134 | } | 128 | } |
| 135 | } | 129 | } |
| 136 | $sToRender .= "return true;\n}\n"; | 130 | $sToRender .= "return true;\n}\n"; |
| 137 | - | ||
| 138 | $sToRender .= "//-->\n</script>\n\n"; | 131 | $sToRender .= "//-->\n</script>\n\n"; |
| 139 | 132 | ||
| 140 | return $sToRender; | 133 | return $sToRender; |
| 141 | - | ||
| 142 | } | 134 | } |
| 143 | } | 135 | } |
| 144 | - | ||
| 145 | ?> | 136 | ?> |