-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontentRenderer.cfc
executable file
·176 lines (146 loc) · 5.29 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
This file is part of the Escape Velocity Mura CMS Theme
*/
component extends="mura.cfobject" output="false" {
/*
This is the THEME contentRenderer.cfc
* Add theme-specific methods here
* Any methods here will be accessible with the following notation:
$.yourFunctionName()
*/
// contentRenderer settings
// GENERAL
this.jsLib = 'jquery';
this.jsLibLoaded = true;
this.suppressWhitespace = false;
//this.showInlineEditor=true;
// layout manager
this.layoutmanager=true;
this.legacyObjects=false;
// nav
this.ulTopClass = '';
// wrappers
this.generalWrapperClass = 'box';
this.navWrapperClass = this.generalWrapperClass;
this.tagCloudWrapperClass = this.generalWrapperClass;
//this.userToolsWrapperClass = this.generalWrapperClass;
// headings
this.headline = 'h1';
this.subHead1 = 'h2';
this.subHead2 = 'h3';
this.subHead3 = 'h4';
this.subHead4 = 'h5';
// buttons
this.customButtonClass = 'button button-style1';
this.customButtonClassAlt = 'button button-style3';
this.searchResultWrapperClass='';
this.searchResultsRowClass='';
this.searchResultsMoreResultsRowClass='';
this.searchAgainRowClass='';
this.searchFormSubmitClass=this.customButtonClass;
this.searchAgainSubmitClass=this.customButtonClass;
this.loginWrapperClass='';
this.formButtonClass=this.customButtonClass;
this.commentSubmitButtonClass=this.customButtonClass;
this.formBuilderSubmitClass=this.customButtonClass;
this.loginFormSubmitClass=this.customButtonClass;
this.mailingListSubmitClass=this.customButtonClass;
this.userToolsLoginFormSubmitClass=this.customButtonClass;
this.notRegisteredLinkClass=this.customButtonClass;
this.editProfileExtAttributeDownloadButtonClass=this.customButtonClass;
this.editProfileSubmitButtonClass=this.customButtonClass;
this.userToolsLoginFormSubmitClass=this.customButtonClass;
this.userToolsNotRegisteredLinkClass=this.customButtonClass;
this.userToolsEditProfileLinkClass=this.customButtonClass;
this.userToolsLogoutLinkClass=this.customButtonClassAlt;
// Custom List Properties
this.contentListPropertyMap={
containerEl={tag='div'}
, itemEl={tag='dl'}
, labelEl={tag='span'}
, title={tag='dt', class='list-title'}
, date={tag='dt'}
, credits={tag='dd',showLabel=true,rbkey='list.by'}
, tags={tag='dd',showLabel=true,labelDelim=':',rbkey='tagcloud.tags'}
, rating={tag='dd',showLabel=true,labelDelim=':',rbkey='list.rating'}
, 'default'={tag='dd'}
};
// custom theme methods
public any function getSectionTitle() {
return variables.$.getCrumbVarByLevel('title', 1);
}
public any function dspReleaseDate() {
return IsDate(variables.$.content('releaseDate'))
? LSDateFormat(variables.$.content('releaseDate'), 'long')
: '';
}
public any function getHomeBean() {
return variables.$.getBean('content').loadby(filename='');
}
public string function dspBackgroundImage() {
var img = variables.$.getURLForImage(fileid=getHomeBean().getValue('headerBackgroundImage'), size='headerbackgroundimage');
return Len(img)
? '<style>##header-wrapper{background-image:url(' & img & ');size:cover;}</style>'
: '';
}
// class extension specific methods
// helper for RSS Feeds
public any function convertFeedDateTime(string httpDateTime) {
return IsDate(arguments.httpDateTime)
? LSDateFormat(ParseDateTime(arguments.httpDateTime), 'long')
: 'invalid';
}
// used to populate selectbox class extensions with a list of feeds
public any function getLocalFeeds() {
return variables.$.getBean('feedManager').getFeeds(siteid=variables.$.event('siteid'), type='local');
}
public any function getLocalFeedNames() {
var rs = getLocalFeeds();
return rs.getRecordcount()
? ValueList(rs.name, '^')
: 'No Content Collections Exist!';
}
// Helpers
public any function dspComponent(string componentid) {
return variables.$.dspObject(
object='component'
, objectid=arguments.componentid
);
}
public any function dspNoFeedNotice(feedName='') {
return '<h3>The #HTMLEditFormat(arguments.feedName)# Content Collection Does Not Exist</h3><p>Go to <strong>Modules > Content Collections</strong> and create it!</p>';
}
public any function dspNoItemsNotice() {
return '<h3>No items exist yet.</h3>';
}
public any function columnizeFeed(
string feedName=''
, string feedHeading=''
, numeric maxItems=6
, numeric columnCount=3
, string readMoreText=''
) {
var local = {};
local.item = '';
local.str = '';
local.feed = variables.$.getBean('feed')
.loadBy(name=arguments.feedName)
.setMaxItems(Val(arguments.maxItems))
.setNextN(Val(arguments.maxItems));
local.it = local.feed.getIterator();
local.totalItems = it.getRecordcount();
local.itemsPerRow = Val(arguments.columnCount) > 0 ? Val(arguments.columnCount) : 1;
local.itemsPerColumn = Round(totalItems/itemsPerRow);
local.columnClass = Round(12/arguments.columnCount) & 'u';
savecontent variable="str" {
if ( feed.getIsNew() ) {
WriteOutput(dspNoFeedNotice(feedName=arguments.feedName));
} else if ( !totalItems ) {
WriteOutput(dspNoItemsNotice());
} else {
include 'content_types/component_feedcolumns/index.cfm';
}
}
return str;
}
}