Last active
December 29, 2016 15:31
-
-
Save stevewithington/7340758 to your computer and use it in GitHub Desktop.
Mura CMS : This is an example of how you could modify the link output of a Mura CMS calendar. This example adds the start and end times to each calendar event.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
To alter the link output of Mura's calendar, you could drop these custom methods into your contentRenderer.cfc | |
(either the Site or Theme, it doesn't matter). | |
Then, copy the entire directory located under /{SiteID}/includes/display_objects/calendar/ | |
and paste it under either the /custom/ directory, or under your theme at: | |
/{SiteID}/includes/themes/{ThemeName}/display_objects/ | |
Finally, open the dsp_dp_showmonth.cfm file, and change the call to dspNestedNav() to $.dspCalendarNav() | |
---> | |
<cffunction name="dspCalendarNav" output="false" returntype="string"> | |
<cfargument name="contentid" type="string"> | |
<cfargument name="viewDepth" type="numeric" required="true" default="1"> | |
<cfargument name="currDepth" type="numeric" required="true" default="1"> | |
<cfargument name="type" type="string" default="default"> | |
<cfargument name="today" type="date" default="#now()#"> | |
<cfargument name="class" type="string" default="#$.getContentRenderer().ulTopClass#"> | |
<cfargument name="querystring" type="string" default=""> | |
<cfargument name="sortBy" type="string" default="orderno"> | |
<cfargument name="sortDirection" type="string" default="asc"> | |
<cfargument name="context" type="string" default="#$.globalConfig().getContext()#"> | |
<cfargument name="stub" type="string" default="#$.globalConfig().getStub()#"> | |
<cfargument name="categoryID" type="string" default=""> | |
<cfargument name="relatedID" type="string" default=""> | |
<cfargument name="rs" required="true" default=""> | |
<cfargument name="size" required="true" default="#$.getContentRenderer().navsize#"> | |
<cfargument name="itemClass" type="string" default="mura-calendar-item"> | |
<cfscript> | |
var rsSection = arguments.rs; | |
var adjust = 0; | |
var link = ''; | |
var isCurrent = false; | |
var nest = ''; | |
var subnav = false; | |
var theNav = ''; | |
var linkArgs = {}; | |
var started = false; | |
if ( !isQuery(rsSection) ) { | |
rsSection = $.getBean('contentGateway').getKids( | |
'00000000000000000000000000000000000' | |
, $.event('siteID') | |
, arguments.contentid | |
, arguments.type | |
, arguments.today | |
, Val(arguments.size) | |
, '' | |
, 0 | |
, arguments.sortBy | |
, arguments.sortDirection | |
, arguments.categoryID | |
, arguments.relatedID | |
); | |
} | |
</cfscript> | |
<cfif rsSection.recordcount and ((variables.event.getValue('r').restrict and variables.event.getValue('r').allow) or (not variables.event.getValue('r').restrict))> | |
<cfset adjust=rsSection.recordcount> | |
<cfsavecontent variable="theNav"> | |
<cfoutput> | |
<cfloop query="rsSection"> | |
<cfif $.allowLink(rssection.restricted,rssection.restrictgroups,variables.event.getValue('r').loggedIn)> | |
<cfsilent> | |
<cfscript> | |
linkArgs = { | |
type = rsSection.type | |
, filename = rsSection.filename | |
, title = rsSection.menutitle | |
, contentid = rsSection.contentid | |
, target = rsSection.target | |
, targetParams = rsSection.targetParams | |
, siteID = $.event('siteID') | |
, querystring = arguments.querystring | |
}; | |
link = addCalendarLink(argumentCollection=linkArgs); | |
</cfscript> | |
</cfsilent> | |
<cfif not started> | |
<cfset started=true> | |
<ul class="#arguments.class#"> | |
</cfif> | |
<li class="#arguments.itemClass#"> | |
#link# | |
</li> | |
<cfelse> | |
<cfset adjust=adjust-1> | |
</cfif> | |
</cfloop> | |
<cfif started></ul></cfif> | |
</cfoutput> | |
</cfsavecontent> | |
</cfif> | |
<cfreturn theNav /> | |
</cffunction> | |
<cffunction name="addCalendarlink" output="false" returntype="string"> | |
<cfargument name="type" required="true"> | |
<cfargument name="filename" required="true"> | |
<cfargument name="title" required="true"> | |
<cfargument name="target" type="string" default=""> | |
<cfargument name="targetParams" type="string" default=""> | |
<cfargument name="contentid" required="true"> | |
<cfargument name="siteid" required="true"> | |
<cfargument name="querystring" type="string" default=""> | |
<cfargument name="context" type="string" default="#$.globalConfig().getContext()#"> | |
<cfargument name="stub" type="string" default="#$.globalConfig().getStub()#"> | |
<cfargument name="indexFile" type="string" default=""> | |
<cfargument name="class" type="string" default="mura-calendar-link"> | |
<cfargument name="complete" type="boolean" default="false"> | |
<cfargument name="id" type="string" default=""> | |
<cfscript> | |
var link = ''; | |
var theClass = arguments.class; | |
var href=$.createHREF( | |
arguments.type | |
,arguments.filename | |
,arguments.siteid | |
,arguments.contentid | |
,arguments.target | |
,iif(arguments.filename eq $.event('contentBean').getfilename(),de(''),de(arguments.targetParams)) | |
,arguments.queryString | |
,arguments.context | |
,arguments.stub | |
,arguments.indexFile | |
,arguments.complete | |
,false | |
); | |
var cBean = $.getBean('content').loadBy(contentid=arguments.contentid); | |
if ( !cBean.getIsNew() ) | |
timeStart = cBean.getValue('displayStart'); | |
timeEnd = cBean.getValue('displayStop'); | |
link = '<div class="mura-calendar-link-wrapper"><a href="' & href & '"'; | |
if ( Len(arguments.id) ) { | |
link &= 'id="' & arguments.id & '"'; | |
} | |
link &= 'class="' & arguments.class & '">'; | |
link &= HTMLEditFormat(arguments.title); | |
if ( Len(timeEnd) ) { | |
link &= '<br><span class="event-time">' & LSTimeFormat(timeStart, 'short') & ' - ' & LSTimeFormat(timeEnd, 'short') & '</span>'; | |
} | |
link &= '</a></div>'; | |
} | |
return link; | |
</cfscript> | |
</cffunction> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- You could also paste this into the index.cfm file for some custom styling ---> | |
<style type="text/css"> | |
.event-time { | |
font-size: 0.75em; | |
} | |
.mura-calendar-link-wrapper { | |
margin: 0.75em 0; | |
padding: 0.5em; | |
background-color: #ddd; | |
} | |
</style> |
I just updated this Gist, but simply change line 25 to:
<cfargument name="size" required="true" default="#$.getContentRenderer().navsize#">
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get the following message on mura 6.1