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,141 @@
1
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
2
+ // Issue # : 9464
3
+ // Date : 13 Dec 2006
4
+ // Purpose : To implement search functionality to the decision process pages
5
+ // Modification History:
6
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
7
+
8
+ //Variable to store the clone of list box options
9
+ var oSearchParams;
10
+
11
+ //Creates search param object and assigns the values
12
+ function CreateSearchParams(CtrlSearchItem,CtrlSearchText,CtrlToSearch,SearchAll)
13
+ {
14
+
15
+ oSearchParams = new SearchParams();
16
+ oSearchParams.CtrlSearchItem = document.getElementById(CtrlSearchItem);
17
+ oSearchParams.CtrlSearchText = CtrlSearchText;
18
+ oSearchParams.CtrlToSearch = CtrlToSearch;
19
+ if (document.getElementById(CtrlSearchText)!=null)
20
+ {
21
+ document.getElementById(CtrlSearchText).onkeydown = HandleKeyPress;
22
+ if(document.getElementById(CtrlSearchText).value != "")
23
+ Search();
24
+ if (SearchAll=="true")
25
+ {
26
+ document.getElementById(CtrlSearchItem).selectedIndex=0;
27
+ }
28
+ }
29
+ }
30
+
31
+ // Search params object
32
+ function SearchParams()
33
+ {
34
+ this.CtrlSearchItem;
35
+ this.CtrlSearchText;
36
+ this.CtrlToSearch;
37
+ this.SearchValues;
38
+ }
39
+
40
+ function Search()
41
+ {
42
+
43
+ //SearchParams must be created before start searching...
44
+ if(oSearchParams == null || typeof(oSearchParams) == "undefined")
45
+ return;
46
+
47
+ //SearchParams values are needed to search ...
48
+ if(oSearchParams.CtrlSearchText == null || oSearchParams.CtrlSearchItem == null || oSearchParams.CtrlToSearch == null)
49
+ return;
50
+
51
+ var SearchText = document.getElementById(oSearchParams.CtrlSearchText).value.toLowerCase();
52
+
53
+ //Search Text cannot be empty..
54
+ if(SearchText == "")
55
+ {
56
+ alert("Enter text to search.");
57
+ document.getElementById(oSearchParams.CtrlSearchText).focus();
58
+ return false;
59
+ }
60
+ // Forward to search all page if the searchitem type is all otherwise search the ctrl.
61
+ if(oSearchParams.CtrlSearchItem.options[oSearchParams.CtrlSearchItem.selectedIndex].value == "all")
62
+ {
63
+ var a = oSearchParams.CtrlSearchItem.document.location.pathname.indexOf('/admin/product/');
64
+ if(a>=0)
65
+ {
66
+ SearchAllProducts(SearchText);
67
+ }
68
+ else
69
+ {
70
+ SearchAll(SearchText);
71
+ }
72
+ }
73
+ else
74
+ {
75
+ SearchCtrl(SearchText);
76
+ }
77
+ }
78
+
79
+ // Forward to search all page..
80
+ function SearchAll(SearchText)
81
+ {
82
+ location.href="searchresults.aspx?searchtext=" + SearchText;
83
+ }
84
+ function SearchAllProducts(SearchText)
85
+ {
86
+ location.href="../decision/searchresults.aspx?searchtext=" + SearchText;
87
+ }
88
+ //Search list control in the page..
89
+ function SearchCtrl(SearchText)
90
+ {
91
+ var icount;
92
+
93
+
94
+ if(oSearchParams.SearchValues == null || typeof(oSearchParams.SearchValues) == "undefined")
95
+ oSearchParams.SearchValues = document.getElementById(oSearchParams.CtrlToSearch).parentElement.innerHTML;
96
+
97
+ if( ClearSearch(false))
98
+ {
99
+ var ddlCtrltoSearch = document.getElementById(oSearchParams.CtrlToSearch);
100
+
101
+ for(icount=ddlCtrltoSearch.options.length-1;icount>=0;icount--)
102
+ {
103
+ if(ddlCtrltoSearch.options[icount].text.toLowerCase().indexOf(SearchText) == -1)
104
+ ddlCtrltoSearch.options.remove(icount);
105
+ }
106
+ }
107
+
108
+ if(ddlCtrltoSearch.options.length==0)
109
+ {
110
+ alert("No records found.");
111
+ }
112
+ }
113
+
114
+ //Clear search
115
+ function ClearSearch(Reset)
116
+ {
117
+ if(Reset)
118
+ {
119
+ document.getElementById(oSearchParams.CtrlSearchText).value = "";
120
+ document.getElementById(oSearchParams.CtrlSearchText).focus();
121
+ }
122
+
123
+ if(oSearchParams.SearchValues != null && typeof(oSearchParams.SearchValues) != "undefined")
124
+ {
125
+ document.getElementById(oSearchParams.CtrlToSearch).parentElement.innerHTML =oSearchParams.SearchValues;
126
+ return true;
127
+ }
128
+
129
+ return false;
130
+ }
131
+
132
+ function HandleKeyPress()
133
+ {
134
+ if(event.keyCode == 13)
135
+ {
136
+ Search();
137
+ document.getElementById(oSearchParams.CtrlSearchText).focus();
138
+ event.cancelBuble= true;
139
+ event.returnValue = false;
140
+ }
141
+ }
@@ -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
+ }