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> | |
// add to an event handler | |
public any function onContentEditMessageRender(event, m) { | |
// reference to the event, if needed | |
var e = arguments.event; | |
// could also get a reference to event via Mura Scope | |
var mse = arguments.m.event(); | |
// this example merely shows how to render a simple message |
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
<!--- | |
NOTE: | |
In Mura 6, using '$.dspObject(object='component', objectid='Some Component')' in a layout template | |
would generate a pencil icon for content manager to edit the component from the front-end view of the site. | |
In Mura 7, we have migrated to using a layout manager for front-end edits. However, this old functionality no longer works. | |
So, here's a workaround to accomplish something very similar to the functionality in Mura 6. | |
1. Under your theme, create a directory labeled 'content_types' if it doesn't already exist | |
2. Under the 'content_types' directory, create another directory labeled 'component' |
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
<script> | |
Mura.DisplayObject.Form.reopen({ | |
onAfterRender: function() { | |
//this.context.targetEl is a pointer to the dom element that contains the rendered Mura form. | |
var container = Mura(this.context.targetEl); | |
console.log(this.context.targetEl); | |
} |
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
<!--- | |
Use to display mobile specific content (assumes you have an attribute called 'mobilebody') | |
---> | |
<cfset mybody = request.muramobilerequest == 1 | |
&& YesNoFormat(m.content('hasmobilebody')) | |
&& Len(m.content('mobilebody')) | |
? m.content('mobilebody') | |
: m.content('body') /> |
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
<!--- Force Image Resave for All Images ---> | |
<cfset application.serviceFactory.getBean('fileManager').rebuildImageCache(siteid='YOURSITEID')> | |
<!--- or to just reset a specific image size you can use ---> | |
<cfset application.serviceFactory.getBean('fileManager').rebuildImageCache(siteid='YOURSITEID' ,size='YOURSIZE')> |
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"> |