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
<!--- | |
A brief example on how to use the 'CustomUI' option when creating a class extension in Mura CMS. | |
This example assumes you have an extended attribute called 'Page/Book'. | |
It also assumes you have an attribute set using the 'CustomUI' container/tab assignment. | |
Any extended attributes you assign to the attribute set, you are responsible for collecting | |
that data using your own form fields. Make sure the 'name' and 'id' attributes match the | |
names you've used when you created the extended attributes! For example, if you have an | |
extended attribute with a name of 'bookPublisher', make sure you have a form field with an | |
'id' and 'name' attribute of 'bookPublisher'. Check your casing too! |
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
<cfscript> | |
// Example of how to get a CSV report of all content items | |
// Drop this under a temp directory under the Mura webroot | |
// You could explicitly set this to any siteid you want, if desired | |
if ( !IsDefined('$') ) { | |
siteid = StructKeyExists(session, 'siteid') ? session.siteid : 'default'; | |
$ = application.serviceFactory.getBean('$').init(siteid); | |
} |
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
<!--- Drop these in the Theme or a Plugin eventHandler.cfc (global events won't work in the Site Handler) ---> | |
<cfset variables.passwordexpired = false /> | |
<!--- Custom method to determine if password is expired ---> | |
<cffunction name="isPasswordExpired" output="false"> | |
<cfargument name="userBean" required="true" /> | |
<cfset var daysUntilExpired = 90 /> | |
<cfset var expires = DateAdd('d', daysUntilExpired, arguments.userBean.getValue('passwordcreated')) /> | |
<cfreturn DateCompare(expires, Now()) eq 1 ? false : true /> |
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
<!--- Drop this in your Site or Theme eventHandler.cfc ---> | |
<cffunction name="onAfterFormSubmitSave"> | |
<cfargument name="$"> | |
<cfset var msg = '' /> | |
<cfset var formBean = $.event().getValue('formBean') /> | |
<cfset var formResultBean = $.event().getValue('formDataBean') /> | |
<cfset var formResultStruct = $.event().getValue('formDataBean').getValue('formResult') /> | |
<cfif formBean.getTitle() eq 'Your Desired Form Title'> | |
<cfsavecontent variable="msg"> |
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
<cfscript> | |
public any function onAfterUserSave($) { | |
// reference to new user bean | |
var user = arguments.$.event('userBean'); | |
// reference to old user bean | |
//var oldUserBean = arguments.$.getBean('user').loadBy(userid=user.getUserID()); | |
// reference to content item that will be the parent of the 'User' page | |
var parentbean = $.getBean('content').loadBy(title='Reps'); |
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
<!--- | |
https://gist.github.com/stevewithington/18a6ef38e7234f1e1fc3 | |
1) Drop this in your Site or Theme contentRenderer.cfc | |
2) To use, drop the following line of code in your layout template, and modify as you wish: | |
#$.getUpcomingEventsByFeedname(feedname='Your Feed Name', maxMonths=2, groupDailyEvents=true)# | |
---> | |
<cffunction name="getUpcomingEventsByFeedname"> | |
<cfargument name="feedName" type="string" required="true" /> | |
<cfargument name="maxMonths" type="numeric" default="3" /> | |
<cfargument name="groupDailyEvents" default="true" /> |
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
<!--- | |
1) Drop this method in your /config/cfapplication.cfm and modify it as you wish. | |
For example, maybe you only want to allow front end tools if editing the site behind your firewall | |
---> | |
<cfscript> | |
public boolean function getEnableFrontEndTools() { | |
return getPageContext().getRequest().getServerName() == 'someURLAccessibleOnlyBehindYourFirewall.com'; | |
} | |
</cfscript> |
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
<cfscript> | |
// This will NOT work unless you have 'allowlocalfiles=true' in /config/settings.ini.cfm | |
// example path to files | |
try { | |
filepath = ExpandPath('./files'); | |
} catch(any e) { | |
filepath = ExpandPath('./'); | |
} |
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
<cfset itKids = $.content().getKidsIterator() /> | |
<cfif itKids.hasNext()> | |
<ul> | |
<cfloop condition="itKids.hasNext()"> | |
<li> | |
<cfscript> | |
item = itKids.next(); | |
fileid = item.getValue('fileid'); | |
if ( item.hasImage() ) { |