| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : forums_edit.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : June 01, 2004 |
|---|
| 6 | Last Updated : November 5, 2006 |
|---|
| 7 | History : Removed mappings (rkc 8/27/05) |
|---|
| 8 | : Simple size change (rkc 7/27/06) |
|---|
| 9 | : Allow attachments (rkc 11/6/06) |
|---|
| 10 | : Reverted description to text field (rkc 11/5/06) |
|---|
| 11 | Purpose : |
|---|
| 12 | ---> |
|---|
| 13 | |
|---|
| 14 | <cfif isDefined("form.cancel") or not isDefined("url.id") or not len(url.id)> |
|---|
| 15 | <cflocation url="forums.cfm" addToken="false"> |
|---|
| 16 | </cfif> |
|---|
| 17 | |
|---|
| 18 | <cfif isDefined("form.save")> |
|---|
| 19 | <cfset errors = ""> |
|---|
| 20 | <cfif not len(trim(form.name))> |
|---|
| 21 | <cfset errors = errors & "You must specify a name.<br>"> |
|---|
| 22 | </cfif> |
|---|
| 23 | <cfif not len(trim(form.description))> |
|---|
| 24 | <cfset errors = errors & "You must specify a description.<br>"> |
|---|
| 25 | </cfif> |
|---|
| 26 | <cfif not len(errors)> |
|---|
| 27 | <cfset forum = structNew()> |
|---|
| 28 | <cfset forum.name = trim(htmlEditFormat(form.name))> |
|---|
| 29 | <cfset forum.description = trim(htmlEditFormat(form.description))> |
|---|
| 30 | <cfset forum.readonly = trim(htmlEditFormat(form.readonly))> |
|---|
| 31 | <cfset forum.active = trim(htmlEditFormat(form.active))> |
|---|
| 32 | <cfset forum.attachments = trim(htmlEditFormat(form.attachments))> |
|---|
| 33 | <cfset forum.conferenceidfk = trim(htmlEditFormat(form.conferenceidfk))> |
|---|
| 34 | <cfif url.id neq 0> |
|---|
| 35 | <cfset application.galleon.forum.saveForum(url.id, forum)> |
|---|
| 36 | <cfelse> |
|---|
| 37 | <cfset application.galleon.forum.addForum(forum)> |
|---|
| 38 | </cfif> |
|---|
| 39 | <cfset msg = "Forum, #forum.name#, has been updated."> |
|---|
| 40 | <cflocation url="forums.cfm?msg=#urlEncodedFormat(msg)#"> |
|---|
| 41 | </cfif> |
|---|
| 42 | </cfif> |
|---|
| 43 | |
|---|
| 44 | <!--- get forum if not new ---> |
|---|
| 45 | <cfif url.id neq 0> |
|---|
| 46 | <cfset forum = application.galleon.forum.getForum(url.id)> |
|---|
| 47 | <cfparam name="form.name" default="#forum.name#"> |
|---|
| 48 | <cfparam name="form.description" default="#forum.description#"> |
|---|
| 49 | <cfparam name="form.readonly" default="#forum.readonly#"> |
|---|
| 50 | <cfparam name="form.active" default="#forum.active#"> |
|---|
| 51 | <cfparam name="form.attachments" default="#forum.attachments#"> |
|---|
| 52 | <cfparam name="form.conferenceidfk" default="#forum.conferenceidfk#"> |
|---|
| 53 | <cfelse> |
|---|
| 54 | <cfparam name="form.name" default=""> |
|---|
| 55 | <cfparam name="form.description" default=""> |
|---|
| 56 | <cfparam name="form.readonly" default="false"> |
|---|
| 57 | <cfparam name="form.active" default="false"> |
|---|
| 58 | <cfparam name="form.attachments" default="false"> |
|---|
| 59 | <cfparam name="form.conferenceidfk" default=""> |
|---|
| 60 | </cfif> |
|---|
| 61 | |
|---|
| 62 | <!--- get all conferences ---> |
|---|
| 63 | <cfset conferences = application.galleon.conference.getConferences(false)> |
|---|
| 64 | |
|---|
| 65 | <cfmodule template="../tags/layout.cfm" templatename="admin" title="Forum Editor"> |
|---|
| 66 | |
|---|
| 67 | <cfoutput> |
|---|
| 68 | <p> |
|---|
| 69 | <cfif isDefined("errors")><ul><b>#errors#</b></ul></cfif> |
|---|
| 70 | <form action="#cgi.script_name#?#cgi.query_string#" method="post"> |
|---|
| 71 | <table width="100%" cellspacing=0 cellpadding=5 class="adminEditTable"> |
|---|
| 72 | <tr valign="top"> |
|---|
| 73 | <td align="right"><b>Name:</b></td> |
|---|
| 74 | <td><input type="text" name="name" value="#form.name#" size="100"></td> |
|---|
| 75 | </tr> |
|---|
| 76 | <tr valign="top"> |
|---|
| 77 | <td align="right"><b>Conference:</b></td> |
|---|
| 78 | <td> |
|---|
| 79 | <select name="conferenceidfk"> |
|---|
| 80 | <cfloop query="conferences"> |
|---|
| 81 | <option value="#id#" <cfif form.conferenceidfk is id>selected</cfif>>#name#</option> |
|---|
| 82 | </cfloop> |
|---|
| 83 | </select> |
|---|
| 84 | </td> |
|---|
| 85 | </tr> |
|---|
| 86 | <tr valign="top"> |
|---|
| 87 | <td align="right"><b>Description:</b></td> |
|---|
| 88 | <td><input type="text" name="description" value="#form.description#" size="100"></td> |
|---|
| 89 | </tr> |
|---|
| 90 | <tr valign="top"> |
|---|
| 91 | <td align="right"><b>Read Only:</b></td> |
|---|
| 92 | <td><select name="readonly"> |
|---|
| 93 | <option value="1" <cfif form.readonly>selected</cfif>>Yes</option> |
|---|
| 94 | <option value="0" <cfif not form.readonly>selected</cfif>>No</option> |
|---|
| 95 | </select></td> |
|---|
| 96 | </tr> |
|---|
| 97 | <tr valign="top"> |
|---|
| 98 | <td align="right"><b>Active:</b></td> |
|---|
| 99 | <td><select name="active"> |
|---|
| 100 | <option value="1" <cfif form.active>selected</cfif>>Yes</option> |
|---|
| 101 | <option value="0" <cfif not form.active>selected</cfif>>No</option> |
|---|
| 102 | </select></td> |
|---|
| 103 | </tr> |
|---|
| 104 | <tr valign="top"> |
|---|
| 105 | <td align="right"><b>Attachments:</b></td> |
|---|
| 106 | <td><select name="attachments"> |
|---|
| 107 | <option value="1" <cfif isBoolean(form.attachments) and form.attachments>selected</cfif>>Yes</option> |
|---|
| 108 | <option value="0" <cfif (isBoolean(form.attachments) and not form.attachments) or form.attachments is "">selected</cfif>>No</option> |
|---|
| 109 | </select></td> |
|---|
| 110 | </tr> |
|---|
| 111 | <tr> |
|---|
| 112 | <td> </td> |
|---|
| 113 | <td><input type="submit" name="save" value="Save"> <input type="submit" name="cancel" value="Cancel"></td> |
|---|
| 114 | </tr> |
|---|
| 115 | </table> |
|---|
| 116 | </form> |
|---|
| 117 | </p> |
|---|
| 118 | </cfoutput> |
|---|
| 119 | |
|---|
| 120 | </cfmodule> |
|---|
| 121 | |
|---|
| 122 | <cfsetting enablecfoutputonly=false> |
|---|