PageRenderTime 25ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/home/default.asp

http://github.com/khaneh/Orders
ASP | 257 lines | 234 code | 18 blank | 5 comment | 20 complexity | a4b5032d14a707b04cd291e93770c24d MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 
  2'Home (0)
  3PageTitle= "������ ������"
  4SubmenuItem=1
  5if not Auth(0 , 1) then NotAllowdToViewThisPage()
  6
  7captionFGColor = "#C6C6D7"
  8captionBGColor = "#F4F4FE"
  9MsgBodyColor = "#F4F4FE" '"#FFFFEE"
 10UrgentMsgBodyColor = "#FFDDDD"
 11VeryUrgentMsgBodyColor = "yellow"
 12OrderReadyMsgBodyColor = "#33FF99" '#00CCFF
 13VeryUrgentMsgScrlColor = "#FFFFCC"
 14MsgMainColor = "#FFFFFF"
 15
 16activeTabColor="#336699"
 17disableTabColor="#CCCCCC"
 18
 19%>
 20<!--#include file="top.asp" -->
 21<!--#include File="../include_farsiDateHandling.asp"-->
 22<!--#include File="../include_JS_InputMasks.asp"-->
 23<%
 24
 25panel = request("panel")
 26if panel="" then 
 27	panel=1
 28else
 29	panel=cint(panel)
 30end if
 31
 32if request("act")="changeStatus" then
 33	MsgIDsCount = request.form("MsgIDs").count
 34	if MsgIDsCount > 0 then
 35		MsgIDs = "(0"
 36		for i=1 to MsgIDsCount
 37			MsgIDs = MsgIDs & ", " & clng(request.form("MsgIDs")(i))
 38		next 
 39		MsgIDs = MsgIDs & ")"
 40		
 41		Select Case request.form("MsgAct")
 42			Case 1:		' ������� ���
 43				MySQL="UPDATE Messages SET IsSmall=1 WHERE ID IN " & MsgIDs
 44			Case 2:		' ��� ���
 45				MySQL="UPDATE Messages SET IsRead=1 WHERE ID IN " & MsgIDs
 46			Case 3:		' ���� ���� ���
 47				MySQL="UPDATE Messages SET IsRead=0, IsSmall=0 WHERE ID IN " & MsgIDs
 48			Case else:
 49				response.write "<br>"
 50				CALL showAlert ("���! ��� ������ ��� ��������� ����.",CONST_MSG_ERROR) 
 51				response.end
 52		End Select
 53
 54		Conn.Execute MySQL
 55
 56		'***---------- Re-Writing Message Status:
 57%>
 58		<SCRIPT LANGUAGE="JavaScript">
 59		<!--
 60			document.getElementById("MessagesStatusPanel").innerHTML = "<%=WriteMessagesStatus%>"
 61		//-->
 62		</SCRIPT>
 63<%
 64		'------ End of Re-Writing Message Status
 65
 66	end if
 67end if
 68
 69%>
 70<style>
 71	.MsgTable {font-family:tahoma; direction: RTL; background-color:gray; width:100%; border:none;}
 72	.MsgTable td {vertical-align:top;border-bottom:1px solid black;}
 73	.MsgTable a {text-decoration:none;color:#000088}
 74	.MsgTable a:hover {text-decoration:underline;}
 75	.CusTableHeader {background-color: #33AACC; text-align: center; font-weight:bold;}
 76	.CusTD3 {background-color: #DDDDDD; text-align: center; font-size:9pt;}
 77	.CusTD4 {background-color: #CCCC66; direction: LTR; text-align: center; font-size:9pt;}
 78	.CustTable4 {font-family:tahoma; direction: RTL; width:100%; background-color:#C3DBEB; border:4 solid <%=activeTabColor%>;}
 79
 80	.CusTD1 {background-color: <%=activeTabColor%>; text-align: center; }
 81	.CusTD1 a {color:#FFFF00; font-size:9pt;}
 82	.CusTD2 {background-color: <%=disableTabColor%>; text-align: center; }
 83	.CusTD2 a {color:#888888; font-size:9pt;}
 84	.MsgBodyClass {width:500px;height:60px;overflow:auto;}
 85	.MsgButton {border:1px solid #AAAAAA !important;vertical-align:bottom; background-color: #CCCCCC}
 86</style>
 87<SCRIPT LANGUAGE="JavaScript">
 88<!--
 89function selectAll(src){
 90	totalMsgIDs=document.getElementsByName("MsgIDs").length
 91	checked=src.checked
 92	for (i=0;i<totalMsgIDs;i++)
 93		document.getElementsByName("MsgIDs")[i].checked=checked;
 94}
 95
 96//-->
 97</SCRIPT>
 98<table cellspacing=0 cellpadding=0 width="100%" style="border:4 solid <%=AppFgColor%>;">
 99<tr><td>
100	<TABLE cellspacing=0 cellpadding=0 width="100%">
101	<TR height='15'>
102		<TD></TD>
103	</TR>
104
105	<TR class='alak' height='25'>
106	<TD width=15 >&nbsp;</TD>
107<%
108		if panel=1 then styleClass="CusTD1" else styleClass="CusTD2" 
109%> 
110		<TD align=center class='<%=styleClass%>'><A HREF='?panel=1'>���� ��� ����</A></TD>
111
112		<TD width=5 >&nbsp;</TD>
113<%
114		if panel=2 then styleClass="CusTD1" else styleClass="CusTD2" 
115%> 
116		<TD align=center class='<%=styleClass%>'><A HREF='?panel=2'>���� ��� ������� ���</A></TD>
117	<TD width=400 >&nbsp;</TD>
118	<TD width=* align=left>&nbsp;</TD>
119	</TR>
120</td></tr>
121</table>
122<TaBlE class="CustTable4" cellspacing="2" cellspacing="0" >
123	<Tr>
124	<Td valign="top" align="center">
125		<FORM METHOD=POST ACTION="default.asp?act=changeStatus&panel=<%=panel%>">
126		<table class="MsgTable" cellspacing='1'>
127<%
128		selectTop=""
129'		selectTop="TOP 20"
130'		session("id") = 6
131
132		if panel=1 then '���� ��� ����
133			isSmall=0
134		elseif panel=2 then '���� ��� ������� ���
135			isSmall=1
136		else 
137			response.end
138		end if
139		MySQL = "SELECT " & selectTop & " Messages.*, message_types.name as messageTypeName, message_types.id as typeID, Messages_1.MsgBody AS OrigMsgBody, Messages_1.MsgDate AS OrigMsgDate, Messages_1.MsgTime AS OrigMsgTime, Users.RealName AS Sender FROM Messages INNER JOIN Users ON Messages.MsgFrom = Users.ID LEFT OUTER JOIN Messages Messages_1 ON Messages.replyTo = Messages_1.id inner join message_types on message_types.id= messages.type WHERE (Messages.MsgTo = '" & session("id") & "') AND (Messages.IsRead = 0) AND (Messages.IsSmall = " & IsSmall & ") ORDER BY Messages.id DESC"
140		Set RS1 = conn.execute(mySQL)
141		if not RS1.eof then
142%>
143			<tr>
144				<td class="CusTD3"></td>
145				<td class="CusTD3" rowspan=2><INPUT TYPE="checkbox" NAME="SelectAll" onclick="selectAll(this);"></td>
146				<td class="CusTD3" colspan=4 style="text-align:right;">
147					<SELECT NAME="MsgAct" style="font-family:tahoma;font-size:9pt;width:200px;">
148						<option value="1">������� ���</option>
149						<option value="2">��� ���</option>
150						<option value="3">���� ���� ���</option>
151					</SELECT>
152					<INPUT TYPE="submit" Value="����� �����"class="genButton">
153				</td>
154			</tr>
155			<tr>
156				<td class="CusTD3">#</td>
157				<td class="CusTD3">��</td>
158				<td class="CusTD3">�����</td>
159				<td class="CusTD3">����</td>
160				<td class="CusTD3" >����� ��</td>
161			</tr>
162<%
163			tmpCounter=0
164			Do while not RS1.eof 
165				tmpCounter = tmpCounter + 1
166				if tmpCounter mod 2 = 1 then
167					tmpColor="#FFFFFF"
168					tmpColor2="#FFFFBB"
169				Else
170					tmpColor="#DDDDDD"
171					tmpColor2="#EEEEBB"
172				End if 
173				if RS1("Urgent")=0 then 
174					tmpColor=MsgMainColor
175				elseif RS1("Urgent")=2 then 
176					tmpColor=VeryUrgentMsgBodyColor 
177				elseif RS1("Urgent")=3 then 
178					tmpColor=OrderReadyMsgBodyColor
179				else 
180					tmpColor=UrgentMsgBodyColor
181				end if
182
183				RelatedTable = "NaN"
184
185				if trim(RS1("RelatedTable")) = "orders" then 
186					RelatedTable="����� "
187					RelatedLink = "../order/order.asp?act=show&id=" & RS1("RelatedID")
188				elseif trim(RS1("RelatedTable")) = "accounts" then 
189					RelatedTable="���� "
190					RelatedLink = "../CRM/AccountInfo.asp?act=show&SelectedCustomer="& RS1("RelatedID")
191				elseif trim(RS1("RelatedTable")) = "invoices" then 
192					RelatedTable="������ "
193					RelatedLink = "../AR/AccountReport.asp?act=showInvoice&invoice=" & RS1("RelatedID")
194				end if
195%>
196				<TR bgcolor="<%=tmpColor%>" onclick="javascript:void(0);">
197					<TD dir="LTR" align='right'><%=tmpCounter%>&nbsp;</TD>
198					<TD><INPUT TYPE="checkbox" NAME="MsgIDs" Value="<%=RS1("id")%>"></TD>
199					<TD width=60 height=100%>
200						<table style="width:100%;height:100%">
201							<tr height=20 >
202								<td colspan=2><%=RS1("Sender")%></td>
203							</tr>
204							<tr height=* >
205								<td colspan=2 style="border-bottom:none;">&nbsp;</td>
206							</tr>
207							<tr height=15 >
208								<td class="MsgButton" >
209									<A HREF="message.asp?act=reply&id=<%=RS1("id")%>&retURL=<%=Server.URLEncode("default.asp")%>&typeID=<%=rs1("typeID")%>">����</a>
210								</td>
211								<td class="MsgButton">
212									<A HREF="message.asp?act=forward&id=<%=RS1("id")%>&retURL=<%=Server.URLEncode("default.asp")%>&typeID=<%=rs1("typeID")%>">�����</a>
213								</td>
214							</tr>
215						</table>
216					</TD>
217					<TD dir="LTR" align='right'>
218						<div><%=RS1("MsgDate")%><br><%=RS1("MsgTime")%></div>
219						<div style="font-size:6pt;margin:7px 0 0 0;color:gray;"><%=RS1("messageTypeName")%></div>
220					</TD>
221					<TD>
222						<div class="MsgBodyClass"><%=replace(RS1("MsgBody"),chr(13),"<br>")%>&nbsp;</div>
223						<%if RS1("isReply") <> 0 then%>
224							<div class="MsgBodyClass" style="border-top:1px solid gray;">�� ���� ���� ���� ��� (<%=RS1("OrigMsgTime")%> - <%=replace(RS1("OrigMsgDate"),"/",".")%>) �� ��� ���:<BR> <%=replace(RS1("OrigMsgBody"),chr(13),"<br>")%>&nbsp;</div>
225						<%end if%>
226					</TD>
227					<TD width="50"><%if RelatedTable <> "NaN" then%>
228						<A HREF="<%=RelatedLink%>" target="_blank"><%=RelatedTable%> <%=RS1("RelatedID")%></A>
229						<%end if%> &nbsp;
230					</TD>
231				</TR>
232<%
233			RS1.moveNext
234			Loop
235			RS1.Close
236
237			if selectTop<>"" and tmpCounter = briefQtty then
238%>
239			<tr>
240				<td colspan="9" class="CusTableHeader" style="text-align:right;"><A HREF="?userID=<%=userID%>&showAll=on&panel=1">����� ���� ...</A></td>
241			</tr>
242<%
243			end if
244		else
245%>
246			<tr>
247				<td colspan="9" class="CusTD3">���</td>
248			</tr>
249<%
250		end if
251%>
252		</table>
253		</FORM>
254	</Td>
255	</Tr>
256</TaBlE>
257<!--#include file="tah.asp" -->