-
Notifications
You must be signed in to change notification settings - Fork 8
/
contentRenderer.cfc
executable file
·159 lines (137 loc) · 6.84 KB
/
contentRenderer.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!--- This file is part of Mura CMS.
Mura CMS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, Version 2 of the License.
Mura CMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mura CMS. If not, see <http://www.gnu.org/licenses/>.
Linking Mura CMS statically or dynamically with other modules constitutes the preparation of a derivative work based on
Mura CMS. Thus, the terms and conditions of the GNU General Public License version 2 ("GPL") cover the entire combined work.
However, as a special exception, the copyright holders of Mura CMS grant you permission to combine Mura CMS with programs
or libraries that are released under the GNU Lesser General Public License version 2.1.
In addition, as a special exception, the copyright holders of Mura CMS grant you permission to combine Mura CMS with
independent software modules (plugins, themes and bundles), and to distribute these plugins, themes and bundles without
Mura CMS under the license of your choice, provided that you follow these specific guidelines:
Your custom code
• Must not alter any default objects in the Mura CMS database and
• May not alter the default display of the Mura CMS logo within Mura CMS and
• Must not alter any files in the following directories.
/admin/
/tasks/
/config/
/requirements/mura/
/Application.cfc
/index.cfm
/MuraProxy.cfc
You may copy and distribute Mura CMS with a plug-in, theme or bundle that meets the above guidelines as a combined work
under the terms of GPL for Mura CMS, provided that you include the source code of that other code when and as the GNU GPL
requires distribution of source code.
For clarity, if you create a modified version of Mura CMS, you are not obligated to grant this special exception for your
modified version; it is your choice whether to do so, or to make such modified version available under the GNU General Public License
version 2 without this exception. You may, if you choose, apply this exception to your own modified versions of Mura CMS.
--->
<cfcomponent extends="mura.cfobject">
<!--- Add theme-specific methods here --->
<cffunction name="dspCarouselByFeedName" output="false">
<cfargument name="feedName" type="string" default="Slideshow" />
<cfargument name="showCaption" type="boolean" default="true" />
<cfargument name="cssID" type="string" default="myCarousel" />
<cfargument name="size" type="string" default="custom" hint="If you want to use a custom height/width, then use 'custom' ... otherwise, you can use 'small, medium, large' OR any other predefined custom image size 'name' you created via the back-end administrator." />
<cfargument name="width" type="numeric" default="1280" hint="width in pixels" />
<cfargument name="height" type="numeric" default="500" hint="height in pixels" />
<cfargument name="interval" type="any" default="5000" hint="Use either milliseconds OR use 'false' to NOT auto-advance to next slide." />
<cfargument name="autoStart" type="boolean" default="true" />
<cfscript>
var local = {};
local.imageArgs = {};
if ( not ListFindNoCase('small,medium,large,custom', arguments.size) and variables.$.getBean('imageSize').loadBy(name=arguments.size,siteID=variables.$.event('siteID')).getIsNew() ) {
arguments.size = 'custom';
};
if ( not Len(Trim(arguments.size)) or LCase(arguments.size) eq 'custom' ) {
local.imageArgs.width = Val(arguments.width);
local.imageArgs.height = Val(arguments.height);
} else {
local.imageArgs.size = arguments.size;
};
</cfscript>
<cfsavecontent variable="local.str"><cfoutput>
<!--- BEGIN: Bootstrap Carousel --->
<!--- IMPORTANT: This will only output items that have associated images --->
<cfset local.feed = variables.$.getBean('feed').loadBy(name=arguments.feedName)>
<cfset local.iterator = local.feed.getIterator()>
<cfif local.iterator.hasNext()>
<div id="#arguments.cssID#" class="carousel slide" data-interval="#arguments.interval#">
<!--- Carousel items --->
<div class="carousel-inner">
<cfset local.idx = 0>
<cfloop condition="local.iterator.hasNext()">
<cfset local.item=iterator.next()>
<cfif ListFindNoCase('jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
<cfset local.idx++>
<!--- row-fluid class on this fixes Firefox bug where slide height gets wonky on transition due to resizing of image via media queries --->
<div class="row-fluid item<cfif local.idx eq 1> active</cfif>">
<img src="#local.item.getImageURL(argumentCollection=local.imageArgs)#" alt="#HTMLEditFormat(local.item.getTitle())#">
<cfif arguments.showCaption>
<div class="carousel-caption">
<h4><a href="#local.item.getURL()#">#HTMLEditFormat(local.item.getTitle())#</a></h4>
#local.item.getSummary()#
</div>
</cfif>
</div>
</cfif>
</cfloop>
</div>
<cfif local.idx>
<!--- Carousel nav --->
<cfif local.idx gt 1>
<a class="left carousel-control" href="###arguments.cssID#" data-slide="prev">‹</a>
<a class="right carousel-control" href="###arguments.cssID#" data-slide="next">›</a>
<!--- AutoStart --->
<cfif arguments.autoStart>
<script>jQuery(document).ready(function($){$('###arguments.cssID#').carousel({interval:#arguments.interval#});});</script>
</cfif>
</cfif>
<cfelse>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button>
<h4>Oh snap!</h4>
Your feed has no items <em>with images</em>.
</div>
</cfif>
</div>
<cfelse>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button>
<h4>Heads up!</h4>
Your feed has no items.
</div>
</cfif>
<!--- // END: Bootstrap Carousel --->
</cfoutput></cfsavecontent>
<cfreturn local.str />
</cffunction>
<cffunction name="getMBUseFluid" output="false">
<cfscript>
var local = {};
try {
local.useFluid = YesNoFormat(variables.$.siteConfig('mbUseFluid'));
} catch(any e) {
return false;
};
if ( local.useFluid ) {
return true;
} else {
return false;
};
</cfscript>
</cffunction>
<cffunction name="getMBContainerClass" output="false">
<cfreturn IIF(getMBUseFluid(), DE('container-fluid'), DE('container'))>
</cffunction>
<cffunction name="getMBRowClass" output="false">
<cfreturn IIF(getMBUseFluid(), DE('row-fluid'), DE('row'))>
</cffunction>
</cfcomponent>