[:"red"]WARNING: THERE ARE SOME ERRORS IN THE DOCUMENTATION FOR THIS HACK. YOU MAY WANT TO DELAY USING THIS HACK UNTIL THE ERRORS HAVE BEEN CORRECTED.[/]
Code
NAME: Calendar <br />VERSION: Dave_L.0.1 (temporary until someone decides what number this should be) <br />DESCRIPTION: Enables one or more forums to be used as event calendars. <br />WORKING UNDER: UBB.threads 6.2br2 <br />PREREQUISITES: none <br />AUTHORS: Gamejag, Max Fisch, Allen Ayers, Dave_L <br />CREDITS: JustDave, Lunatik and others <br />DEMO: none <br />FILES ALTERED: postlist.php, showthreaded.php (optional changes) <br />DATABASE ALTERED: yes <br />NEW FILES: addevent.php, newevent.php, postlist_event.php, <br /> templates/default/addevent_preview.tmpl, templates/default/newevent.tmpl, <br /> images/red_arrow.gif, images/red_arrow_1.gif <br /> <br />HISTORY: <br /> 2002-12-18 Dave_L Dave_L.0.0 <br /> Updated for UBB.threads 6.2 <br /> Use user's time zone offset and date/time format display preferences. <br /> Moved most of the postlist.php changes to a separate file postlist_event.php. <br /> Moved events table query in postlist_event.php out of loop for efficiency. <br /> 2002-12-18 Dave_L Dave_L.0.1 <br /> Corrected description above.
2) I didn't know what version this should be. Until someone else decides this, I temporarily numbered it "Dave_L.0.0".
3) As an experiment, I provided most of the change-instructions using BeyondCompare file-difference-report files.
-----------------------------
Updated to version Dave_L.0.1 - the only change was correcting the description above. I had copied the header info from another hack, and forgot to change it.
I don't have the hack installed on a public site. You might check the older calendar thread(s) to see if someone has a demo site. The 6.2 hack is basically the same as version 3.0.
You think you can tell me how to read a beyond compare difference report? I see nowhere in beyond compare to load it? I am missing something here. I can not read this to be able to install it.
LOL I know I figured that out after beating myself over the head for asking such a stupid question. Just had me all turned around with the beyond compare thing. I was looking for some special thing until I woke up and brought them up in the browser.
I was wondering... - Does this use any kind of cache. I read in the previous version that large boards may have problems with it. I have a reasonably large baord, so I'm concerned.
For the postlist, the number of queries was reduced by fetching all the events for a month with one query. The old version did a separate query for each day of the month.
Was there a way to populate the calendar with the Birthdates automatically? I thought I saw that somewhere, but I can't find it. Maybe it was never done?
From what I could see this should be the latest and the greatest version of this mod, so I closed the other thread that was open. Please correct me if I'm wrong, I don't use the mod myself so I haven't really followed the development of it.
I based the version I posted here on the latest version I could find in the other thread, so closing the other thread probably makes sense, now that 6.2 is released.
I hereby turn over maintenance of this hack to ... everyone.
The first task is to decide on a better version number.
I think this hack developed to be one of the "must-have"s for everyone. What a pity that this calender does not support language files yet. And for international versions it is essential to be able to - exchange AM/PM against a 24hrs display - switch to a display where Monday is 1st day of the week intstead of sunday.
Of course we could try to develope a German version from it (and discuss it on the German board), embedding the neccessary changes. The problem would be only that then two separate calendar hacks would be to maintain instead of only one, a situation that imho. should be avoided....
Also I want to draw your attention again to a wonderful hack that combines Josh's phantastic BIRTHDAY hack with this cool one: it is displaying all found birthdays automatically in the calendar. This hack is burried deep inside this thread: https://ubbdev.com/threads/php/...page=&view=&sb=5&o=&vc=1 Although I don't get it working with the new calendar hack, I think it is well worth not to be forgotten
Am I missing somthing i have had the hack installed for ages, but just went to upgrade to this version and the installation was fine but the addpost.php instructions seem all wrong, is this hack ok for 6.2 RC ?
I cant find this bit for instance: // ------------------------------------------------------------- // If HTML is off then we need to get rid of < and > in the body if ( ($convert != "html") && ($convert !="both") ) { $PrintBody = str_replace("<","<",$PrintBody); $PrintBody = str_replace(">",">",$PrintBody); } $html -> send_header($ubbt_lang['PREV_POST'],$Cat,0,$user,$Extra,$ReadPerm);
I have this which is near // ------------------------------------------------------------- // If HTML is off then we need to get rid of < and > in the body if ( ($convert != "html") && ($convert !="both") ) { $PrintBody = str_replace("<","<",$PrintBody); $PrintBody = str_replace(">",">",$PrintBody); } else { // No server side includes $PrintBody = preg_replace("/<!--(.|\n)*-->/","",$PrintBody); }
well, installed it, but it's not working! i dont get no calendar appearing, also no error messages to enable me to de-bug! ideas?? i probably buggered up on the editing of the files, because they didnt tally up, so i had to give it an educated guess!
I've started using this hack on my production board, and have decided it needs several changes. If I have time, I'd like to change it as follows:
1) Get rid of the E_Location column. Many events don't really have a "location", and it would be much easier to just use the thread title instead. This would also simplify the installation of the hack, since many of the changes are only needed to support the location column.
2) Get rid of the E_Time column. This is unnecessary, since the E_Date column contains both the date and time.
3) Get rid of the other unused columns: E_Duration, E_Recurring, E_Recurtype, E_End, E_Frequency, E_Days. They could always be added back in later if support for them were needed.
4) Add a column E_AdjustTime. If 1, the event date/time is adjusted according to the viewer's time zone offset. If 0, the event date/time is not adjusted. The former setting would be appropriate for online events, the latter for "physical" events.
5) Add support for editing the date/time of an event.
6) Add changes to showflat.php for displaying the event date/time.
7) Add dimopoulos's changes that use the Profile Birthdays modification to populate the birthdays automatically.
Any feedback on these changes?
------- Update:
I've revised the hack to effect all of the above changes except for 4, 5 and 7. (7 is a new item referred to in a post below.) I'm trying to figure out if 4 is feasible, and how much effort 5 will take. I've also updated the hack for UBB.threads 6.2.1, which should be released very soon. I'll try to get all this done, including fixing the documentation, within the next few days.
------- Update:
Due to time constraints, I'm abandoning work on this hack. With the above changes, it's gotten far too complicated, is incompatible with the current version, and maintaining it will be too much of a headache.
the location part is very important to me. because i run a car website, the calendar (will be, if i ever get it working) to post up dates and locations of meets throughout the country.
<br /> [:"blue"]$lowdate = mktime(0, 0, 0, $month, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00 <br /> $highdate = mktime(0, 0, 0, $month+1, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of next month, time 00:00:00 <br /> $birthMonth = mktime( 0, 0, 0, $month, 1, $year );[/] <br /> $Board_q = addslashes($Board); <br />
and CHANGE it to
Code
<br /> [:"blue"]$lowdate = mktime(0, 0, 0, $month, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00[/] <br /> [:"blue"]$highdate = mktime(0, 0, 0, $month+1, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of next month, time 00:00:00[/] <br /> <br /> $events_for_month = array(); <br />// 20030113 - Birthday Update New Start <br /> // Construct the query to check for the birthday modification <br /> $strQuery = " <br /> SHOW FIELDS <br /> FROM {$config['tbprefix']}Users <br /> "; <br /> <br /> $result = $dbh -> do_query($strQuery); <br /> <br /> $intFieldsFound = 0; <br /> <br /> // Cycle through the fields and increase the counter where appropriate <br /> while ( $arrDataLine = $dbh -> fetch_array($result) ) <br /> { <br /> if ( $arrDataLine[0] == "U_BirthYear" ) { $intFieldsFound++; }; <br /> if ( $arrDataLine[0] == "U_BirthDay" ) { $intFieldsFound++; }; <br /> if ( $arrDataLine[0] == "U_BirthMonth" ) { $intFieldsFound++; }; <br /> <br /> // Exit the loop if all three fields have been found <br /> if ( $intFieldsFound == 3 ) <br /> { <br /> break; <br /> } <br /> } <br /> <br /> $dbh -> finish_sth($result); <br /> <br /> if ( $intFieldsFound == 3 ) <br /> { <br /> $query = " <br /> SELECT U_Username, U_Birthday, U_BirthYear, U_Number <br /> FROM {$config['tbprefix']}Users <br /> WHERE U_BirthMonth = FROM_UNIXTIME($birthMonth,'%b') <br /> ORDER BY U_Username <br /> "; <br /> $result = $dbh->do_query($query); <br /> while(list($bUsername, $bBirthday, $bBirthYear, $bNumber ) = $dbh->fetch_array($result)) <br /> { <br /> <br /> if ( $bBirthYear > 0 ) <br /> { <br /> $bAge = $year - $bBirthYear; <br /> $bExtra = " ($bAge)"; <br /> } <br /> else <br /> { <br /> $bExtra = ""; <br /> } <br /> <br /> $arrData['E_ID'] = 0; <br /> $arrData['E_Date'] = mktime(0, 0, 0, $month, $bBirthday, $year) - $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00 <br /> $arrData['E_Time'] = 0; <br /> $arrData['E_Location'] = "Birthday"; <br /> $arrData['B_Subject'] = "<a href=\"$config[phpurl]/showprofile.php?Cat=$Cat&User=$bNumber&what=\">$bUsername$bExtra</a><br />"; <br /> $arrData['B_Number'] = 0; <br /> $arrData['B_Replies'] = 0; <br /> <br /> $date = getdate($arrData['E_Date'] + $user['U_TimeOffset'] * 3600); <br /> $mday = $date['mday']; <br /> <br /> if (empty($events_for_month[$mday])) <br /> { <br /> $events_for_month[$mday] = array(); <br /> } <br /> array_push($events_for_month[$mday], $arrData); <br /> } <br /> <br /> $dbh->finish_sth($result); <br /> } <br />// 20030113 - Birthday Update New End <br /> <br /> <br /> $Board_q = addslashes($Board); <br />
4. Find this:
Code
<br />// The second parameter MYSQL_ASSOC in the call to sql::to fetch_array() anticipates a <br />// requested change to that method, which will increase efficiency. Until that change <br />// is made, the parameter has no effect, but there's harm in leaving it there. <br /> <br /> $events_for_month = array(); <br /> while($row = $dbh->fetch_array($result, MYSQL_ASSOC)) { <br />
and CHANGE it to this
Code
<br />// The second parameter MYSQL_ASSOC in the call to sql::to fetch_array() anticipates a <br />// requested change to that method, which will increase efficiency. Until that change <br />// is made, the parameter has no effect, but there's harm in leaving it there. <br /> <br /> while($row = $dbh->fetch_array($result, MYSQL_ASSOC)) { <br />
NOTE: The code in [:"blue"]BLUE[/] is in ONE line only and has been split for aesthetic purposes only!
That should do the trick
Warm regards
Nikos
PS: Sorry that it took me so long to get this thing but I have been awfully busy lately
[b]Edit:[b] Fixed small bug with Age calculation when the Age was not set. Added code to check for the Profile Birthday modification and display the birthdays automatically on the calendar. If the modification has not been installed the paricular code will not execute 2002-02-03 - Change to show the correct birthdays for users with time offset
Attached is a custombox6pal.php file which you can use as a birthday pal. If you already use the 6th custom box in your IIP, change its number to something that you don't use.
That suggests that you didn't install the changes correctly. Without seeing the actual file, I can't be more specific, and we're not allowed to post that stuff here.
Make sure that you have followed the instructions as per the modification. When I was installing it, I used the files provided in the attachment, without realizing that I actually need to copy and paste content from existing files and then change some of it.
The modification that I posted you can leave it out for the time being so that you don't get confused. Later on you can apply the modification along with Josh's Birthday 1.4.
If you wish PM me and I can email you my files so that you can compare them and see where you went wrong.
When I have time, I was going to make the changes I proposed several posts ago, which will include redoing the instructions. If the Location column is removed, that should simplify the instructions too.
Maybe my experiment at using BeyondCompare difference files didn't work very well.
If someone else wants to fix the instructions in the meantime, feel free.
Nikos: I'm not sure how to deal with your changes. Should I try to incorporate those into the main hack, or should I just ignore them? On my board, I don't want to populate the calendar with birthdays, but I guess the main hack's documentation could indicate your changes as an option. This is getting complicated.
I agree that we need to put this as an option at the bottom of the instructions. If you want I can put a check in there that will query the fields of the Users table and if the ones for the calendar exist then the code will be executed.
Do you think that this check will increase the overhead on the script, since it will be another query in the database?
include ("$thispath/templates/$tempstyle/postlist.tmpl");
=============================================== I can only find the below so I inserted it there is this correct. This [:"blue"] if (!$debug) [/] {is omitted from the instructions do I keep it in or take it out?
=============================================== // Grab the tablewrapper list($tbopen,$tbclose) = $html -> table_wrapper();
I found the prob with my error.....ell, this one so far..... In the "newevent.htm" instruction file thee is a closing bracket missing as below in [:"blue"]blue (I inserted) [/]
May I suggest a hot cup of tea to get your mind off the computer for a bit and then try and have a go at it? I am sure that it is a small typo that doesn't allow you to proceed.
It is one query per month and it is working as expected. I have updated my previous post above, so go ahead and take it as it is and use it with the instructions.
I hope to be able to look at and post updating instructions here maybe by this weekend. I've installed this for several clients and it's worked.. but I don't think the instructions were exactly right. (In other words some code may have changed from when this was written to the current version).
I've just been too busy to look at updating it, but it's on my list. Maybe that will help.
I've posted a status update here. You're welcome to post corrected documentation if you like. In any case, I'll try to post the updated hack, with correct documentation, within the next few days.
Do you know how I can hide the time that shows on the calendar as lots of my things don't have a time as yet, or maybe left blank instead of having a time that is wrong displaying?
Coincidentally, one of the changes I'm adding is a checkbox to hide the time when you post an event.
With the current hack, I think if you manually set the w3t_Events.E_Time field to 0 with a database query, that will hide the event time on the postlist (calendar display).
In the current mod, there is no way to set the time to 0, since it defaults to a time on its own from the form. What Liahona though did seems quite reasonable to me, since this is how I used to do it.
Liahona, your query should have done the trick, but that error still bugs me... Any more info?
Is it possible to add a " 0 " (blank) to the list of time, if so how do it, do I just search for "11" in the postlist.php and add lines the same as the others with " 0 " instead of a number?
Due to time constraints, I'm abandoning work on this hack. With the planned changes, it's gotten far too complicated, is incompatible with the current version, and maintaining it will be too much of a headache.
I'm gonna wade right in here with some newbie questions...I need a calendar to work with UBB.x 3.0.4. (Or some other calander I can use on our site if it is not possible to combine with UBB) How would I set this up? If it is a complicated procedure, is it allowable to ask if someone on this list can be hired to do it? I can provide more details if required. Thanks for any help.
UBB version 3? Have you considered upgrading to UBB 6.3 or Threads 6.2. Either forum has hacks that provide a calendar like this one or the calendar mod over at ubbdev.com for UBB 6.3
Actually... if I'm not mistaken.... UBB.x is an infopop hosted solution. (Basically a MySQL version of OpenTopic). Since it's hosted by Infopop, I don't think you can hack or modify any of the scripts, as you don't have access to them. Sorry. You might wish to run UBB.Threads on your own server.. much more flexibility.
Just to inform everyone: I have made a slight change on the my post earlier concerning the integration of Profile Birthdays and Calendar 6.2. It appeared that for users with a time offset other than 0 the modification was moving the user's birthdays as many months forward or backward as the time offset.
Please refer to the previous post concerning this modification. The changes are a new variable declaration ignoring the time offset and the use of that variable in the database query.
Here is my attached instructions. Anyone is welcome to improve upon them. I will not be able to since I am changing a lot in the way the calendar diplays things for my own custom set now.
NOTICE: The time does not seem to wrok properly for the 12:00 hour and selecting am. It will display pm for the link in the calendar. Could this be from the time zone thing implemented?
Maybe this would be a good opportunity to try a conversion to military time??
And while I am thinkin about it. Is there a way to take that date and time of the event posted in teh calendar to display in the actual thread post? I confuse myself sometime if I read something and forgot what day it was listed under in the calendar part.
dont' know if this has been discussed or not, but I think it would be a good idea to add a blank spot in the time selection table. Honestly, I have no idea what time I was born, as well as with holidays and stuff. Just a thought.
I agree that we need to enhace the calendar and it is already on my list of things to do, since Dave_L is quite busy to continue supporting this modification.
The first thing I was working on was to allow for a null time, which will make this an all-day-event (like your birthday or other related events). I think I have something good set up on my machine at home but haven't been able to post anything since I had problems with my isp.
The next thing on my list will be to create an edit screen which will allow you to edit the events and also allow for deletion of the events when the parent post is deleted.
I will keep you posted on the progress and once I have this finished then I can take up on requests
I posted a code change that will delete the event when the related post is deleted a while back in one of the earlier version threads. I'll have to search for it. It's pretty simple though.
Is the event timestamp more than one field? I forget but I don't think it is. I thought Dave_L mentioned something about condensing the time/date fields into a single timestamp. If that's the case then the null value wouldn't work. I guess it's a matter of choice though.
I recall the post of Dave_L regarding the merging of the two fields. At the moment there are two fields one for the date and one for the time, however I don't remember if the time is used. The null value on the time that I was thinking could in effect set the time to be 00:00:00 but also set a new field "AllDayEvent" to yes. this way we can cater for events that will occur at midnight but also get rid of the time if we have an all-day event.
There are also some other fields there for recurrance etc. Those need additional consideration in the future.
I had implemented most of the changes I had talked about, including getting rid of the extra time column, and replacing it with a flag indicating whether the time-of-day should be displayed, or only the date.
One problem with these changes is that they would not be downward-compatible with the current version of this hack, so an "altertable" would be needed.
I had started to add editing capability. It involved changes to a bunch of files (several scripts and several templates). Keeping all of these files up to date when doing version upgrades would have been a big headache.
And then there was the birthdate modification to this hack.
These problems, combined with the fact that I was getting behind on other work, are why I had to abandon work on this hack.
Nikko, if you want, I could give you the changed files, although the changes are incomplete, and they're not fully tested or documented.
I'm wondering if it would be better to make the calendar a separate add-on, rather than a hacked forum.
I wouldn't mind having a look at the implementation although come to think of it your suggestion concerning an addon is far better for future releases of the threads software. Even with the best comments in the code we will have problems.
If you want we can discuss it a bit in private and then come up with a better design. I have already implemented a calendar solution (needs tidying up though and documenting) which could in effect be modified to work as an addon.
Damn! Why does the day have to have only 24 hours and I have to sleep 5 of them
My opinion on the Calendar at this stage is that it would be best served to separate it from inclusion to UBB.Threads...for a few reasons.
1. Easier to install 2. Does not get touched with subsequent UBB.threads upgrades 3. Adds to front page much the same way the "WHO'S ONLINE" hack does...an addition to the template.
I might try messing with the 6.2 a bit, see if I can happily separate it.
I thought more on this and looked at some detail in the code, and it should be fairly easy (as a quick, not a perma thing) to separate out.
1. Copy the w3t_Posts table and name it w3t_EventData 2. DELETE FROM w3t_EventData WHERE B_Board not like 'calendar' (change this to keep only your calendar posts) 3. Copy the modified postlist.php and rename it eventlist.php 4. In the ubbthreads.tmpl write an "IF" statement that says if $Calendar='Y', then the <a href="{$config['phpurl']}/postlist.php?Cat=$Cat&Board={$forum[$c][$f]['Keyword']}"> url should point to eventlist.php instead of postlist.
This might be easier to install once this has had a few iterations with all of you...as we would have 4 separate php pages and a few tmpl pages...and the only UBBThreads page we would have to modify would be the ubbthreads.tmpl. Adding the w3t_Events would stay the same, and we would add a w3t_EventData in a fresh install.
I know I am missing something (passing $Calendar to ubbthreads is first in my head)...but I am sure this would be easy to figure out, and we could then modify this calendar add-on MUCH easier than trying to re-hack it every upgrade.
Actually you can still comment, etc on the above setup. I changed my test board tonight just to see how it would work.
But on the flip side...on my live board I copied postlist.php to eventlist.php - and I copied showflat.php to showevent.php. So I separated the PHP pages, made 2 new templates for them, and voila...I can customize the Events pages AND/OR upgrade UBBThreads - and they stay separate.
hmmm... might be best to start a new thread with the most current code in the first post - even I am a bit lost about which version to use, lots of changes on many pages
[]AllenAyres said: hmmm... might be best to start a new thread with the most current code in the first post - even I am a bit lost about which version to use, lots of changes on many pages [/]
I agree, I really need a Calendar for our forum. We have the calendar hack for our UBB Classic which we are about to migrate over to Threads. Our users love the calendar and couldn't live without it for too long.
I am really confused as to the status of this calendar, who's presently "leading" development of it and which is the most recent download.
A new thread with updated info in the first post would be great.
ExcelsiorDDZ I did not post it that I remember. Oh well, all I konw is that it works and I have not been touching it. See it at www.theddz.com in the gaming calendar section.
Just an FYI. There will be a calendar system in 6.4. It won't be this particular version, rather a standalone system. I won't say much more than that at this time because it's still under development.
ExcelsiorDDZ the first post on page 9 has the attached file that has the updated instructions you posted and yes it does work on your site as well as mine
[]AllenAyres said: hmmm... might be best to start a new thread with the most current code in the first post - even I am a bit lost about which version to use, lots of changes on many pages <img src="/threads/php/images/graemlins/tongue.gif" alt="" /> [/]
Hi,
can someone please paste a link here to a working calendar for 6.2.3
There are so many comments and differents ways described here that I am confused and don't know what to use.
Allens idea to make this a little bit clearer again is welcome
Download the original file in the first post. That should mostly work. I think that download includes the changes found in a later upload as when I reviewed them, I didnt have to make any changes.
If your dates are messed up - then apply my fix above.
Depends on how they do calendars in 6.4 - but if the uses the Posts tables, shouldnt be too hard. If they make a new table, then would probably just be a metter of mapping fields to fields.
Nope the format is entirely different and as this mod was merely a mix match of various versions put together by many people without no-one supporting it an import script is not around.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.