Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Mod : Red1 Calendar Mod Mod (Upcoming/Recent days)
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 16 May 2003 :  14:22:51  Show Profile  Visit MarcelG's Homepage
Hi there...this is a mod on a mod by Red1, by myself, which changes the way Red1 Calendar Mod works.

Instead of showing a static number of upcoming/recent events on cal_default.asp, it will display only those events which will take place in the upcoming period (for instance n days).

Next to that, it groups them by day in the overview of upcoming/recent events.

Changed files:
cal_default.asp
cal_functions.asp
cal_constants.asp

What did I do ?
Basically I took the sub WriteUpcomingEvents, and copied it into a new sub named WriteUpcomingEventsPeriod
The code below is the modded version; just copy it into cal_functions.asp, at the bottom, before the %>

'*****************************************************************
 Sub WriteUpcomingEventsPeriod
'*****************************************************************


strSql = "SELECT "
strSql = strSql & "T.TOPIC_ID, " & _
                  "T.T_SUBJECT, " & _
                  "T.T_MESSAGE, " & _
                  "T.FORUM_ID, " & _
                  "T.T_STATUS, " & _
                  "T.T_EVENT_DATE, " & _
                  "C.CAT_MODERATION, " & _
                  "F.F_MODERATION " & _
          "FROM " & strTablePrefix & "TOPICS T, " & _
                    strTablePrefix & "CATEGORY C, " & _
                    strTablePrefix & "FORUM F " & _
          "WHERE T.T_ISEVENT=1 " & _
          "AND   T_EVENT_DATE > '" & datetostr(DateValue(strForumTimeAdjust)) & "' " & _
          "AND   T_EVENT_DATE < '" & datetostr(DateValue(strForumTimeAdjust)+intUpcomingPeriod) & "' " & _
          "AND   F.FORUM_ID = T.FORUM_ID " & _
          "AND   C.CAT_ID = T.CAT_ID " & _
          "ORDER BY T.T_EVENT_DATE Asc"

set rs = Server.CreateObject("ADODB.Recordset")
if strDBtype = "mysql" then rs.MaxRecords = intEventstoDisplay
rs.open StrSql, My_conn

If rs.EOF then
    Response.Write "<DIV class=""listitem"">" & strCalNoUpcoming & "</DIV>" & vbnewline
else do while not rs.eof
    Topic_ID = rs("TOPIC_ID")
    Topic_Subject = rs("T_SUBJECT")
    Forum_ID = rs("FORUM_ID")
    Topic_Status = rs("T_STATUS")
    Event_Date = StrToDate(rs("T_EVENT_DATE"))
    Cat_Moderation = rs("CAT_MODERATION")
    Forum_Moderation = rs("F_MODERATION")
	Topic_Message = rs("T_MESSAGE")

    '*****************************************************************
    'Code for Topic Moderation and Private Forums
    if mLev = 4 then
        AdminAllowed = 1
        ForumChkSkipAllowed = 1
    elseif mLev = 3 then
        if chkForumModerator(Forum_ID, chkString(strDBNTUserName,"decode")) = "1" then
            AdminAllowed = 1
            ForumChkSkipAllowed = 1
        else
            if lcase(strNoCookies) = "1" then
                AdminAllowed = 1
                ForumChkSkipAllowed = 0
            else
                AdminAllowed = 0
                ForumChkSkipAllowed = 0
            end if
        end if
    elseif lcase(strNoCookies) = "1" then
        AdminAllowed = 1
        ForumChkSkipAllowed = 0
    else   
        AdminAllowed = 0
        ForumChkSkipAllowed = 0
    end if

    if strPrivateForums = "1" and ForumChkSkipAllowed <> "1" then
        forumAccess = ChkForumAccess(Forum_ID, MemberID, false)
    else
        forumAccess = true
    end if
    
    if strModeration > 0 and Cat_Moderation > 0 and Forum_Moderation > 0 and AdminAllowed = 0 then
            Moderation = "Y"
    else
            Moderation = "N"
    end if
    '*****************************************************************



    if forumAccess and not(Moderation = "Y" and Topic_Status > 1 and Topic_Author <> MemberID) then
    if Event_Date <> Previous_Event_Date then
        Response.Write  "<DIV class=""listitem"">" & Day(Event_Date) &  " " & MonthName(Month(Event_Date)) & " " & Year(Event_Date) & "<DIV>" & vbnewline
	end if
	Response.Write  "<DIV class=""indented""><SPAN class=""spnMessageText""><b>·</b> <A href=""topic.asp?TOPIC_ID=" & Topic_ID & """title=""" & ChkString(left(RemoveForumCode(RemoveHTML(Topic_Message)), 1000), "tooltip") & """>" & Topic_Subject & "</A></SPAN></DIV>"
    end if
	Previous_Event_Date = Event_Date
    rs.movenext
    loop
end if
rs.close
set rs = nothing
End Sub 'WriteUpcomingEventsPeriod


Ok, for defining the period, I have added a constant to cal_constants.asp:
Added this code at line 24:

'### Length in days of upcoming period ###
Const intUpcomingPeriod = 31


Ok, now the work is nearly done:
Change cal_default.asp, at the place the current sub is requested (line 119)
Added the bold parts:


Response.Write  "   <TD width=""33%"" bgcolor=""" & strForumCellColor & """ valign=""top"" class=""smallfont""><b>" & strCalUpcoming & "</b><br><small>within the next " & intUpcomingPeriod & " days</small><br /> " & vbNewLine
WriteUpcomingEventsPeriod


That's it!
The same could be done for the recent events, limiting it to a period of days to show recent events.

Just call for WriteUpcomingEventsPeriod instead of WriteUpcomingEvents where you want to use this code.

Hope this one is usefull to anyone. If anyone's interested, I could post the fully modded files here, which has these changes in all functions.

portfolio - linkshrinker - oxle - twitter

Edited by - MarcelG on 16 May 2003 14:26:16

Etymon
Advanced Member

United States
2385 Posts

Posted - 16 May 2003 :  14:33:11  Show Profile  Visit Etymon's Homepage
quote:

Hope this one is usefull to anyone. If anyone's interested, I could post the fully modded files here, which has these changes in all functions.



Hi marcelgoertz,

I think your MOD is useful. I would like to see it as a downloadable MOD. Thank you for the code! Might you have a demo site to see it in action?

Thanks again,

Etymon
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 16 May 2003 :  19:54:41  Show Profile  Visit MarcelG's Homepage
Etymon, I will post the modded files as soon as possible (I can get my hands on the code when I get back to work on monday).
Unfortunately I don't have a demo site, as I use this code on our Intranet site at work.

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 18 May 2003 :  00:40:29  Show Profile  Visit Etymon's Homepage
That's fine on the demo site. Just was wanting to compare my results with how it's supposed to work and look.

No hurry on the MOD really. The Calendar MOD by Red1 is one of my favorite MODs, and I like the addon's people offer for it.

Thanks for sharing,

Etymon
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.17 seconds. Powered By: Snitz Forums 2000 Version 3.4.07