Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 9

CurtisOdenericgilletteleafmonster +6 guests

Countdown Calendar

This discussion is related to the Countdown Calendar addon.
Countdown Calendar
«1

Comments

  • Is this what used to be called the "Gig Calendar"?
  • Posts: 840
    It's always been called Countdown Calendar, it's just that in the code it still says 'Gig Calendar' yeah, I can change it though if you guys want.
  • Posts: 2,610
    When you post the next update it might prevent questions like that ;)
  • Posts: 2,419
    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...
    pic 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');" pic
    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)

  • Posts: 5,574
    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?
  • Posts: 2,419
    extensions/Calendar/cal.txt

    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)

  • Posts: 1,406
    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.
  • Posts: 2,419
    More details please jimw?

    Posted: Saturday, 10 March 2007 at 8:17AM (AEDT)

  • Posts: 1,406
    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
  • Posts: 2,419
    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.

    Posted: Sunday, 11 March 2007 at 11:22AM (AEDT)

  • Posts: 2,419
    jimw your fix stopped the preview error but the calendar still does not appear.

    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)

  • Posts: 840
    Because you're too dumb to set it up? Typical Mac mentality ;-)
  • Posts: 2,419
    Maybe if the instructions were not completely wrong...
    pic 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');" pic
    Typical lazy, amateur programmer wannabe! (Regardless of Mac or PC Mentality!) pic

    Posted: Monday, 12 March 2007 at 9:49AM (AEDT)

  • Posts: 840
    As long as it works, I couldn't really give a damn how it does it :)
  • Posts: 2,419
    I fixed it.

    Posted: Sunday, 18 March 2007 at 7:46PM (AEDT)

  • Posts: 1,406
    Here is one other thing I modified code which seems to work for me.

    if($Context->Session->User->Preference('CalendarEnabled') && isset($Head))
  • Posts: 2,419
    I also adjusted the time zone as it was a little off for down-under...

    $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)

  • Posts: 1,406
    Sounds like it's working now. That's good.
  • Posts: 206
    @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!
  • Posts: 2,419
    And...
    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)

  • Posts: 206
    @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.
  • Posts: 206
    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?';

    $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);
    }
    ?>
  • Posts: 840
    You're an absolute star, thanks icouto! I've updated the php files accordingly.
  • Uploaded version 1.2 of Countdown Calendar.
  • Posts: 50
    i have installed this extension and enable the calendar from my account page but its not showing.
  • Posts: 2,419
    Do you have a future date in the .txt file?

    Once the dates pass, nothing is displayed.

    Posted: Thursday, 22 March 2007 at 10:26AM (AEDT)

  • Posts: 50
    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"

    the "fsfdfs" part is my comment text
  • Posts: 2,419
    See this: Countdown Calendar # 10

    Posted: Thursday, 22 March 2007 at 11:09AM (AEDT)

  • Posts: 206
    @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:

    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');
  • I'm getting an "Undefined offset" on line 31 on default.php error when I install the extension.

    Any ideas?
This discussion has been closed.