| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : questions_edit.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : September 17, 2004 |
|---|
| 6 | Last Updated : September 17, 2004 |
|---|
| 7 | History : |
|---|
| 8 | Purpose : |
|---|
| 9 | ---> |
|---|
| 10 | <cfimport taglib="../tags/" prefix="tags"> |
|---|
| 11 | |
|---|
| 12 | <cfif not isDefined("url.surveyidfk")> |
|---|
| 13 | <cflocation url="questions.cfm" addToken="false"> |
|---|
| 14 | </cfif> |
|---|
| 15 | <cfif isDefined("form.cancel")> |
|---|
| 16 | <cflocation url="questions.cfm?surveyidfk=#url.surveyidfk#" addToken="false"> |
|---|
| 17 | </cfif> |
|---|
| 18 | |
|---|
| 19 | <!--- get question if not new ---> |
|---|
| 20 | <cfif url.id neq 0> |
|---|
| 21 | <cfset question = application.question.getQuestion(url.id)> |
|---|
| 22 | <cfset form.questionType = question.questionTypeIDFK> |
|---|
| 23 | </cfif> |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | <!--- get question types ---> |
|---|
| 27 | <cfset qts = application.questiontype.getQuestionTypes()> |
|---|
| 28 | |
|---|
| 29 | <tags:layout templatename="admin" title="Question Editor"> |
|---|
| 30 | |
|---|
| 31 | <cfif isDefined("url.questionType")> |
|---|
| 32 | <cfset form.questionType = url.questionType> |
|---|
| 33 | </cfif> |
|---|
| 34 | <cfif not isDefined("form.questionType")> |
|---|
| 35 | |
|---|
| 36 | <cfoutput> |
|---|
| 37 | <p> |
|---|
| 38 | <form action="questions_edit.cfm?#cgi.query_string#" method="post"> |
|---|
| 39 | Please select a question type: |
|---|
| 40 | <select name="questionType"> |
|---|
| 41 | <cfloop query="qts"> |
|---|
| 42 | <option value="#id#">#name#</option> |
|---|
| 43 | </cfloop> |
|---|
| 44 | </select> |
|---|
| 45 | <br> |
|---|
| 46 | <input type="submit" value="Submit"> <input type="submit" name="cancel" value="Cancel"> |
|---|
| 47 | </form> |
|---|
| 48 | </p> |
|---|
| 49 | </cfoutput> |
|---|
| 50 | |
|---|
| 51 | <cfelse> |
|---|
| 52 | |
|---|
| 53 | <cfset qt = application.questionType.getQuestionType(form.questionType)> |
|---|
| 54 | |
|---|
| 55 | <cfset qs = cgi.query_string> |
|---|
| 56 | <cfif not findNoCase("questionType",qs)> |
|---|
| 57 | <cfset qs = qs & "&questionType=#form.questionType#"> |
|---|
| 58 | </cfif> |
|---|
| 59 | |
|---|
| 60 | <cfset extra = structNew()> |
|---|
| 61 | <cfif url.id is not 0> |
|---|
| 62 | <!--- pass the question in ---> |
|---|
| 63 | <cfset extra.question = question> |
|---|
| 64 | </cfif> |
|---|
| 65 | |
|---|
| 66 | <cfset top = application.survey.getTopRank(surveyidfk)> |
|---|
| 67 | |
|---|
| 68 | <!--- fire edit handler for qt ---> |
|---|
| 69 | <cfmodule template="../handlers/#qt.handlerRoot#/edit.cfm" |
|---|
| 70 | queryString="#qs#" |
|---|
| 71 | surveyidfk="#surveyidfk#" |
|---|
| 72 | topRank="#top#" |
|---|
| 73 | questionType="#qt#" |
|---|
| 74 | attributeCollection="#extra#" |
|---|
| 75 | /> |
|---|
| 76 | |
|---|
| 77 | </cfif> |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | </tags:layout> |
|---|
| 81 | |
|---|
| 82 | <cfsetting enablecfoutputonly=false> |
|---|