HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

updated it and I want to help more

Hey I had to make some changes to a few objects for the following:
loading a forum before clicking new discussion was not showing the date fields
the dates under discussion and discussions were not being formatted correctly by GND_Format:Date
the event calendar display did not hide the overlay div for the event when not hovering

These are all fixed and working here:
http://narwhalsonfire.com/eventcalendar/2015/07

I'd also like to continue working on this to extend some of the behavior you seem to have started. Would you mind letting me jump in?

Comments

  • R_JR_J Admin

    That would be great! I will check if I have the sources on github and upload them if not when I'm on my desktop pc again - right now I'm typing with my mobile.

  • R_JR_J Admin

    It's on GitHub: https://github.com/R-J/EventCalendar

    If you want to improve something, feel free to send a pull request!

  • Thanks! Also, this will be my first time working on a plugin to this extent. I'm searching through the docs on vanillaforums.org for info...

    In particular I'd like to read up on class defs for changes to class.eventcalendar.plugin.php. I want to replace the the date field array with the datepicker provided by jQuery here:
    https://jqueryui.com/datepicker/

  • R_JR_J Admin

    This is the code that adds the (Vanilla) date input: https://github.com/R-J/EventCalendar/blob/master/class.eventcalendar.plugin.php#L140-L146

     $HtmlOut = <<< EOT
    <div class="P EventCalendarInput{$Hidden}">
    {$Sender->Form->Label('Event Date', 'EventCalendarDate')}
    {$Sender->Form->Date('EventCalendarDate', array('YearRange' => $YearRange, 'fields' => array('day', 'month', 'year')))}
    </div>
    EOT;
    echo $HtmlOut;
    

    The datepicker code uses this html:

    <p>Date: <input type="text" id="datepicker"></p>
    

    This script turns an input box into the datepicker:

    $(function() {
    $( "#datepicker" ).datepicker();
    });
    

    I must admit I never tried something like that, but I would insert a textbox instead of a datecontrol and use the jquery ".on" command to bind that datepicker() command to this textbox.

    Just ask if you need more guidance.

  • sweet, got that part working...just need to to figure out validation... the applyrule call is rejecting my test value of 06/23/2015 which i expect might be due to formatting.

  • I just shifted the format and it works fine...I would prefer to change the validation if the m/d/Y format is acceptable.

  • R_JR_J Admin

    @shumoo said:
    sweet, got that part working...just need to to figure out validation... the applyrule call is rejecting my test value of 06/23/2015 which i expect might be due to formatting.

    First the explanation: it is quite easy to understand what should happen here $Sender->Validation->ApplyRule('EventCalendarDate', 'Date', T('The event date you\'ve entered is invalid'));
    But you have to look at Vanillas source to exactly understand that ;)

    The class.validation.php calls the function "ValidatDate" in functions.validation.php in order to validate a date. Looking through that function shows you why your format fails // Dates should be in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format and looking further through that function proves, that there is no way to change this format.


    But that doesn't mean that you cannot use another format, you simply have to validate it in another way.

    If you had taken a look at the class.validation.php you can see what that class offers for us. Take a look at "AddValidationResult()".
    You can manually set those validation error messages without using Vanillas validation rules. Replacing that "... ApplyRule... 'Date' ..." from above with $Sender->Validation->AddValidationResult('EventCalendarDate', T('The event date you\'ve entered is invalid')); will always add our "wrong date format" error.
    But you do not want it always, but only

    if $Sender->EventArguments['FormPostValues']['EventCalendarDate'] has not format m/d/Y

    I would have to google that, too, so I leave it up to you ;)

Sign In or Register to comment.