| 13 |
rsolanki |
1 |
<%
|
|
|
2 |
'=============================================================
|
|
|
3 |
'//
|
|
|
4 |
'// Form Component
|
|
|
5 |
'//
|
|
|
6 |
'// version: 1.1
|
|
|
7 |
'// last modified: 19-Aug-2004 13:47 by Sasha Vukovic
|
|
|
8 |
'=============================================================
|
|
|
9 |
%>
|
|
|
10 |
<%
|
|
|
11 |
'------------- GLOBALS --------------
|
|
|
12 |
Const LIMG_FORM_COMPONENT_DROP_DOWN = "<img src='controls/ERGFormComponent/images/bi_dropdown.gif' width='15' height='16' border='0' hspace='2' align='absmiddle'>"
|
|
|
13 |
Const LIMG_FORM_COMPONENT_DROP_DOWN_OFF = "<img src='controls/ERGFormComponent/images/bi_dropdown_off.gif' width='15' height='16' border='0' align='absmiddle' hspace='2'>"
|
|
|
14 |
'------------------------------------
|
|
|
15 |
%>
|
|
|
16 |
<%
|
|
|
17 |
Class FormComponent
|
|
|
18 |
|
|
|
19 |
Private mFormName
|
|
|
20 |
Private mMethod
|
|
|
21 |
Private mAction
|
|
|
22 |
Private mOnSubmit
|
|
|
23 |
Private msDisabled
|
|
|
24 |
|
|
|
25 |
Public Property Let FormName ( sFormName )
|
|
|
26 |
mFormName = sFormName
|
|
|
27 |
End Property
|
|
|
28 |
|
|
|
29 |
Public Property Let Method ( sMethod )
|
|
|
30 |
mMethod = sMethod
|
|
|
31 |
End Property
|
|
|
32 |
|
|
|
33 |
Public Property Let Action ( sAction )
|
|
|
34 |
mAction = sAction
|
|
|
35 |
End Property
|
|
|
36 |
|
|
|
37 |
Public Property Let OnSubmit ( sOnSubmit )
|
|
|
38 |
mOnSubmit = "onSubmit='"& sOnSubmit &"'"
|
|
|
39 |
End Property
|
|
|
40 |
|
|
|
41 |
Public Property Let IsReadonlyAction ( IsReadonly )
|
|
|
42 |
If IsReadonly = enumDB_YES Then
|
|
|
43 |
msDisabled = " disabled "
|
|
|
44 |
|
|
|
45 |
ElseIf IsReadonly = enumDB_NO Then
|
|
|
46 |
msDisabled = NULL
|
|
|
47 |
Else
|
|
|
48 |
msDisabled = " disabled "
|
|
|
49 |
|
|
|
50 |
End If
|
|
|
51 |
|
|
|
52 |
End Property
|
|
|
53 |
|
|
|
54 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
55 |
Public Function Combo ( sName, aList, bOneBlank, sAttributes )
|
|
|
56 |
'=== List Definition ===
|
|
|
57 |
' Method expects list array to have 3 columns ( filed value, field name, word "selected" for selected item )
|
|
|
58 |
|
|
|
59 |
Dim compSTR
|
|
|
60 |
Dim rowNum, numOfRows
|
|
|
61 |
|
|
|
62 |
compSTR = ""
|
|
|
63 |
|
|
|
64 |
'/* Generate Combo */
|
|
|
65 |
|
|
|
66 |
compSTR = compSTR &"<select name='"& sName &"' "& sAttributes &" "& msDisabled &">"
|
|
|
67 |
|
|
|
68 |
'-- Blank Item --
|
|
|
69 |
If bOneBlank Then compSTR = compSTR &"<option value=''></option>"
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
If IsArray(aList) Then
|
|
|
73 |
|
|
|
74 |
numOfRows = UBound( aList, 2 )
|
|
|
75 |
For rowNum = 0 To numOfRows
|
|
|
76 |
compSTR = compSTR &"<option value='"& aList( 0, rowNum ) &"' "& aList( 2, rowNum ) &">"& aList( 1, rowNum ) &"</option>"
|
|
|
77 |
Next
|
|
|
78 |
|
|
|
79 |
End If
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
compSTR = compSTR &"</select>"
|
|
|
83 |
|
|
|
84 |
Combo = compSTR
|
|
|
85 |
End Function
|
|
|
86 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
87 |
Private Function Advanced_Combo ( sName, sValue, aList, sAttributes, sMore, bForceDropdown )
|
|
|
88 |
Dim compSTR
|
|
|
89 |
Dim rowNum, numOfRows, Display
|
|
|
90 |
|
|
|
91 |
compSTR = ""
|
|
|
92 |
|
|
|
93 |
'--- Text Box ---
|
|
|
94 |
compSTR = compSTR &"<input name='"& sName &"' type='text' "& sAttributes &" value='"& sValue &"' "& msDisabled &">"
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
'--- Dropdown Button ---
|
|
|
98 |
If IsNull(aList) OR (NOT IsNull(msDisabled)) Then
|
|
|
99 |
compSTR = compSTR & LIMG_FORM_COMPONENT_DROP_DOWN_OFF
|
|
|
100 |
Advanced_Combo = compSTR
|
|
|
101 |
Exit Function
|
|
|
102 |
End If
|
|
|
103 |
compSTR = compSTR &"<a href='javascript:;' onClick=""ToggleDisplay('divDropDown"& sName &"');"">"& LIMG_FORM_COMPONENT_DROP_DOWN &"</a>"
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
'-- Default dispaly value
|
|
|
107 |
Display = "none"
|
|
|
108 |
If bForceDropdown Then
|
|
|
109 |
Display = "block"
|
|
|
110 |
End If
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
'--- Dropdown List ---
|
|
|
114 |
compSTR = compSTR &"<DIV id='divDropDown"& sName &"' name='divDropDown"& sName &"' style='display:"& Display &";' ><div style='height:150px; overflow: auto;'>"
|
|
|
115 |
compSTR = compSTR &"<table width='100%' border='0' cellspacing='0' cellpadding='1'>"
|
|
|
116 |
compSTR = compSTR &"<tr>"
|
|
|
117 |
compSTR = compSTR &" <td background='controls/ERGFormComponent/images/bg_table_border.gif'><table width='100%' border='0' cellspacing='0' cellpadding='2'>"
|
|
|
118 |
|
|
|
119 |
numOfRows = UBound( aList, 2 )
|
|
|
120 |
For rowNum = 0 To numOfRows
|
|
|
121 |
compSTR = compSTR &" <tr>"
|
|
|
122 |
compSTR = compSTR &" <td nowrap bgcolor='#FFFFFF'><a href='javascript:;' class='menu_link' onClick="""& mFormName &"."& sName &".value = '"& aList(1, rowNum) &"';ToggleDisplay('divDropDown"& sName &"');"">"& aList(1, rowNum) &"</a></td>"
|
|
|
123 |
compSTR = compSTR &" </tr>"
|
|
|
124 |
Next
|
|
|
125 |
|
|
|
126 |
'-- Display More.. link if required
|
|
|
127 |
If NOT IsNull(sMore) Then
|
|
|
128 |
compSTR = compSTR &" <tr>"
|
|
|
129 |
compSTR = compSTR &" <td nowrap bgcolor='#FFFFFF'><a href='"& sMore &"' class='body_link'>More...</a></td>"
|
|
|
130 |
compSTR = compSTR &" </tr>"
|
|
|
131 |
End If
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
compSTR = compSTR &" </table></td>"
|
|
|
135 |
compSTR = compSTR &"</tr>"
|
|
|
136 |
compSTR = compSTR &"</table>"
|
|
|
137 |
compSTR = compSTR &"</div></DIV>"
|
|
|
138 |
|
|
|
139 |
Advanced_Combo = compSTR
|
|
|
140 |
End Function
|
|
|
141 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
142 |
Public Function ComboWithTextAndFilter ( sName, sValue, aList, sAttributes, sMore, bForceDropdown )
|
|
|
143 |
ComboWithTextAndFilter = Advanced_Combo ( sName, sValue, aList, sAttributes, sMore, bForceDropdown )
|
|
|
144 |
End Function
|
|
|
145 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
146 |
Public Function ComboWithText ( sName, sValue, aList, sAttributes )
|
|
|
147 |
ComboWithText = Advanced_Combo ( sName, sValue, aList, sAttributes, NULL, FALSE )
|
|
|
148 |
End Function
|
|
|
149 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
150 |
Public Function TextArea ( sName, sValue, nRows, nCols, sAttributes )
|
|
|
151 |
|
|
|
152 |
TextArea = _
|
|
|
153 |
"<textarea name='"& sName &"' rows='"& nRows &"' cols='"& nCols &"' "& sAttributes &" "& msDisabled &">"& sValue &"</textarea>"
|
|
|
154 |
|
|
|
155 |
End Function
|
|
|
156 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
157 |
Public Function TextBox ( sName, sValue, sAttributes )
|
|
|
158 |
TextBox = _
|
|
|
159 |
"<input type='text' name='"& sName &"' "& sAttributes &" value='"& sValue &"' "& msDisabled &">"
|
|
|
160 |
|
|
|
161 |
End Function
|
|
|
162 |
'-----------------------------------------------------------------------------------------------------------------
|
| 15 |
rsolanki |
163 |
Public Function CheckBox ( sName, sValue, sAttributes )
|
|
|
164 |
CheckBox = _
|
|
|
165 |
"<input type='checkbox' name='"& sName &"' "& sAttributes &" value='"& sValue &"' "& msDisabled &">"
|
|
|
166 |
|
|
|
167 |
End Function
|
|
|
168 |
'-----------------------------------------------------------------------------------------------------------------
|
| 13 |
rsolanki |
169 |
Public Function SubmitButton ( sValue, sAttributes )
|
|
|
170 |
SubmitButton = _
|
|
|
171 |
"<input type='submit' value='"& sValue &"' "& sAttributes &" "& msDisabled &">"
|
|
|
172 |
End Function
|
|
|
173 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
174 |
Public Function CancelButton ( sValue, sAttributes, sURLreturn )
|
|
|
175 |
CancelButton = _
|
|
|
176 |
"<input type='reset' value='"& sValue &"' "& sAttributes &" onClick=""window.location='"& sURLreturn &"';"">"
|
|
|
177 |
End Function
|
|
|
178 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
179 |
Public Function BackButton ( sValue, sAttributes )
|
|
|
180 |
BackButton = _
|
|
|
181 |
"<input type='reset' value='"& sValue &"' "& sAttributes &" onClick=""history.back();"">"
|
|
|
182 |
End Function
|
|
|
183 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
184 |
Public Sub FormStart ()
|
|
|
185 |
If IsNull(mFormName) Then Err.Raise 8, "Method FormComponent.FormStart", "Form Name is not defined."
|
|
|
186 |
If IsNull(mAction) Then Err.Raise 8, "Method FormComponent.FormStart", "Action Filename is not defined."
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
Response.write "<form name='"& mFormName &"' method='"& mMethod &"' action='"& mAction &"' "& mOnSubmit &">"
|
|
|
190 |
|
|
|
191 |
End Sub
|
|
|
192 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
193 |
Public Sub FormEnd ()
|
|
|
194 |
Response.write "</form>"
|
|
|
195 |
|
|
|
196 |
End Sub
|
|
|
197 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
198 |
Private Sub Class_Initialize()
|
|
|
199 |
'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
|
|
|
200 |
|
|
|
201 |
mFormName = NULL
|
|
|
202 |
mMethod = "post"
|
|
|
203 |
mAction = NULL
|
|
|
204 |
mOnSubmit = NULL
|
|
|
205 |
msDisabled = NULL
|
|
|
206 |
|
|
|
207 |
End Sub
|
|
|
208 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
209 |
Private Sub Class_Terminate()
|
|
|
210 |
'// Perform action on object disposal. e.g. Set myObj = Nothing
|
|
|
211 |
End Sub
|
|
|
212 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
213 |
End Class
|
|
|
214 |
%>
|