admin_module 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +2 -0
  4. data/README.md +7 -0
  5. data/admin_module.gemspec +3 -1
  6. data/{bin → exe}/admin_module +0 -0
  7. data/lib/admin_module.rb +9 -0
  8. data/lib/admin_module/command/config.rb +20 -0
  9. data/lib/admin_module/command/gdl.rb +15 -0
  10. data/lib/admin_module/guideline.rb +8 -0
  11. data/lib/admin_module/page_factory.rb +43 -2
  12. data/lib/admin_module/pages.rb +38 -81
  13. data/lib/admin_module/pages/guideline_page.rb +54 -1
  14. data/lib/admin_module/pages/guideline_page_400.rb +87 -0
  15. data/lib/admin_module/pages/guideline_version_page.rb +9 -5
  16. data/lib/admin_module/pages/guidelines_page.rb +40 -34
  17. data/lib/admin_module/pages/guidelines_page_400.rb +65 -0
  18. data/lib/admin_module/pages/guidelines_version_all_page.rb +79 -72
  19. data/lib/admin_module/pages/guidelines_version_all_page_400.rb +122 -0
  20. data/lib/admin_module/pages/login_page.rb +2 -2
  21. data/lib/admin_module/pages/login_page_400.rb +73 -0
  22. data/lib/admin_module/version.rb +1 -1
  23. data/spec/data/config/no_ams_version.admin_module +11 -0
  24. data/spec/data/html/guideline-400.html +2713 -0
  25. data/spec/data/html/guideline-400_files/BindChildren.js +852 -0
  26. data/spec/data/html/guideline-400_files/CVlogo.jpg +0 -0
  27. data/spec/data/html/guideline-400_files/Guideline.js +301 -0
  28. data/spec/data/html/guideline-400_files/OptimalOutcome.png +0 -0
  29. data/spec/data/html/guideline-400_files/WebResource(1).axd +561 -0
  30. data/spec/data/html/guideline-400_files/WebResource.axd +548 -0
  31. data/spec/data/html/guideline-400_files/styles.css +444 -0
  32. data/spec/data/html/guideline-400_files/styles2.css +115 -0
  33. data/spec/data/html/guideline-400_files/tab.css +50 -0
  34. data/spec/data/html/guideline-400_files/tabpane.js +297 -0
  35. data/spec/data/html/guideline.html +1809 -0
  36. data/spec/data/html/guideline_files/BindChildren.js +799 -0
  37. data/spec/data/html/guideline_files/Guideline.js +300 -0
  38. data/spec/data/html/guideline_files/LeftMenu.html +0 -0
  39. data/spec/data/html/guideline_files/MainFrame.html +18 -0
  40. data/spec/data/html/guideline_files/ScriptResource.axd +3725 -0
  41. data/spec/data/html/guideline_files/Stylesheet.css +1545 -0
  42. data/spec/data/html/guideline_files/WebResource(1).axd +0 -0
  43. data/spec/data/html/guideline_files/WebResource(2).axd +566 -0
  44. data/spec/data/html/guideline_files/WebResource(3).axd +219 -0
  45. data/spec/data/html/guideline_files/WebResource.axd +696 -0
  46. data/spec/data/html/guideline_files/framebar.html +0 -0
  47. data/spec/data/html/guideline_files/guideline.html +0 -0
  48. data/spec/data/html/guideline_files/home.png +0 -0
  49. data/spec/data/html/guideline_files/jquery-ui.css +578 -0
  50. data/spec/data/html/guideline_files/jquery.js +7 -0
  51. data/spec/data/html/guideline_files/slidebar.gif +29 -0
  52. data/spec/data/html/guideline_files/tab.css +49 -0
  53. data/spec/data/html/guideline_files/tabpane.js +297 -0
  54. data/spec/data/html/guidelines-400.html +368 -0
  55. data/spec/data/html/guidelines-400_files/CVlogo.jpg +0 -0
  56. data/spec/data/html/guidelines-400_files/EditListSearchHelper.js +141 -0
  57. data/spec/data/html/guidelines-400_files/OptimalOutcome.png +0 -0
  58. data/spec/data/html/guidelines-400_files/WebResource(1).axd +561 -0
  59. data/spec/data/html/guidelines-400_files/WebResource.axd +548 -0
  60. data/spec/data/html/guidelines-400_files/menu.css +29 -0
  61. data/spec/data/html/guidelines-400_files/menu.js +48 -0
  62. data/spec/data/html/guidelines-400_files/shadow.gif +0 -0
  63. data/spec/data/html/guidelines-400_files/styles.css +444 -0
  64. data/spec/data/html/guidelines-400_files/styles2.css +115 -0
  65. data/spec/data/html/guidelines.html +217 -0
  66. data/spec/data/html/guidelines_files/EditListSearchHelper.js +123 -0
  67. data/spec/data/html/guidelines_files/ScriptResource.axd +3725 -0
  68. data/spec/data/html/guidelines_files/Stylesheet.css +1545 -0
  69. data/spec/data/html/guidelines_files/jquery-ui.css +578 -0
  70. data/spec/data/html/login.aspx.html +293 -0
  71. data/spec/data/html/login.aspx_files/ScriptResource.axd +3332 -0
  72. data/spec/data/html/login.aspx_files/Stylesheet.css +1545 -0
  73. data/spec/data/html/login.aspx_files/jquery-ui.css +578 -0
  74. data/spec/data/html/login.aspx_files/jquery.js +7 -0
  75. data/spec/data/html/login400.aspx.html +191 -0
  76. data/spec/data/html/login400.aspx_files/WebResource(1).axd +561 -0
  77. data/spec/data/html/login400.aspx_files/WebResource.axd +548 -0
  78. data/spec/data/html/login400.aspx_files/styles.css +444 -0
  79. data/spec/data/html/version_all_guidelines-400.html +702 -0
  80. data/spec/data/html/version_all_guidelines-400_files/CVlogo.jpg +0 -0
  81. data/spec/data/html/version_all_guidelines-400_files/Calendar.js +521 -0
  82. data/spec/data/html/version_all_guidelines-400_files/OptimalOutcome.png +0 -0
  83. data/spec/data/html/version_all_guidelines-400_files/TwoSelects.js +300 -0
  84. data/spec/data/html/version_all_guidelines-400_files/menu.css +29 -0
  85. data/spec/data/html/version_all_guidelines-400_files/menu.js +48 -0
  86. data/spec/data/html/version_all_guidelines-400_files/shadow.gif +0 -0
  87. data/spec/data/html/version_all_guidelines-400_files/styles(1).css +134 -0
  88. data/spec/data/html/version_all_guidelines-400_files/styles.css +444 -0
  89. data/spec/data/html/version_all_guidelines-400_files/styles2.css +115 -0
  90. data/spec/data/html/version_all_guidelines.html +560 -0
  91. data/spec/data/html/version_all_guidelines_files/Calendar.js +521 -0
  92. data/spec/data/html/version_all_guidelines_files/ScriptResource.axd +3725 -0
  93. data/spec/data/html/version_all_guidelines_files/Stylesheet.css +1545 -0
  94. data/spec/data/html/version_all_guidelines_files/TwoSelects.js +304 -0
  95. data/spec/data/html/version_all_guidelines_files/jquery-ui.css +578 -0
  96. data/spec/lib/admin_module/command/config_spec.rb +27 -0
  97. data/spec/lib/admin_module/command/gdl_spec.rb +31 -0
  98. data/spec/lib/admin_module/configuration_spec.rb +47 -0
  99. data/spec/lib/admin_module/guideline_spec.rb +26 -0
  100. data/spec/lib/admin_module/page_factory_spec.rb +72 -0
  101. data/spec/lib/admin_module/pages/guideline_page_400_spec.rb +51 -0
  102. data/spec/lib/admin_module/pages/guideline_page_spec.rb +50 -0
  103. data/spec/lib/admin_module/pages/guidelines_page_400_spec.rb +92 -0
  104. data/spec/lib/admin_module/pages/guidelines_page_spec.rb +91 -0
  105. data/spec/lib/admin_module/pages/guidelines_version_all_page_400_spec.rb +102 -0
  106. data/spec/lib/admin_module/pages/guidelines_version_all_page_spec.rb +105 -0
  107. data/spec/lib/admin_module/pages/login_page_400_spec.rb +42 -0
  108. data/spec/lib/admin_module/pages/login_page_spec.rb +33 -0
  109. data/spec/support/html_spec.rb +26 -0
  110. data/spec/support/mocks.rb +23 -0
  111. metadata +191 -5
