PageRenderTime 22ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/members_only/photo_gallery/video/index.asp

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