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