#* ------------------------------------------------------------------ # # The CHEF Velocity Macro library # # To be included in each webapp's velocity file area. # *# ------------------------------------------------------------------ #* ------------------------------------------------------------------ # The standard way to escape text to make it safe for embedding in html *# ------------------------------------------------------------------ #macro (chef_html $txt)$sakai_Validator.escapeHtml($txt)#end #* ------------------------------------------------------------------ # The standard toolbar based on the $sakai_menu definition # Note: url type items don't support form field sending, override other settings, and go to a new window # CSS requirements: navIntraTool inlineForm searchField # portletToolBarDisabled chefToolBarSelected chefToolBarDisabled *# ------------------------------------------------------------------ #macro (chef_toolbar) ## use the standard menu reference #set ($mnu=$sakai_menu) #set($hasItems="false") #foreach ($item in $mnu.Items) #if ($item.IsEnabled || $item.IsChecked || $mnu.Showdisabled) #set($hasItems="true") #end #end #if (($mnu) && (!$mnu.isEmpty()) && ($hasItems=="true")) ## end if "if there's a menu" if #end #end #* ------------------------------------------------------------------ # The standard way to deal with the ToolPortlet Alert *# ------------------------------------------------------------------ #macro (chef_alert) #if(!$sakai_alert.isEmpty())
$sakai_alert.Alert
#end #end #* ------------------------------------------------------------------ # The standard way to deal with the message at the top of a tool *# ------------------------------------------------------------------ #macro (chef_viewmsg $msg)
#chef_html($msg)
#end #* ------------------------------------------------------------------ # The standard way to deal with the message in place of a flat list *# ------------------------------------------------------------------ #macro (chef_listmsg $msg)
#chef_html($msg)
#end #* ------------------------------------------------------------------ # The standard way to start a vm file - deal with fragment or not & css *# ------------------------------------------------------------------ #macro (chef_start) #if ($sakai_fragment=='false') $!{toolTitle} $!sakai_head ## setup wysiwyg editor ########################### This should already be handled by portal or sakai-editor/editor.js #* #set($editor_path = "vm/editor/$!sakai_editor/sakai_header.vm") #parse("$editor_path") *# #if ($frameRefresh) #foreach ($id in $frameRefresh) #end #end #if ($topRefresh) #end #if ($focusChange) #end #end ## no comment #end #* ------------------------------------------------------------------ # Macros for adding content to the header *# ------------------------------------------------------------------ #* ------------------------------------------------------------------ # Prepends a line to the section of the page. # This is useful for adding CSS which should go before the skin CSS # so that it can be easily overridden by the skin. *# ------------------------------------------------------------------ #macro (header_prepend $extra) #set($sakai_head="${extra} ${sakai_head}") #end #* ------------------------------------------------------------------ # Appends a line to the section of the page. # This is useful for adding JavaScript which needs to exist after the # standard JavaScript. *# ------------------------------------------------------------------ #macro (header_append $extra) #set($sakai_head="${sakai_head} ${extra}") #end #* ------------------------------------------------------------------ # The standard way to end a vm file - deal with fragment or not *# ------------------------------------------------------------------ #macro (chef_end) #if ($sakai_fragment=='false')#end #end #* ------------------------------------------------------------------ # The standard way to start a portlet body - end with portletContainerEnd *# ------------------------------------------------------------------ #macro (chef_portletContainer)
#end #* ------------------------------------------------------------------ # The standard way to end a portlet body - started with portletContainer *# ------------------------------------------------------------------ #macro (chef_portletContainerEnd)
#end #* ------------------------------------------------------------------ # The standard way to start a portlet content - end with portletContentEnd *# ------------------------------------------------------------------ #macro (chef_portletContent)
#end #* ------------------------------------------------------------------ # The standard way to end a portlet content - started with portletContent *# ------------------------------------------------------------------ #macro (chef_portletContentEnd)
#end #* ------------------------------------------------------------------ # The standard way to start a flat list view table - end with portletFlatListEnd *# ------------------------------------------------------------------ #macro (chef_portletFlatList $summary) #end #* ------------------------------------------------------------------ # The standard way to end a flat list view table - started with portletFlatList *# ------------------------------------------------------------------ #macro (chef_portletFlatListEnd)
#end #* ------------------------------------------------------------------ # The standard way to setup a date selection widget # # IMPORTANT: ResourceBundle with months referenced by $tlang.getString("jan") # through $tlang.getString("dec") _must_ be defined # # Creates a drop-down date selection, as well as a pop-up date selection # $yearselect_id The name and id attribute of the year selection dropdown list (html SELECT tag) # $monthselect_id The name and id attribute of the month selection dropdown list (html SELECT tag) # $dayselect_id The name and id attribute of the day selection dropdown list (html SELECT tag) # $earliestYear The earliest year to display in the year dropdown (2002 for example) # $latestYear The latest year to display in the year dropdown (2005 for examlple) # $yearSelected The year selected # $monthSelected The month selected # $daySelected The day selected # $dateFormat Locale specific date format pattern # $onChangeAction optional javascript for onchange attribute *# ------------------------------------------------------------------ #macro (chef_dateselectionwidget $yearselect_id $monthselect_id $dayselect_id $earliestYear $latestYear $yearSelected $monthSelected $daySelected $dateFormat $onChangeAction) #set($yearList = [$earliestYear .. $latestYear]) #foreach ( $format in $dateFormat ) #* Create Month Select Box *# #if ($format=="m") #if ($onChangeAction) #end #if ($monthSelected == 1) #else #end #if ($monthSelected == 2) #else #end #if ($monthSelected == 3) #else #end #if ($monthSelected == 4) #else #end #if ($monthSelected == 5) #else #end #if ($monthSelected == 6) #else #end #if ($monthSelected == 7) #else #end #if ($monthSelected == 8) #else #end #if ($monthSelected == 9) #else #end #if ($monthSelected == 10) #else #end #if ($monthSelected == 11) #else #end #if ($monthSelected == 12) #else #end #end #* Create Day Select Box *# #if ($format=="d") #if ($onChangeAction) #end #foreach($d in [1..31]) #if($d == $daySelected) #else #end #end #end #* Create Year Select Box *# #if ($format=="y") #if ($onChangeAction) #end #foreach ($y in $yearList) #if ($y == $yearSelected) #else #end #end #end #end #* Create Date Selection Popup *# #chef_dateselectionwidgetpopup($yearselect_id $monthselect_id $dayselect_id) #end #* ------------------------------------------------------------------ # The standard way to setup a date selection widget # # IMPORTANT: ResourceBundle with months referenced by $tlang.getString("jan") # through $tlang.getString("dec") _must_ be defined # # Creates a drop-down date selection, as well as a pop-up date selection # $yearselect_id The name and id attribute of the year selection dropdown list (html SELECT tag) # $monthselect_id The name and id attribute of the month selection dropdown list (html SELECT tag) # $dayselect_id The name and id attribute of the day selection dropdown list (html SELECT tag) # $earliestYear The earliest year to display in the year dropdown (2002 for example) # $latestYear The latest year to display in the year dropdown (2005 for examlple) # $yearSelected The year selected # $monthSelected The month selected # $daySelected The day selected # $dateFormat Locale specific date format pattern # $monthtitle The title attribute for the month selector # $daytitle The title attribute for the day selector # $yeartitle The title attribute for the year selector # $onChangeAction optional javascript for onchange attribute *# ------------------------------------------------------------------ #macro (chef_dateselectionwidgetwithtitles $yearselect_id $monthselect_id $dayselect_id $earliestYear $latestYear $yearSelected $monthSelected $daySelected $dateFormat $monthtitle $daytitle $yeartitle $onChangeAction) #set($yearList = [$earliestYear .. $latestYear]) #foreach ( $format in $dateFormat ) #* Create Month Select Box *# #if ($format=="m") #if ($onChangeAction) #end #if ($monthSelected == 1) #else #end #if ($monthSelected == 2) #else #end #if ($monthSelected == 3) #else #end #if ($monthSelected == 4) #else #end #if ($monthSelected == 5) #else #end #if ($monthSelected == 6) #else #end #if ($monthSelected == 7) #else #end #if ($monthSelected == 8) #else #end #if ($monthSelected == 9) #else #end #if ($monthSelected == 10) #else #end #if ($monthSelected == 11) #else #end #if ($monthSelected == 12) #else #end #end #* Create Day Select Box *# #if ($format=="d") #if ($onChangeAction) #end #foreach($d in [1..31]) #if($d == $daySelected) #else #end #end #end #* Create Year Select Box *# #if ($format=="y") #if ($onChangeAction) #end #foreach ($y in $yearList) #if ($y == $yearSelected) #else #end #end #end #end #* Create Date Selection Popup *# #chef_dateselectionwidgetpopup($yearselect_id $monthselect_id $dayselect_id) #end #* --------------------------------------------------------------------------------------- # The standard way to instantiate a popup calendar widget that allows the user to select a date # $yearselect_id The id attribute of the year selection dropdown list (html SELECT tag) # $monthselect_id The id attribute of the month selection dropdown list (html SELECT tag) # $dayselect_id The id attribute of the day selection dropdown list (html SELECT tag) # ---------------------------------------------------------------------------------------- *# #macro (chef_dateselectionwidgetpopup $yearselect_id $monthselect_id $dayselect_id) #set ($calendar_title = "") #if ($!tlang.keySet().contains("calendar.title")) #set ($calendar_title = $tlang.getString("calendar.title")) #end ## Everything is in an our own external JavaScript library ## ## Call a JavaScript function from within the library to do setup ## ## Everything is in an our own external JavaScript library ## Call a JavaScript function from within the library to do setup #end #* ------------------------------------------------------------------ # The standard way to instantiate a WYSIWYG formatted text editing widget # $textarea_id - The HTML id of the textarea form element already in the HTML document *# ------------------------------------------------------------------ #macro (chef_setupformattedtextarea $textarea_id) #if (!$is_wireless_device) #end #end #* ------------------------------------------------------------------ # As above but parameters (height, width, toolbar options) are expected # $textarea_id - The HTML id of the textarea form element already in the HTML document *# ------------------------------------------------------------------ #macro (chef_setupformattedtextareaparams $textarea_id $height $width $ToolBarSetChoice) #if (!$is_wireless_device) #end #end #* ------------------------------------------------------------------ # The standard way to instantiate a WYSIWYG full-document editing widget # $textarea_id - The HTML id of the textarea form element already in the HTML document *# ------------------------------------------------------------------ #macro (chef_setuphtmldocumenttextarea $textarea_id) #* ## setup wysiwyg editor #set($editor_path = "vm/editor/$!sakai_editor/sakai_body.vm") #parse("$editor_path") *# #end #macro (sakai_courier) #if ($courier) #end #end #* ------------------------------------------------------------------ # # For CHEF 1.x support # *# ------------------------------------------------------------------ #macro (toolbar $toolbar_mnu) #set($sakai_menu=$toolbar_mnu) #chef_toolbar() #end #macro (toolLink $toolLinkJunk $toolLinkAction)$sakai_ActionURL.setParameter("sakai_action","$toolLinkAction")#end #macro (toolForm $toolFormJunk)$sakai_ActionURL.setAction()#end #macro (imageLink $imageLinkName)$sakai_ActionURL.setResourcePath("${sakai_image_path}${imageLinkName}")#end #macro (scriptLink $scriptName)$sakai_ActionURL.setResourcePath("${sakai_script_path}${scriptName}")#end #macro (libraryLink $path)${sakai_library_path}${path}#end #macro (scheduleLink $scheduleLinkName)/library/schedule/$scheduleLinkName#end #macro (chatlogLink $chatlogLinkPanel)$sakai_ActionURL.setParameter("$param_panel","$chatlogLinkPanel")#end #macro (contentLink $contentLinkPanel)$sakai_ActionURL.setParameter("$param_panel","$contentLinkPanel")#end #macro (contentCourierLink $contentCourierLinkPanel)$sakai_ActionURL.setParameter("$param_panel","$contentCourierLinkPanel")#end #macro (toolLinkParam $toolLinkJunk $toolLinkAction $toolLinkQuery)$sakai_ActionURL.setParameter("sakai_action","$toolLinkAction").setQueryString("$toolLinkQuery")#end