PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/beta/admin/userManager.asp

http://github.com/khaneh/Orders
ASP | 695 lines | 611 code | 51 blank | 33 comment | 44 complexity | 7384ea46a277079a0e685aa23f0eb5cc MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2' Admin
  3PageTitle="������ �������"
  4SubmenuItem=1
  5%>
  6<!--#include file="top.asp" -->
  7<%
  8NumberOfCategories = 14
  9dim pagesPermissions(20,25)
 10dim pages(20,25)
 11'-------------------------------------
 12 pages ( 0 , 0 ) = "���� ���"         
 13	pages ( 0 , 1 ) = "������ ����"   
 14	pages ( 0 , 2 ) = "����� ����"    
 15	pages ( 0 , 3 ) = "���� ���� ����"     
 16	pages ( 0 , 4 ) = "������� �����" 
 17	pages ( 0 , 5 ) = "������� ����"  
 18	pages ( 0 , 6 ) = "������ ���� ����"     
 19	pages ( 0 , 7 ) = "����� ���� �� ���"     
 20	pages ( 0 , 8 ) = "��������"
 21	pages (0,9)		= "������ ������"
 22'-------------------------------------
 23 pages ( 1 , 0 ) = "����� ������"
 24	pages ( 1 , 1 ) = "����� �������"
 25	pages ( 1 , 2 ) = "����"
 26	pages ( 1 , 3 ) = "�����"
 27	pages ( 1 , 4 ) = "����� ����� � ��� ������"
 28	pages ( 1 , 5 ) = "����� ����� ����"
 29	pages (1, 6)	= "����ԝ��"
 30	pages (1, 7)	= "����� ����� ����"
 31	pages (1, 8)	= "������ �������"
 32	pages (1, 9)	= "������ �����"
 33	pages (1, 10)	= "����� ���� �� �����"
 34'-------------------------------------
 35 pages ( 2 , 0 ) = "�������"
 36	pages ( 2 , 1 ) = "����� �� �����"
 37	pages ( 2 , 2 ) = "����� �����"
 38	pages ( 2 , 3 ) = "������ �����"
 39	pages ( 2 , 4 ) = "����� ���� ����� � ��������"
 40	pages ( 2 , 5 ) = "������  �������"
 41	pages ( 2 , 6 ) = "����� ���"
 42	pages ( 2 , 7 ) = "����� ������"
 43	pages ( 2 , 8 ) = "����� ������ - ������ ����� �����"
 44	pages ( 2 , 9 ) = "�������"
 45	pages ( 2 , 10 ) = "�����"						'A
 46	pages ( 2 , 11 ) = "�ǁ"						'B
 47	pages ( 2 , 12 ) = "���� �����"					'C
 48	pages ( 2 , 13 ) = "����� ��� �� �����"			'D
 49	pages ( 2 , 14 ) = "�ǁ ����� �����"				'E
 50	pages ( 2 , 15 ) = "����� �� ���"				'F
 51	pages ( 2 , 16 ) = "����� ���� �������"			'G
 52	pages ( 2 , 17 ) = "����� ������� ����� �����"			'H
 53'-------------------------------------
 54 pages ( 3 , 0 ) = "�����"
 55	pages ( 3 , 1 ) = "���� ����� �����"
 56	pages ( 3 , 2 ) = "������ ���� �����"
 57	pages ( 3 , 3 ) = "������ �����"
 58	pages ( 3 , 4 ) = "������  �������"
 59	pages ( 3 , 5 ) = "����� ������� ���� �� ����� ���� ������ �� ������ �� ���� ���� ��� ���"
 60	pages ( 3 , 6 ) = "���� �����"
 61	pages (3,7)		= "������"
 62	pages (3,9)		= "������ ������"
 63	pages (3,10)	= "����� ������"					'A
 64	pages (3,8)		= "������ ����"
 65	pages (3,11)	= "����� ���� ����"				'B
 66'-------------------------------------
 67 pages ( 4 , 0 ) = "����"
 68	pages ( 4 , 1 ) = "������� ���� ����� �����"
 69	pages ( 4 , 2 ) = "������� ���� �������� �� � �����"
 70	pages ( 4 , 3 ) = "����� ����"
 71	pages ( 4 , 4 ) = "������ ����"
 72	pages ( 4 , 5 ) = "�����"
 73	pages ( 4 , 6 ) = "����� ����� ������"
 74	pages (4,7)		= "����� ���� ����� ���� �� ������ ����"
 75	pages (4,8)		= "����� �������"
 76'-------------------------------------
 77 pages ( 5 , 0 ) = "�����"
 78	pages ( 5 , 1 ) = "���� ����� ����� ��� ����� �� ����� �� � �������"
 79	pages ( 5 , 2 ) = "���� ����"
 80	pages ( 5 , 3 ) = "���� ����"
 81	pages ( 5 , 4 ) = "����� ����� ����"
 82	pages ( 5 , 5 ) = "�����"
 83	pages ( 5 , 6 ) = "����� ����"
 84	pages ( 5 , 7 ) = "����� ���� �� ������ "
 85	pages ( 5 , 8 ) = "����� ������"
 86	pages ( 5 , 9 ) = "���� ����� ����� ����� �� ����� ��"
 87	pages ( 5 , 10 ) = "��� ������� ����"					'A
 88	pages ( 5 , 11 ) = "������ ������"					'B
 89	pages ( 5 , 12 ) = "��� ����/���� �� ����� ������"			'C
 90	pages ( 5 , 13 ) = "��� ���� ���� �� �� ���� �����"			'D
 91	pages (5,14) = "��� ���� ����� ������ �����"				'E
 92	pages (5,15) = "��� ���� �� �����"						'F
 93	pages (5,16) = "��� ����� ������"						'G
 94	pages (5,17) = "���� �� ���� ����ѝ��"						'H
 95	pages (5,18) = "���� �� ������" 						'I
 96	pages (5,19) = "���� ����� �����" 						'J
 97	pages (5,20) = "������� ���� �� ���� �����" 				'K
 98'-------------------------------------
 99 pages ( 6 , 0 ) = "�������� ����"
