need help with velocity and cascade fullcalendar

eric hassenplug's Avatar

eric hassenplug

28 Jul, 2014 12:50 AM

I need to output the contact name from an event Below is my code, I need to know how to reference the contact name field and use that as the speaker name.

#macro (outputEvent $eventId, $start,$panel_ID)
    #set ($eventSDS = $eventDataHash.get($eventId))
    #set ($startDate = $start) 
    #set ($link = $eventSDS.get("link"))

    #if ($eventSDS.get("title"))
        #set ($title = $eventSDS.get("title"))
    #else
        #set ($title = $eventSDS.get("name"))
    #end
    
    #set ($summary = "") 
    #set ( $summary = $_EscapeTool.xml($eventSDS.get("summary")) )
    #set ($location = "") 
    #set ( $location = $_EscapeTool.xml($eventSDS.get("location")) )
  #set ($contact_name = "") 

    #set ($titleText = $_EscapeTool.xml($title))
    
    #if ($_DateTool.format("m", $startDate) == 0)
        #set ($display_time = $_DateTool.format("h:00 a", $startDate))
    #else
        #set ($display_time = $_DateTool.format("h:m a", $startDate))
    #end
    
    #if ($_DateTool.format("m", $endDate) == 0)
        #set ($display_endtime = $_DateTool.format("h:00 a", $endDate))
    #else
        #set ($display_endtime = $_DateTool.format("h:m a", $endDate))
    #end
    <div class="panel">         
     <div data-toggle="collapse" data-target="#collapse${eventId}" data-parent="#accordion" class="panel-heading">
     <strong class="panel-title"><a style="font-weight:600; color:#695E49;" href="#">${display_time} ${titleText} </a><br />
     Speaker: ${contact_name} </strong></div>
     <div id='collapse${eventId}' class="panel-collapse collapse">
      <strong class="panel-title">
         <div class="panel-body">
           #* <strong>Where:</strong> <br /> *#
            <strong>When:</strong> ${display_time} - ${display_endtime}<br />
            <strong>Description:</strong> ${summary} <br /> <a target="calendar_frame" href="${link}">More Details</a>
         </div>
        </strong>
    </div>
    </div>
#end
  1. 1 Posted by Ryan Griffith on 28 Jul, 2014 02:45 PM

    Ryan Griffith's Avatar

    Hi Eric,

    It looks as though you are almost there, but need to adjust the way you are setting the $contact_name variable.

    I am assuming you are customizing the events landing listing Format, so this will require two updates:

    • Locate the following within the outputEvents macro:
      #set ($eventData = {
      "id": $event.getAttribute("id").value,
      "title": $event.getChild("title").value,
      "name": $event.getChild("name").value,
      "link": $event.getChild("link").value,
      "summary": $event.getChild("summary").value
      })
      
    • Update it to also include your contact name field:
      #set ($eventData = {
      "id": $event.getAttribute("id").value,
      "title": $event.getChild("title").value,
      "name": $event.getChild("name").value,
      "link": $event.getChild("link").value,
      "summary": $event.getChild("summary").value,
      "contact_name": $sds.getChild("contact_name").value
      })
      
    • Update the line within the outputEvent macro that sets the variable:
      #set ($contact_name = $eventSDS.get("contact_name"))
      

    Note: I made some assumptions on how your event Data Definition is set up, so you may need to adjust the way the contact_name field is obtained in the outputEvents macro.

    Please let me know if you have any questions.

    Thanks!

  2. Ryan Griffith closed this discussion on 04 Aug, 2014 12:44 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac