Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

Steve Withington stevewithington

⛑️
solving problems
View GitHub Profile
@stevewithington
stevewithington / muraCalendarUtilityExamples.cfm
Last active April 27, 2018 19:17
Mura CMS : New CalendarUtility Bean Usage Examples
<cfscript>
// 1) Drop these methods into your Theme or Site contentRenderer.cfc
// 2) Create a component called 'Upcoming Events' and using the Mura tag, call [m]$.getUpcomingEvents(calendarid='Events')[/m]
// 3) You can also control how many months of data you wish to retrieve and the maxItems to return
// For example: [m]$.getUpcomingEvents(calendarid='Events', months=3, maxItems=3)[/m]
// NOTE: The code examples assume you have a 'Calendar' with a Title of 'Events'
public any function getUpcomingEvents(
string calendarid=''
, string feedid = ''
, numeric months=3
@stevewithington
stevewithington / muraFullCalendar.cfm
Last active August 29, 2015 14:05
Mura CMS : How to override default Calendar display with FullCalendar, a jQuery plugin
<cfscript>
// Drop this in your Site or Theme eventHandler.cfc
public string function onCalendarDefaultBodyRender(event, $) {
var str = '';
savecontent variable='str' {
WriteOutput(arguments.$.dspInclude('display_objects/fullcalendar/index.cfm'));
}
return str;
}
@stevewithington
stevewithington / muraJavaSettingsExample.cfm
Last active December 14, 2023 09:58
Mura CMS : JavaSettings LoadPaths example
<cfscript>
/*
Assuming you have downloaded and extracted the OpenCSV project from http://opencsv.sourceforge.net
you will then need to grab the file from /deploy/opencsv-2.x.jar file, and add it to one of your
registered javaSettingsLoadPaths directories.
You _may_ have to restart CF for the libraries to get registered.
*/
// full filesystem path to the file
@stevewithington
stevewithington / nav_kids.cfm
Created August 26, 2014 22:29
Mura CMS : Custom Kids Only Nav
<!---
Drop this into your theme's display_objects directory,
then include it on your template using $.dspThemeInclude('display_objects/nav_kids.cfm')
--->
<cfset itKids = $.content().getKidsIterator().setNextN(0) />
<cfoutput>
<ul class="navSecondary">
<li class="current">
<a class="current" href="#$.content('url')#">#$.content('menuTitle')#</a>
<cfif itKids.hasNext()>
@stevewithington
stevewithington / muraOnAfterContentSave.cfm
Last active December 18, 2017 10:54
Mura CMS : How to reference information about a content item after it's been saved
<cfscript>
public any function onAfterContentSave($) {
// reference the new bean that was created
var newBean = arguments.$.event('contentBean');
// reference to the OLD bean
var oldBean = arguments.$.event('activeBean'); // can also use 'currentBean' to access the same bean
// you can now reference any of the attributes of the new bean ...
WriteDump(var=newBean.getAllValues(), abort=true);
@stevewithington
stevewithington / esapiEncode.cfm
Last active August 29, 2015 14:05
Mura CMS : esapiEncode() for Adobe ColdFusion
<cfif Not StructKeyExists(server, 'railo')>
<cffunction name="esapiEncode" output="false" returntype="string">
<cfargument name="encodeFor" type="string" default="html" hint="encode for what, valid values are: - css: for output inside Cascading Style Sheets (CSS) - dn: for output in LDAP Distinguished Names - html: for output inside HTML - html_attr: for output inside HTML Attributes - javascript: for output inside Javascript - ldap: for output in LDAP queries - url: for output in URL - vbscript: for output inside vbscript - xml: for output inside XML - xml_attr: for output inside XML Attributes - xpath: for output in XPath">
<cfargument name="inputString" type="string" required="true" hint="Required. String to encode">
<cfscript>
var lc = {};
var encodedString = '';
lc.encoder = CreateObject("java", "org.owasp.esapi.ESAPI").encoder();
switch(arguments.encodeFor) {
@stevewithington
stevewithington / muraAltTheme.cfm
Created August 19, 2014 16:21
Mura CMS : How to dynamically alter which theme Mura will use
<cfscript>
// drop this in your Site eventHandler.cfc
public any function onRenderStart(event, $) {
arguments.$.event('altTheme', 'MyTheme');
}
// this assumes you have a theme directory called 'MyTheme' of course
</cfscript>
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@stevewithington
stevewithington / mura-content-tab-event-example.cfm
Last active April 27, 2018 19:17
Mura CMS : Example of how to use one of Mura's Content Tab Events to display a Custom UI field.
<!---
Place this method in your Site, Theme, or Plugin's eventHandler.cfc
See http://docs.getmura.com/v6/back-end/events/content-tab-events/ for more Content Tab Events
--->
<cffunction name="onContentTabBasicTopRender">
<cfset var local = {} />
<!--- This assumes you've created some extended attributes to account for each custom form field --->
<cfsavecontent variable="local.str">
<div class="fieldset">
<div class="form-group control-group">
@stevewithington
stevewithington / muraFW1Example.cfm
Last active August 29, 2015 14:05
MuraFW1 Example : How to allow for arguments in display objects.
<cfscript>
// Let's say you want to pass in some arguments to the file located under /includes/displayObjects.cfc. For example:
public any function dspMuraFW1App3($, someArg='', anotherArg='Something') {
param name='request.context' default='#{}#';
StructAppend(request.context.myArgs, arguments);
// now they'll be available in your subapps as rc.myArgs.argName
return getApplication().doAction('app3:main.default');
}
</cfscript>