All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ect.velocity.sakai-velocity-tool.23.2.source-code.VM_chef_library.vm Maven / Gradle / Ivy

There is a newer version: 23.3
Show newest version
#* ------------------------------------------------------------------
#
# 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 flash notifications
 *# ------------------------------------------------------------------
#macro (chef_flashnotif)
	#if($flashNotif)
		
$flashNotif $flashNotifCloseTitle
#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 #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) #end #* ------------------------------------------------------------------ # This allows you to link to JavaScript and have it automatically version the URLs # ------------------------------------------------------------------ *# #macro (javascript $url) #end #* ------------------------------------------------------------------ # This allows you to link to a JavaScript module and have it automatically version the URLs # ------------------------------------------------------------------ *# #macro (module $url) #end #* ------------------------------------------------------------------ # This allows you to link to CSS and have it automatically version the URLs # ------------------------------------------------------------------ *# #macro (css $url $attrs) #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 (toolLinkParam $toolLinkJunk $toolLinkAction $toolLinkQuery)$sakai_ActionURL.setParameter("sakai_action","$toolLinkAction").setQueryString("$toolLinkQuery")#end #macro (siteLink $siteId)${config.getPortalUrl()}/site/${siteId}#end #* ----------------------------------------------------------------------------------- # Adds a view filter dropdown to the page. Intended for use in a sakai-table-toolbar. # Requires spinner.js to be loaded on the page. # ----------------------------------------------------------------------------------- *# #macro (viewFilterPanel $panelName $selectName $selectOptions $actionKey) #set($libLink="#libraryLink('js/sakai-table-toolbar/viewFilterPanelMacro.js')")
$tlang.getString("gen.listnavselect")
#end ## viewFilterPanel #* ----------------------------------------------------------------------------------- # Adds a table pager to the page. Intended for use in a sakai-table-toolbar. # Requires spinner.js to be loaded on the page. # ----------------------------------------------------------------------------------- *# #macro (pagerPanel $panelName) #set($libLink="#libraryLink('js/sakai-table-toolbar/pagerPanelMacro.js')") #if(!$allMsgNumber)#set($allMsgNumber = 0)#end #if(!$topMsgPos || $allMsgNumber == 0) #set($topMsgPos = 0) #end #if(!$btmMsgPos || $allMsgNumber == 0) #set($btmMsgPos = 0) #end #if($allMsgNumber == 0) #set($goFPButton = "false") #set($goPPButton = "false") #set($goNPButton = "false") #set($goLPButton = "false") #end #if(!$goLPButton) #set($goLPButton = "false") #end
$tlang.getFormattedMessage("gen.viewing.phrase", $topMsgPos, $btmMsgPos, $allMsgNumber)
$tlang.getString("gen.first") $tlang.getFormattedMessage('gen.previous.pagesize', $pagesize)
$tlang.getString("gen.listnavselect")
$tlang.getFormattedMessage('gen.next.pagesize', $pagesize) $tlang.getString('gen.last')
#end ## pagerPanel #* ----------------------------------------------------------------------------------- # Adds a search filter to the page. Intended for use in a sakai-table-toolbar. # Requires spinner.js to be loaded on the page. # ----------------------------------------------------------------------------------- *# #macro (searchFilterPanel $panelName $userSearchTerm $searchActionKey $clearSearchActionKey)
#if($!userSearchTerm && !$userSearchTerm.isEmpty()) #end
#set($libLink="#libraryLink('js/sakai-table-toolbar/searchFilterPanelMacro.js')") #end ## searchFilterPanel




© 2015 - 2024 Weber Informatics LLC | Privacy Policy