Skip to content

Instantly share code, notes, and snippets.

View jsieber's full-sized avatar

John Sieber jsieber

  • BlueLine Development
  • Missoula, Montana
View GitHub Profile
@jsieber
jsieber / index.cfm
Created July 31, 2015 18:03
Delete all "link" objects under same parent in Mura CMS
<cfscript>
// This will delete all items that have a type of link under the same parent at this page. Include this to a page in the same parent with the Mura tag.
// writeDump(var=$.content('type'), abort=true);
queryService=new Query();
queryService.setSQL(
'SELECT contentID, siteid
FROM tcontent
WHERE parentID = :parentID
AND siteID = :siteID
ucase(Concat(left(uuid(), 23), right(uuid(),12)))
@jsieber
jsieber / dsp_folder.cfm
Last active August 29, 2015 14:24
Add Category to top of folder content listing if present for specific contentID.
<!--- Place alert about category display if showing blog category results. This is added into a custom version of dsp_Folder.cfm --->
<cfset categoryBean = variables.$.getBean('category').loadBy(categoryID='#variables.$.event('categoryID')#', siteid=variables.$.event('siteid'))>
<cfif len(categoryBean.getName()) and variables.$.content('contentId') eq "2A66AE85-77CB-407F-B3FCD352EC6F64B8">
<div class="alert alert-success">Blog posts in the "#categoryBean.getName()#" category. <a href="/resources/blog">Return</a> to the full blog.</div>
</cfif>
@jsieber
jsieber / dsp_login.cfm
Created February 19, 2015 20:51
custom returnLoginCheck
<cfif variables.$.event('expired') eq true>
<div class="alert alert-error">#variables.$.rbKey('user.forgotexpired')#</div>
</cfif>
@jsieber
jsieber / updateattributes.cfm
Created November 5, 2014 20:06
Update Display, Nav and Search Exclude attributes in child pages
<cfoutput>
<!--- Read out an existing node from the default site.--->
<cfset contentBean=application.contentManager.getActiveContent('59280367-A98E-4F7D-B4463B3E405054FD','default')>
<!--- Pull out a content iterator of the nodes child content (all underlying pages within a given node).--->
<cfset it=contentBean.getKidsIterator(liveOnly='false') />
<!--- The number of Items to be listed is determined by the content.getNextN() value. Its default is 10. --->
<cfset it.setPage(1)>
<!--- You can also set the start row instead of setting a page number. --->
<cfset it.setStartRow(1)>
<!--- Stick this in to your theme/remote/rebuild.cfm --->
<cfset application.serviceFactory.getBean('fileManager').rebuildImageCache(siteid='YOURSITEID')>
<!---
Place this file in your theme remote folder
--->
<cfscript>
// add the content ID of the folder you wish to loop through and turn on
itemID=''
content=$.getBean('content').loadBy(contentID=itemID);
// Only get the feed if it's a valid node
<cfscript>
// This will NOT work unless you have 'allowlocalfiles=true' in /config/settings.ini.cfm
// read image info on local file for default value
try {
ir = ImageRead('steve-withington.jpg');
img = ir.source;
} catch(any e) {
img = '';
}
<cfscript>
// drop this in your eventHandler.cfc
public void function onSiteCKFinderConfig($) {
var config = arguments.$.event('config');
// Override CKFinder's default image compression settings to allow for hi-res images
config.images.maxWidth = 0;
config.images.maxHeight = 0;
config.images.quality = 100;
@jsieber
jsieber / eventHandler.cfc
Last active December 14, 2023 10:18
Mura CMS release date at top of content
function onPageBodyRender($) {
// add release date to top of blog posts. Include contentID of parent in if statement.
if ($.content('parentID') eq '57B92471-11BA-4759-937182D9ADED7226') {
return "<p id='releaseDate'><i class='ion-calendar'></i> #dateformat($.content('releaseDate'), 'medium')# #timeFormat($.content('releaseDate'), 'medium')#</p>" & $.setDynamicContent($.content('body'));
}
}