root/trunk/website/blog/index.cfm @ 15

Revision 5, 12.8 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true>
2<cfprocessingdirective pageencoding="utf-8">
3<!---
4        Name         : Index
5        Author       : Raymond Camden
6        Created      : February 10, 2003
7        Last Updated : May 18, 2007
8        History      : Reset history for version 5.0
9                                 : Link for more entries fixed (rkc 6/25/06)
10                                 : Gravatar support (rkc 7/8/06)
11                                 : Cleanup of area shown when no entries exist (rkc 7/15/06)
12                                 : Use of rb(), use of icons, other small mods (rkc 8/20/06)
13                                 : Change how categories are handled (rkc 9/17/06)
14                                 : Big change to cut down on whitespace (rkc 11/30/06)
15                                 : comment mod support (rkc 12/7/06)
16                                 : gravatar fix, thanks Pete F (rkc 12/26/06)
17                                 : use app.maxentries, digg link (rkc 2/28/07)
18                                 : fix bug where 11 items showed up, not 10 (rkc 5/18/07)
19        Purpose          : Blog home page
20--->
21
22<!--- Handle URL variables to figure out how we will get betting stuff. --->
23<cfmodule template="tags/getmode.cfm" r_params="params"/>
24
25<!--- only cache on home page --->
26<cfset disabled = false>
27<cfif url.mode is not "" or len(cgi.query_string) or not structIsEmpty(form)>
28        <cfset disabled = true>
29</cfif>
30
31<cfmodule template="tags/scopecache.cfm" cachename="#application.applicationname#" scope="application" disabled="#disabled#" timeout="#application.timeout#">
32
33<!--- Try to get the articles. --->
34<cftry>
35        <cfset articleData = application.blog.getEntries(params)>
36        <cfset articles = articleData.entries>
37        <!--- if using alias, switch mode to entry --->
38        <cfif url.mode is "alias">
39                <cfset url.mode = "entry">
40                <cfset url.entry = articles.id>
41        </cfif>
42        <cfcatch>
43                <cfset articles = queryNew("id")>
44        </cfcatch>
45</cftry>
46
47<!--- Call layout custom tag. --->
48<cfmodule template="tags/layout.cfm">
49
50        <!-- load up swfobject --->
51        <cfoutput>
52        <script src="#application.rooturl#/includes/swfobject_modified.js" type="text/javascript"></script>
53        </cfoutput>
54       
55        <cfset lastDate = "">
56        <cfloop query="articles">
57       
58                <cfoutput><div class="entry<cfif articles.currentRow EQ articles.recordCount>Last</cfif>"></cfoutput>
59               
60                <cfif application.trackbacksallowed>
61                        <!--- output this rdf for auto discovery of trackback links --->
62                        <cfoutput>
63                        <!--
64                        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns##"
65                     xmlns:dc="http://purl.org/dc/elements/1.1/"
66                     xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
67                    <rdf:Description
68                        rdf:about="#application.blog.makeLink(id)#"
69                        dc:identifier="#application.blog.makeLink(id)#"
70                        dc:title="#title#"
71                        trackback:ping="#application.rooturl#/trackback.cfm?#id#" />
72                    </rdf:RDF>
73                        -->
74                        </cfoutput>             
75                </cfif>
76
77                <cfoutput>
78                <h1><a href="#application.blog.makeLink(id)#">#title#</a></h1>
79               
80                <div class="byline">#rb("postedat")# : #application.localeUtils.dateLocaleFormat(posted)# #application.localeUtils.timeLocaleFormat(posted)#
81                <cfif len(name)>| #rb("postedby")# : #name#</cfif><br />
82                #rb("relatedcategories")#:
83                </cfoutput>
84                <cfset lastid = listLast(structKeyList(categories))>
85                <cfloop item="catid" collection="#categories#">
86                        <cfoutput><a href="#application.blog.makeCategoryLink(catid)#">#categories[currentRow][catid]#</a><cfif catid is not lastid>, </cfif></cfoutput>
87                </cfloop>
88                <cfoutput>
89                </div>
90                </cfoutput>
91
92                <cfoutput>             
93                <div class="body">
94                #application.blog.renderEntry(body,false,enclosure)#
95               
96                <!--- STICK IN THE MP3 PLAYER --->
97                <cfif enclosure contains "mp3">
98                        <cfset alternative=replace(getFileFromPath(enclosure),".mp3","") />
99                        <div class="audioPlayerParent">
100                                <div id="#alternative#" class="audioPlayer">
101                                </div>
102                        </div>
103                        <script type="text/javascript">
104                        // <![CDATA[
105                                var flashvars = {};
106                                // unique ID
107                                flashvars.playerID = "#alternative#";
108                                // load the file
109                                flashvars.soundFile= "#application.rooturl#/enclosures/#getFileFromPath(enclosure)#";
110                                // Load width and Height again to fix IE bug
111                                flashvars.width = "470";
112                                flashvars.height = "24";
113                                // Add custom variables
114                                var params = {};
115                                params.allowScriptAccess = "sameDomain";
116                                params.quality = "high";
117                                params.allowfullscreen = "true";
118                                params.wmode = "transparent";
119                                var attributes = false;
120                                swfobject.embedSWF("#application.rooturl#/includes/audio-player/player.swf", "#alternative#", "470", "24", "8.0.0","/includes/audio-player/expressinstall.swf", flashvars, params, attributes);
121                        // ]]>
122                        </script>
123                </cfif>
124
125               
126                <cfif len(morebody) and url.mode is not "entry">
127                <p align="right">
128                <a href="#application.blog.makeLink(id)###more">[#rb("more")#]</a>
129                </p>
130                <cfelseif len(morebody)>
131                <span id="more"></span>
132                #application.blog.renderEntry(morebody)#
133                </cfif>
134                </div>
135                </cfoutput>
136
137                <cfoutput>
138                <div class="byline">
139                </cfoutput>
140               
141                <cfif allowcomments or commentCount neq ""><cfoutput><img src="#application.rooturl#/images/comment.gif" align="middle" title="#rb("comments")#" height="16" width="16"> <a href="#application.blog.makeLink(id)###comments">#rb("comments")# (<cfif commentCount is "">0<cfelse>#commentCount#</cfif>)</a> | </cfoutput></cfif>
142                <cfif application.trackbacksallowed><cfoutput><a href="#application.blog.makeLink(id)###trackbacks">Trackbacks (<cfif trackbackCount is "">0<cfelse>#trackbackCount#</cfif>)</a> | </cfoutput></cfif>
143                <cfif application.isColdFusionMX7><cfoutput><img src="#application.rooturl#/images/printer.gif" align="middle" title="#rb("print")#" height="16" width="16"> <a href="#application.rooturl#/print.cfm?id=#id#" rel="nofollow">#rb("print")#</a> | </cfoutput></cfif>
144                <cfoutput><img src="#application.rooturl#/images/email.gif" align="middle" title="#rb("send")#" height="16" width="16"> <a href="#application.rooturl#/send.cfm?id=#id#" rel="nofollow">#rb("send")#</a> | </cfoutput>
145                <cfif len(enclosure)><cfoutput><img src="#application.rooturl#/images/disk.png" align="middle" title="#rb("download")#" height="16" width="16"> <a href="#application.rooturl#/enclosures/#urlEncodedFormat(getFileFromPath(enclosure))#">#rb("download")#</a> | </cfoutput></cfif>
146                <cfoutput>
147        <img src="#application.rooturl#/images/icon_delicious.gif" align="middle" title="del.ico.us" height="11" width="11"> <a href="http://del.icio.us/post?url=#application.blog.makeLink(id)#&title=#URLEncodedFormat("#application.blog.getProperty('blogTitle')#:#title#")#">del.icio.us</a>
148                | <img src="#application.rooturl#/images/digg.gif" align="middle" title="Digg It!" height="14" width="16"> <a href="http://digg.com/submit?phase=2&url=#application.blog.makeLink(id)#&title=#URLEncodedFormat("#title#")#&topic=">Digg It!</a>
149            | <img src="#application.rooturl#/images/technorati.gif" align="middle" title="#rb("linkingblogs")#" height="16" width="16"> <a href="http://www.technorati.com/search/#application.blog.makeLink(id)#">#rb("linkingblogs")#</a>
150            | #views# #rb("views")#   
151                </div>
152                </cfoutput>
153
154                <!--- Things to do if showing one entry --->                                           
155                <cfif articles.recordCount is 1>
156               
157                        <cfset qRelatedBlogEntries = application.blog.getRelatedBlogEntries(entryId=id,bDislayFutureLinks=true) />     
158
159                        <cfif qRelatedBlogEntries.recordCount>
160                                <cfoutput>
161                                <div id="relatedentries">
162                                <p>
163                                <div class="relatedentriesHeader">#rb("relatedblogentries")#</div>
164                                </p>
165                       
166                                <ul id="relatedEntriesList">
167                                <cfloop query="qRelatedBlogEntries">
168                                <li><a href="#application.blog.makeLink(entryId=qRelatedBlogEntries.id)#">#qRelatedBlogEntries.title#</a> (#application.localeUtils.dateLocaleFormat(posted)#)</li>
169                                </cfloop>                       
170                                </ul>
171                                </div>
172                                </cfoutput>
173                        </cfif>
174
175                        <cfif application.trackbacksallowed>
176                                <cfset trackbacks = application.blog.getTrackBacks(id)>
177                                <cfoutput>     
178                                <div id="trackbacks">
179                                <div class="trackbackHeader">TrackBacks</div>
180                                </cfoutput>
181                               
182                                <cfif trackbacks.recordCount>
183               
184                                        <cfoutput>             
185                                        <div class="trackbackBody addTrackbackLink">
186                                        [<a href="javaScript:launchTrackback('#id#')">#application.resourceBundle.getResource("addtrackback")#</a>]
187                                        </div>                         
188                                        </cfoutput>
189                                       
190                                        <cfoutput query="trackbacks">
191                                                <div class="trackback<cfif currentRow mod 2>Alt</cfif>">
192                                                <div class="trackbackBody">
193                                                <a href="#postURL#" target="_new" rel="nofollow" class="tbLink">#title#</a><br>
194                                                #paragraphFormat2(excerpt)#
195                                                </div>
196                                                <div class="trackbackByLine">#application.resourceBundle.getResource("trackedby")# #blogname# | #application.resourceBundle.getResource("trackedon")# #application.localeUtils.dateLocaleFormat(created,"short")# #application.localeUtils.timeLocaleFormat(created)#</div>
197                                                </div>
198                                        </cfoutput>                     
199                                <cfelse>
200                                        <cfoutput><div class="body">#application.resourceBundle.getResource("notrackbacks")#</div></cfoutput>
201                                </cfif>
202                               
203                                <cfoutput>
204                                <p>
205                                <div class="body">
206                                #application.resourceBundle.getResource("trackbackurl")#<br>
207                                #application.rooturl#/trackback.cfm?#id#
208                                </div>
209                                </p>
210                                <div class="trackbackBody addTrackbackLink">
211                                        [<a href="javaScript:launchTrackback('#id#')">#application.resourceBundle.getResource("addtrackback")#</a>]
212                                </div>
213                                </div>
214                                </cfoutput>                             
215                        </cfif>
216
217                        <cfif application.usetweetbacks>
218
219                                <cfoutput>     
220                                <div id="tweetbacks">
221                                <div class="tweetbackHeader">TweetBacks</div>
222                                <div id="tbContent">
223                                </cfoutput>
224
225                                <cfoutput>
226                                </div>
227                                </div>
228                                </cfoutput>                             
229
230                        </cfif>
231
232                        <cfoutput>
233                        <div id="comments">
234                        <div class="commentHeader">#rb("comments")# <cfif application.commentmoderation>(#rb("moderation")#)</cfif></div>
235                        </cfoutput>
236                       
237                        <cfset comments = application.blog.getComments(id)>
238                        <cfif comments.recordCount>
239
240                                <cfif allowComments>
241                                        <cfoutput>
242                                        <div class="trackbackBody addCommentLink">
243                                        [<a href="javaScript:launchComment('#id#')">#rb("addcomment")#</a>]
244                                        [<a href="javaScript:launchCommentSub('#id#')">#rb("addsub")#</a>]
245
246                                        </div>
247                                        </cfoutput>
248                                </cfif>
249                               
250                                <cfset entryid = id>
251                                <cfoutput query="comments">
252                                <div id="c#id#" class="comment<cfif currentRow mod 2>Alt</cfif>">
253                                        <div class="commentBody">
254                                        <cfif application.gravatarsAllowed><img src="http://www.gravatar.com/avatar/#lcase(hash(email))#?s=40&r=pg&d=#application.rooturl#/images/gravatar.gif" alt="#name#'s Gravatar" border="0"></cfif>
255                                        #paragraphFormat2(replaceLinks(comment))#
256                                        </div>
257                                        <div class="commentByLine">
258                                        <a href="#application.blog.makeLink(entryid)###c#id#">##</a> #rb("postedby")# <cfif len(comments.website)><a href="#comments.website#" rel="nofollow">#name#</a><cfelse>#name#</cfif>
259                                        | #application.localeUtils.dateLocaleFormat(posted,"short")# #application.localeUtils.timeLocaleFormat(posted)#
260                                        </div>
261                                </div>
262                                </cfoutput>
263
264                                <cfif allowComments>
265                                        <cfoutput>
266                                        <div class="trackbackBody addCommentLink">
267                                        [<a href="javaScript:launchComment('#id#')">#rb("addcomment")#</a>]
268                                        </div>
269                                        </cfoutput>
270                                </cfif>
271                                                               
272                        <cfelseif not allowcomments>
273                                <cfoutput><div class="body">#rb("commentsnotallowed")#</div></cfoutput>
274                        <cfelse>
275                                <cfoutput>
276                                <div class="trackbackBody addCommentLink">
277                                <p style="text-align:left">#rb("nocomments")#</p>                               
278                                [<a href="javaScript:launchComment('#id#')">#rb("addcomment")#</a>]
279                                [<a href="javaScript:launchCommentSub('#id#')">#rb("addsub")#</a>]                             
280                                </div>
281                                </cfoutput>
282                        </cfif>
283
284                        <cfoutput>
285                        </div>
286                        </cfoutput>
287
288                </cfif>
289
290                <!--- this div ends the entry div --->
291                <cfoutput>
292                </div>
293                </cfoutput>
294               
295        </cfloop>
296       
297        <cfif articles.recordCount is 0>
298       
299                <cfoutput><div class="body">#rb("sorry")#</div></cfoutput>
300                <cfoutput>
301                <div class="body">
302                <cfif url.mode is "">
303                        #rb("noentries")#
304                <cfelse>
305                        #rb("noentriesforcriteria")#
306                </cfif>
307                </div>
308                </cfoutput>
309               
310        <cfelseif articleData.totalEntries gte url.startRow + application.maxEntries>
311               
312                <!--- get path if not /index.cfm --->
313                <cfset path = rereplace(cgi.path_info, "(.*?)/index.cfm", "")>
314               
315                <!--- clean out startrow from query string --->
316                <cfset qs = cgi.query_string>
317                <!--- handle: http://www.coldfusionjedi.com/forums/messages.cfm?threadid=4DF1ED1F-19B9-E658-9D12DBFBCA680CC6 --->
318                <cfset qs = reReplace(qs, "<.*?>", "", "all")>
319                <cfset qs = reReplace(qs, "[\<\>]", "", "all")>
320
321                <cfset qs = reReplaceNoCase(qs, "&*startrow=[0-9]+", "")>
322                <cfset qs = qs & "&startRow=" & (url.startRow + application.maxEntries)>
323                <cfif isDefined("form.search") and len(trim(form.search)) and not structKeyExists(url, "search")>
324                        <cfset qs = qs & "&search=#htmlEditFormat(form.search)#">
325                </cfif>
326
327                <cfoutput>
328                <p align="right">
329                <a href="#application.rooturl#/index.cfm#path#?#qs#">#rb("moreentries")#</a>
330                </p>
331                </cfoutput>
332        </cfif>
333
334</cfmodule>
335</cfmodule>
336
337<cfsetting enablecfoutputonly=false>    
Note: See TracBrowser for help on using the browser.