@@ -0,0 +1,301 @@
1
+ /*
2
+ Added for scripts related to Guideline page
3
+ */
4
+
5
+ // method to move listitems from one list to another
6
+ // from Rule/Ruleset List to Guideline list
7
+ function MoveListItems(sourceList,destinationList)
8
+ {
9
+ var sourceObj,destObj,tempObj;
10
+ var i,j,k;
11
+
12
+ sourceObj=document.getElementById(sourceList);
13
+ destObj=document.getElementById(destinationList);
14
+
15
+ if((sourceObj==null)||(destObj==null))
16
+ return;
17
+ //debugger;
18
+ if(sourceObj.selectedIndex<0)
19
+ {
20
+ alert("Please select an item to add");
21
+ return;
22
+ }
23
+ //listitems count
24
+ i=sourceObj.options.length;
25
+ k=destObj.options.length;
26
+ j=0;
27
+ while(j<i)
28
+ {
29
+ if(sourceObj.options[j].selected)
30
+ {
31
+ tempObj=new Option(sourceObj.options[j].text,sourceObj.options[j].value);
32
+ if(tempObj.value.substring(0,1)==2) //Pricing Block
33
+ {
34
+ tempObj.style.color='red';
35
+ }
36
+ if(tempObj.value.substring(0,1)==3) //Added for PowerLookup Implementation
37
+ {
38
+ tempObj.style.color='Orange';
39
+ }
40
+ destObj.add(tempObj,k);
41
+ sourceObj.remove(j);
42
+ i--;
43
+ k++;
44
+ }
45
+ else
46
+ {
47
+ j++;
48
+ }
49
+ }
50
+
51
+ }
52
+
53
+ //From guidelineList to Rule/Ruleset Lists
54
+ function RemoveToListItems(sourceList,destinationList1,destinationList2)
55
+ {
56
+ var sourceObj,ruleObj,ruleSetObj,tempObj;
57
+ var i,j,k,m;
58
+
59
+ sourceObj=document.getElementById(sourceList);
60
+ ruleObj=document.getElementById(destinationList1);
61
+ ruleSetObj=document.getElementById(destinationList2);
62
+
63
+ if((sourceObj==null)||(ruleObj==null)||(ruleSetObj==null))
64
+ return;
65
+
66
+ if(sourceObj.selectedIndex<0)
67
+ {
68
+ alert("Please select an item to remove");
69
+ return;
70
+ }
71
+ //listitems count
72
+ i=sourceObj.options.length;
73
+ k=ruleObj.options.length;
74
+ m=ruleSetObj.options.length;
75
+
76
+ j=0;
77
+ while(j<i)
78
+ {
79
+ if(sourceObj.options[j].selected)
80
+ {
81
+ tempObj=new Option(sourceObj.options[j].text,sourceObj.options[j].value);
82
+
83
+ if(sourceObj.options[j].value.substring(0,1)==0) //rule
84
+ ruleObj.add(tempObj,k);
85
+ else if(sourceObj.options[j].value.substring(0,1)==1) //ruleset
86
+ {
87
+ ruleSetObj.add(tempObj,m);
88
+ }
89
+ else if(sourceObj.options[j].value.substring(0,1)==3) //'Added for PowerLookup Implementation
90
+ {
91
+ tempObj.style.color='Orange';
92
+ ruleSetObj.add(tempObj,m);
93
+ }
94
+
95
+ else if(sourceObj.options[j].value.substring(0,1)==2) //Pricing Block
96
+ {
97
+ tempObj.style.color='red';
98
+ ruleObj.add(tempObj,0);
99
+ }
100
+
101
+ sourceObj.remove(j);
102
+ i--;
103
+ k++;
104
+ }
105
+ else
106
+ {
107
+ j++;
108
+ }
109
+ }
110
+
111
+ }
112
+
113
+
114
+ function SetPricingBlockColor()
115
+ {
116
+ var gdlObj,ruleObj,ruleSetObj,tempObj;
117
+ var i,j,k,m;
118
+
119
+ gdlObj=document.getElementById('lstGuideline');
120
+ ruleObj=document.getElementById('lstRules');
121
+
122
+
123
+ if((gdlObj==null)||(ruleObj==null))
124
+ return;
125
+
126
+ //listitems count
127
+ i=gdlObj.options.length;
128
+ j=0;
129
+ while(j<i)
130
+ {
131
+ if(gdlObj.options[j].value.substring(0,1)==2) //Pricing Block
132
+ {
133
+ gdlObj.options[j].style.color='red';
134
+ }
135
+ j++;
136
+ }
137
+
138
+ k=ruleObj.options.length;
139
+ j=0;
140
+ while(j<k)
141
+ {
142
+ if(ruleObj.options[j].value.substring(0,1)==2) //Pricing Block
143
+ {
144
+ ruleObj.options[j].style.color='red';
145
+ }
146
+ j++;
147
+ }
148
+
149
+
150
+ }
151
+
152
+ //to move rule/ruleset up or down
153
+ //updwnFlag - 0 to moveup 1 to movedown
154
+ function ChangePos(objList,updwnFlag)
155
+ {
156
+ var sourceObj,tempObj;
157
+ var i,j,k,m;
158
+ var selText,selValue,Selected,selColor;
159
+
160
+ sourceObj=document.getElementById(objList);
161
+
162
+
163
+ if(sourceObj==null)
164
+ return;
165
+
166
+ if(sourceObj.selectedIndex<0)
167
+ {
168
+ alert("Please select an item to Move");
169
+ return;
170
+ }
171
+ //alert(sourceObj.selectedIndex);
172
+ //listitems count
173
+ i=sourceObj.options.length;
174
+
175
+ j=0;
176
+ if(updwnFlag==0)
177
+ {
178
+ while(j<i)
179
+ {
180
+
181
+ if(sourceObj.options[j].selected)
182
+ {
183
+ if(j==0) break;
184
+ if(j>0)
185
+ {
186
+ selText=sourceObj.options[j-1].text;
187
+ selValue=sourceObj.options[j-1].value;
188
+ Selected=sourceObj.options[j-1].selected;
189
+ selColor=sourceObj.options[j-1].style.color;
190
+
191
+ sourceObj.options[j-1].text=sourceObj.options[j].text;
192
+ sourceObj.options[j-1].value=sourceObj.options[j].value;
193
+ sourceObj.options[j-1].selected=sourceObj.options[j].selected;
194
+ sourceObj.options[j-1].style.color=sourceObj.options[j].style.color;
195
+
196
+ sourceObj.options[j].text=selText;
197
+ sourceObj.options[j].value=selValue;
198
+ sourceObj.options[j].selected=Selected;
199
+ sourceObj.options[j].style.color=selColor;
200
+ }
201
+ }
202
+ j++;
203
+ }
204
+ }
205
+ else if(updwnFlag==1)
206
+ {
207
+ j=i-1;
208
+ while(j>=0)
209
+ {
210
+ if(sourceObj.options[j].selected)
211
+ {
212
+ if(j==i-1) break;
213
+ if(j<i)
214
+ {
215
+ selText=sourceObj.options[j+1].text;
216
+ selValue=sourceObj.options[j+1].value;
217
+ Selected=sourceObj.options[j+1].selected;
218
+ selColor=sourceObj.options[j+1].style.color;
219
+
220
+ sourceObj.options[j+1].text=sourceObj.options[j].text;
221
+ sourceObj.options[j+1].value=sourceObj.options[j].value;
222
+ sourceObj.options[j+1].selected=sourceObj.options[j].selected;
223
+ sourceObj.options[j+1].style.color=sourceObj.options[j].style.color;
224
+
225
+ sourceObj.options[j].text=selText;
226
+ sourceObj.options[j].value=selValue;
227
+ sourceObj.options[j].selected=Selected;
228
+ sourceObj.options[j].style.color=selColor;
229
+ }
230
+ }
231
+ j--;
232
+ }
233
+
234
+ }
235
+ }
236
+
237
+
238
+ function selectAll(isAll)
239
+ {
240
+ var lst = document.getElementById("lstGuideline");
241
+ if (lst != null)
242
+ {
243
+ var bln;
244
+ lst.multiple = true;
245
+
246
+ if (isAll==0)
247
+ {
248
+ bln = false;
249
+ }
250
+ else
251
+ {
252
+ bln = true;
253
+ }
254
+
255
+ for (var i=0;i<lst.options.length;i++)
256
+ {
257
+
258
+ lst.options[i].selected = bln;
259
+ }
260
+ return false;
261
+ }
262
+ }
263
+
264
+ function selectAllForSave()
265
+ {
266
+ var lstGdl = document.getElementById("lstGuideline");
267
+ if (lstGdl != null)
268
+ {
269
+
270
+ lstGdl.multiple = true;
271
+ for (var i=0;i<lstGdl.options.length;i++)
272
+ {
273
+
274
+ lstGdl.options[i].value = lstGdl.options[i].value + "|" + lstGdl.options[i].text;
275
+ lstGdl.options[i].selected = true;
276
+ }
277
+ }
278
+ return true;
279
+ }
280
+ //Added for PowerLookup Implementation
281
+ //start
282
+ function SetColorPowerLookup()
283
+ {
284
+ ListColor('lstGuideline');
285
+ ListColor('lstRulesets');
286
+ }
287
+
288
+ function ListColor(ListName)
289
+ {
290
+
291
+ var ddlRef = document.getElementById(ListName);
292
+ var i,iLength = ddlRef.options.length-1;
293
+ for(i=0;i<=iLength;i++)
294
+ {
295
+ var toColor=ddlRef.options[i].value.split('|');
296
+ if (Number(toColor[0]) == 3)
297
+ ddlRef.options[i].style.color='orange';
298
+ }
299
+
300
+ }
301
+ //end
@@ -0,0 +1,561 @@
1
+ var Page_ValidationVer = "125";
2
+ var Page_IsValid = true;
3
+ var Page_BlockSubmit = false;
4
+ var Page_InvalidControlToBeFocused = null;
5
+ var Page_TextTypes = /^(text|password|file|search|tel|url|email|number|range|color|datetime|date|month|week|time|datetime-local)$/i;
6
+ function ValidatorUpdateDisplay(val) {
7
+ if (typeof(val.display) == "string") {
8
+ if (val.display == "None") {
9
+ return;
10
+ }
11
+ if (val.display == "Dynamic") {
12
+ val.style.display = val.isvalid ? "none" : "inline";
13
+ return;
14
+ }
15
+ }
16
+ if ((navigator.userAgent.indexOf("Mac") > -1) &&
17
+ (navigator.userAgent.indexOf("MSIE") > -1)) {
18
+ val.style.display = "inline";
19
+ }
20
+ val.style.visibility = val.isvalid ? "hidden" : "visible";
21
+ }
22
+ function ValidatorUpdateIsValid() {
23
+ Page_IsValid = AllValidatorsValid(Page_Validators);
24
+ }
25
+ function AllValidatorsValid(validators) {
26
+ if ((typeof(validators) != "undefined") && (validators != null)) {
27
+ var i;
28
+ for (i = 0; i < validators.length; i++) {
29
+ if (!validators[i].isvalid) {
30
+ return false;
31
+ }
32
+ }
33
+ }
34
+ return true;
35
+ }
36
+ function ValidatorHookupControlID(controlID, val) {
37
+ if (typeof(controlID) != "string") {
38
+ return;
39
+ }
40
+ var ctrl = document.getElementById(controlID);
41
+ if ((typeof(ctrl) != "undefined") && (ctrl != null)) {
42
+ ValidatorHookupControl(ctrl, val);
43
+ }
44
+ else {
45
+ val.isvalid = true;
46
+ val.enabled = false;
47
+ }
48
+ }
49
+ function ValidatorHookupControl(control, val) {
50
+ if (typeof(control.tagName) != "string") {
51
+ return;
52
+ }
53
+ if (control.tagName != "INPUT" && control.tagName != "TEXTAREA" && control.tagName != "SELECT") {
54
+ var i;
55
+ for (i = 0; i < control.childNodes.length; i++) {
56
+ ValidatorHookupControl(control.childNodes[i], val);
57
+ }
58
+ return;
59
+ }
60
+ else {
61
+ if (typeof(control.Validators) == "undefined") {
62
+ control.Validators = new Array;
63
+ var eventType;
64
+ if (control.type == "radio") {
65
+ eventType = "onclick";
66
+ } else {
67
+ eventType = "onchange";
68
+ if (typeof(val.focusOnError) == "string" && val.focusOnError == "t") {
69
+ ValidatorHookupEvent(control, "onblur", "ValidatedControlOnBlur(event); ");
70
+ }
71
+ }
72
+ ValidatorHookupEvent(control, eventType, "ValidatorOnChange(event); ");
73
+ if (Page_TextTypes.test(control.type)) {
74
+ ValidatorHookupEvent(control, "onkeypress",
75
+ "event = event || window.event; if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } ");
76
+ }
77
+ }
78
+ control.Validators[control.Validators.length] = val;
79
+ }
80
+ }
81
+ function ValidatorHookupEvent(control, eventType, functionPrefix) {
82
+ var ev = control[eventType];
83
+ if (typeof(ev) == "function") {
84
+ ev = ev.toString();
85
+ ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}"));
86
+ }
87
+ else {
88
+ ev = "";
89
+ }
90
+ control[eventType] = new Function("event", functionPrefix + " " + ev);
91
+ }
92
+ function ValidatorGetValue(id) {
93
+ var control;
94
+ control = document.getElementById(id);
95
+ if (typeof(control.value) == "string") {
96
+ return control.value;
97
+ }
98
+ return ValidatorGetValueRecursive(control);
99
+ }
100
+ function ValidatorGetValueRecursive(control)
101
+ {
102
+ if (typeof(control.value) == "string" && (control.type != "radio" || control.checked == true)) {
103
+ return control.value;
104
+ }
105
+ var i, val;
106
+ for (i = 0; i<control.childNodes.length; i++) {
107
+ val = ValidatorGetValueRecursive(control.childNodes[i]);
108
+ if (val != "") return val;
109
+ }
110
+ return "";
111
+ }
112
+ function Page_ClientValidate(validationGroup) {
113
+ Page_InvalidControlToBeFocused = null;
114
+ if (typeof(Page_Validators) == "undefined") {
115
+ return true;
116
+ }
117
+ var i;
118
+ for (i = 0; i < Page_Validators.length; i++) {
119
+ ValidatorValidate(Page_Validators[i], validationGroup, null);
120
+ }
121
+ ValidatorUpdateIsValid();
122
+ ValidationSummaryOnSubmit(validationGroup);
123
+ Page_BlockSubmit = !Page_IsValid;
124
+ return Page_IsValid;
125
+ }
126
+ function ValidatorCommonOnSubmit() {
127
+ Page_InvalidControlToBeFocused = null;
128
+ var result = !Page_BlockSubmit;
129
+ if ((typeof(window.event) != "undefined") && (window.event != null)) {
130
+ window.event.returnValue = result;
131
+ }
132
+ Page_BlockSubmit = false;
133
+ return result;
134
+ }
135
+ function ValidatorEnable(val, enable) {
136
+ val.enabled = (enable != false);
137
+ ValidatorValidate(val);
138
+ ValidatorUpdateIsValid();
139
+ }
140
+ function ValidatorOnChange(event) {
141
+ event = event || window.event;
142
+ Page_InvalidControlToBeFocused = null;
143
+ var targetedControl;
144
+ if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
145
+ targetedControl = event.srcElement;
146
+ }
147
+ else {
148
+ targetedControl = event.target;
149
+ }
150
+ var vals;
151
+ if (typeof(targetedControl.Validators) != "undefined") {
152
+ vals = targetedControl.Validators;
153
+ }
154
+ else {
155
+ if (targetedControl.tagName.toLowerCase() == "label") {
156
+ targetedControl = document.getElementById(targetedControl.htmlFor);
157
+ vals = targetedControl.Validators;
158
+ }
159
+ }
160
+ if (vals) {
161
+ for (var i = 0; i < vals.length; i++) {
162
+ ValidatorValidate(vals[i], null, event);
163
+ }
164
+ }
165
+ ValidatorUpdateIsValid();
166
+ }
167
+ function ValidatedTextBoxOnKeyPress(event) {
168
+ event = event || window.event;
169
+ if (event.keyCode == 13) {
170
+ ValidatorOnChange(event);
171
+ var vals;
172
+ if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
173
+ vals = event.srcElement.Validators;
174
+ }
175
+ else {
176
+ vals = event.target.Validators;
177
+ }
178
+ return AllValidatorsValid(vals);
179
+ }
180
+ return true;
181
+ }
182
+ function ValidatedControlOnBlur(event) {
183
+ event = event || window.event;
184
+ var control;
185
+ if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
186
+ control = event.srcElement;
187
+ }
188
+ else {
189
+ control = event.target;
190
+ }
191
+ if ((typeof(control) != "undefined") && (control != null) && (Page_InvalidControlToBeFocused == control)) {
192
+ control.focus();
193
+ Page_InvalidControlToBeFocused = null;
194
+ }
195
+ }
196
+ function ValidatorValidate(val, validationGroup, event) {
197
+ val.isvalid = true;
198
+ if ((typeof(val.enabled) == "undefined" || val.enabled != false) && IsValidationGroupMatch(val, validationGroup)) {
199
+ if (typeof(val.evaluationfunction) == "function") {
200
+ val.isvalid = val.evaluationfunction(val);
201
+ if (!val.isvalid && Page_InvalidControlToBeFocused == null &&
202
+ typeof(val.focusOnError) == "string" && val.focusOnError == "t") {
203
+ ValidatorSetFocus(val, event);
204
+ }
205
+ }
206
+ }
207
+ ValidatorUpdateDisplay(val);
208
+ }
209
+ function ValidatorSetFocus(val, event) {
210
+ var ctrl;
211
+ if (typeof(val.controlhookup) == "string") {
212
+ var eventCtrl;
213
+ if ((typeof(event) != "undefined") && (event != null)) {
214
+ if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
215
+ eventCtrl = event.srcElement;
216
+ }
217
+ else {
218
+ eventCtrl = event.target;
219
+ }
220
+ }
221
+ if ((typeof(eventCtrl) != "undefined") && (eventCtrl != null) &&
222
+ (typeof(eventCtrl.id) == "string") &&
223
+ (eventCtrl.id == val.controlhookup)) {
224
+ ctrl = eventCtrl;
225
+ }
226
+ }
227
+ if ((typeof(ctrl) == "undefined") || (ctrl == null)) {
228
+ ctrl = document.getElementById(val.controltovalidate);
229
+ }
230
+ if ((typeof(ctrl) != "undefined") && (ctrl != null) &&
231
+ (ctrl.tagName.toLowerCase() != "table" || (typeof(event) == "undefined") || (event == null)) &&
232
+ ((ctrl.tagName.toLowerCase() != "input") || (ctrl.type.toLowerCase() != "hidden")) &&
233
+ (typeof(ctrl.disabled) == "undefined" || ctrl.disabled == null || ctrl.disabled == false) &&
234
+ (typeof(ctrl.visible) == "undefined" || ctrl.visible == null || ctrl.visible != false) &&
235
+ (IsInVisibleContainer(ctrl))) {
236
+ if ((ctrl.tagName.toLowerCase() == "table" && (typeof(__nonMSDOMBrowser) == "undefined" || __nonMSDOMBrowser)) ||
237
+ (ctrl.tagName.toLowerCase() == "span")) {
238
+ var inputElements = ctrl.getElementsByTagName("input");
239
+ var lastInputElement = inputElements[inputElements.length -1];
240
+ if (lastInputElement != null) {
241
+ ctrl = lastInputElement;
242
+ }
243
+ }
244
+ if (typeof(ctrl.focus) != "undefined" && ctrl.focus != null) {
245
+ ctrl.focus();
246
+ Page_InvalidControlToBeFocused = ctrl;
247
+ }
248
+ }
249
+ }
250
+ function IsInVisibleContainer(ctrl) {
251
+ if (typeof(ctrl.style) != "undefined" &&
252
+ ( ( typeof(ctrl.style.display) != "undefined" &&
253
+ ctrl.style.display == "none") ||
254
+ ( typeof(ctrl.style.visibility) != "undefined" &&
255
+ ctrl.style.visibility == "hidden") ) ) {
256
+ return false;
257
+ }
258
+ else if (typeof(ctrl.parentNode) != "undefined" &&
259
+ ctrl.parentNode != null &&
260
+ ctrl.parentNode != ctrl) {
261
+ return IsInVisibleContainer(ctrl.parentNode);
262
+ }
263
+ return true;
264
+ }
265
+ function IsValidationGroupMatch(control, validationGroup) {
266
+ if ((typeof(validationGroup) == "undefined") || (validationGroup == null)) {
267
+ return true;
268
+ }
269
+ var controlGroup = "";
270
+ if (typeof(control.validationGroup) == "string") {
271
+ controlGroup = control.validationGroup;
272
+ }
273
+ return (controlGroup == validationGroup);
274
+ }
275
+ function ValidatorOnLoad() {
276
+ if (typeof(Page_Validators) == "undefined")
277
+ return;
278
+ var i, val;
279
+ for (i = 0; i < Page_Validators.length; i++) {
280
+ val = Page_Validators[i];
281
+ if (typeof(val.evaluationfunction) == "string") {
282
+ eval("val.evaluationfunction = " + val.evaluationfunction + ";");
283
+ }
284
+ if (typeof(val.isvalid) == "string") {
285
+ if (val.isvalid == "False") {
286
+ val.isvalid = false;
287
+ Page_IsValid = false;
288
+ }
289
+ else {
290
+ val.isvalid = true;
291
+ }
292
+ } else {
293
+ val.isvalid = true;
294
+ }
295
+ if (typeof(val.enabled) == "string") {
296
+ val.enabled = (val.enabled != "False");
297
+ }
298
+ if (typeof(val.controltovalidate) == "string") {
299
+ ValidatorHookupControlID(val.controltovalidate, val);
300
+ }
301
+ if (typeof(val.controlhookup) == "string") {
302
+ ValidatorHookupControlID(val.controlhookup, val);
303
+ }
304
+ }
305
+ Page_ValidationActive = true;
306
+ }
307
+ function ValidatorConvert(op, dataType, val) {
308
+ function GetFullYear(year) {
309
+ var twoDigitCutoffYear = val.cutoffyear % 100;
310
+ var cutoffYearCentury = val.cutoffyear - twoDigitCutoffYear;
311
+ return ((year > twoDigitCutoffYear) ? (cutoffYearCentury - 100 + year) : (cutoffYearCentury + year));
312
+ }
313
+ var num, cleanInput, m, exp;
314
+ if (dataType == "Integer") {
315
+ exp = /^\s*[-\+]?\d+\s*$/;
316
+ if (op.match(exp) == null)
317
+ return null;
318
+ num = parseInt(op, 10);
319
+ return (isNaN(num) ? null : num);
320
+ }
321
+ else if(dataType == "Double") {
322
+ exp = new RegExp("^\\s*([-\\+])?(\\d*)\\" + val.decimalchar + "?(\\d*)\\s*$");
323
+ m = op.match(exp);
324
+ if (m == null)
325
+ return null;
326
+ if (m[2].length == 0 && m[3].length == 0)
327
+ return null;
328
+ cleanInput = (m[1] != null ? m[1] : "") + (m[2].length>0 ? m[2] : "0") + (m[3].length>0 ? "." + m[3] : "");
329
+ num = parseFloat(cleanInput);
330
+ return (isNaN(num) ? null : num);
331
+ }
332
+ else if (dataType == "Currency") {
333
+ var hasDigits = (val.digits > 0);
334
+ var beginGroupSize, subsequentGroupSize;
335
+ var groupSizeNum = parseInt(val.groupsize, 10);
336
+ if (!isNaN(groupSizeNum) && groupSizeNum > 0) {
337
+ beginGroupSize = "{1," + groupSizeNum + "}";
338
+ subsequentGroupSize = "{" + groupSizeNum + "}";
339
+ }
340
+ else {
341
+ beginGroupSize = subsequentGroupSize = "+";
342
+ }
343
+ exp = new RegExp("^\\s*([-\\+])?((\\d" + beginGroupSize + "(\\" + val.groupchar + "\\d" + subsequentGroupSize + ")+)|\\d*)"
344
+ + (hasDigits ? "\\" + val.decimalchar + "?(\\d{0," + val.digits + "})" : "")
345
+ + "\\s*$");
346
+ m = op.match(exp);
347
+ if (m == null)
348
+ return null;
349
+ if (m[2].length == 0 && hasDigits && m[5].length == 0)
350
+ return null;
351
+ cleanInput = (m[1] != null ? m[1] : "") + m[2].replace(new RegExp("(\\" + val.groupchar + ")", "g"), "") + ((hasDigits && m[5].length > 0) ? "." + m[5] : "");
352
+ num = parseFloat(cleanInput);
353
+ return (isNaN(num) ? null : num);
354
+ }
355
+ else if (dataType == "Date") {
356
+ var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([-/]|\\. ?)(\\d{1,2})\\4(\\d{1,2})\\.?\\s*$");
357
+ m = op.match(yearFirstExp);
358
+ var day, month, year;
359
+ if (m != null && (((typeof(m[2]) != "undefined") && (m[2].length == 4)) || val.dateorder == "ymd")) {
360
+ day = m[6];
361
+ month = m[5];
362
+ year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));
363
+ }
364
+ else {
365
+ if (val.dateorder == "ymd"){
366
+ return null;
367
+ }
368
+ var yearLastExp = new RegExp("^\\s*(\\d{1,2})([-/]|\\. ?)(\\d{1,2})(?:\\s|\\2)((\\d{4})|(\\d{2}))(?:\\s\u0433\\.|\\.)?\\s*$");
369
+ m = op.match(yearLastExp);
370
+ if (m == null) {
371
+ return null;
372
+ }
373
+ if (val.dateorder == "mdy") {
374
+ day = m[3];
375
+ month = m[1];
376
+ }
377
+ else {
378
+ day = m[1];
379
+ month = m[3];
380
+ }
381
+ year = ((typeof(m[5]) != "undefined") && (m[5].length == 4)) ? m[5] : GetFullYear(parseInt(m[6], 10));
382
+ }
383
+ month -= 1;
384
+ var date = new Date(year, month, day);
385
+ if (year < 100) {
386
+ date.setFullYear(year);
387
+ }
388
+ return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null;
389
+ }
390
+ else {
391
+ return op.toString();
392
+ }
393
+ }
394
+ function ValidatorCompare(operand1, operand2, operator, val) {
395
+ var dataType = val.type;
396
+ var op1, op2;
397
+ if ((op1 = ValidatorConvert(operand1, dataType, val)) == null)
398
+ return false;
399
+ if (operator == "DataTypeCheck")
400
+ return true;
401
+ if ((op2 = ValidatorConvert(operand2, dataType, val)) == null)
402
+ return true;
403
+ switch (operator) {
404
+ case "NotEqual":
405
+ return (op1 != op2);
406
+ case "GreaterThan":
407
+ return (op1 > op2);
408
+ case "GreaterThanEqual":
409
+ return (op1 >= op2);
410
+ case "LessThan":
411
+ return (op1 < op2);
412
+ case "LessThanEqual":
413
+ return (op1 <= op2);
414
+ default:
415
+ return (op1 == op2);
416
+ }
417
+ }
418
+ function CompareValidatorEvaluateIsValid(val) {
419
+ var value = ValidatorGetValue(val.controltovalidate);
420
+ if (ValidatorTrim(value).length == 0)
421
+ return true;
422
+ var compareTo = "";
423
+ if ((typeof(val.controltocompare) != "string") ||
424
+ (typeof(document.getElementById(val.controltocompare)) == "undefined") ||
425
+ (null == document.getElementById(val.controltocompare))) {
426
+ if (typeof(val.valuetocompare) == "string") {
427
+ compareTo = val.valuetocompare;
428
+ }
429
+ }
430
+ else {
431
+ compareTo = ValidatorGetValue(val.controltocompare);
432
+ }
433
+ var operator = "Equal";
434
+ if (typeof(val.operator) == "string") {
435
+ operator = val.operator;
436
+ }
437
+ return ValidatorCompare(value, compareTo, operator, val);
438
+ }
439
+ function CustomValidatorEvaluateIsValid(val) {
440
+ var value = "";
441
+ if (typeof(val.controltovalidate) == "string") {
442
+ value = ValidatorGetValue(val.controltovalidate);
443
+ if ((ValidatorTrim(value).length == 0) &&
444
+ ((typeof(val.validateemptytext) != "string") || (val.validateemptytext != "true"))) {
445
+ return true;
446
+ }
447
+ }
448
+ var args = { Value:value, IsValid:true };
449
+ if (typeof(val.clientvalidationfunction) == "string") {
450
+ eval(val.clientvalidationfunction + "(val, args) ;");
451
+ }
452
+ return args.IsValid;
453
+ }
454
+ function RegularExpressionValidatorEvaluateIsValid(val) {
455
+ var value = ValidatorGetValue(val.controltovalidate);
456
+ if (ValidatorTrim(value).length == 0)
457
+ return true;
458
+ var rx = new RegExp(val.validationexpression);
459
+ var matches = rx.exec(value);
460
+ return (matches != null && value == matches[0]);
461
+ }
462
+ function ValidatorTrim(s) {
463
+ var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
464
+ return (m == null) ? "" : m[1];
465
+ }
466
+ function RequiredFieldValidatorEvaluateIsValid(val) {
467
+ return (ValidatorTrim(ValidatorGetValue(val.controltovalidate)) != ValidatorTrim(val.initialvalue))
468
+ }
469
+ function RangeValidatorEvaluateIsValid(val) {
470
+ var value = ValidatorGetValue(val.controltovalidate);
471
+ if (ValidatorTrim(value).length == 0)
472
+ return true;
473
+ return (ValidatorCompare(value, val.minimumvalue, "GreaterThanEqual", val) &&
474
+ ValidatorCompare(value, val.maximumvalue, "LessThanEqual", val));
475
+ }
476
+ function ValidationSummaryOnSubmit(validationGroup) {
477
+ if (typeof(Page_ValidationSummaries) == "undefined")
478
+ return;
479
+ var summary, sums, s;
480
+ var headerSep, first, pre, post, end;
481
+ for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {
482
+ summary = Page_ValidationSummaries[sums];
483
+ summary.style.display = "none";
484
+ if (!Page_IsValid && IsValidationGroupMatch(summary, validationGroup)) {
485
+ var i;
486
+ if (summary.showsummary != "False") {
487
+ summary.style.display = "";
488
+ if (typeof(summary.displaymode) != "string") {
489
+ summary.displaymode = "BulletList";
490
+ }
491
+ switch (summary.displaymode) {
492
+ case "List":
493
+ headerSep = "<br>";
494
+ first = "";
495
+ pre = "";
496
+ post = "<br>";
497
+ end = "";
498
+ break;
499
+ case "BulletList":
500
+ default:
501
+ headerSep = "";
502
+ first = "<ul>";
503
+ pre = "<li>";
504
+ post = "</li>";
505
+ end = "</ul>";
506
+ break;
507
+ case "SingleParagraph":
508
+ headerSep = " ";
509
+ first = "";
510
+ pre = "";
511
+ post = " ";
512
+ end = "<br>";
513
+ break;
514
+ }
515
+ s = "";
516
+ if (typeof(summary.headertext) == "string") {
517
+ s += summary.headertext + headerSep;
518
+ }
519
+ s += first;
520
+ for (i=0; i<Page_Validators.length; i++) {
521
+ if (!Page_Validators[i].isvalid && typeof(Page_Validators[i].errormessage) == "string") {
522
+ s += pre + Page_Validators[i].errormessage + post;
523
+ }
524
+ }
525
+ s += end;
526
+ summary.innerHTML = s;
527
+ window.scrollTo(0,0);
528
+ }
529
+ if (summary.showmessagebox == "True") {
530
+ s = "";
531
+ if (typeof(summary.headertext) == "string") {
532
+ s += summary.headertext + "\r\n";
533
+ }
534
+ var lastValIndex = Page_Validators.length - 1;
535
+ for (i=0; i<=lastValIndex; i++) {
536
+ if (!Page_Validators[i].isvalid && typeof(Page_Validators[i].errormessage) == "string") {
537
+ switch (summary.displaymode) {
538
+ case "List":
539
+ s += Page_Validators[i].errormessage;
540
+ if (i < lastValIndex) {
541
+ s += "\r\n";
542
+ }
543
+ break;
544
+ case "BulletList":
545
+ default:
546
+ s += "- " + Page_Validators[i].errormessage;
547
+ if (i < lastValIndex) {
548
+ s += "\r\n";
549
+ }
550
+ break;
551
+ case "SingleParagraph":
552
+ s += Page_Validators[i].errormessage + " ";
553
+ break;
554
+ }
555
+ }
556
+ }
557
+ alert(s);
558
+ }
559
+ }
560
+ }
561
+ }