PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/members_only/calendars/intro.asp

https://github.com/evizitei/bcfpd_asp
ASP | 169 lines | 144 code | 17 blank | 8 comment | 2 complexity | 4e80f0cefcaf26bd55613561803ceebc MD5 | raw file
  1. <!-- #include virtual="/members_only/include/functions.asa"-->
  2. <%
  3. If Not Session("Authorized")(8) Then
  4. Response.Redirect "/members_only/index.asp"
  5. End If
  6. ' Create a recordset object called rsNodes.
  7. set rsNodes = Server.CreateObject("ADODB.Recordset")
  8. strNode = "SELECT * FROM Calendar_Nodes"
  9. ' If there is a request to delete, delete the record.
  10. 'If Request.Form("Submit") = "Delete Calendar" Then
  11. rsNodes.Open "Calendar_Nodes", cnnMain, 3, 3
  12. Do While Not rsNodes.EOF
  13. If Request.Form("Delete" & rsNodes("Node_ID")) Then
  14. rsNodes.Delete
  15. End If
  16. rsNodes.MoveNext
  17. Loop
  18. rsNodes.Close
  19. 'End If
  20. ' If there is a request to update the new record, update the new record.
  21. If Request.Form("Submit") = "Update Calendar" Then
  22. rsNodes.Open "Calendar_Nodes", cnnMain,3,3
  23. rsNodes.AddNew
  24. For Each Item in Request.Form
  25. If Item <> "Submit" Then
  26. rsNodes(Item) = Request.Form(Item)
  27. End If
  28. Next
  29. rsNodes.Update
  30. rsNodes.Close
  31. End If
  32. ' If there is a request to update an existing record, update the existing record.
  33. If Request.Form("Submit") = "Update Existing Calendar" Then
  34. rsNodes.Open "SELECT * FROM Calendar_Nodes WHERE Node_ID =" & Request.Form("Node_ID"), cnnMain,3,3
  35. For Each Item in Request.Form
  36. If Item <> "Submit" AND Item <> "Node_ID" Then
  37. rsNodes(Item) = Request.Form(Item)
  38. End If
  39. Next
  40. rsNodes.Update
  41. rsNodes.Close
  42. End If
  43. %>
  44. <!--#include virtual="/members_only/include/templates/top.asa"-->
  45. <!--#include virtual="/members_only/include/templates/members.asa"-->
  46. <table border="0" width="98%" cellspacing="0" cellpadding="5">
  47. <tr>
  48. <td class="PageTitle">BCFPD Calendars</td>
  49. </tr>
  50. <tr>
  51. <td width="100%" valign="bottom">
  52. <% If Request.Form("Submit") = "Add New Calendar" OR Request.QueryString("Node_ID") <> "" Then
  53. set rsNodes = Server.CreateObject("ADODB.Recordset")
  54. ' If there is a request to add new record, add new record.
  55. If Request.Form("Submit") = "Add New Calendar" Then
  56. rsNodes.Open strNode, cnnMain, 3, 3
  57. rsNodes.AddNew
  58. End If
  59. ' If there is a request by clicking a hyper link, open the recordset and grab the selected record.
  60. If Request.QueryString("Node_ID") <> "" Then
  61. rsNodes.Open "SELECT * FROM Calendar_Nodes WHERE Node_ID = " & Request.QueryString("Node_ID"), cnnMain, 3, 3
  62. End If
  63. %>
  64. <!--' 9. A form is created that contains a table with update fields.-->
  65. <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>" id="form1" name="form1">
  66. <!-- 9a. A table is created that contains the requested information.-->
  67. <table border="0" cellpadding="3" cellspacing="3">
  68. <tr>
  69. <td></td>
  70. <td>
  71. <table border="0" cellpadding="0" cellspacing="0" bordercolor="#f2f2f2">
  72. <tr>
  73. <td class="ContactInfo">Calendar:</td>
  74. <td><input type="text" name="Name" value="<%=rsNodes("Name")%>"></td>
  75. </tr>
  76. <tr>
  77. <td class="ContactInfo">Description:</td>
  78. <td><textarea name="Description" cols="50" rows="10"><%=rsNodes("Description")%></textarea></td>
  79. </tr>
  80. <tr>
  81. <td align="right" colspan="2">
  82. <!-- 9b. If Then Else statement to check if updating new record or existing.-->
  83. <% If Request.QueryString("Node_ID") <> "" Then %>
  84. <a href="javascript:submit(document.form1, 'Update Existing Calendar');"><img SRC="/images/members/buttons/Save.gif" border="0"></a>
  85. <img src="/images/spacer.gif" border="0" height="1" width="35">
  86. <a style="cursor: hand" OnClick="window.history.back();"><img src="/images/members/buttons/cancel.gif" border="0" width="45" height="34"></a>
  87. <input type="hidden" name="Submit">
  88. <input type="hidden" name="Node_ID" value="<%=rsNodes("Node_ID")%>">
  89. <% Else %>
  90. <a href="javascript:submit(document.form1, 'Update Calendar');"><img SRC="/images/members/buttons/Save.gif" border="0"></a>
  91. <img src="/images/spacer.gif" border="0" height="1" width="35">
  92. <a style="cursor: hand" OnClick="window.history.back();"><img src="/images/members/buttons/cancel.gif" border="0" width="45" height="34"></a>
  93. <input type="Hidden" name="Submit">
  94. <% End If %>
  95. </td>
  96. </tr>
  97. </table>
  98. </td>
  99. </tr>
  100. </table>
  101. </form>
  102. <% Else %>
  103. <%
  104. set rsNodes = Server.CreateObject("ADODB.Recordset")
  105. rsNodes.Open "SELECT * FROM Calendar_Nodes" , cnnMain, 3, 3
  106. %>
  107. <!-- 10. A form is created that contains a table with delete/make feature capability, Headline hyper links, and date info.-->
  108. <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>" id="form2" name="form2">
  109. <!-- 11. A table is created that will contain a delete check box, Make Feature/Headline links, and date info.-->
  110. <table border="0" cellpadding="3" cellspacing="3">
  111. <tr>
  112. <td></td>
  113. <td>
  114. <table border="0" cellpadding="3" cellspacing="3" bordercolor="#f2f2f2">
  115. <tr>
  116. <td class="subheadercenter">Delete</td>
  117. <td class="subheadercenter">Name</td>
  118. <td class="subheadercenter">Description</td>
  119. <td class="subheadercenter">View Calendar</td>
  120. </tr>
  121. <!-- 12. Do While Loop to populate the table with database information.-->
  122. <% Do while not rsNodes.EOF %>
  123. <tr>
  124. <td valign="top" align="center"><input type="checkbox" name="Delete<%=rsNodes("Node_ID")%>" value="true"></td>
  125. <td valign="top" ><a class="Update" href="<%Request.ServerVariables("SCRIPT_NAME")%>?Node_ID=<%=rsNodes("Node_ID")%>"><%=rsNodes("Name")%></a></td>
  126. <td valign="top" class="contactInfo"><%=rsNodes("Description")%></td>
  127. <td valign="top" ><a class="Update" href="index.asp?Node_ID=<%=rsNodes("Node_ID")%>">Calendar View</a><br><a class="Update" href="layout.asp?Node_ID=<%=rsNodes("Node_ID")%>">Layout View</a></td>
  128. </tr>
  129. <% rsNodes.MoveNext
  130. Loop
  131. %>
  132. <tr>
  133. <td align="right" colspan="4">
  134. <a href="javascript:submit(document.form2, 'Add New Calendar');"><img SRC="/images/members/buttons/add.gif" border="0"></a>
  135. <img src="/images/spacer.gif" border="0" height="1" width="35">
  136. <a href="javascript:Delete();"><img SRC="/images/members/buttons/Delete.gif" border="0"></a>
  137. <img src="/images/spacer.gif" border="0" height="1" width="35">
  138. <a style="cursor: hand" OnClick="window.history.back();"><img src="/images/members/buttons/cancel.gif" border="0" width="45" height="34"></a>
  139. <input type="hidden" name="Submit">
  140. </td>
  141. </tr>
  142. </table>
  143. </td>
  144. </tr>
  145. </table>
  146. </form>
  147. <%rsNodes.Close%>
  148. <% End If %>
  149. </td>
  150. </tr>
  151. </table>
  152. <!--#include virtual="/members_only/include/templates/bottom.asa"-->