equal
deleted
inserted
replaced
52 |
52 |
53 |
53 |
54 CHOICE_TYPES = set(('selection', 'pick_multi', 'choice', 'pick_quant')) |
54 CHOICE_TYPES = set(('selection', 'pick_multi', 'choice', 'pick_quant')) |
55 TEXT_TYPES = set(('long_answer', 'short_answer')) |
55 TEXT_TYPES = set(('long_answer', 'short_answer')) |
56 PROPERTY_TYPES = tuple(CHOICE_TYPES) + tuple(TEXT_TYPES) |
56 PROPERTY_TYPES = tuple(CHOICE_TYPES) + tuple(TEXT_TYPES) |
|
57 |
|
58 # used in View.getSchemaOptions to map POST values |
|
59 BOOL = {'True': True, 'False': False} |
57 |
60 |
58 _short_answer = ("Short Answer", |
61 _short_answer = ("Short Answer", |
59 "Less than 40 characters. Rendered as a text input. " |
62 "Less than 40 characters. Rendered as a text input. " |
60 "It's possible to add a free form question (Content) " |
63 "It's possible to add a free form question (Content) " |
61 "and a in-input prompt/example text.") |
64 "and a in-input prompt/example text.") |
422 # set 'question' entry (free text label for question) in schema |
425 # set 'question' entry (free text label for question) in schema |
423 question_for = 'NEW_' + key |
426 question_for = 'NEW_' + key |
424 if question_for in POST: |
427 if question_for in POST: |
425 schema[key]["question"] = POST[question_for] |
428 schema[key]["question"] = POST[question_for] |
426 |
429 |
|
430 # set wheter the question is required |
|
431 required_for = 'required_for_' + key |
|
432 schema[key]['required'] = BOOL[POST[required_for]] |
|
433 |
|
434 # set wheter the question allows comments |
|
435 comment_for = 'comment_for_' + key |
|
436 schema[key]['has_comment'] = BOOL[POST[comment_for]] |
|
437 |
427 def createGet(self, request, context, params, seed): |
438 def createGet(self, request, context, params, seed): |
428 """Pass the question types for the survey creation template. |
439 """Pass the question types for the survey creation template. |
429 """ |
440 """ |
430 |
441 |
431 context['question_types'] = QUESTION_TYPES |
442 context['question_types'] = QUESTION_TYPES |