Skip to content

Instantly share code, notes, and snippets.

View davidpanzarella's full-sized avatar

David Panzarella davidpanzarella

View GitHub Profile
@timmaybrown
timmaybrown / customJSON.cfc
Last active March 4, 2016 04:12
Here is a component that extends Ben Nadel's JSON Serializer CFC (http://www.bennadel.com/blog/2505-JsonSerializer-cfc-A-Data-Serialization-Utility-For-ColdFusion.htm) and uses the jsonUTIL project in lieu of native CF serialization to fix some known issues. This approach uses a CFDirectory call to find all my persistent CFCs (in this case they …
<cfcomponent extends="model.util.jsonSerializer" singleton="true">
<cfproperty name="jsonUTIL" inject="model" />
<cffunction name="init">
<!---// let's init Mr. Nadel's serializer--->
<cfset super.init()>
<!--- FOR Reference: PROPERTIES THAT ARE AVAILABLE due to the SUPER.init() call above
// Every key is added to the full key list.
@stevewithington
stevewithington / muraRelatedContent.cfm
Last active May 7, 2020 08:33
Mura CMS : Related Content Iterators and outputting extended attributes
<cfoutput>
<cfscript>
// Content Bean of the Section of the site to narrow feed down to
cBean = $.getBean('content').loadBy(title='Blog');
// Feed Bean
fBean = $.getBean('feed');
fBean.addParam(
relationship='and'
@stevewithington
stevewithington / muraExtendedAttributes.cfm
Last active December 14, 2023 10:42
Mura CMS : In version 6.1, you can now obtain a Content Bean's extended attributes as a struct, and even pass in the Extend Set Name to get specific sets of extended attributes.
<cfoutput>
<cfscript>
// Access all of the current content bean's extended attributes
$.content().getExtendedAttributes();
// Access a specific Extend Set's attributes of the current content bean
$.content().getExtendedAttributes(name='Your Extend Set Name Goes Here');
// Access a query/recordset of the current content bean's extended attributes
$.content().getExtendedAttributesQuery();
@modmedia
modmedia / muraCreateContentNodeFromForm.cfm
Last active December 27, 2015 14:39
Create a Mura content node from a Mura form
<!--- Drop this into your site eventhandler.cfc --->
<cffunction name="onAfterFormSubmitSave" output="true">
<cfif $.event('formid') EQ '{ID of the Mura form}'>
<!--- Get the form result --->
<cfset formBean = $.event().getValue('formresult')>
<!--- Get a new content bean --->
<cfset cBean = application.contentManager.getBean()>
<!--- Set the new node attributes --->
<cfset cBean.setSiteID($.event('siteid'))>
@stevewithington
stevewithington / muraRequiredSummary.cfm
Created November 15, 2013 04:21
Mura CMS : This is an example of how to make the Summary field a required field. You could use this example to make pretty much any other field, including extended attributes, required as well.
<cfscript>
// Drop this in your Site or Theme eventHandler.cfc
public any function onBeforeContentSave($) {
// reference to the newBean
var newBean = arguments.$.event('newBean');
// reference to the original contentBean
var oldBean = arguments.$.event('contentBean');
// example on how to create some errors
var error = '';
@stevewithington
stevewithington / muraSourceImage.cfm
Created November 26, 2013 21:15
Mura CMS : If you're attempting to store "source" images in your Mura CMS, then you will want to modify your /config/settings.ini.cfm file. Then, you may also want to customize the default Gallery output and add a link to download the "Source" image.
<!--- Add this to your /config/settings.ini.cfm --->
maxsourceimagewidth=99999
<!---
As long as the source image width is less than the value (in pixels) entered above,
then the source image will NOT be modified at all
--->
<!---
Then, you will probably want to copy the '/display_objects/gallery/' directory,
@modmedia
modmedia / muraSubmitFormDataToSalesForce.cfm
Last active December 29, 2015 15:09
Submit data from a Mura form to Sales Force
<cffunction name="onAfterFormSubmitSave">
<cfargument name="$">
<cfif $.content('title') eq "{content Title}">
<!--- Send Sales Leads to SalesForce --->
<cfhttp method="post" url="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
<cfhttpparam type="formfield" name="oid" value="XXXXXXXXXXX"/>
<cfhttpparam type="formfield" name="retURL" value="http://www.domain.com"/>
<!---
<cfhttpparam type="formfield" name="debug" value="1"/>
<cfhttpparam type="formfield" name="debugEmail" value="[email protected]"/>
@stevewithington
stevewithington / muraColumnizeFolderContent1.cfm
Last active December 30, 2015 12:49
Mura CMS : This example shows how you could columnize Folder content quickly, and easily.
<!---
Drop this into your config.xml.cfm file, then reload the application
to create a new Folder/Columns content type
--->
<extension type="Folder" subType="Columns">
<attributeset name="Column Settings" container="Basic">
<attribute
name="columnCount"
label="# Columns"
hint="Select the number of columns you wish to split the body area into."
@stevewithington
stevewithington / muraFindAndReplace.cfm
Last active April 25, 2019 04:08
Mura CMS : Find old links in Mura CMS and replace/update them with new ones, quickly and easily with this little script.
<cfscript>
// place this in your Site or Theme eventHandler.cfc, then reload your application!
public any function onApplicationLoad($) {
arguments.$.getBean('contentUtility').findAndReplace(
find='http://olddomain.com'
, replace='http://newdomain.com'
, siteid=arguments.$.event('siteid')
);
}
</cfscript>
@stevewithington
stevewithington / onAdminHTMLFootRender.cfm
Created December 11, 2013 22:23
Mura CMS : How to add a custom link to Mura's Admin navigation.
<cfscript>
// Add this to an eventHandler.cfc
public any function onAdminHTMLFootRender($) {
var str = '';
// this will add a link to the bottom of the 'Modules' button in the back end admin area
savecontent variable='str' {
WriteOutput('<script>
jQuery(document).ready(function($){
$("##navSecondary").append(''<li><a href="/some-url/"><i class="icon-cog fa-cog"></i> Some URL</a></li>'');
});