root/trunk/website/blog/admin/entry.cfm @ 5

Revision 5, 26.4 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         : C:\projects\blogcfc5\client\admin\entry.cfm
5        Author       : Raymond Camden
6        Created      : 04/07/06
7        Last Updated : 1/14/08
8        History      : Nuked old history for 5.7 (rkc 4/13/07)
9                                   Don't save text when editing existing entries (rkc 4/13/07)
10                                   Delete cookies on cancel (rkc 5/18/07)
11                                   Yet another date fix (rkc 1/14/08)
12--->
13
14<cftry>
15        <cfif url.id neq 0>
16                <cfset entry = application.blog.getEntry(url.id,true)>
17                <cfif len(entry.morebody)>
18                        <cfset entry.body = entry.body & "<more/>" & entry.morebody>
19                </cfif>
20
21                <cfparam name="form.title" default="#entry.title#">
22                <cfparam name="form.body" default="#entry.body#">
23                <cfparam name="form.posted" default="#entry.posted#">
24                <cfparam name="form.alias" default="#entry.alias#">
25                <cfparam name="form.allowcomments" default="#entry.allowcomments#">
26                <cfparam name="form.oldenclosure" default="#entry.enclosure#">
27                <cfparam name="form.oldfilesize" default="#entry.filesize#">
28                <cfparam name="form.oldmimetype" default="#entry.mimetype#">
29                <cfparam name="form.released" default="#entry.released#">
30                <cfparam name="form.duration" default="#entry.duration#">
31                <cfparam name="form.keywords" default="#entry.keywords#">
32                <cfparam name="form.subtitle" default="#entry.subtitle#">
33                <cfparam name="form.summary" default="#entry.summary#">
34                <cfif form.released>
35                        <cfparam name="form.sendemail" default="false">
36                <cfelse>
37                        <cfparam name="form.sendemail" default="true">
38                </cfif>
39               
40               
41                <!--- handle case where form submitted, cant use cfparam --->
42                <cfif not isDefined("form.save") and not isDefined("form.preview")>
43                        <cfset form.categories = structKeyList(entry.categories)>
44                        <cfset variables.relatedEntries = application.blog.getRelatedBlogEntries(url.id, true, true)>   
45                        <cfset form.relatedEntries = valueList(relatedEntries.id)>
46                </cfif>
47               
48               
49        <cfelse>
50       
51                <!--- look for savedtitle, savedbody from cookie, but only if not POSTing --->
52                <cfif not structKeyExists(form, "title") and structKeyExists(cookie, "savedtitle")>
53                        <cfset form.title = cookie.savedtitle>
54                </cfif>
55                <cfif not structKeyExists(form, "body") and structKeyExists(cookie, "savedbody")>
56                        <cfset form.body = cookie.savedbody>
57                </cfif>
58                       
59                <cfif not isDefined("form.save") and not isDefined("form.return") and not isDefined("form.preview")>
60                        <cfset form.categories = "">
61                </cfif>
62                <cfparam name="form.title" default="">
63                <cfparam name="form.body" default="">
64                <cfparam name="form.alias" default="">
65                <cfparam name="form.posted" default="#dateAdd("h", application.blog.getProperty("offset"), now())#">
66                <cfparam name="form.allowcomments" default="">
67                <cfparam name="form.oldenclosure" default="">
68                <cfparam name="form.oldfilesize" default="0">
69                <cfparam name="form.oldmimetype" default="">
70                <cfparam name="form.released" default="true">
71                <cfparam name="form.duration" default="">
72                <cfparam name="form.keywords" default="">
73                <cfparam name="form.subtitle" default="">
74                <cfparam name="form.summary" default="">
75                <cfparam name="form.relatedEntries" default="">
76                <cfparam name="form.sendemail" default="true">
77        </cfif>
78        <cfcatch>
79                <!--- <cflocation url="entries.cfm" addToken="false"> --->
80                <cfrethrow>
81        </cfcatch>
82</cftry>
83
84<cfset allCats = application.blog.getCategories()>
85
86<cfparam name="form.newcategory" default="">
87
88<cfif structKeyExists(form, "cancel")>
89        <cfcookie name="savedtitle" expires="now">
90        <cfcookie name="savedbody" expires="now">
91        <cflocation url="entries.cfm" addToken="false">
92</cfif>
93
94<cfif isDefined("form.delete_enclosure")>
95        <cfif len(form.oldenclosure) and fileExists(form.oldenclosure)>
96                <cffile action="delete" file="#form.oldenclosure#">
97        </cfif>
98        <cfset form.oldenclosure = "">
99        <cfset form.oldfilesize = "0">
100        <cfset form.oldmimetype = "">
101        <!--- We need to set a msg to warn folks that they need to save the entry --->
102        <cfif url.id is not "new">
103                <cfset message = application.resourceBundle.getResource("enclosureentrywarning")>
104        </cfif>
105</cfif>
106
107<!---
108Enclosure logic move out to always run. Thinking is that it needs to run on preview.
109--->
110<cfif isDefined("form.enclosure") and len(trim(form.enclosure))>
111        <cfset destination = expandPath("../enclosures")>
112        <!--- first off, potentially make the folder --->
113        <cfif not directoryExists(destination)>
114                <cfdirectory action="create" directory="#destination#">
115        </cfif>
116       
117        <cffile action="upload" filefield="enclosure" destination="#destination#" nameconflict="makeunique">
118        <cfif cffile.filewassaved>
119                <cfset form.oldenclosure = cffile.serverDirectory & "/" & cffile.serverFile>
120                <cfset form.oldfilesize = cffile.filesize>
121                <cfset form.oldmimetype = cffile.contenttype & "/" & cffile.contentsubtype>
122        </cfif>
123<cfelseif isDefined("form.manualenclosure") and len(trim(form.manualenclosure))>
124        <cfset destination = expandPath("../enclosures")>
125        <!--- first off, potentially make the folder --->
126        <cfif not directoryExists(destination)>
127                <cfdirectory action="create" directory="#destination#">
128        </cfif>
129        <cfif fileExists(destination & "/" & form.manualenclosure)>
130                <cfset form.oldenclosure = destination & "/" & form.manualenclosure>
131                <cfdirectory action="list" directory="#destination#" filter="#form.manualenclosure#" name="getfile">
132                <cfset form.oldfilesize = getfile.size>
133                <!---
134                Thanks: http://www.coldfusionmuse.com/index.cfm/2006/8/2/mime.types
135                --->
136                <cftry>
137                        <cfset form.oldmimetype = getPageContext().getServletContext().getMimeType(form.oldenclosure)>
138                        <cfcatch>
139                                <!--- silently fail for BD.Net --->
140                        </cfcatch>
141                </cftry>
142                <cfif not isDefined("form.oldmimetype")>
143                        <cfset form.oldmimetype = "application/unknown">
144                </cfif>
145        </cfif>
146</cfif>
147
148<cfif not isNumeric(form.oldfilesize)>
149        <cfset form.oldfilesize = 0>
150</cfif>
151
152<cfif isDefined("form.save")>
153
154        <cfset errors = arrayNew(1)>
155        <cfif not len(trim(form.title))>
156                <cfset arrayAppend(errors, application.resourceBundle.getResource("mustincludetitle"))>
157        <cfelse>
158                <cfset form.title = trim(form.title)>
159        </cfif>
160        <!--- Set the locale --->
161        <cfif not application.isColdFusionMX7>
162                <cfset setLocale(application.localeUtils.java2CF())>
163        <cfelse>
164                <cfset setLocale(application.blog.getProperty("locale"))>
165        </cfif>
166        <cfif not lsIsDate(form.posted)>
167                <cfset arrayAppend(errors, application.resourceBundle.getResource("invaliddate"))>
168        </cfif>
169        <cfif not len(trim(form.body))>
170                <cfset arrayAppend(errors, application.resourceBundle.getResource("mustincludebody"))>
171                <cfset origbody = "">
172        <cfelse>
173                <cfset form.body = trim(form.body)>
174               
175                <!--- Fix damn smart quotes. Thank you Microsoft! --->
176                <!--- This line taken from Nathan Dintenfas' SafeText UDF --->
177                <!--- www.cflib.org/udf.cfm/safetext --->
178                <cfset form.body = replaceList(form.body,chr(8216) & "," & chr(8217) & "," & chr(8220) & "," & chr(8221) & "," & chr(8212) & "," & chr(8213) & "," & chr(8230),"',',"","",--,--,...")>
179
180                <cfset origbody = form.body>
181
182                <!--- Handle potential <more/> --->
183                <!--- fix by Andrew --->
184                <cfset strMoreTag = "<more/>">
185                <cfset moreStart = findNoCase(strMoreTag,form.body)>
186                <cfif moreStart gt 1>
187                        <cfset moreText = trim(mid(form.body,(moreStart+len(strMoreTag)),len(form.body)))>
188                        <cfset form.body = trim(left(form.body,moreStart-1))>
189                <cfelseif moreStart is 1>
190                        <cfset arrayAppend(errors, application.resourceBundle.getResource("mustincludebody"))>
191                <cfelse>
192                        <cfset moreText = "">
193                </cfif>
194
195        </cfif>
196       
197        <cfif (not isDefined("form.categories") or form.categories is "") and not len(trim(form.newCategory))>
198                <cfset arrayAppend(errors, application.resourceBundle.getResource("mustincludecategory"))>
199        <cfelse>
200                <cfset form.newCategory = trim(htmlEditFormat(form.newCategory))>
201                <!--- double check if existing --->
202                <cfset cats = valueList(allCats.categoryName)>
203                <cfif listFindNoCase(cats, form.newCategory)>
204                        <!--- This category already existed, loop and find id --->
205                        <cfloop query="allCats">
206                                <cfif form.newCategory is categoryName>
207                                        <cfif not isDefined("form.categories")>
208                                                <cfset form.categories = "">
209                                        </cfif>
210                                        <cfset form.categories = listAppend(form.categories, categoryID)>
211                                        <cfset form.newcategory = "">
212                                        <cfbreak>
213                                </cfif>
214                        </cfloop>
215                </cfif>
216        </cfif>
217
218        <cfif len(form.alias)>
219                <cfset form.alias = trim(htmlEditFormat(form.alias))>
220        <cfelse>
221                <!--- Auto create the alias --->
222                <cfset form.alias = application.blog.makeTitle(form.title)>
223        </cfif>
224               
225        <!---
226        The purpose of this code:
227       
228        If you try to add an entry with an enclosure and your session timed out,
229        you get forced back to login.cfm. I can't recreate the form w/ your file upload.
230        So on login.cfm I notice it - and add a special form var named enclosureerror.
231        I throw an error to the user so he knows to re-pick the file fo rupload.
232        --->
233        <cfif structKeyExists(form, "enclosureerror")>
234                <cfset arrayAppend(errors, "Your enclosure was removed because your session timed out. Please upload it again.")>
235        </cfif>
236               
237        <cfif not arrayLen(errors)>
238       
239                <!--- convert datetime to native --->
240                <cfset form.posted = lsParseDateTime(form.posted)>
241               
242                <!--- Before we save, modify the posted time by -1 * posted --->
243                <cfset form.posted = dateAdd("h", -1 * application.blog.getProperty("offset"), form.posted)>
244
245                <cfif isDefined("variables.entry")>
246                        <!--- Begin: Shane Zehnder | released posts should have the post date of when they're released --->
247                        <cfif (form.released eq "true") and (entry.released eq "false") and (dateCompare(dateAdd("h", application.blog.getProperty("offset"), form.posted), now()) lt 0)>
248                                <cfset form.posted = dateAdd("h", application.blog.getProperty("offset"), now()) />
249                        </cfif>
250                        <!--- End: Shane Zehnder --->
251
252                        <cfset application.blog.saveEntry(url.id, form.title, form.body, moreText, form.alias, form.posted, form.allowcomments, form.oldenclosure, form.oldfilesize, form.oldmimetype, form.released, form.relatedentries, form.sendemail, form.duration, form.subtitle, form.summary, form.keywords )>
253                <cfelse>
254                        <cfset url.id = application.blog.addEntry(form.title, form.body, moreText, form.alias, form.posted, form.allowcomments, form.oldenclosure, form.oldfilesize, form.oldmimetype, form.released, form.relatedentries, form.sendemail, form.duration, form.subtitle, form.summary, form.keywords )>
255                </cfif>
256                <!--- remove all old cats that arent passed in --->
257                <cfif url.id is not "new">
258                        <cfset application.blog.removeCategories(url.id)>
259                </cfif>
260                <!--- potentially add new cat --->
261                <cfif len(trim(form.newCategory))>
262                        <cfparam name="form.categories" default="">
263                        <cfset form.categories = listAppend(form.categories,application.blog.addCategory(form.newCategory, application.blog.makeTitle(newCategory)))>
264                </cfif>
265                <cfset application.blog.assignCategories(url.id,form.categories)>
266                <cfmodule template="../tags/scopecache.cfm" scope="application" clearall="true">
267                <cfcookie name="savedtitle" expires="now">
268                <cfcookie name="savedbody" expires="now">
269                <cflocation url="entries.cfm" addToken="false">
270        <cfelse>
271                <!--- restore body, since it loses more body --->
272                <cfset form.body = origbody>
273        </cfif>
274</cfif>
275
276<cfset allCats = application.blog.getCategories()>
277
278<cfmodule template="../tags/adminlayout.cfm" title="Entry Editor">
279
280        <cfoutput>
281        <link rel="stylesheet" type="text/css" href="/css/tab.css">
282        <script type="text/javascript">
283                var tabberOptions = {'onClick':function(args){
284                        // if we call the comments tab, we need to resize the iframe
285                        if( args.tabber.tabs[args.index].headingText == "Comments" ){
286                                var el = top.commentsFrame;
287                                // we need to delay the call so the tab can be shown
288                                setTimeout( function (){
289                                        el.adjustIframeSize();
290                                }, 100);
291                        }
292                }};
293                // Used to hide tabber flash
294                document.write('<style type="text/css">.tabber{display:none;}<\/style>');
295        </script>
296        <script type="text/javascript" src="/js/tabber.js"></script>
297        </cfoutput>
298
299        <cfif not structKeyExists(form, "preview")>
300
301                <!---
302                Ok, so this line below here has been the cuase of MUCH pain in agony. The problem is in noticing
303                when you save and ensuring you have a valid date. I don't know why this is so evil, but it caused
304                me a lot of trouble a few months back. A new bug cropped up where if you hit the 'new entry'
305                url direct (entry.cfm?id=0), the date would default to odbc date. So now the logic ensures
306                that you either have NO form post, of a form post with username from the login.
307               
308                I can bet I'll be back here one day soon.
309                --->
310                <cfif lsIsDate(form.posted) and (not isDefined("form.fieldnames") or isDefined("form.username"))>
311                        <cfset form.posted = createODBCDateTime(form.posted)>
312                        <cfset form.posted = application.localeUtils.dateLocaleFormat(form.posted,"short") & " " & application.localeUtils.timeLocaleFormat(form.posted)>
313                </cfif>
314
315                <!--- tabs --->
316                <cfoutput>
317                <form action="entry.cfm?id=#url.id#" method="post" enctype="multipart/form-data" name="editForm" id="editForm">
318
319                <div class="tabber">
320
321                <div class="tabbertab" title="Main">   
322                <p>
323                You can use &lt;code&gt;....&lt;/code&gt; to add formatting to code blocks.<br />
324                You can dynamically include textblocks using &lt;textblock label="..."&gt;.<br />
325                If you want to show only a portion of your entry on the home page, separate your content with the &lt;more/&gt; tag.
326                </p>           
327                </cfoutput>
328               
329                <cfif structKeyExists(variables, "errors") and arrayLen(errors)>
330                        <cfoutput>
331                        <div class="errors">
332                        Please correct the following error(s):
333                        <ul>
334                        <cfloop index="x" from="1" to="#arrayLen(errors)#">
335                        <li>#errors[x]#</li>
336                        </cfloop>
337                        </ul>
338                        </div>
339                        </cfoutput>
340                <cfelseif structKeyExists(variables, "message")>
341                        <cfoutput>
342                        <div class="message">
343                        #message#
344                        </div>
345                        </cfoutput>
346                </cfif>
347               
348                <cfoutput>
349                <script type="text/javascript" src="/js/spry/xpath.js"></script>
350                <script type="text/javascript" src="/js/spry/SpryData.js"></script>
351                <script type="text/javascript">
352                var dsCategories = new Spry.Data.XMLDataSet("spryproxy.cfm?method=getcategories", "categories/category");
353                var dsEntries = new Spry.Data.XMLDataSet("spryproxy.cfm?method=getentries&category={dsCategories::CATEGORYID}", "entries/entry");               
354               
355                function addEntry(id) {
356                        // was this ID already added?
357                        for(var i = 0; i < document.editForm.cbRelatedEntries.length; i++) {
358                                if(document.editForm.cbRelatedEntries.options[i].value == id) return;
359                        }
360                       
361                        //sets the hidden form field
362                        if(document.editForm.relatedentries.value == '') document.editForm.relatedentries.value = id;
363                        else document.editForm.relatedentries.value = document.editForm.relatedentries.value + "," + id;
364
365                        //We can't pass in the title as it may have a ', and with Spry I can't pre-filter the content for JS safeness.
366                        //So I passed in row num, which should equal the option
367                        var data = dsEntries.getData();
368                        for(var i = 0; i < data.length; i++) {
369                                if(data[i]["ID"] == id) title = data[i]["TITLE"];       
370                        }
371                        //sets the new combox
372                        var opt = new Option(title,id);
373                        document.editForm.cbRelatedEntries.options[document.editForm.cbRelatedEntries.options.length] = opt;
374                }
375               
376                function removeSelected() {
377                        for(var i = document.editForm.cbRelatedEntries.length-1; i >= 0; i--) {
378                                if(document.editForm.cbRelatedEntries.options[i].selected) document.editForm.cbRelatedEntries.options[i] = null;
379                        }
380                        //quickly regen the hidden field
381                        document.editForm.relatedentries.value = '';
382                        for(var i = 0; i < document.editForm.cbRelatedEntries.length; i++) {
383                                if(document.editForm.relatedentries.value == '') document.editForm.relatedentries.value = document.editForm.cbRelatedEntries.options[i].value;
384                                else document.editForm.relatedentries.value = document.editForm.relatedentries.value + "," + document.editForm.cbRelatedEntries.options[i].value;                               
385                        }                       
386                }
387               
388                //for image upload
389                function imgUpload() {
390                        var imgWin = window.open('#application.rooturl#/admin/imgwin.cfm','imgWin','width=400,height=100,toolbar=0,resizeable=1,menubar=0');   
391                }
392
393                <cfif len(application.imageroot)>
394                        <cfset sImgRoot = application.imageroot />
395                <cfelse>
396                        <cfset sImgRoot = "/images/" />
397                </cfif>
398
399                function newImage(str) {
400                        var imgstr = '<img src="#application.rooturl##application.utils.fixUrl("/#sImgRoot#/")#' + str + '" />';
401                        var textbox = document.getElementById('body');
402                        textbox.value = textbox.value + '\n' + imgstr;
403                }
404
405                //for image browse
406                function imgBrowse() {
407                        var imgBrowse = window.open('#application.rooturl#/admin/imgbrowse.cfm','imgBrowse','width=800,height=800,toolbar=1,resizeable=1,menubar=1,scrollbars=1');     
408                }
409
410                <cfif url.id eq 0>
411                //used to save your form info (title/body) in case your browser crashes
412                function saveText() {
413                        var titleField = Spry.$("title");
414                        var bodyField = Spry.$("body");
415                        var expire = new Date();
416                        expire.setDate(expire.getDate()+7);
417                       
418                        //write title to cookie
419                        var cookieString = 'SAVEDTITLE='+escape(titleField.value)+'; expires='+expire.toGMTString()+'; path=/';
420                        document.cookie = cookieString;
421                        cookieString = 'SAVEDBODY='+escape(bodyField.value)+'; expires='+expire.toGMTString()+'; path=/';
422                        document.cookie = cookieString;
423                        window.setTimeout('saveText()',5000);
424                }
425               
426                window.setTimeout('saveText()',5000);
427                </cfif>
428                </script>
429
430                <table width="75%"      >
431                        <tr>
432                                <td align="right">title:</td>
433                                <td><input type="text" name="title" id="title" value="#htmlEditFormat(form.title)#" class="txtField" maxlength="100"></td>
434                        </tr>
435                        <tr valign="top">
436                                <td align="right">body:</td>
437                                <td>
438                                </cfoutput><cfmodule template="../tags/textarea.cfm" fieldname="body" value="#htmlEditFormat(form.body)#" class="txtArea"><cfoutput>
439                                <br />
440                                <a href="javascript:imgUpload()">[Upload and Insert Image]</a> / <a href="javascript:imgBrowse()">[Browse Image Library]</a>
441                                </td>
442                        </tr>
443                        <tr valign="top">
444                                <td align="right">categories:</td>
445                                <td><cfif allCats.recordCount><select name="categories" multiple size=4 class="txtDropdown">
446                                <cfloop query="allCats">
447                                <option value="#categoryID#" <cfif isDefined("form.categories") and listFind(form.categories,categoryID)>selected</cfif>>#categoryName#</option>
448                                </cfloop>
449                                </select><br></cfif>
450                                 </td>
451                        </tr>
452                        <tr valign="top">
453                                <td align="right">new category:</td>
454                                <td><input type="text" name="newcategory" value="#htmlEditFormat(form.newcategory)#" class="txtField" maxlength="50"></td>
455                        </tr>
456                        <tr><td colspan="2"><br /></td></tr>           
457                        <tr valign="top">
458                                <td align="right">enclosure:</td>
459                                <td>
460                                <input type="hidden" name="oldenclosure" value="#form.oldenclosure#">
461                                <input type="hidden" name="oldfilesize" value="#form.oldfilesize#">
462                                <input type="hidden" name="oldmimetype" value="#form.oldmimetype#">
463                                <input type="file" name="enclosure" style="width:100%">
464                                or manually enter a file name (must exist under encloses folder)
465                                <input type="text" name="manualenclosure">
466                               
467                                <cfif len(form.oldenclosure)><br /><br />#listLast(form.oldenclosure,"/\")# <input type="submit" name="delete_enclosure" value="#application.resourceBundle.getResource("deleteenclosure")#"></cfif>
468
469                                </td>
470                        </tr>
471                        <tr>
472                                <td>&nbsp;</td>
473                                <td><input type="submit" name="cancel" value="Cancel" onClick="return confirm('Are you sure you want to cancel this entry?')"> <input type="submit" name="preview" value="Preview"> <input type="submit" name="save" value="Save"></td>
474                        </tr>
475                </table>
476                </div>
477                </cfoutput>
478               
479                <!--- tab 2 --->
480                <cfoutput>
481                <div class="tabbertab" title="Additional Settings">     
482                        <table>
483                        <tr>
484                                <td align="right">posted:</td>
485                                <td><input type="text" name="posted" value="#form.posted#" class="txtField" maxlength="100"></td>
486                        </tr>                   
487                        <tr valign="top">
488                                <td>related entries:</td>
489                                <td>
490                                        <table border="0" width="100%" cellpadding="0" cellspacing="0" style="padding: 5px;">
491                                        <tr>
492                                                <td width="50%"><strong>Categories</strong></td>
493                                                <td width="50%">
494                                                        <div style="float:left;"><strong>Entries</strong></div>
495                                                        <div style="float:right; padding-right: .5em;">
496                                                                Sort By: 
497                                                                <a href="javascript:void(0);" id="sortLinkDate" onclick="dsEntries.sort('POSTED','toggle')" style="color:rgb(0, 0, 255);">Date</a> | 
498                                                                <a href="javascript:void(0);" id="sortLinkTitle" onclick="dsEntries.sort('TITLE','toggle')" style="color:rgb(128, 128, 128);">Title</a> 
499                                                        </div>
500                                                </td>
501                                </tr>
502                                <tr>
503                              <td style="padding-right: 5px;">
504                                                <div id="Categories_DIV" spry:region="dsCategories">
505                                                <select id="Categories_DropDown" onchange="dsCategories.setCurrentRow(this.selectedIndex)" multiple="multiple" size="4" style="width:100%;" >
506                                                <option spry:repeat="dsCategories" id="{CATEGORYID}">{CATEGORYNAME}</option>
507                                                </select>
508                                                </div>
509                              </td>
510                                  <td><!---dsEntries.setCurrentRow(this.selectedIndex)--->
511                                                <div id="Entries_DIV" spry:region="dsEntries">
512                                                <select id="Entries_DropDown" onchange="addEntry(this.options[this.selectedIndex].value);" size="4" style="width:100%;" >
513                                                <option spry:repeat="dsEntries" value="{ID}">{TITLE}</option>
514                                                </select>
515                                                </div>
516                                  </td>
517                                </tr>
518                                <tr>
519                                        <td width="100%" colspan="2"><strong>Current Related Entries</strong></td>
520                                </tr>
521                                <tr valign="top">
522                                        <td width="100%" colspan="2">
523                                        <input type="hidden" name="relatedentries" value="#form.relatedentries#">
524                                                <select id="cbRelatedEntries" name="cbRelatedEntries" multiple="multiple" size="4" style="width: 70%;" >
525                                                <cfif structKeyExists(variables, "relatedEntries")>
526                                                        <cfloop query="relatedEntries">
527                                                        <option value="#id#">#title#</option>
528                                                        </cfloop>
529                                                <cfelse>
530                                                        <cfloop list="#form.relatedentries#" index="i">
531                                                        <option value="#i#">#application.blog.getEntry(i).title#</option>
532                                                        </cfloop>
533                                                </cfif>
534                                                </select>
535                                                <input type="button" value="Remove Selected" onClick="removeSelected()">
536                                        </td>
537                                </tr>
538                                        </table>
539                                </td>
540                        </tr>
541                               
542                        <tr>
543                                <td align="right">alias:</td>
544                                <td><input type="text" name="alias" value="#form.alias#" class="txtField" maxlength="100"></td>
545                        </tr>
546                        <tr>
547                                <td align="right">iTunes Subtitle:</td>
548                                <td><input type="text" name="subtitle" value="#form.subtitle#" class="txtField" maxlength="100"></td>
549                        </tr>
550                        <tr>
551                                <td align="right">iTunes Keywords:</td>
552                                <td><input type="text" name="keywords" value="#form.keywords#" class="txtField" maxlength="100"></td>
553                        </tr>
554                        <tr>
555                                <td align="right">iTunes Summary:</td>
556                                <td></cfoutput><cfmodule template="../tags/textarea.cfm" fieldname="summary" value="#htmlEditFormat(form.summary)#" class="txtArea"><cfoutput></td>
557                        </tr>
558                        <tr>
559                                <td align="right">duration:</td>
560                                <td><input type="text" name="duration" value="#form.duration#" class="txtField" maxlength="10"></td>
561                        </tr>
562                        <tr>
563                                <td align="right">allow comments:</td>
564                                <td>
565                                <select name="allowcomments">
566                                <option value="true" <cfif form.allowcomments is "true">selected</cfif>>Yes</option>
567                                <option value="false" <cfif form.allowcomments is "false">selected</cfif>>No</option>
568                                </select>
569                                </td>
570                        </tr>
571                        <tr>
572                                <td align="right">send blog entry<br />to subscribers:</td>
573                                <td>
574                                <select name="sendemail">
575                                <option value="true" <cfif form.sendemail is "true">selected</cfif>>Yes</option>
576                                <option value="false" <cfif form.sendemail is "false">selected</cfif>>No</option>
577                                </select>
578                                </td>
579                        </tr>
580                        <tr>
581                                <td align="right">released:</td>
582                                <td>
583                                <select name="released">
584                                <option value="true" <cfif form.released is "true">selected</cfif>>Yes</option>
585                                <option value="false" <cfif form.released is "false">selected</cfif>>No</option>
586                                </select>
587                                </td>
588                        </tr>
589                        <tr>
590                    <td>&nbsp;</td>
591                <td><input type="submit" name="cancel" value="Cancel" onClick="return confirm('Are you sure you want to cancel this entry?')"> <input type="submit" name="preview" value="Preview"> <input type="submit" name="save" value="Save"></td>
592                        </tr>                           
593                        </table>
594                </div>
595                </cfoutput>
596
597                <!--- tab 3 --->
598                <cfif url.id neq 0>
599                        <cfoutput>
600                        <div class="tabbertab" title="Comments">       
601                                <iframe
602                                        src="entry_comments.cfm?id=#url.id#"
603                                        id="commentsFrame"
604                                        name="commentsFrame"
605                                        style="width: 100%; min-height: 500px; overflow-y: hidden;"
606                                        scrolling="false"
607                                        frameborder="0"
608                                        marginheight="0"
609                                        marginwidth="0"></iframe>
610                        </div>
611                        </cfoutput>
612                </cfif>
613               
614                <!--- end all tabs --->
615                <cfoutput>
616                </div>
617                </form>
618                </cfoutput>
619
620        <cfelse>
621
622                <cfif not application.isColdFusionMX7>
623                        <cfset setLocale(application.localeUtils.java2CF())>
624                <cfelse>
625                        <cfset setLocale(application.blog.getProperty("locale"))>
626                </cfif>
627
628                <cfset posted = lsParseDateTime(form.posted)>
629                <cfset posted = dateAdd("h", -1 * application.blog.getProperty("offset"), posted)>
630               
631                <cfparam name="form.categories" default="">
632               
633                <!--- Handles previews. --->
634                <cfoutput>
635                <div class="previewEntry">
636                <h1>#form.title#</h1>
637               
638                <div style="margin-bottom: 10px">#application.resourceBundle.getResource("postedat")# : #application.localeUtils.dateLocaleFormat(posted)# #application.localeUtils.timeLocaleFormat(posted)#
639                | #application.resourceBundle.getResource("postedby")# : #application.blog.getNameForUser(getAuthUser())#<br />
640                #application.resourceBundle.getResource("relatedcategories")#:
641                <cfloop index="x" from=1 to="#listLen(form.categories)#">
642                <a href="#application.blog.makeCategoryLink(listGetAt(form.categories,x))#">#application.blog.getCategory(listGetAt(form.categories,x)).categoryname#</a><cfif x is not listLen(form.categories)>,</cfif>
643                </cfloop>
644                </div>
645               
646                #application.blog.renderEntry(form.body,false,form.oldenclosure)#
647                </div>
648                </cfoutput>
649               
650                <cfoutput>
651                <form action="entry.cfm?#cgi.query_string#" method="post">
652                <cfloop item="key" collection="#form#">
653                        <cfif not listFindNoCase("preview,fieldnames,enclosure,username", key)>
654                                <input type="hidden" name="#key#" value="#htmlEditFormat(form[key])#">
655                        </cfif>
656                </cfloop>
657                <input type="submit" name="return" value="Return"> <input type="submit" name="save" value="Save">
658                </form>
659                </cfoutput>
660
661        </cfif>
662       
663</cfmodule>
664
665
666<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.