<% check_security(1) %>
<% sub render_title %> <% end sub %> <% dim content dim event_id dim dt_end dim CodeAdmin dim dt_start dim id dim b_personal dim description dim tm_start dim tm_end dim event_name dim Cat dim NomU dim detail_events_sql sub request_detail_events ''' request form inputs from this form event_id = request("event_id") dt_end = request("dt_end") CodeAdmin = request("CodeAdmin") dt_start = request("dt_start") id = request("id") b_personal = request("b_personal") description = request("description") tm_start = request("tm_start") tm_end = request("tm_end") event_name = request("event_name") Cat = request("Cat") NomU = request("NomU") end sub sub validate_detail_events ''' request and validate data entered from this form event_id = trim(request("event_id")) dt_end = trim(request("dt_end")) CodeAdmin = trim(request("CodeAdmin")) dt_start = trim(request("dt_start")) id = trim(request("id")) b_personal = trim(request("b_personal")) description = trim(request("description")) tm_start = trim(request("tm_start")) tm_end = trim(request("tm_end")) event_name = trim(request("event_name")) Cat = trim(request("Cat")) NomU = trim(request("NomU")) end sub sub db_select_detail_Events incDate1 = "#" & Replace(incDate, "'", "''") & "#" detail_Events_sql = "SELECT " & _ "Events.dt_end, " & _ "Events.CodeAdmin, " & _ "Events.dt_start, " & _ "EventsOccur.id, " & _ "EventsOccur.tm_start, " & _ "EventsOccur.tm_end, " & _ "Events.event_id, " & _ "Admin.NomU, " & _ "EventsOccur.event_name, " & _ "EventsOccur.description, " & _ "Events.b_personal FROM ((Events LEFT JOIN Admin ON Events.CodeAdmin = Admin.CodeAdmin) LEFT JOIN EventsOccur ON Events.event_id = EventsOccur.event_id) " & _ " WHERE (b_personal = 0 OR b_personal = 2 OR b_personal is null OR Events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ")" & _ " AND (dt_occur = " & incDate1& ") ORDER BY tm_start" end sub sub db_delete_detail_Events sql = "DELETE FROM EventsOccur" & _ " WHERE " & _ "id = " & to_sql(id,"number") & "" 'response.write sql on error resume next cn.Execute(sql) if err.number <> 0 then b_error = true end if on error goto 0 end sub do_search = request("do_search") sortby = request("sortby") ''' request form keys and inputs id = request("id") ':: request action action = lcase(request("action")) ':: handle the action select case action case "select_detail_events" ' select the requested key record from database if id <> "" then db_select_detail_Events else b_error = true error_list.add "edit_detail_Events", "Specify record to select." end if end select ':: handle the default case(s) (ignores value of action parameter) dim incDate, boxSize, a_events(31) incDate = request("incDate") mo = request("mo") yr = request("yr") if "mm/dd/yyyy"="mm/dd/yyyy" then if incDate = "" and mo <> "" and yr <> "" then incDate = mo & "/1/" & yr else if incDate = "" and mo <> "" and yr <> "" then incDate = "01/" & mo & "/" & yr end if if action = "detail" then db_select_detail_events else b_display_new_content = true end if %> <% display_errs display_msg %> <% if action = "" then If incDate = "" Then '' get the current months first day incDate = DatePart ("m" , Date) & "/01/" & DatePart("yyyy" , Date) Else incDate = DatePart ("m" , incDate) & "/" & DatePart ("d" , incDate) & "/" & DatePart("yyyy" , incDate) End If '' pixel size for the cell boxes boxSize = "40" ' To change the month, Pass in a date with POST or GET of a valid date ' to a variable named incDate Function GetDateName (monthNumber) Select Case monthNumber Case 1 GetDateName = "Janvier" Case 2 GetDateName = "Février" Case 3 GetDateName = "Mars" Case 4 GetDateName = "Avril" Case 5 GetDateName = "Mai" Case 6 GetDateName = "Juin" Case 7 GetDateName = "Juillet" Case 8 GetDateName = "Août" Case 9 GetDateName = "Septembre" Case 10 GetDateName = "Octobre" Case 11 GetDateName = "Novembre" Case 12 GetDateName = "Décembre" End Select End Function function DaysInAnyMonth(iMonth, iYear) dim dTemp dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1)) DaysInAnyMonth = Day(dTemp) end function function WeekdayNameOfFirstOfMonth(iMonth, iYear) dim dTemp dTemp = WeekdayName(Weekday(iMonth & "/01/" & iYear,VBSunday)) FirstWeekdayOfMonth = dTemp 'response.write "
1st day of " & iMonth & "/" & iYear & " is a: " & dTemp & "
" end function function DateFirstWeekdayFallsOn(iMonth, iYear, iWeekdayNumber) dim dTemp dTemp = iWeekdayNumber - Weekday(iMonth & "/01/" & iYear, 1) if dTemp < 0 then dTemp = 0 dTemp = DateAdd("d",dTemp,iMonth & "/01/" & iYear) DateFirstWeekdayFallsOn = dTemp 'response.write "
The 1st " & WeekdayName(iWeekdayNumber) & " of " & iMonth & "/" & iYear & " is on: " & dTemp & "
" end function render_title if request("wk") = "" then %> <% '' select events and assign to a_events array CatId = request("CatId") if CatId = "" then sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE " sql = sql + "(" sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "Events.CodeAdmin = Admin.CodeAdmin" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.event_id = Events.event_id" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & "" sql = sql + ")" sql = sql + " ORDER BY dt_occur" ''response.write sql else sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE " sql = sql + "(" sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.catid = " & to_sql(catid,"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "Events.CodeAdmin = Admin.CodeAdmin" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.event_id = Events.event_id" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & "" sql = sql + ")" sql = sql + " ORDER BY dt_occur" 'response.write sql end if set rs = cn.execute(sql) days_in_month = DaysInAnyMonth(month(incDate),year(incDate)) lastDate = DateAdd("d",days_in_month-1,incDate) do until rs.EOF dt_start = rs("dt_start") dt_end = rs("dt_end") dt_occur = rs("dt_occur") recurring = rs("recurring") recurring_end = rs("recurring_end") b_personal = rs("b_personal") CodeAdmin = rs("CodeAdmin") NomU = rs("NomU") ev_start = 0 ev_end = 0 if (dt_end = dt_start) OR isnull(dt_end) then if b_personal = 2 AND CodeAdmin <> session("CodeAdmin") then a_events(day(dt_occur)) = a_events(day(dt_occur)) & NomU & " busy..
" else a_events(day(dt_occur)) = a_events(day(dt_occur)) & "" & left(rs("event_name"),25) & "..
" end if end if rs.MoveNext loop rs.Close '' calendar loop dim w, d, count, dispDay, currDay dateCount = incDate count = 1 dispDay = 1 for w = 1 to 6 %> <% for d = 1 to 7 if Not (count => DatePart("w" , incDate)) AND (count < 8) then %> <% count = count + 1 else ':: current date? If "mm/dd/yyyy" ="mm/dd/yyyy" then currDy = DatePart("m" , incDate) & "/" & dispDay & "/" currDay = DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate) Else currDy = dispDay & "/" & DatePart("m" , incDate) & "/" currDay = dispDay & "/" & DatePart("m" , incDate) & "/" & DatePart("yyyy" , incDate) End if If IsDate(currDay) Then ':: today If datevalue(currDay) = datevalue(Date) Then %> <% Else ':: other date %> <% End If count = count + 1 dispDay = dispDay + 1 Else ':: no date spacer cell %> <% End If end if next 'day %> <% next 'week lastmo = DateAdd("M", -1, incDate) nextmo = DateAdd("M", 1, incDate) %>
Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi
 <%=dispDay%><% if not isEmpty(a_events(dispDay)) then %>
