root/trunk/website/forums/admin/threads_edit.cfm @ 41

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

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

Line 
1<cfsetting enablecfoutputonly=true>
2<!---
3        Name         : threads_edit.cfm
4        Author       : Raymond Camden
5        Created      : June 09, 2004
6        Last Updated : July 27, 2006
7        History      : Removed mappings, added sticky (rkc 8/27/05)
8                                 : Simple size change (rkc 7/27/06)
9        Purpose          :
10--->
11
12<cfif isDefined("form.cancel") or not isDefined("url.id") or not len(url.id)>
13        <cflocation url="threads.cfm" addToken="false">
14</cfif>
15
16<cfif isDefined("form.save")>
17        <cfset errors = "">
18        <cfif not len(trim(form.name))>
19                <cfset errors = errors & "You must specify a name.<br>">
20        </cfif>
21        <cfif not len(trim(form.datecreated)) or not isDate(form.datecreated)>
22                <cfset errors = errors & "You must specify a valid creation date.<br>">
23        </cfif>
24
25        <cfif not len(errors)>
26                <cfset thread = structNew()>
27                <cfset thread.name = trim(htmlEditFormat(form.name))>
28                <cfset thread.readonly = trim(htmlEditFormat(form.readonly))>
29                <cfset thread.active = trim(htmlEditFormat(form.active))>
30                <cfset thread.forumidfk = trim(htmlEditFormat(form.forumidfk))>
31                <cfset thread.datecreated = trim(htmlEditFormat(form.datecreated))>
32                <cfset thread.useridfk = trim(htmlEditFormat(form.useridfk))>
33                <cfset thread.sticky = trim(htmlEditFormat(form.sticky))>
34                <cfif url.id neq 0>
35                        <cfset application.galleon.thread.saveThread(url.id, thread)>
36                <cfelse>
37                        <cfset application.galleon.thread.addThread(thread)>
38                </cfif>
39                <cfset msg = "Thread, #thread.name#, has been updated.">
40                <cflocation url="threads.cfm?msg=#urlEncodedFormat(msg)#">
41        </cfif>
42</cfif>
43
44<!--- get thread if not new --->
45<cfif url.id neq 0>
46        <cfset thread = application.galleon.thread.getThread(url.id)>
47        <cfparam name="form.name" default="#thread.name#">
48        <cfparam name="form.readonly" default="#thread.readonly#">
49        <cfparam name="form.active" default="#thread.active#">
50        <cfparam name="form.forumidfk" default="#thread.forumidfk#">
51        <cfparam name="form.datecreated" default="#dateFormat(thread.datecreated,"m/dd/yy")#">
52        <cfparam name="form.useridfk" default="#thread.useridfk#">
53        <cfparam name="form.sticky" default="#thread.sticky#">
54<cfelse>
55        <cfparam name="form.name" default="">
56        <cfparam name="form.readonly" default="false">
57        <cfparam name="form.active" default="false">
58        <cfparam name="form.forumidfk" default="">
59        <cfparam name="form.datecreated" default="#dateFormat(now(),"m/dd/yy")#">
60        <cfparam name="form.useridfk" default="">
61        <cfparam name="form.sticky" default="false">
62</cfif>
63
64<!--- get all forums --->
65<cfset forums = application.galleon.forum.getForums(false)>
66
67<!--- get all users --->
68<cfset users = application.galleon.user.getUsers()>
69
70<cfmodule template="../tags/layout.cfm" templatename="admin" title="Thread Editor">
71
72<cfoutput>
73<p>
74<cfif isDefined("errors")><ul><b>#errors#</b></ul></cfif>
75<form action="#cgi.script_name#?#cgi.query_string#" method="post">
76<table width="100%" cellspacing=0 cellpadding=5 class="adminEditTable">
77        <tr valign="top">
78                <td align="right"><b>Name:</b></td>
79                <td><input type="text" name="name" value="#form.name#" size="100"></td>
80        </tr>
81        <tr valign="top">
82                <td align="right"><b>Forum:</b></td>
83                <td>
84                        <select name="forumidfk">
85                        <cfloop query="forums">
86                        <option value="#id#" <cfif form.forumidfk is id>selected</cfif>>#name#</option>
87                        </cfloop>
88                        </select>
89                </td>
90        </tr>
91        <tr valign="top">
92                <td align="right"><b>Date Created:</b></td>
93                <td><input type="text" name="datecreated" value="#form.datecreated#" size="50"></td>
94        </tr>
95        <tr valign="top">
96                <td align="right"><b>User:</b></td>
97                <td>
98                        <select name="useridfk">
99                        <cfloop query="users">
100                        <option value="#id#" <cfif form.useridfk is id>selected</cfif>>#username#</option>
101                        </cfloop>
102                        </select>
103                </td>
104        </tr>
105        <tr valign="top">
106                <td align="right"><b>Read Only:</b></td>
107                <td><select name="readonly">
108                <option value="1" <cfif form.readonly>selected</cfif>>Yes</option>
109                <option value="0" <cfif not form.readonly>selected</cfif>>No</option>
110                </select></td>
111        </tr>
112        <tr valign="top">
113                <td align="right"><b>Active:</b></td>
114                <td><select name="active">
115                <option value="1" <cfif form.active>selected</cfif>>Yes</option>
116                <option value="0" <cfif not form.active>selected</cfif>>No</option>
117                </select></td>
118        </tr>
119        <tr valign="top">
120                <td align="right"><b>Sticky:</b></td>
121                <td><select name="sticky">
122                <option value="1" <cfif isBoolean(form.sticky) and form.sticky>selected</cfif>>Yes</option>
123                <option value="0" <cfif (isBoolean(form.sticky) and not form.sticky) or not isBoolean(form.sticky)>selected</cfif>>No</option>
124                </select></td>
125        </tr>
126        <tr>
127                <td>&nbsp;</td>
128                <td><input type="submit" name="save" value="Save"> <input type="submit" name="cancel" value="Cancel"></td>
129        </tr>
130</table>
131</form>
132</p>
133</cfoutput>
134
135</cfmodule>
136
137<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.