100	pages ( 6 , 1 ) = "���� ������ "
101	pages ( 6 , 2 ) = "������� ������/��������"
102	pages ( 6 , 3 ) = "����� ������"
103	pages ( 6 , 4 ) = "���� ������ �ѐ��"
104	pages ( 6 , 5 ) = "����� ������ �ѐ��"
105	pages ( 6 , 6 ) = "����� ����"
106	pages ( 6 , 7 ) = "�����"
107	pages ( 6 , 8 ) = "����� ���� ����"
108	pages ( 6 , 9 ) = "����� ���� ���"
109	pages ( 6 , 10 ) = "������� ���� ������ ��� �� ����"			'A
110	pages ( 6 , 11 ) = "unused"						'B
111	pages ( 6 , 12 ) = "����� ������"						'C
112	pages ( 6 , 13 ) = "���� ������"						'D
113	pages ( 6 , 14 ) = "�ǁ ������� ������"					'E
114	pages ( 6 , 15 ) = "���� ������ �� ����"				'F
115	pages ( 6 , 16 ) = "���� ������ �� �����"				'G
116	pages ( 6 , 17 ) = "����� ������� ����"					'H
117	pages ( 6 , 18 ) = "���� ������ �� ����� ������"			'I
118	pages ( 6 , 19 ) = "�ǁ ����� ����"					'J
119	pages ( 6 , 20 ) = "���� (������ / �ѐ�� ) ���� �����"		'K
120	pages ( 6 , 21 ) = "߁� ��� ����"					'L
121	pages ( 6 , 22 ) = "������� ���/� ��� �� ����"			'M
122	pages (6, 23)	 = "������� ���/� ��� �� ����"			'N
123	pages (6,24)	 = "�ǁ ������"						'O
124
125'-------------------------------------
126 pages ( 7 , 0 ) = "�������� ����"
127	pages ( 7 , 1 ) = "���� ������ ����"
128	pages ( 7 , 2 ) = "����� ������ ����"
129	pages ( 7 , 3 ) = "�����"
130	pages ( 7 , 4 ) = "������� ������/��������"
131	pages ( 7 , 5 ) = "����� ����"
132	pages ( 7 , 6 ) = "�����"
133	pages ( 7 , 7 ) = "����� ����"
134	pages ( 7 , 8 ) = "����� ������� ����"
135	pages ( 7 , 9 ) = "����� ������ ����"
136	pages ( 7 , 10 ) = "�ǁ ����� ����"						'A
137	pages ( 7 , 11 ) = "������ ����"							'B
138'-------------------------------------
139 pages ( 8 , 0 ) = "�������� "
140	pages ( 8 , 1 ) = "����  ���"
141	pages ( 8 , 2 ) = "���� ��� ��� ��� ���"
142	pages ( 8 , 3 ) = "[����] ����� �����"
143	pages ( 8 , 4 ) = "���� ��"
144	pages ( 8 , 5 ) = "���� ��� ��� ���� ���"
145	pages ( 8 , 6 ) = "���� ��� ��� ����� ��� � ����� ����� ����"
146	pages ( 8 , 7 ) = "���� ��� ��� ��� ����"
147	pages ( 8 , 8 ) = "����� �� ����� ����� ��� ��� ��� ����"
148	pages ( 8 , 9 ) = "���� ��� ������� ��"
149	pages ( 8 , 10 ) = "����� ����"							'A
150	pages ( 8 , 11 ) = "����� ������"						'B
151	pages ( 8 , 12 ) = "������ ��� �����"					'C
152	pages ( 8 , 13 ) = "����� ���� �� ��� ��� �����"		'D
153	pages ( 8 , 14 ) = "���� ���� ����� ��"					'E
154	pages ( 8 , 15 ) = "��� ���� (���� � ������) "			'F
155	pages ( 8 , 16 ) = "����� ������ ����������"			'G
156	pages ( 8 , 17 ) = "���� ������� ������ �� ������ ����� ���"	'H
157'-------------------------------------
158 pages ( 9 , 0 ) = "�����"
159	pages ( 9 , 1 ) = "������"
160	pages ( 9 , 2 ) = "������ ���"
161	pages ( 9 , 3 ) = "����� �����"
162	pages ( 9 , 4 ) = "����"
163	pages ( 9 , 5 ) = "�����"
164	pages ( 9 , 6 ) = "����� �� �����"
165	pages ( 9 , 9 ) = "����� �� ����� (����)"
166	pages ( 9 , 7 ) = "����� �� ��� � ��� ������/������"
167	pages ( 9 , 8 ) = "�ǁ ��� ������"
168'-------------------------------------
169 pages ( 10 , 0 ) = "����"									'A
170	pages ( 10 , 1 ) = "���� ��"
171	pages ( 10 , 2 ) = "������ �� �������"
172	pages ( 10 , 3 ) = "������ �� �������"
173	pages ( 10 , 4 ) = "��� �����"
174	pages ( 10 , 5 ) = "������ ������"
175	pages ( 10 , 6 ) = "������ �� ����"
176	pages ( 10 , 7 ) = "���� �� ����"
177	pages ( 10 , 8 ) = "���� ��"
178	pages ( 10 , 9 ) = "������"
179'-------------------------------------
180 pages ( 11 , 0 ) = "�������� ����"							'B
181	pages ( 11 , 1 ) = "����� ����"
182	pages ( 11 , 2 ) = "���� ������� ��"
183	pages ( 11 , 3 ) = "������"
184	pages ( 11 , 4 ) = "�����"
185	pages ( 11 , 5 ) = "����� ����"
186	pages ( 11 , 6 ) = "����� ������� ����"
187	pages ( 11 , 7 ) = "�ǁ ����� ����"						
188	pages ( 11 , 8 ) = "����"						
189
190'-------------------------------------
191 pages ( 12 , 0 ) = "���� ����� ��� ��� �������� ����"		'C
192	pages ( 12 , 1 ) = "����� ���� ������"
193	pages ( 12 , 2 ) = "����� ���� ������ �� ����� ������"
194	pages ( 12 , 3 ) = "����� ���� ��� ���� "
195	pages ( 12 , 4 ) = "����� ������ ��� ���"
196	pages ( 12 , 5 ) = "����� ���� ��� ���"
197	pages ( 12 , 6 ) = "����� ���� ��� ���� ����� �������"
198	pages ( 12 , 7 ) = "����� ���� ���� ���"
199	pages ( 12 , 8 ) = "����� ���� ���� �����"
200	pages ( 12 , 9 ) = "����� �������� �� ������ ���� ��� ����"
201	pages (12,10) = "����� �ѐ�� �� ����"			'A
202	pages ( 12 , 11 ) = "����� ���� ��� ���� �����"	'B
203'-------------------------------------
204 pages ( 13 , 0 ) = "��� ���"								'D
205	pages ( 13 , 1 ) = "����� ��� ���"
206	pages ( 13 , 2 ) = "������ ��� ����� ����"
207	pages ( 13 , 3 ) = "������ ��� ����� ��� (���� ����)"
208	pages ( 13 , 4 ) = "������ ��� ���� ��� (����� ����)"
209	pages ( 13 , 5 ) = "���� ��� ����� ���"
210	pages ( 13 , 6 ) = "�� ��� �ѐ���"
211	pages ( 13 , 7 ) = "����� ��� ����� ����"
212
213'-------------------------------------
214 pages ( 14 , 0 ) = "������"								'E
215	pages ( 14 , 1 ) = "Reserved - ���� �� ���� admin"
216	pages ( 14 , 2 ) = "Reserved - ����� ���� �������"
217	pages ( 14 , 3 ) = "Reserved"
218	pages ( 14 , 4 ) = "Reserved"
219	pages ( 14 , 5 ) = "���� ��� ��� ���� �������"
220	pages ( 14 , 6 ) = "���� ����ԝ��� �����"
221
222
223function Auth(menuID, subMenuID, permission)
224	pr = permission
225
226	st = inStr(pr,"#"&menuID)
227	
228	if subMenuID >= "A" then 
229		subMenuID_int = cint(asc(subMenuID)-55)
230	else
231		subMenuID_int = cint(subMenuID)
232	end if
233
234	Auth = false
235	if st > 0 then
236		en = inStr(st+1, pr, "#")
237		sm = inStr(st+2, pr, subMenuID)
238		if subMenuID_int = 0 or ((sm <> 0) and (en > sm or en = 0 )) then
239			Auth = true
240		end if		
241	end if
242end function
243
244
245%>
246<style>
247	.TABLE1 {font-family: tahoma; font-size: 8pt; Background-Color:navy; border:2 solid navy; cursor:pointer;}
248	.TD_Rowspan {Background-Color:navy;}
249	.textbox1 {border:none; width:100px; font-family: tahoma; font-size: 8pt; Background-Color:transparent; cursor:pointer;} 
250	.TABLE1 TR {Background-Color:white; height:20px; }
251	.TD10 {Background-Color:#CCCCCC;height:10px;}
252	.TD00 {Background-Color:#BBBBFF;height:10px;}
253	.TD11 {Background-Color:#FFFFFF;height:10px;}
254	.TD01 {Background-Color:#DDDDFF;height:10px;}
255</style>
256<SCRIPT LANGUAGE="JavaScript">
257<!--
258function showUser(user){
259	window.location="?act=edit&userID="+user;
260}
261//-->
262</SCRIPT>
263<%
264
265'-----------------------------------------------------------------------------------------------------
266'------------------------------------------------------------------------------------------ Users List
267'-----------------------------------------------------------------------------------------------------
268if request("act")="" then
269	set RSc=Conn.Execute ("SELECT count(*) as c FROM Users WHERE ID<>0")
270%>
271	<BR>
272
273	<TABLE class="table1" border=0 cellspacing=1 cellpadding=1 align=right>
274	<TR>
275		<TD rowspan="3" height=100>�����</TD>
276	</tr>
277	<TR>
278		<%
279		for i=0 to NumberOfCategories
280			j=0
281			if not pagesPermissions(i,j)="ok" then 
282				disableChecks="disabled"
283				rowBGColor="#F0F0F0"
284				groupChecked=""
285			else
286				disableChecks=""
287				rowBGColor="#33AACC"
288				groupChecked="checked"
289			end if
290
291			Do While pages(i,j+1)<>"" 
292				j=j+1
293			Loop
294
295			%>
296			<td colspan=<%=j%> align=center ><%=pages(i,0)%></td>
297 			<td rowspan=<%=RSc("c")+3%> class="TD_Rowspan" ></td>
298<%
299		next
300%>
301	</tr>
302	<TR>
303<%
304		for i=0 to NumberOfCategories
305			j=0
306			while pages(i,j+1)<>"" 
307				j=j+1
308
309				if j <10 then
310					jj = j
311				else
312					jj = chr(55+j)
313				end if
314				
315				%>
316				<td title="<%=pages(i,j)%>"><%response.write jj'pages(i,j)%></td>
317				<%
318			wend
319		next
320
321%>
322	</TR>
323<% 
324	set RSV=Conn.Execute ("SELECT * FROM Users WHERE ID<>0 ORDER BY RealName") 
325	tmpRowCounter=0
326	Do while not RSV.eof
327		Permission = RSV("Permission")
328		RealName = RSV("RealName")
329		tmpRowCounter = tmpRowCounter + 1
330
331%>
332		<TR height='10px' onclick="showUser(<%=RSV("ID")%>);">
333			<TD height='10px' class="TD<%=tmpRowCounter Mod 2%>1"><INPUT TYPE="text" class="textbox1" Value="<%=RealName%>"><br></TD>
334<%
335			tmpColCounter=0
336			for i=0 to NumberOfCategories
337				j=0
338				while pages(i,j+1)<>"" 
339					tmpColCounter = tmpColCounter + 1
340					j=j+1
341
342					if i <10 then
343						ii = i
344					else
345						ii = chr(55+i)
346					end if
347
348					if j <10 then
349						jj = j
350					else
351						jj = chr(55+j)
352					end if
353					
354					%>
355					<td height='10px' class="TD<%=tmpRowCounter Mod 2%><%=tmpColCounter Mod 2%>" title="<%=RealName & ": " & vbCrLf & pages(i,j) %>"><%if Auth (ii,jj,Permission) then %><B>x</B><%else%>&nbsp;<%end if%></td>
356					<%
357				wend
358			next
359
360%>
361
362		</TR>
363<%
364		RSV.moveNext
365
366	Loop
367	RSV.close
368%>
369		<TR height='10px' onclick="showUser('');">
370			<TD height='10px' class="TD<%=(tmpRowCounter+1) Mod 2%>1"><INPUT TYPE="text" class="textbox1" Value="*����*"><br></TD>
371			
372			
373			
374		</TR>
375<%
376'-----------------------------------------------------------------------------------------------------
377'------------------------------------------------------------------------------------ Show Permissions
378'-----------------------------------------------------------------------------------------------------
379elseif request("act")="edit" then
380%>
381	<BR><BR>
382<%
383	userID = request("userID")
384	if userID="" then 
385		Password	= ""
386%>
387		<center>
388		<H3>����� ����</H3>
389		</center>
390<%
391	else
392		userID = cint(request("userID"))
393		set RSM = conn.Execute ("SELECT * from Users where ID="& userID & "")
394
395		UserName	= RSM("UserName")
396		Password	= "$aMe@sB4" 'Same as Before  instead of : RSM("Password") 
397		if left(RSM("Password"),1)="'" then
398			DisabledChecked="checked"
399		else
400			DisabledChecked=""
401		end if 
402		RealName	= RSM("RealName") 
403		Account		= RSM("Account") 
404		Permission	= RSM("Permission")
405		Display		= RSM("Display")
406		'costCenterString= RSM("costCenter")
407		RSM.close
408		if Display then
409			DisplayChecked="checked"
410		else
411			DisplayChecked=""
412		end if
413
414		sp = split (Permission,"#")
415		for u=1 to ubound(sp)
416			x = left(sp(u),1)
417			if x >= "A" then 
418				i=cint(asc(x)-55)
419			else
420				i=cint(x)
421			end if
422
423			pagesPermissions(i,0)="ok"
424			for v = 2 to len(sp(u))
425				tmpp=mid(sp(u),v,1)
426
427				if tmpp >= "A" then 
428					j=cint(asc(tmpp)-55)
429				else
430					j=cint(tmpp)
431				end if
432				'j=cint(mid(sp(u),v,1))
433				pagesPermissions(i,j)="ok"
434			next
435		next
436%>
437		<center>
438		<H3>������ �����: "<%=RealName%>"</H3>
439		</center>
440<%
441	end if
442%>
443
444	<FORM METHOD=POST ACTION="?act=submit">
445
446	<TABLE style="font-family:tahoma;font-size:9pt; " Cellspacing="0" Cellpadding="5" width=100%>
447	<TR>
448		<TD valign=top>
449
450		������:<br><br>
451		<TABLE border=1>
452		<TR>
453			<TD>�� �����:</TD>
454			<TD dir=LTR><%=userID%>&nbsp;<INPUT TYPE="hidden" Name="userID" Value="<%=userID%>"></TD>
455		</TR>
456		<TR>
457			<TD>��� ������:</TD>
458			<TD><INPUT TYPE="text" NAME="UserName" Value="<%=UserName%>" dir=LTR></TD>
459		</TR>
460		<TR>
461			<TD>��� ����</TD>
462			<TD><INPUT TYPE="Password" NAME="Password" Value="<%=Password%>" dir=LTR></TD>
463		</TR>
464		<TR>
465			<TD>��� ����� ���� ���:</TD>
466			<TD><INPUT TYPE="text" NAME="RealName" Value="<%=RealName%>"></TD>
467		</TR>
468		<TR>
469			<TD>����� ���� �� �����:</TD>
470			<TD><INPUT TYPE="text" NAME="Account" Value="<%=Account%>"></TD>
471		</TR>
472		<TR>
473			<TD>�� ���� ����� ���� ���</TD>
474			<TD><INPUT TYPE="checkbox" NAME="Display" <%=DisplayChecked%> ></TD>
475		</TR>
476		<TR>
477			<TD>��� ����� �� ����� ���� ���</TD>
478			<TD><INPUT TYPE="checkbox" NAME="disable" <%=DisabledChecked%>></TD>
479		</TR>
480		<tr>
481			<td>����� �����</td>
482			<td>
483				<table width="100%">
484					<%
485					'----------------------------- COST CENTER ---------------------------------
486					if userID<>"" then
487						mySQL="SELECT cost_centers.name as costCenterName, cost_drivers.*,isnull(cost_user_relations.driver_id,-1) as driver_id FROM cost_centers inner join cost_drivers on cost_centers.id=cost_drivers.cost_center_id left outer join cost_user_relations on cost_drivers.id=cost_user_relations.driver_id and cost_user_relations.user_id=" & userID
488					else
489						mySQL="SELECT cost_centers.name as costCenterName, cost_drivers.*,isnull(cost_user_relations.driver_id,-1) as driver_id FROM cost_centers inner join cost_drivers on cost_centers.id=cost_drivers.cost_center_id left outer join cost_user_relations on cost_drivers.id=cost_user_relations.driver_id"
490					end if
491					set rrs=Conn.Execute(mySQL)
492					oldCostCenter=-1
493					while not rrs.eof
494						theTitle=""
495						set oprs=Conn.Execute("select * from cost_operation_type where driver_id=" & rrs("id"))
496						'response.write ("select * from cost_operation_type where driver_id=" & rrs("id"))
497						while not oprs.eof 
498							theTitle= theTitle & oprs("name") & "� "
499							oprs.moveNext
500						wend
501						oprs.close
502						if oldCostCenter=cint(rrs("cost_center_id")) then
503							
504							%>
505							<tr>
506								<td title="<%=theTitle%>"><%=rrs("name")%></td>
507								<td><input type="checkbox" name="costDriver-<%=rrs("id")%>" <%if cint(rrs("driver_id"))>0 then response.write("checked='checked'")%>></td>
508							</tr>
509							<%
510						else
511							%>
512							<tr bgcolor="#33AACC">
513								<td colspan="2" align="center"><b><%=rrs("costCenterName")%></b></td>
514							</tr>
515							<tr>
516								<td title="<%=theTitle%>"><%=rrs("name")%></td>
517								<td><input type="checkbox" name="costDriver-<%=rrs("id")%>" <%if cint(rrs("driver_id"))>0 then response.write("checked='checked'")%>></td>
518							</tr>
519							<%
520						end if
521							%>
522						<%
523						oldCostCenter=cint(rrs("cost_center_id"))
524						rrs.MoveNext
525					wend
526					rrs.close
527					'--------------------------------------------------------------------------------
528					%>
529				</table>
530			</td>
531		</tr>
532		<TR>
533			<TD colspan=2 align=center><INPUT TYPE="submit" value="�����"></TD>
534		</TR>
535		</TABLE>
536
537		</TD>
538		<TD Width="350" >
539		���� ��:<br><br>
540		<table style="font-family:tahoma;font-size:9pt; border:1 dashed #888888; direction:RTL;"  Cellspacing="0" Cellpadding="5">
541		<tbody id="PermissionsTable">
542		<% 
543			for i=0 to NumberOfCategories
544				j=0
545				if not pagesPermissions(i,j)="ok" then 
546					disableChecks="disabled"
547					rowBGColor="#F0F0F0"
548					groupChecked=""
549				else
550					disableChecks=""
551					rowBGColor="#33AACC"
552					groupChecked="checked"
553				end if
554				%>
555				<tr bgcolor='<%=rowBGColor%>'>
556					<td width=20> <INPUT TYPE="checkbox" NAME="P<%=i%>" value="<%=j%>" onclick="activeGroup(this)" <%=groupChecked%>> </td>
557					<td align=right><B><%=pages(i,0)%></B></td>
558				</tr>
559				<tr>
560					<td width=20> </td>
561					<td align=right> 
562				<%
563				while pages(i,j+1)<>"" 
564					j=j+1
565
566					if j <10 then
567						jj = j
568					else
569						jj = chr(55+j)
570					end if
571
572					%>
573					<INPUT TYPE="checkbox" <%=disableChecks%> NAME="P<%=i%>" value="<%=jj%>" <%if pagesPermissions(i,j)="ok" then %>checked<% end if %>> <%=pages(i,j)%> <BR>
574					<%
575				wend
576			next
577			%>
578					</td>
579				</tr>
580		</table>
581		</TD>
582	</TR>
583	</TABLE>
584	</FORM>
585
586<%
587'-----------------------------------------------------------------------------------------------------
588'-------------------------------------------------------------------------------------- Submit Changes
589'-----------------------------------------------------------------------------------------------------
590elseif request("act")="submit" then
591	userID		= request("userID")
592
593	RealName	= request("RealName") 
594	RealName	= "N'" & RealName & "'"
595
596	Account		= request("Account") 
597
598	UserName	= request("UserName")
599	UserName	= "'" & UserName & "'"
600
601	Password	= request("Password") 
602	if Password="$aMe@sB4" then
603		Password= "Password"
604	else
605		Password= "'" & Password & "'"
606	end if
607
608	if request("disable")="on" then 
609		Password = "'''' + REPLACE(" & Password & ",'''','')"
610	else
611		Password = "REPLACE(" & Password & ",'''','')"
612	end if
613
614	Permission = ""
615	for i=0 to NumberOfCategories 
616		if request.form("P"& i ) <> "" then
617			if i <10 then
618				ii = i
619			else
620
621				ii = chr(55+i)
622			end if
623			alll = replace(request.form("P"& i ),", ","")
624			Permission = Permission	& "#" & ii &  right( alll, len(alll)-1)
625		end if
626	next
627	Permission	= "'" & Permission & "'"
628
629	Display		= request("Display")
630	if Display="on" then
631		Display="1"
632	else
633		Display="0"
634	end if
635	'------------------------ COST CENTER -----------------------------------
636	if userID<>"" then
637		conn.Execute("delete cost_user_relations where user_id=" & userID)
638	end if
639	set rrs = Conn.execute("select id from cost_drivers")
640	while not rrs.eof
641		if request("costDriver-"&rrs("id"))="on" then 
642			conn.Execute("insert into cost_user_relations (user_id,driver_id) values ("& userID & "," & rrs("id") & ")")
643		end if
644		rrs.MoveNext
645	wend
646	rrs.close
647	if userID="" then 
648		' Add New User
649		mySQL="SELECT MAX(ID)+1 AS NewID FROM Users"
650		set RS=Conn.Execute (mySQL) 
651		userID = RS("NewID")
652		RS.close
653		mySQL="INSERT INTO Users (ID, UserName, Password, RealName, Account, Permission, Display) VALUES (" & userID & ", " & userName & ", " & Password & ", " & RealName & ", " & Account & ", " & Permission & "," & Display & ")"
654		msg="����� ���� ����� ��."
655	else
656		' Update User Info
657		userID = cint(request("userID"))
658
659		mySQL="UPDATE Users SET UserName=" & UserName & ", Password=" & Password & ", RealName=" & RealName & ", Account=" & Account& ", Permission= " & Permission & ", Display=" & Display & " WHERE ID="& userID & ""
660		msg="������� �� ��� ����� ����� �����"
661	end if
662
663	conn.Execute (mySQL)
664	conn.close
665	response.redirect "?act=edit&userID=" & userID & "&msg=" & Server.URLEncode(msg)
666end if
667%>
668<SCRIPT LANGUAGE="JavaScript">
669<!--
670
671function activeGroup(src){
672	rowNo=src.parentNode.parentNode.rowIndex;
673	invTable=document.getElementById("PermissionsTable");
674	theRowPr=invTable.getElementsByTagName("tr")[rowNo];
675	theRow=invTable.getElementsByTagName("tr")[rowNo+1];
676	boxCount=theRow.getElementsByTagName("INPUT").length;
677	if (src.checked){
678		theRowPr.bgColor= '#33AACC';
679		for (i=0;i<boxCount;i++){
680			theRow.getElementsByTagName("INPUT")[i].disabled=false;
681		}
682//		theRow.disabled=false;
683	}
684	else{
685		for (i=0;i<boxCount;i++){
686			theRow.getElementsByTagName("INPUT")[i].disabled=true;
687		}
688		theRowPr.bgColor= '#F0F0F0';
689//		theRow.disabled=true;
690	}
691
692}
693//-->
694</SCRIPT>
695<!--#include file="tah.asp" -->