Jump to:

10845 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 1673 Views
  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    Hello unclecheese,
    I am trying to extend your event_calendar so that I get a rollover popup when I hover the cell <td class="hasEvent">.

    Now I have got the jQuery and CSS worked out so this can popup I just neeed to be able to add another field to the CalendarEvent.php so that I can enter some brief text for the rollover to show, and I need to be able to update what the $LiveCalendarWidget outputs so that it shows:

    <td class=" hasEvent"> <a href="/silverstripe/silverstripe-v2.4.1/calendar/view/20100820">20<span>This is what will show in the rollover popup</span></a></td>

    instead of:

    <td class=" hasEvent"> <a href="/silverstripe/silverstripe-v2.4.1/calendar/view/20100820">20</a></td>

    So that the text in the span is shown on the rollover.

    Are you able to please show me what files I need to modifiy to do this?
    For the adding field part I have only ever done this:

    class ResultsPage extends Page {
    static $db = array(

    'Calendarhovertext' => 'Text'

    );

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new TextField('Calendarhovertext'), 'Content');

    return $fields;
    }

    etc

    I had a look at CalendarEvent.php

    I see

    static $db = array (
          'Recursion' => 'Boolean',
          'CustomRecursionType' => 'Int',
          'DailyInterval' => 'Int',
          'WeeklyInterval' => 'Int',
          'MonthlyInterval' => 'Int',
          'MonthlyRecursionType1' => 'Int',
          'MonthlyRecursionType2' => 'Int',
          'MonthlyIndex' => 'Int',
          'MonthlyDayOfWeek' => 'Int'
          'Rollovertext' => 'Text'
       );

    I presume I add 'Calendarhovertext' => 'Text' to here.

    The public function getCMSFields()
       {
          $f = parent::getCMSFields();

    function looks a bit different than normal, what do I do there???

    If you could please show me how to modify that <td> output and what to do with this field would be great.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    You can just copy LiveCalendarWidget.ss to your theme_dir/templates/Includes and change what you need to.

  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    UncleCheese

    I have copied the LiveCalendarWidget.ss
    to my
    themes/tutorials/templates/Includes

    directory which I am testing on, but it appears that the LiveCalendarWidget.ss is still being read out of the event_calendar/templates directory.

    I did a flush and a dev build but still it gets read from there. Is there anything else I have to do to it?

    Thanks for the help

  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    also UncleCheese I see under LiveCalendarWidget.ss

          <% control Days %>
             <td class="$Today $OutOfMonth $CurrentDay $HasEvent">
              <a href="$ShowDayLink">$Number</a>
             </td>
    <% end_control %>

    Now how do change this control / what is written for this cell for the $HasEvent class only ???

  • UncleCheese
    Avatar
    4085 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    Actually, scratch that. It should go in your parent templates directory, not Includes.

  • UncleCheese
    Avatar
    4085 Posts
  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    ok thanks for that unlcecheese, so now I have

          <% control Days %>
             <td class="$Today $OutOfMonth $CurrentDay">
              <a href="$ShowDayLink">$Number</a>
             </td>
    <% if HasEvent %>
    <td class="$HasEvent">
              <a href="$ShowDayLink">$Number<SPAN>This is my rollover text</SPAN></a>
             </td>
    <% end_if %>
    <% end_control %>

    But now I double up the hasEvent day in my calendar, so I have day 20, I get a cell with has_Event and one without.

    Screenshot
    http://gyazo.com/c2c102c0e2984abc2222679b283db040.png

    How do I stop that?

  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Re: Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class Link to this post

    dont worry unclecheese I worked it out

    <% control Weeks %>
          <tr>

       <% control Days %>
       <% if HasEvent %>
    <td class="$HasEvent">
              <a href="$ShowDayLink">$Number<SPAN>This is my rollover text</SPAN></a>
             </td>
    <% else %>
          
             <td class="$Today $OutOfMonth $CurrentDay">
              <a href="$ShowDayLink">$Number</a>
             </td>

    <% end_if %>
    <% end_control %>
             <td class="showWeek">
    <a title="<% _t('SHOWWEEK','Show week') %>" href="$ShowWeekLink">&laquo;</a>
             </td>

          </tr>
    <% end_control %>

    1673 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.