| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : ranks_edit.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : August 28, 2005 |
|---|
| 6 | Last Updated : |
|---|
| 7 | History : |
|---|
| 8 | Purpose : |
|---|
| 9 | ---> |
|---|
| 10 | |
|---|
| 11 | <cfif isDefined("form.cancel") or not isDefined("url.id") or not len(url.id)> |
|---|
| 12 | <cflocation url="ranks.cfm" addToken="false"> |
|---|
| 13 | </cfif> |
|---|
| 14 | |
|---|
| 15 | <cfif isDefined("form.save")> |
|---|
| 16 | <cfset errors = ""> |
|---|
| 17 | <cfif not len(trim(form.name))> |
|---|
| 18 | <cfset errors = errors & "You must specify a name.<br>"> |
|---|
| 19 | </cfif> |
|---|
| 20 | <cfif not len(trim(form.minposts)) or not isNumeric(form.minposts) or form.minposts lt 0> |
|---|
| 21 | <cfset errors = errors & "You must specify a numeric value greater than zero for the minimum number of posts.<br>"> |
|---|
| 22 | </cfif> |
|---|
| 23 | <cfif not len(errors)> |
|---|
| 24 | <cfset rank = structNew()> |
|---|
| 25 | <cfset rank.name = trim(htmlEditFormat(form.name))> |
|---|
| 26 | <cfset rank.minposts = trim(htmlEditFormat(form.minposts))> |
|---|
| 27 | <cfif url.id neq 0> |
|---|
| 28 | <cfset application.galleon.rank.saveRank(url.id, rank)> |
|---|
| 29 | <cfelse> |
|---|
| 30 | <cfset application.galleon.rank.addRank(rank)> |
|---|
| 31 | </cfif> |
|---|
| 32 | <cfset msg = "Rank, #rank.name#, has been updated."> |
|---|
| 33 | <cflocation url="ranks.cfm?msg=#urlEncodedFormat(msg)#"> |
|---|
| 34 | </cfif> |
|---|
| 35 | </cfif> |
|---|
| 36 | |
|---|
| 37 | <!--- get conference if not new ---> |
|---|
| 38 | <cfif url.id neq "0"> |
|---|
| 39 | <cfset rank = application.galleon.rank.getRank(url.id)> |
|---|
| 40 | <cfparam name="form.name" default="#rank.name#"> |
|---|
| 41 | <cfparam name="form.minposts" default="#rank.minposts#"> |
|---|
| 42 | <cfelse> |
|---|
| 43 | <cfparam name="form.name" default=""> |
|---|
| 44 | <cfparam name="form.minposts" default=""> |
|---|
| 45 | </cfif> |
|---|
| 46 | |
|---|
| 47 | <cfmodule template="../tags/layout.cfm" templatename="admin" title="Rank Editor"> |
|---|
| 48 | |
|---|
| 49 | <cfoutput> |
|---|
| 50 | <p> |
|---|
| 51 | <cfif isDefined("errors")><ul><b>#errors#</b></ul></cfif> |
|---|
| 52 | <form action="#cgi.script_name#?#cgi.query_string#" method="post"> |
|---|
| 53 | <table width="100%" cellspacing=0 cellpadding=5 class="adminEditTable"> |
|---|
| 54 | <tr valign="top"> |
|---|
| 55 | <td align="right"><b>Name:</b></td> |
|---|
| 56 | <td><input type="text" name="name" value="#form.name#" size="50"></td> |
|---|
| 57 | </tr> |
|---|
| 58 | <tr valign="top"> |
|---|
| 59 | <td align="right"><b>Minimum Number of Posts:</b></td> |
|---|
| 60 | <td><input type="text" name="minposts" value="#form.minposts#" size="50"></td> |
|---|
| 61 | </tr> |
|---|
| 62 | <tr> |
|---|
| 63 | <td> </td> |
|---|
| 64 | <td><input type="submit" name="save" value="Save"> <input type="submit" name="cancel" value="Cancel"></td> |
|---|
| 65 | </tr> |
|---|
| 66 | </table> |
|---|
| 67 | </form> |
|---|
| 68 | </p> |
|---|
| 69 | </cfoutput> |
|---|
| 70 | |
|---|
| 71 | </cfmodule> |
|---|
| 72 | |
|---|
| 73 | <cfsetting enablecfoutputonly=false> |
|---|