| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <cfprocessingdirective pageencoding="utf-8"> |
|---|
| 3 | <!--- |
|---|
| 4 | Name : /client/admin/page.cfm |
|---|
| 5 | Author : Raymond Camden |
|---|
| 6 | Created : 07/07/06 |
|---|
| 7 | Last Updated : |
|---|
| 8 | History : |
|---|
| 9 | ---> |
|---|
| 10 | |
|---|
| 11 | <cfparam name="url.id" default="0"> |
|---|
| 12 | |
|---|
| 13 | <cfif url.id is not 0> |
|---|
| 14 | <cftry> |
|---|
| 15 | <cfset tb = application.textblock.getTextblock(id=url.id)> |
|---|
| 16 | <cfif structIsEmpty(tb)> |
|---|
| 17 | <cflocation url="textblocks.cfm" addToken="false"> |
|---|
| 18 | </cfif> |
|---|
| 19 | <cfcatch> |
|---|
| 20 | <cflocation url="textblocks.cfm" addToken="false"> |
|---|
| 21 | </cfcatch> |
|---|
| 22 | </cftry> |
|---|
| 23 | <cfparam name="form.label" default="#tb.label#"> |
|---|
| 24 | <cfparam name="form.body" default="#tb.body#"> |
|---|
| 25 | <cfelse> |
|---|
| 26 | <cfparam name="form.label" default=""> |
|---|
| 27 | <cfparam name="form.body" default=""> |
|---|
| 28 | </cfif> |
|---|
| 29 | |
|---|
| 30 | <cfif structKeyExists(form, "cancel")> |
|---|
| 31 | <cflocation url="textblocks.cfm" addToken="false"> |
|---|
| 32 | </cfif> |
|---|
| 33 | |
|---|
| 34 | <cfif structKeyExists(form, "save")> |
|---|
| 35 | <cfset errors = arrayNew(1)> |
|---|
| 36 | |
|---|
| 37 | <cfif not len(trim(form.label))> |
|---|
| 38 | <cfset arrayAppend(errors, "The label cannot be blank.")> |
|---|
| 39 | </cfif> |
|---|
| 40 | <cfif not len(trim(form.body))> |
|---|
| 41 | <cfset arrayAppend(errors, "The body cannot be blank.")> |
|---|
| 42 | </cfif> |
|---|
| 43 | |
|---|
| 44 | <cfif not arrayLen(errors)> |
|---|
| 45 | <cfset application.textblock.saveTextblock(url.id, left(form.label,255), form.body)> |
|---|
| 46 | <cflocation url="textblocks.cfm" addToken="false"> |
|---|
| 47 | </cfif> |
|---|
| 48 | |
|---|
| 49 | </cfif> |
|---|
| 50 | |
|---|
| 51 | <cfmodule template="../tags/adminlayout.cfm" title="Textblock Editor"> |
|---|
| 52 | |
|---|
| 53 | <cfoutput> |
|---|
| 54 | <p> |
|---|
| 55 | Use the form below to edit a textblock. Textblocks are random blocks of text that you can use in your site. These would |
|---|
| 56 | be useful for pods or footer text that you need to update often. |
|---|
| 57 | </p> |
|---|
| 58 | </cfoutput> |
|---|
| 59 | |
|---|
| 60 | <cfif structKeyExists(variables, "errors") and arrayLen(errors)> |
|---|
| 61 | <cfoutput> |
|---|
| 62 | <div class="errors"> |
|---|
| 63 | Please correct the following error(s): |
|---|
| 64 | <ul> |
|---|
| 65 | <cfloop index="x" from="1" to="#arrayLen(errors)#"> |
|---|
| 66 | <li>#errors[x]#</li> |
|---|
| 67 | </cfloop> |
|---|
| 68 | </ul> |
|---|
| 69 | </div> |
|---|
| 70 | </cfoutput> |
|---|
| 71 | </cfif> |
|---|
| 72 | |
|---|
| 73 | <cfoutput> |
|---|
| 74 | <form action="textblock.cfm?id=#url.id#" method="post"> |
|---|
| 75 | <table> |
|---|
| 76 | <tr> |
|---|
| 77 | <td align="right">label:</td> |
|---|
| 78 | <td><input type="text" name="label" value="#form.label#" class="txtField" maxlength="255"></td> |
|---|
| 79 | </tr> |
|---|
| 80 | <tr valign="top"> |
|---|
| 81 | <td align="right">body:</td> |
|---|
| 82 | <td><textarea name="body" class="txtArea">#form.body#</textarea></td> |
|---|
| 83 | </tr> |
|---|
| 84 | <tr> |
|---|
| 85 | <td> </td> |
|---|
| 86 | <td><input type="submit" name="cancel" value="Cancel"> <input type="submit" name="save" value="Save"></td> |
|---|
| 87 | </tr> |
|---|
| 88 | </table> |
|---|
| 89 | </form> |
|---|
| 90 | </cfoutput> |
|---|
| 91 | </cfmodule> |
|---|
| 92 | |
|---|
| 93 | <cfsetting enablecfoutputonly=false> |
|---|