<% =a_events(dispDay) %>
<% end if %>
<%=dispDay%><% if not isEmpty(a_events(dispDay)) then %>
<% =a_events(dispDay) %>
<% end if %>
 
< <% =GetDateName(month(lastmo)) %> <% =GetDateName(month(nextmo)) %> >
<% else %> <% '' select events and assign to a_events array if CatId = "" then sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE " sql = sql + "(" sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "Events.CodeAdmin = Admin.CodeAdmin" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.event_id = Events.event_id" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & "" sql = sql + ")" sql = sql + " ORDER BY dt_occur" 'response.write sql else sql = "SELECT * FROM Events, EventsOccur WHERE " sql = sql + "(" sql = sql + "b_personal = 0 OR b_personal is null OR CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.catid = " & to_sql(cat_id,"number") & "" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "EventsOccur.event_id = Events.event_id" sql = sql + ")" sql = sql + "AND" sql = sql + "(" sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & "" sql = sql + ")" sql = sql + " ORDER BY dt_occur" 'response.write sql end if set rs = cn.execute(sql) days_in_month = DaysInAnyMonth(month(incDate),year(incDate)) lastDate = DateAdd("d",days_in_month-1,incDate) do until rs.EOF dt_start = rs("dt_start") dt_end = rs("dt_end") dt_occur = rs("dt_occur") recurring = rs("recurring") recurring_end = rs("recurring_end") b_personal = rs("b_personal") NomU = rs("NomU") ev_start = 0 ev_end = 0 if (dt_end = dt_start) OR isnull(dt_end) then if b_personal = 2 AND CodeAdmin <> session("CodeAdmin") then a_events(day(dt_occur)) = a_events(day(dt_occur)) & NomU & " busy..
" else a_events(day(dt_occur)) = a_events(day(dt_occur)) & "" & left(rs("event_name"),25) & "..
" end if end if rs.MoveNext loop rs.Close '' calendar loop dateCount = incDate count = 1 dispDay = DatePart("d",incDate) for d = 1 to 7 If IsDate( DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate)) Then currDy = DatePart("m" , incDate) & "/" & dispDay & "/" currDay = DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate) %> <% If datevalue(currDay) = datevalue(Date) Then %> <% Else %> <% End If count = count + 1 dispDay = dispDay + 1 %> <% end if next 'day lastwk = DateAdd("d", -7, incDate) nextwk = DateAdd("d", 7, incDate) %>
<% if weekdayname(weekday(currDay)) = "Saturday" then response.write "Samedi" %> <% if weekdayname(weekday(currDay)) = "Sunday" then response.write "Dimanche" %> <% if weekdayname(weekday(currDay)) = "Monday" then response.write "Lundi" %> <% if weekdayname(weekday(currDay)) = "Tuesday" then response.write "Mardi" %> <% if weekdayname(weekday(currDay)) = "Wednesday" then response.write "Mercredi" %> <% if weekdayname(weekday(currDay)) = "Thursday" then response.write "Jeudi" %> <% if weekdayname(weekday(currDay)) = "Friday" then response.write "Vendredi" %> <%=dispDay%><% if not isEmpty(a_events(dispDay)) then %>
<% =a_events(dispDay) %>
<% end if %>
<%=dispDay%><% if not isEmpty(a_events(dispDay)) then %>
<% =a_events(dispDay) %>
<% end if %>
  Suivent >>
<% end if %> <% else render_title %> <% page_no = request("page_no") if page_no = "" then page_no = 1 if detail_Events_sql <> "" then cmd.CommandText = detail_Events_sql rs.Filter = "" rs.CursorLocation = 3 rs.CacheSize = 5 rs.Open cmd if not rs.EOF then rs.MoveFirst num_recs = rs.RecordCount results = true else results = false rs.Close end if else results = false end if rec_count = 0 %>
<% =incDate %>
<% if results = true then %> <% do while not rs.EOF ':: read db record on error resume next event_id = rs("event_id") dt_end = rs("dt_end") CodeAdmin = rs("CodeAdmin") dt_start = rs("dt_start") id = rs("id") b_personal = rs("b_personal") description = rs("description") tm_start = rs("tm_start") tm_end = rs("tm_end") event_name = rs("event_name") Cat = rs("Cat") NomU = rs("NomU") on error goto 0 %> <% event_desc = left(event_desc,100) %> <% rs.MoveNext rec_count = rec_count + 1 loop rs.Close %>
Horaire Titre Type Dernière modification
<% if tm_start <> "" and tm_end <> "" then tm_start = timevalue(tm_start) & " - " & timevalue(tm_end) elseif tm_start <> "" then tm_start = timevalue(tm_start) else tm_start = " --Toute la journée-- " end if %><% =tm_start %> <% if b_personal=2 and session("CodeAdmin") <> CodeAdmin then %><% =NomU %> busy<% else %><% =event_name %><% if b_register then %>  [register] <% end if %> <% end if %> <% =Cat %> <% =NomU %>
<% else %> [Pas d'événement] <% end if %>

Jour précédent

Jour suivant
<% end if %> <% ':: assure that any db resources are freed on error resume next rs.Close set rs = NOTHING cn.Close set cn = NOTHING user_cn.Close set user_cn = NOTHING on error goto 0 %>