<% if not Session("DiaryAdmin") then Response.Redirect("login.asp?go=diary_EditE.asp?" & Request.QueryString()) End If Response.ExpiresAbsolute = dateadd("d", -5, date()) Response.Expires = -10 set my_conn= Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") my_Conn.Open strCon function ChkStr(strT) if strT = "" then strT = " " strT = Replace(strT, "'", "''") strT = Replace(strT, "|", "/") ChkStr = strT End Function Sub DropDown(tbl, valField, selVal, Field) set rsDrop = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT DISTINCT " & valField & ", " & Field & " FROM " & tbl & " ORDER BY " & field rsDrop.Open strSQL, my_conn do until rsDrop.EOF Response.Write "" & vbcrlf rsDrop.MoveNext loop rsDrop.Close end sub %> Diary Manager
Edit Diary Events
Close
<% select case Request.QueryString("mode") case "edit" SQL = "SELECT * FROM diary where id =" & Request.QueryString("id") rs.Open SQL, my_Conn dt = rs("dte") %>
"> <% case "Add" %>
Event Category
Event Date " onFocus="javascript:openCal('editC.dte','editC.dteDisplay');etitle.focus();">
Event Start (hh:mm) ">
Event End (hh:mm) ">
Event Title ">
Location ">
Event Details
Delete Event
Duplicate Event - for weeks
" id="Hidden1"> <% case "DoADD" ErrMsg = "" if Request.Form("dte") = "" then ErrMsg = "You Must Enter a Date for the Event
" if Request.Form("Tim") = "" then ErrMsg=ErrMsg & "You Must Enter a Time for the Event
" if Request.Form("title") = "" then ErrMsg=ErrMsg & "You Must Enter a Titlefor the Event
" if Request.Form("details") = "" then ErrMsg=ErrMsg & "You Must Enter some details for the Event
" if len(ErrMsg) > 0 then Response.Write "" Else SQL = "INSERT INTO diary (dte, eTime, sTime, location, text_field, details, category) VALUES (" & Request.Form("dte") & ", '" & ChkStr(Request.Form("tim")) & "', '" & ChkStr(Request.Form("tim2")) & "', '" & ChkStr(Request.Form("location")) & "', '" & ChkStr(Request.Form("title")) & "', '" & ChkStr(Request.Form("details")) & "', " & Request.Form("cat") & ")" my_Conn.Execute SQL Response.Write "
Added Event
" End If case "DoEdit" if Request.Form("Del") = "ON" then SQL = "DELETE * from diary WHERE id = " & Request.Form("ID") my_conn.Execute SQL Response.Write "
Deleted Event
" elseif Request.Form("dup") = "ON" then if Request.Form("repeatorclone") = 1 then NewDate = Request.Form("dte") SQL = "INSERT INTO diary (dte, eTime, sTime, location, text_field, details, category) VALUES (" & NewDate & ", '" & ChkStr(Request.Form("tim")) & "', '" & ChkStr(Request.Form("tim2")) & "', '" & ChkStr(Request.Form("location")) & "', '" & ChkStr(Request.Form("title")) & "', '" & ChkStr(Request.Form("details")) & "', " & Request.Form("cat") & ")" my_Conn.Execute SQL else for duplic = 1 to request.form("freq") NewDate = Request.Form("dte") + (7*duplic) SQL = "INSERT INTO diary (dte, eTime, sTime, location, text_field, details, category) VALUES (" & NewDate & ", '" & ChkStr(Request.Form("tim")) & "', '" & ChkStr(Request.Form("tim2")) & "', '" & ChkStr(Request.Form("location")) & "', '" & ChkStr(Request.Form("title")) & "', '" & ChkStr(Request.Form("details")) & "', " & Request.Form("cat") & ")" my_Conn.Execute SQL next end if Response.Write "
Duplicated Event
" Else ErrMsg = "" if Request.Form("dte") = "" then ErrMsg = "You Must Enter a Date for the Event
" if Request.Form("Tim") = "" then ErrMsg=ErrMsg & "You Must Enter a Time for the Event
" if Request.Form("title") = "" then ErrMsg=ErrMsg & "You Must Enter a Titlefor the Event
" if Request.Form("details") = "" then ErrMsg=ErrMsg & "You Must Enter some details for the Event
" if Request.Form("Tim2") = "" then ErrMsg=ErrMsg & "You Must Enter an End Time for the Event
" if Request.Form("location") = "" then ErrMsg=ErrMsg & "You Must Enter a Location for the Event
" if len(ErrMsg) > 0 then Response.Write "" Else SQL = "UPDATE diary SET dte =" & Request.Form("dte") & ", " & " eTime= '" & ChkStr(Request.Form("tim")) & "', " & " sTime= '" & ChkStr(Request.Form("tim2")) & "', " & " location = '" & ChkStr(Request.Form("location")) & "', " & " text_field = '" & ChkStr(Request.Form("title")) & "', " & " details = '" & ChkStr(Request.Form("details")) & "', category = " & Request.Form("cat") & " WHERE id = " & Request.Form("ID") my_conn.Execute SQL Response.Write "
Updated Event
" End If End If Case Else End Select %>
Event Category
Event Date" onFocus="javascript:openCal('editC.dte','editC.dteDisplay');etitle.focus();">
Event Start (hh:mm) ">
Event End (hh:mm) ">
Event Title
Location
Event Details
There were problems with your edits:
" Response.Write "
" & ErrMsg & "
" Response.Write "" Response.Write "
Back
There were problems with your edits:
" Response.Write "
" & ErrMsg & "
" Response.Write "" Response.Write "
Back