This topic is locked

Additional information on calendar list pages

5/20/2014 10:18:19 PM
ASPRunnerPro General questions
M
mfred author

A client wants a calendar for their club. I am using the calendar template. Currently, the list pages for the calmonthly and calweekly simply lists the subject. The client wants the subject and category text to appear. How do I add that?

M
mfred author 5/21/2014

The listed code for the Calmonthly, 'List page: before display' event does not seem to match the code in the calendar template. The template code for Calmonthly, 'List page: before display' event is:
Dim strWhereClause,var_SESSION,ResetMess,dictMonth,mdays,mont,ndays,days,mon,yr,wd,i,mess,strSQL,rstmp,datatmp,strSQL2,rstmp2,dictDay,kolstr,d,datatmp2,strRow,a,de1,de2,dictEvent,strColor,c1,c2,k,var_REQUEST,strtmp,ztrtmp,newdate,dictTmp3,dictTmp,c,v,j,z,y,strT,x,dictTmp2,tmpSQL,kol,dal_calcategory,monarray

doAssignment strWhereClause,Session("strWhereClause")

ResetMess = ""

if not IsEqual(Session("UserID"),"Guest") then

xt.assign_p2 "allow_add",true

ResetMess = "ResetMess();"

end if

xt.assign_p2 "bodyattrs",("onselectstart=""if(mclick==1 || cclick==1)return false;else return true;"" onmouseup=""mclick=0;" & CSmartStr(ResetMess)) & """"

Set dictMonth = (CreateDictionary())

Set mdays = (CreateDictionary())

setArrElement mdays,1,31

setArrElement mdays,2,28

setArrElement mdays,3,31

setArrElement mdays,4,30

setArrElement mdays,5,31

setArrElement mdays,6,30

setArrElement mdays,7,31

setArrElement mdays,8,31

setArrElement mdays,9,30

setArrElement mdays,10,31

setArrElement mdays,11,30

setArrElement mdays,12,31

setArrElement mont,1,ArrayElement(locale_info,"LOCALE_SMONTHNAME1")

setArrElement mont,2,ArrayElement(locale_info,"LOCALE_SMONTHNAME2")

setArrElement mont,3,ArrayElement(locale_info,"LOCALE_SMONTHNAME3")

setArrElement mont,4,ArrayElement(locale_info,"LOCALE_SMONTHNAME4")

setArrElement mont,5,ArrayElement(locale_info,"LOCALE_SMONTHNAME5")

setArrElement mont,6,ArrayElement(locale_info,"LOCALE_SMONTHNAME6")

setArrElement mont,7,ArrayElement(locale_info,"LOCALE_SMONTHNAME7")

setArrElement mont,8,ArrayElement(locale_info,"LOCALE_SMONTHNAME8")

setArrElement mont,9,ArrayElement(locale_info,"LOCALE_SMONTHNAME9")

setArrElement mont,10,ArrayElement(locale_info,"LOCALE_SMONTHNAME10")

setArrElement mont,11,ArrayElement(locale_info,"LOCALE_SMONTHNAME11")

setArrElement mont,12,ArrayElement(locale_info,"LOCALE_SMONTHNAME12")

Set ndays = (CreateDictionary())

setArrElement ndays,1,ArrayElement(locale_info,"LOCALE_SDAYNAME1")

setArrElement ndays,2,ArrayElement(locale_info,"LOCALE_SDAYNAME2")

setArrElement ndays,3,ArrayElement(locale_info,"LOCALE_SDAYNAME3")

setArrElement ndays,4,ArrayElement(locale_info,"LOCALE_SDAYNAME4")

setArrElement ndays,5,ArrayElement(locale_info,"LOCALE_SDAYNAME5")

setArrElement ndays,6,ArrayElement(locale_info,"LOCALE_SDAYNAME6")

setArrElement ndays,7,ArrayElement(locale_info,"LOCALE_SDAYNAME7")

xt.assign_p2 "row00sdname1",ArrayElement(ndays,1)

xt.assign_p2 "row00sdname2",ArrayElement(ndays,2)

xt.assign_p2 "row00sdname3",ArrayElement(ndays,3)

xt.assign_p2 "row00sdname4",ArrayElement(ndays,4)

xt.assign_p2 "row00sdname5",ArrayElement(ndays,5)

xt.assign_p2 "row00sdname6",ArrayElement(ndays,6)

xt.assign_p2 "row00sdname7",ArrayElement(ndays,7)

days = CSmartDbl(Session("days"))+0

mon = CSmartDbl(Session("mon"))+0

yr = CSmartDbl(Session("yr"))+0

if IsLess(ArrayElement(mdays,mon),days) then

doAssignment days,ArrayElement(mdays,mon)

end if

if IsEqual(round(CSmartDbl(yr)/4,0),CSmartDbl(yr)/4) then

setArrElement mdays,2,29

end if

doAssignmentByRef wd,mydate("w",mktime(0,0,0,mon,1,yr))

if IsEqual(wd,0) then

wd = 7

end if

wd = CSmartDbl(wd)-1

i = 1

do while IsLessOrEqual(i,50)

xt.assign_p2 ("row00" & CSmartStr(i)) & "WeekDaysvalue",""

xt.assign_p2 ("row00AddHideM" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "value","style=""display:none;"""

