This gadget does not work at all for me. It does however produce the following error when previewing a comment... Warning: fopen(extensions/Calendar/cal.txt): failed to open stream: No such file or directory in /forum/extensions/Calendar/default.php on line 26
Line 26 is $fp = fopen('extensions/Calendar/cal.txt', 'rb'); What is the 'rb' parameter???
Also the readme says...
The calendar text file is currently at a fixed position, please edit this to suit your own calendar's needs by editing this code: "$fp = fopen('extensions/Calendar/cal.txt', 'rb');"
Surely the above is not correct?
Isn't this the line to adjust position?$Panel->AddList('Gig Calendar', 200);
In any case, this add-on is a dud unless it's fixed. Not that I have any gigs to list but I do have a use for it.
It means the calendar *text file* is as a fixed position *within the filesystem* - i.e. it has to be in extensions/calendar/cal.txt (the rb are file handling parameters, i believe rb is 'open as read only' or some such but i dont know off the top of my head) - are you sure that file exists and has suitable permissions?
Yes the file is there, correct capitalisation, permissions seem OK, especially if read-only is required. Even with permission set to 777, still the same error.
I also ran into that error with just going to the Discussions or Categories on my local install. I added the " && isset($Head)"
which seemed to fix it.
I've gotten similar errors with other extensions I've developed locally and with PreviewPost. One solution for me, at least, was to correct the way I was loading the path to the file. So, maybe the isset didn't take care of it. I've changed so many things recently, but I know the path to the file was giving me trouble.
This is what I changed it to:
$fp = fopen($Configuration['APPLICATION_PATH'].'/extensions/Gigs/cal.txt', 'rb'); // Reads the text file
Thanks jimx I'll try this first chance I get. It's Labour Day weekend down under (Melbourne Victoria) so my wife has organised all of my free time! We're going off to yum-cha right now.
Maybe if the instructions were not completely wrong...
The calendar text file is currently at a fixed position, please edit this to suit your own calendar's needs by editing this code: "$fp = fopen('extensions/Calendar/cal.txt', 'rb');"
Typical lazy, amateur programmer wannabe! (Regardless of Mac or PC Mentality!)
@blizeH: thank you for a great add-on!
--------------------------------------------------------
REQUESTS - ESSENTIAL
--------------------------------------------------------
1) in the 'cal.txt' file, put some example text that makes it absolutely clear what the user is supposed to enter, and in what format. I suggest something like:
"Event Title", MM/DD/YY 24:00, "Venue, Location", "http://www.eventurl.com/"
2) yes, please DO change the name from 'Gig Calendar' to 'Countdown Calendar' - including the name in preferences, etc. It is a bit confusing, when we must search the add-on site for 'countdown calendar' but end up with a 'gig calendar' listed. Also, 'gig' is a very specific use for your countdown calendar. Keeping the name generic means it will suit a larger number of uses.
--------------------------------------------------------
REQUESTS - HIGHLY DESIRABLE
--------------------------------------------------------
3) Make an interface in Admin for adding events, rather than manually editing the cal.txt file.
4) Make the calendar able to accept dates in formats other than US only - ie., DD/MM/YY, DD/MM/YYYY, YYYY-MM-DD, etc.
5) Make the calendar multi-lingual (ie., make it compatible with the LanguageSelector add-on by Max_B). Right now, all your interface text seems to be hard-coded into the script.
Once again, many many thanks, and keep up the good work!
@Wanderer: Hmmm, strange... This setting *does* seem to work in my configuration. I've replaced all instances of "Gig Calendar" with "Events", so the code in my installation now looks like this:
$Panel->AddList('Events', 90);
Note the "90" - I've played around with it, so that it now appears where I want it to.
The extension does not work with the new extension update-checker in version 1.1.x. Checking the default.php file, I see that the extension there is named differently from the entry in the add-ons site, and that the version in the file (1.0) is also incorrect (in the add-ons repository it states that this - the current - version is 1.1).
So, although I'm not the original author, I've renamed everything, and added a couple of corrections, as specified in this discussion, and here is my own version of 'default.php', which seems to work just fine. Perhaps the author could update it for us in the add-ons repository, if everyone else checks that this works without too much problem in their own systems:
<?php /* Extension Name: Countdown Calendar Extension Url: http://lussumo.com/community/discussion/3446/ Description: Shows upcoming gigs Version: 1.1 Author: Nick Drew Author Url: http://www.glosunit.co.uk Comments: Huge thanks to SirNot, jimw, and Minisweeper for making this possible. */
$Context->Configuration['PREFERENCE_CalendarEnabled'] = 1; $Context->Dictionary['EnableCalendar'] = 'Enable the countdown calendar?';
if ($diff >= 2592000) // Checks if the time difference is more than a month (roughly translated as 30 days) { $diff = $diff / 2592000; $diff = round($diff); if ($diff < 2) // if there's only one month left, will remove the 's' after month, got to be grammatically correct eh? $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 month left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br><font color="#999999"><i>at '.$venue .'<br />'.$diff.' months left</i></font>', $url); } else if ($diff >= 86400 and $diff < 2592000) // Checks if the time difference is more than a day { $diff = $diff / 86400; $diff = round($diff); if ($diff < 2) // if there's only one day left, will remove the 's' after day $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 day left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />'.$diff.' days left</i></font>', $url); } else if ($diff > 0 and $diff < 86400 ) // Checks if the time difference is less than a day { $diff = $diff / 3600; $diff = round($diff); if ($diff < 2) // if there's only one hour left, will remove the 's' after hour $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 hour left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at' .$venue .'<br />'.$diff.' hours left</i></font>', $url); } } fclose($fp); } ?>
ok i understand and it works now but i found a bug . this mod conflicts with preview mod. when try to preview it says "Warning: fopen(extensions/Calendar/cal.txt) [function.fopen]: failed to open stream: No such file or directory in /home/hebele/public_html/hebel/extensions/Calendar/default.php on line 26 fsfdfs"
@blizeh: I noticed that I was getting the same error reported by abramelin when previewing a post. I followed the link placed above by Wanderer, and corrected line 26 of default.php. It corrects the problem. To make it easier for you:
Comments
It does however produce the following error when previewing a comment...
Warning: fopen(extensions/Calendar/cal.txt): failed to open stream:No such file or directory in /forum/extensions/Calendar/default.php on line 26
Line 26 is
$fp = fopen('extensions/Calendar/cal.txt', 'rb');What is the 'rb' parameter???
Also the readme says... Surely the above is not correct?
Isn't this the line to adjust position?
$Panel->AddList('Gig Calendar', 200);In any case, this add-on is a dud unless it's fixed. Not that I have any gigs to list but I do have a use for it.
Posted: Friday, 9 March 2007 at 2:26PM (AEDT)
Yes the file is there, correct capitalisation, permissions seem OK, especially if read-only is required.
Even with permission set to 777, still the same error.
Posted: Friday, 9 March 2007 at 6:23PM (AEDT)
Posted: Saturday, 10 March 2007 at 8:17AM (AEDT)
It's Labour Day weekend down under (Melbourne Victoria) so my wife has organised all of my free time!
We're going off to yum-cha right now.
Posted: Sunday, 11 March 2007 at 11:22AM (AEDT)
I think, judging from your URL, you have an older version?
The folder is not Gigs in my version, it's Calendar.
Anyway, this is another extension I've added to my don't bother with list.
Posted: Sunday, 11 March 2007 at 4:01PM (AEDT)
Typical lazy, amateur programmer wannabe! (Regardless of Mac or PC Mentality!)
Posted: Monday, 12 March 2007 at 9:49AM (AEDT)
Posted: Sunday, 18 March 2007 at 7:46PM (AEDT)
if($Context->Session->User->Preference('CalendarEnabled') && isset($Head))
$curdate = ($curdate - 54000);It must be getting the time from the server instead of the local computer's clock.
Posted: Monday, 19 March 2007 at 4:47PM (AEDT)
Make this setting actually work so its position in the panel can be adjusted:
$Panel->AddList('Gig Calendar', 200);Currently this is redundant code, removing it has no effect at all.
Posted: Tuesday, 20 March 2007 at 12:26PM (AEDT)
$Panel->AddList('Events', 90);Note the "90" - I've played around with it, so that it now appears where I want it to.
So, although I'm not the original author, I've renamed everything, and added a couple of corrections, as specified in this discussion, and here is my own version of 'default.php', which seems to work just fine. Perhaps the author could update it for us in the add-ons repository, if everyone else checks that this works without too much problem in their own systems:
<?php
/*
Extension Name: Countdown Calendar
Extension Url: http://lussumo.com/community/discussion/3446/
Description: Shows upcoming gigs
Version: 1.1
Author: Nick Drew
Author Url: http://www.glosunit.co.uk
Comments: Huge thanks to SirNot, jimw, and Minisweeper for making this possible.
*/
$Context->Configuration['PREFERENCE_CalendarEnabled'] = 1;
$Context->Dictionary['EnableCalendar'] = 'Enable the countdown calendar?';
$Context->AddToDelegate('PreferencesForm', 'Constructor', 'CountdownCalendar_Preferences');
function CountdownCalendar_Preferences(&$Prefs)
{
if($Prefs->IsPostBack) $Prefs->AddPreference('Calendar', 'EnableCalendar', 'CalendarEnabled');
}
if($Context->Session->User->Preference('CalendarEnabled') && isset($Head))
{
if(!isset($Panel)) return;
$Panel->AddList('Countdown Calendar', 90);
$fp = fopen('extensions/Calendar/cal.txt', 'rb'); // Reads the text file
if(!$fp) return;
while ($row = fgetcsv($fp, 1000))
{
list($title, $date, $venue, $url) = $row;
list($month, $day, $year, $hour, $minute, $second ) = sscanf($date, "%d/%d/%d %d:%d:%d");
$curdate = mktime( $hour, $minute, $second, $month, $day, $year );
$curdate = ($curdate - 54000);
$diff = $curdate - time(); // the number of hours
if ($diff >= 2592000) // Checks if the time difference is more than a month (roughly translated as 30 days)
{
$diff = $diff / 2592000;
$diff = round($diff);
if ($diff < 2) // if there's only one month left, will remove the 's' after month, got to be grammatically correct eh?
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 month left</i></font>', $url);
else
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br><font color="#999999"><i>at '.$venue .'<br />'.$diff.' months left</i></font>', $url);
}
else if ($diff >= 86400 and $diff < 2592000) // Checks if the time difference is more than a day
{
$diff = $diff / 86400;
$diff = round($diff);
if ($diff < 2) // if there's only one day left, will remove the 's' after day
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 day left</i></font>', $url);
else
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />'.$diff.' days left</i></font>', $url);
}
else if ($diff > 0 and $diff < 86400 ) // Checks if the time difference is less than a day
{
$diff = $diff / 3600;
$diff = round($diff);
if ($diff < 2) // if there's only one hour left, will remove the 's' after hour
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 hour left</i></font>', $url);
else
$Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at' .$venue .'<br />'.$diff.' hours left</i></font>', $url);
}
}
fclose($fp);
}
?>
Once the dates pass, nothing is displayed.
Posted: Thursday, 22 March 2007 at 10:26AM (AEDT)
"Warning: fopen(extensions/Calendar/cal.txt) [function.fopen]: failed to open stream: No such file or directory in /home/hebele/public_html/hebel/extensions/Calendar/default.php on line 26
fsfdfs"
the "fsfdfs" part is my comment text
Posted: Thursday, 22 March 2007 at 11:09AM (AEDT)
Line 26 right now is:
$fp = fopen('extensions/Calendar/cal.txt', 'rb');It should be changed to:
$fp = fopen($Configuration['APPLICATION_PATH'].'extensions/Calendar/cal.txt', 'rb');Any ideas?