xt.assign_p2 ("row00" & CSmartStr(i)) & "Datevalue",""

xt.assign_p2 ("row00" & CSmartStr(i)) & "Datevisible",false

i = CSmartDbl(i)+1

loop

xt.assign_p2 "grid_block",true

i = 1

do while IsLessOrEqual(i,ArrayElement(mdays,mon))

if IsLessOrEqual(CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime((((CSmartStr(yr) & "-") & CSmartStr(mon)) & "-") & CSmartStr(i))),0) then

xt.assign_p2 ("row00AddHideM" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "value",""

end if

xt.assign_p2 ("row00" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "Datevalue",i

xt.assign_p2 ("row00" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "Datevisible",true

xt.assign_p2 ("row00" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "Monthvalue",mon

xt.assign_p2 ("row00Dateadd" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "value",(((("yr=" & CSmartStr(yr)) & "&mon=") & CSmartStr(mon)) & "&days=") & CSmartStr(i)

xt.assign_p2 ("row00" & CSmartStr(i)) & "WeekDaysvalue","style=""background-color:#C5D2E5;"""

xt.assign_p2 "addAttr" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd))),((((("days=" & CSmartStr(i)) & " mon=") & CSmartStr(mon)) & " yr=") & CSmartStr(yr)) & ""

if (IsEqual(mydate("Y",""),yr) and IsEqual(mydate("n",""),mon)) and IsEqual(mydate("j",""),i) then

xt.assign_p2 ("row00" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "Nowvalue","style=""border:2px solid #990000"""

else

xt.assign_p2 ("row00" & CSmartStr(CSmartLng(CSmartDbl(i)+CSmartDbl(wd)))) & "Nowvalue","style=""border:1px solid #CCCCCC"""

end if

setArrElement Session,(((CSmartStr(i) & "-") & CSmartStr(mon)) & "-") & CSmartStr(yr),0

setArrElement Session,(((CSmartStr(i) & "-") & CSmartStr(mon)) & "-") & CSmartStr(yr),0

setArrElement Session,(((("more" & CSmartStr(i)) & "-") & CSmartStr(mon)) & "-") & CSmartStr(yr),0

setArrElement Session,(((("count" & CSmartStr(i)) & "-") & CSmartStr(mon)) & "-") & CSmartStr(yr),0

i = CSmartDbl(i)+1

loop

i = 1

do while IsLessOrEqual(i,6)

if not IsEqual(xt.getVar_p1(("row00" & CSmartStr(CSmartLng((CSmartDbl(i)-1)7+1))) & "Datevalue"),"") or not IsEqual(xt.getVar_p1(("row00" & CSmartStr(CSmartLng((CSmartDbl(i)-1)7+7))) & "Datevalue"),"") then

if not IsEqual(xt.getVar_p1(("row00" & CSmartStr(CSmartLng((CSmartDbl(i)-1)7+1))) & "Datevalue"),"") then

mess = ("<a href=""calweekly_list.asp?" & CSmartStr(xt.getVar_p1(("row00Dateadd" & CSmartStr(CSmartLng((CSmartDbl(i)-1)
7+1))) & "value"))) & """>"

else

mess = ("<a href=""calweekly_list.asp?" & CSmartStr(xt.getVar_p1(("row00Dateadd" & CSmartStr(CSmartLng((CSmartDbl(i)-1)7+7))) & "value"))) & """>"

end if

mess = CSmartStr(mess) & "<b>>></b></a>"

xt.assign_p2 "week_link" & CSmartStr(i),mess

end if

i = CSmartDbl(i)+1

loop

i = 1

do while IsLessOrEqual(i,50)

if not IsEqual(Session("UserID"),"Guest") then

mess = ((((((((((((("onmouseover=""cell_day='" & CSmartStr(xt.getVarp1(("row00" & CSmartStr(i)) & "Datevalue"))) & "';" & vbcrlf &

" cell_mon='") & CSmartStr(xt.getVarp1(("row00" & CSmartStr(i)) & "Monthvalue"))) & "';" & vbcrlf &

" if(cclick==1 && cell_day!=cell_day_begin && (cell_day>=ss && cell_mon==sm || cellmon>sm || ") & CSmartStr(Session("yr"))) & ">sy))" & vbcrlf &

" {" & vbcrlf & _

" document.getElementById('add") & CSmartStr(xt.getVarp1(("row00" & CSmartStr(i)) & "Datevalue"))) & "').style.cursor='move';" & vbcrlf &

" document.getElementById('add") & CSmartStr(xt.getVarp1(("row00" & CSmartStr(i)) & "Datevalue"))) & "').style.border='1px dashed gray';" & vbcrlf &

" }" & vbcrlf &

" else" & vbcrlf &


" {" & vbcrlf & _

" document.getElementById('add") & CSmartStr(xt.getVarp1(("row00" & CSmartStr(i)) & "Datevalue"))) & "').style.cursor='default';" & vbcrlf &

" }""" & vbcrlf & _

" onmouseout=""document.getElementById('add") & CSmartStr(xt.getVar_p1(("row00" & CSmartStr(i)) & "Datevalue"))) & "').style.borderStyle='';"""

xt.assign_p2 "onmouseovervalue" & CSmartStr(i),mess

end if

i = CSmartDbl(i)+1

loop

if not IsEqual(strWhereClause,"") then

strWhereClause = ("and (" & CSmartStr(strWhereClause)) & ")"

end if

if IsEqual(GetDatabaseType(),4) then

strSQL = (((((((((((((((("select " & CSmartStr(AddFieldWrappers("DateField"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " where ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " and date_part('year',") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(yr)) & " and date_part('month',") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mon)) & " group by ") & CSmartStr(AddFieldWrappers("DateField"))

else

if IsEqual(GetDatabaseType(),1) then

strSQL = (((((((((((((((("select " & CSmartStr(AddFieldWrappers("DateField"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " where ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " and to_char(") & CSmartStr(AddFieldWrappers("DateField"))) & ",'YYYY')=") & CSmartStr(yr)) & " and to_char(") & CSmartStr(AddFieldWrappers("DateField"))) & ",'MM')=") & CSmartStr(mon)) & " group by ") & CSmartStr(AddFieldWrappers("DateField"))

else

strSQL = (((((((((((((((("select " & CSmartStr(AddFieldWrappers("DateField"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " where ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " and Year(") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(yr)) & " and Month(") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mon)) & " group by ") & CSmartStr(AddFieldWrappers("DateField"))

end if

end if

doAssignmentByRef rstmp,CustomQuery(strSQL)

do while bValue(doAssignmentByRef(datatmp,db_fetch_array(rstmp)))

if IsEqual(GetDatabaseType(),4) then

strSQL2 = (((((((((((((((((((((((((((((((((("select " & CSmartStr(AddTableWrappers("calcalendar"))) & ".
, ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("Color"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " left join ") & CSmartStr(AddTableWrappers("calcategory"))) & " on ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("id"))) & "=") & CSmartStr(AddTableWrappers("calcalendar"))) & ".") & CSmartStr(AddFieldWrappers("Category"))) & " where date_part('year',") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(yr)) & " and date_part('month',") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mon)) & " and date_part('day',") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp,"DateField"))))) & " and ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " order by ") & CSmartStr(AddFieldWrappers("TimeField"))

else

if IsEqual(GetDatabaseType(),1) then

strSQL2 = (((((((((((((((((((((((((((((((((("select " & CSmartStr(AddTableWrappers("calcalendar"))) & "., ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("Color"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " left join ") & CSmartStr(AddTableWrappers("calcategory"))) & " on ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("id"))) & "=") & CSmartStr(AddTableWrappers("calcalendar"))) & ".") & CSmartStr(AddFieldWrappers("Category"))) & " where to_char(") & CSmartStr(AddFieldWrappers("DateField"))) & ",'YYYY')=") & CSmartStr(yr)) & " and to_char(") & CSmartStr(AddFieldWrappers("DateField"))) & ",'MM')=") & CSmartStr(mon)) & " and to_char(") & CSmartStr(AddFieldWrappers("DateField"))) & ",'DD')=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp,"DateField"))))) & " and ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " order by ") & CSmartStr(AddFieldWrappers("TimeField"))

else

strSQL2 = (((((((((((((((((((((((((((((((((("select " & CSmartStr(AddTableWrappers("calcalendar"))) & ".
, ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("Color"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " left join ") & CSmartStr(AddTableWrappers("calcategory"))) & " on ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("id"))) & "=") & CSmartStr(AddTableWrappers("calcalendar"))) & ".") & CSmartStr(AddFieldWrappers("Category"))) & " where Year(") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(yr)) & " and Month(") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mon)) & " and Day(") & CSmartStr(AddFieldWrappers("DateField"))) & ")=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp,"DateField"))))) & " and ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=0 ") & CSmartStr(strWhereClause)) & " order by ") & CSmartStr(AddFieldWrappers("TimeField"))

end if

end if

doAssignmentByRef rstmp2,CustomQuery(strSQL2)

Set dictDay = (CreateDictionary())

doAssignmentByRef kolstr,mydate("j-n-Y",strtotime(ArrayElement(datatmp,"DateField")))

d = 0

do while bValue(doAssignmentByRef(datatmp2,db_fetch_array(rstmp2)))

strRow = ""

doAssignmentByRef a,asp_strlen(ArrayElement(datatmp2,"Theme"))

de1 = 30

de2 = 50

if not bValue(ArrayElement(datatmp2,"DayEvent")) then

de1 = 15

de2 = 30

end if

if IsLess(de1,a) then

if IsLess(Session(kolstr),4) then

doAssignment a,de2

else

doAssignment a,de1

end if

else

doAssignment a,de1

end if

setArrElement Session,"more" & CSmartStr(kolstr),CSmartDbl(Session("more" & CSmartStr(kolstr)))+CSmartDbl(a)

setArrElement Session,"count" & CSmartStr(kolstr),CSmartDbl(Session("count" & CSmartStr(kolstr)))+1

Set dictEvent = (CreateDictionary())

setArrElement Session,kolstr,CSmartDbl(Session(kolstr))+1

strColor = ""

if bValue(ArrayElement(datatmp2,"Color")) then

strColor = (" style=""background-color:" & CSmartStr(ArrayElement(datatmp2,"Color"))) & """"

end if

strRow = CSmartStr(strRow) & "<table cellpadding=0 cellspacing=0 width=100% border=0><tr>"

strRow = CSmartStr(strRow) & "<td "

if not IsEqual(Session("UserID"),"Guest") then

strRow = CSmartStr(strRow) & (((("style=""cursor:move;"" onmousedown='CopyMess(event," & CSmartStr(ArrayElement(datatmp2,"id"))) & ");cell_day_begin=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp2,"DateField"))))) & ";recurr=""0"";'")

end if

strRow = CSmartStr(strRow) & ">"

strRow = CSmartStr(strRow) & ((("<table cellpadding=1 cellspacing=0 width=100% border=0 style=""border: 1px solid gray"" id=edit" & CSmartStr(ArrayElement(datatmp2,"id"))) & ">") & vbcrlf)

strRow = CSmartStr(strRow) & ((("<tr><td width=7 " & CSmartStr(strColor)) & "></td>") & vbcrlf)

c1 = ""

c2 = ""

if bValue(ArrayElement(datatmp2,"DayEvent")) then

doAssignment c1,strColor

else

doAssignment c2,strColor

end if

strRow = CSmartStr(strRow) & ((("<td colspan=2 " & CSmartStr(c1)) & " height=3></td></tr>") & vbcrlf)

strRow = CSmartStr(strRow) & ((("<tr><td width=7 " & CSmartStr(c2)) & " valign=top></td><td style=""font-size:11px;"">") & vbcrlf)

k = 2

if not bValue(ArrayElement(datatmp2,"DayEvent")) then

strRow = CSmartStr(strRow) & ((("<font face=Arial>" & CSmartStr(trim(dbvalue2time(ArrayElement(datatmp2,"TimeField"))))) & "</font>") & vbcrlf)

k = 1

end if

if bValue(ArrayElement(datatmp2,"DateField")) then

if IsEqual(Session("UserID"),"Guest") or (IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(mydate("Y-m-j",strtotime(ArrayElement(datatmp2,"DateField")))) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(ArrayElement(datatmp2,"DateField")))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1)) then

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & ((((((((((("<a href="""" onmousedown=""mclick=0;cclick=0;return false;"" id=viewButton" & CSmartStr(ArrayElement(datatmp2,"id"))) & " idrec=") & CSmartStr(ArrayElement(datatmp2,"id"))) & " days=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp2,"DateField"))))) & " mon=") & CSmartStr(mydate("n",strtotime(ArrayElement(datatmp2,"DateField"))))) & " yr=") & CSmartStr(mydate("Y",strtotime(ArrayElement(datatmp2,"DateField"))))) & ">") & vbcrlf)

end if

strRow = CSmartStr(strRow) & "<b>"

else

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & ((((((((((((("<a onmousedown=""mclick=0;cclick=0;return false;"" href="""" id=editButton" & CSmartStr(ArrayElement(datatmp2,"id"))) & " recur='") & CSmartStr(ArrayElement(datatmp2,"Recurrence"))) & "' idrec=") & CSmartStr(ArrayElement(datatmp2,"id"))) & " days=") & CSmartStr(mydate("j",strtotime(ArrayElement(datatmp2,"DateField"))))) & " mon=") & CSmartStr(mydate("n",strtotime(ArrayElement(datatmp2,"DateField"))))) & " yr=") & CSmartStr(mydate("Y",strtotime(ArrayElement(datatmp2,"DateField"))))) & ">") & vbcrlf)

end if

strRow = CSmartStr(strRow) & "<b>"

end if

end if

doAssignment strtmp,ArrayElement(datatmp2,"Theme")

if IsLess(de1,asp_strlen(strtmp)) then

setArrElement Session,kolstr,CSmartDbl(Session(kolstr))+1

end if

if IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(mydate("Y-m-j",strtotime(ArrayElement(datatmp2,"DateField")))) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(ArrayElement(datatmp2,"DateField")))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1) then

strRow = CSmartStr(strRow) & "<span style=""color:red"">"

end if

if IsLess(de2,asp_strlen(strtmp)) then

strtmp = CSmartStr(asp_substr(strtmp,0,CSmartDbl(de2)-3)) & "..."

end if

if IsLess(de1,asp_strlen(strtmp)) and IsLess(5,Session(kolstr)) then

ztrtmp = CSmartStr(asp_substr(strtmp,0,CSmartDbl(de1)-3)) & "..."

end if

if IsEqual(asp_strlen(trim(strtmp)),0) or not bValue(strtmp) then

strtmp = "&lt;Empty&gt;"

end if

strRow = CSmartStr(strRow) & (CSmartStr(strtmp) & vbcrlf)

if IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(mydate("Y-m-j",strtotime(ArrayElement(datatmp2,"DateField")))) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(ArrayElement(datatmp2,"DateField")))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1) then

strRow = CSmartStr(strRow) & ("</span>" & vbcrlf)

end if

strRow = CSmartStr(strRow) & "</b>"

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & "</a>"

end if

strRow = CSmartStr(strRow) & ("</td></tr></table></td></tr>" & vbcrlf)

if IsLessOrEqual(Session(kolstr),5) then

strRow = CSmartStr(strRow) & ("<tr><td colspan=3 height=1></td></tr>" & vbcrlf)

end if

strRow = CSmartStr(strRow) & ("</table>" & vbcrlf)

if IsEqual(ArrayElement(datatmp2,"TimeField"),"") or bValue(isnull(ArrayElement(datatmp2,"TimeField"))) then

setArrElement dictEvent,0,0

else

setArrElement dictEvent,0,ArrayElement(datatmp2,"TimeField")

end if

setArrElement dictEvent,1,strRow

if IsLess(de1,asp_strlen(strtmp)) then

setArrElement dictEvent,2,2

else

setArrElement dictEvent,2,1

end if

setArrElement dictDay,d,dictEvent

d = CSmartDbl(d)+1

loop

setArrElement dictMonth,mydate("j",strtotime(ArrayElement(datatmp,"DateField"))),dictDay

xt.assign_p2 ("row00" & CSmartStr((CSmartDbl(mydate("j",strtotime(ArrayElement(datatmp,"DateField"))))+CSmartDbl(wd))+0)) & "KolStrvalue",Session(kolstr)

loop

strSQL2 = (((((((((((((((((((("select " & CSmartStr(AddTableWrappers("calcalendar"))) & "., ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("Color"))) & " from ") & CSmartStr(AddTableWrappers("calcalendar"))) & " left join ") & CSmartStr(AddTableWrappers("calcategory"))) & " on ") & CSmartStr(AddTableWrappers("calcategory"))) & ".") & CSmartStr(AddFieldWrappers("id"))) & "=") & CSmartStr(AddTableWrappers("calcalendar"))) & ".") & CSmartStr(AddFieldWrappers("Category"))) & " where ") & CSmartStr(AddFieldWrappers("Recurrence"))) & "=1 ") & CSmartStr(strWhereClause)

doAssignmentByRef rstmp2,CustomQuery(strSQL2)

do while bValue(doAssignmentByRef(datatmp2,db_fetch_array(rstmp2)))

doAssignmentByRef newdate,mydate("Y-m-j",strtotime(ArrayElement(datatmp2,"DateField")))

do while IsLessOrEqual(0,(((CSmartDbl(strtotime(ArrayElement(datatmp2,"EndDate")))-CSmartDbl(strtotime(newdate)))/60)
60)*24)

strRow = ""

doAssignmentByRef kolstr,mydate("j-n-Y",strtotime(newdate))

if IsEqual(mydate("n",strtotime(newdate)),Session("mon")) and IsEqual(mydate("Y",strtotime(newdate)),Session("yr")) then

doAssignmentByRef a,asp_strlen(ArrayElement(datatmp2,"Theme"))

de1 = 30

de2 = 50

if not bValue(ArrayElement(datatmp2,"DayEvent")) then

de1 = 15

de2 = 30

end if

if IsLess(de1,a) then

if IsLess(Session(kolstr),4) then

doAssignment a,de2

else

doAssignment a,de1

end if

else

doAssignment a,de1

end if

setArrElement Session,"more" & CSmartStr(kolstr),CSmartDbl(Session("more" & CSmartStr(kolstr)))+CSmartDbl(a)

setArrElement Session,"count" & CSmartStr(kolstr),CSmartDbl(Session("count" & CSmartStr(kolstr)))+1

Set dictDay = (CreateDictionary())

Set dictEvent = (CreateDictionary())

setArrElement Session,kolstr,CSmartDbl(Session(kolstr))+1

strColor = ""

if bValue(ArrayElement(datatmp2,"Color")) then

strColor = (" style=""background-color:" & CSmartStr(ArrayElement(datatmp2,"Color"))) & """"

end if

strRow = CSmartStr(strRow) & "<table cellpadding=0 cellspacing=0 width=100% border=0><tr>"

strRow = CSmartStr(strRow) & "<td "

if not IsEqual(Session("UserID"),"Guest") then

strRow = CSmartStr(strRow) & (((((("style=""cursor:move;z-index:1;"" onmousedown='CopyMess(event," & CSmartStr(ArrayElement(datatmp2,"id"))) & ");cell_day_begin=") & CSmartStr(mydate("j",strtotime(newdate)))) & ";recurr=""") & CSmartStr(newdate)) & """;'")

end if

strRow = CSmartStr(strRow) & ">"

strRow = CSmartStr(strRow) & ("<table cellpadding=1 cellspacing=0 width=100% border=0 style=""border: 1px solid gray"">" & "")

strRow = CSmartStr(strRow) & ((("<tr><td width=7 " & CSmartStr(strColor)) & "></td>") & vbcrlf)

c1 = ""

c2 = ""

if bValue(ArrayElement(datatmp2,"DayEvent")) then

doAssignment c1,strColor

else

doAssignment c2,strColor

end if

strRow = CSmartStr(strRow) & ((("<td colspan=2 " & CSmartStr(c1)) & " height=3></td></tr>") & vbcrlf)

strRow = CSmartStr(strRow) & ((("<tr><td width=7 " & CSmartStr(c2)) & " valign=top></td><td style=""font-size:11px;"">") & vbcrlf)

k = 2

if not bValue(ArrayElement(datatmp2,"DayEvent")) then

strRow = CSmartStr(strRow) & ((("<font face=Arial>" & CSmartStr(trim(dbvalue2time(ArrayElement(datatmp2,"TimeField"))))) & "</font>") & vbcrlf)

k = 1

end if

if bValue(ArrayElement(datatmp2,"DateField")) then

if IsEqual(Session("UserID"),"Guest") or (IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(newdate) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(newdate))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1)) then

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & ((((((((((("<a href="""" onclick=""mclick=0;cclick=0;return false;"" id=viewButton" & CSmartStr(ArrayElement(datatmp2,"id"))) & " idrec=") & CSmartStr(ArrayElement(datatmp2,"id"))) & " days=") & CSmartStr(mydate("j",strtotime(newdate)))) & " mon=") & CSmartStr(mydate("n",strtotime(newdate)))) & " yr=") & CSmartStr(mydate("Y",strtotime(newdate)))) & ">") & vbcrlf)

end if

strRow = CSmartStr(strRow) & "<b>"

else

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & ((((((((((((("<a href="""" onmousedown=""mclick=0;cclick=0;return false;"" id=editButton" & CSmartStr(ArrayElement(datatmp2,"id"))) & " recur='") & CSmartStr(ArrayElement(datatmp2,"Recurrence"))) & "' idrec=") & CSmartStr(ArrayElement(datatmp2,"id"))) & " days=") & CSmartStr(mydate("j",strtotime(newdate)))) & " mon=") & CSmartStr(mydate("n",strtotime(newdate)))) & " yr=") & CSmartStr(mydate("Y",strtotime(newdate)))) & ">") & vbcrlf)

end if

strRow = CSmartStr(strRow) & "<b>"

end if

end if

doAssignment strtmp,ArrayElement(datatmp2,"Theme")

if IsLess(de1,asp_strlen(strtmp)) then

setArrElement Session,kolstr,CSmartDbl(Session(kolstr))+1

end if

if IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(newdate) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(newdate))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1) then

strRow = CSmartStr(strRow) & "<span style=""color:red"">"

end if

if IsLess(de2,asp_strlen(strtmp)) then

strtmp = CSmartStr(asp_substr(strtmp,0,CSmartDbl(de2)-3)) & "..."

end if

if IsLess(de1,asp_strlen(strtmp)) and IsLess(5,Session(kolstr)) then

strtmp = CSmartStr(asp_substr(strtmp,0,CSmartDbl(de1)-3)) & "..."

end if

if IsEqual(asp_strlen(trim(strtmp)),0) or not bValue(strtmp) then

strtmp = "&lt;Empty&gt;"

end if

strRow = CSmartStr(strRow) & ((CSmartStr(strtmp) & " <img src=images/repeat.gif border=0>") & vbcrlf)

if IsLessOrEqual(0,CSmartDbl(strtotime(now()))-CSmartDbl(strtotime((CSmartStr(newdate) & " ") & CSmartStr(ArrayElement(datatmp2,"TimeField"))))) and not IsEqual(ArrayElement(datatmp2,"DayEvent"),1) or IsLess(0,CSmartDbl(strtotime(mydate("Y-m-d","")))-CSmartDbl(strtotime(newdate))) and IsEqual(ArrayElement(datatmp2,"DayEvent"),1) then

strRow = CSmartStr(strRow) & "</span>"

end if

strRow = CSmartStr(strRow) & "</b>"

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & "</a>"

end if

strRow = CSmartStr(strRow) & ("</td></tr></table></td></tr>" & vbcrlf)

if IsLessOrEqual(Session(kolstr),5) then

strRow = CSmartStr(strRow) & ("<tr><td colspan=3 height=1></td></tr>" & vbcrlf)

end if

strRow = CSmartStr(strRow) & ("</table>" & vbcrlf)

if IsEqual(ArrayElement(datatmp2,"TimeField"),"") or bValue(isnull(ArrayElement(datatmp2,"TimeField"))) then

setArrElement dictEvent,0,0

else

setArrElement dictEvent,0,ArrayElement(datatmp2,"TimeField")

end if

setArrElement dictEvent,1,strRow

if IsLess(15,asp_strlen(strtmp)) then

setArrElement dictEvent,2,2

else

setArrElement dictEvent,2,1

end if

if bValue(asp_array_key_exists(mydate("j",strtotime(newdate)),dictMonth)) then

setArrElementN dictMonth,CreateArray2(mydate("j",strtotime(newdate)),empty),dictEvent

else

setArrElement dictDay,0,dictEvent

setArrElement dictMonth,mydate("j",strtotime(newdate)),dictDay

end if

xt.assign_p2 ("row00" & CSmartStr(CSmartDbl(mydate("j",strtotime(newdate)))+CSmartDbl(wd))) & "KolStrvalue",Session(kolstr)

end if

if IsEqual(ArrayElement(datatmp2,"Period"),"yyyy") then

doAssignmentByRef newdate,mktime(0,0,0,mydate("n",strtotime(newdate)),mydate("j",strtotime(newdate)),CSmartDbl(mydate("Y",strtotime(newdate)))+1)

end if

if IsEqual(ArrayElement(datatmp2,"Period"),"ww") then

doAssignmentByRef newdate,mktime(0,0,0,mydate("n",strtotime(newdate)),CSmartDbl(mydate("j",strtotime(newdate)))+7,mydate("Y",strtotime(newdate)))

end if

if IsEqual(ArrayElement(datatmp2,"Period"),"d") then

doAssignmentByRef newdate,mktime(0,0,0,mydate("n",strtotime(newdate)),CSmartDbl(mydate("j",strtotime(newdate)))+1,mydate("Y",strtotime(newdate)))

end if

if IsEqual(ArrayElement(datatmp2,"Period"),"m") then

doAssignmentByRef newdate,mktime(0,0,0,CSmartDbl(mydate("n",strtotime(newdate)))+1,mydate("j",strtotime(newdate)),mydate("Y",strtotime(newdate)))

end if

doAssignmentByRef newdate,mydate("Y-m-d",newdate)

loop

loop

i = 0

do while IsLessOrEqual(i,31)

if bValue(asp_array_key_exists(i,dictMonth)) then

Set dictTmp3 = (CreateDictionary())

Set dictTmp = (CreateDictionary())

doAssignment dictTmp,ArrayElement(dictMonth,i)

doAssignmentByRef c,asp_count(dictTmp)

doAssignmentByRef v,asp_count(dictTmp)

k = 0

do while IsLess(0,c)

a = "23:30:00"

j = 0

do while IsLessOrEqual(j,CSmartDbl(v)-1)

if bValue(asp_array_key_exists(j,dictTmp)) then

if IsLess(CSmartDbl(strtotime(ArrayElement(ArrayElement(dictTmp,j),0)))-CSmartDbl(strtotime(a)),0) then

doAssignment a,ArrayElement(ArrayElement(dictTmp,j),0)

doAssignment z,j

end if

end if

j = CSmartDbl(j)+1

loop

setArrElement dictTmp3,k,ArrayElement(dictTmp,z)

k = CSmartDbl(k)+1

asp_unsetElement dictTmp,z

c = CSmartDbl(c)-1

loop

setArrElement dictMonth,i,dictTmp3

end if

i = CSmartDbl(i)+1

loop

y = ""

strT = ""

i = 0

do while IsLessOrEqual(i,31)

xt.assign_p2 ("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue","&nbsp;"

if bValue(asp_array_key_exists(i,dictMonth)) then

xt.assign_p2 ("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue",""

Set dictTmp = (CreateDictionary())

doAssignment dictTmp,ArrayElement(dictMonth,i)

x = 0

j = 0

do while IsLess(j,asp_count(dictTmp))

Set dictTmp2 = (CreateDictionary())

doAssignment dictTmp2,ArrayElement(dictTmp,j)

x = CSmartDbl(x)+CSmartDbl(ArrayElement(dictTmp2,2))

if IsLessOrEqual(x,5) then

xt.assign_p2 ("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue",CSmartStr(xt.getVar_p1(("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue")) & CSmartStr(ArrayElement(dictTmp2,1))

if IsEqual(GetRequestValue(Request,"a"),"refresh") and IsEqual(i,days) then

y = CSmartStr(y) & CSmartStr(ArrayElement(dictTmp2,1))

end if

end if

if IsEqual(GetRequestValue(Request,"a"),"year") and IsEqual(i,days) then

y = CSmartStr(y) & CSmartStr(ArrayElement(dictTmp2,1))

end if

j = CSmartDbl(j)+1

loop

if IsLess(5,x) then

strT = "<table width=100% ><tr><td width=100% height=10 align=right style=""font-weight:normal;font-size:9px"">"

strT = CSmartStr(strT) & (((((("<a href=""caldaily_list.asp?yr=" & CSmartStr(yr)) & "&mon=") & CSmartStr(mon)) & "&days=") & CSmartStr(i)) & """>More...</a>&nbsp;")

strT = CSmartStr(strT) & (("(Totals:" & CSmartStr(Session((((("count" & CSmartStr(i)) & "-") & CSmartStr(mon)) & "-") & CSmartStr(yr)))) & ")&nbsp;</td></tr></table>")

xt.assign_p2 ("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue",CSmartStr(xt.getVar_p1(("row00" & CSmartStr(CSmartDbl(i)+CSmartDbl(wd))) & "Dayvalue")) & CSmartStr(strT)

if IsEqual(GetRequestValue(Request,"a"),"refresh") and IsEqual(i,days) then

y = CSmartStr(y) & CSmartStr(strT)

end if

end if

end if

i = CSmartDbl(i)+1

loop

if IsEqual(GetRequestValue(Request,"a"),"year") or IsEqual(GetRequestValue(Request,"a"),"refresh") then

if IsEqual(GetRequestValue(Request,"a"),"year") then

y = (((((("<table cellpadding=3 cellspacing=0 width=100% border=0><tr><td align=center>" & CSmartStr(ArrayElement(mont,mon))) & ", ") & CSmartStr(days)) & " ") & CSmartStr(yr)) & "</td></tr></table>") & CSmartStr(y)

end if

ResponseWrite y

Response.End

end if

tmpSQL = (((("select max(" & CSmartStr(AddFieldWrappers("id"))) & ") as ") & CSmartStr(AddFieldWrappers("maxid"))) & " from ") & CSmartStr(AddTableWrappers("calcategory"))

doAssignmentByRef rstmp,CustomQuery(tmpSQL)

doAssignmentByRef datatmp,db_fetch_array(rstmp)

doAssignment kol,ArrayElement(datatmp,"maxid")

doAssignmentByRef dal_calcategory,dal.Table("calcategory")

doAssignmentByRef rstmp2,dal_calcategory.Query_p2("",AddFieldWrappers("id"))

monarray = ""

monarray = CSmartStr(monarray) & (("<script>var a = new Array(" & CSmartStr(kol)) & ");")

do while bValue(doAssignmentByRef(datatmp2,db_fetch_array(rstmp2)))

monarray = CSmartStr(monarray) & (((("a[" & CSmartStr(ArrayElement(datatmp2,"id"))) & "]='") & CSmartStr(ArrayElement(datatmp2,"Color"))) & "';")

loop

monarray = CSmartStr(monarray) & "</script>"

xt.assign_p2 "Monthly_Array",monarray

Sergey Kornilov admin 5/22/2014

That article is for PHP while you have ASPRunnerPro. You will have to use the idea provided by that article and write your own code.
Here is where your code needs to be added:

strRow = CSmartStr(strRow) & "</b>"

if not IsEqual(GetRequestValue(Request,"a"),"year") then

strRow = CSmartStr(strRow) & "</a>"

end if

'

' your code goes here

'

strRow = CSmartStr(strRow) & ("</td></tr></table></td></tr>" & vbcrlf)
M
mfred author 5/22/2014

Thanks. I forgot to note that I was doing it in ASPRunner. I have both options.