diff --git a/api/app_questionnaires.php b/api/app_questionnaires.php index 0eb139b..0813d4b 100644 --- a/api/app_questionnaires.php +++ b/api/app_questionnaires.php @@ -74,6 +74,7 @@ if ($qnID) { if (isset($config['hint1'])) $q['hint1'] = $config['hint1']; if (isset($config['hint2'])) $q['hint2'] = $config['hint2']; if (isset($config['symptoms'])) $q['symptoms'] = $config['symptoms']; + if (isset($config['scaleType'])) $q['scaleType'] = $config['scaleType']; if (isset($config['range'])) $q['range'] = $config['range']; if (isset($config['constraints'])) $q['constraints'] = $config['constraints']; if (isset($config['precision'])) $q['precision'] = $config['precision']; diff --git a/handlers/app_questionnaires.php b/handlers/app_questionnaires.php index e17e15b..1be6431 100644 --- a/handlers/app_questionnaires.php +++ b/handlers/app_questionnaires.php @@ -265,6 +265,7 @@ if ($qnID) { if (isset($config['hint1'])) $q['hint1'] = $config['hint1']; if (isset($config['hint2'])) $q['hint2'] = $config['hint2']; if (isset($config['symptoms'])) $q['symptoms'] = $config['symptoms']; + if (isset($config['scaleType'])) $q['scaleType'] = $config['scaleType']; if (isset($config['range'])) $q['range'] = $config['range']; if (isset($config['constraints'])) $q['constraints'] = $config['constraints']; if (isset($config['precision'])) $q['precision'] = $config['precision']; diff --git a/import_questionnaires.php b/import_questionnaires.php index a4b4a86..55db515 100644 --- a/import_questionnaires.php +++ b/import_questionnaires.php @@ -83,6 +83,7 @@ try { if (isset($q['hint1'])) $config['hint1'] = $q['hint1']; if (isset($q['hint2'])) $config['hint2'] = $q['hint2']; if (isset($q['symptoms'])) $config['symptoms'] = $q['symptoms']; + if (isset($q['scaleType'])) $config['scaleType'] = $q['scaleType']; if (isset($q['range'])) $config['range'] = $q['range']; if (isset($q['constraints'])) $config['constraints'] = $q['constraints']; if (isset($q['precision'])) $config['precision'] = $q['precision']; @@ -92,7 +93,7 @@ try { if (isset($q['otherNextQuestionId'])) $config['otherNextQuestionId'] = $q['otherNextQuestionId']; if (isset($q['otherOptionKey'])) $config['otherOptionKey'] = $q['otherOptionKey']; if (isset($q['config']) && is_array($q['config'])) { - foreach (['otherNextQuestionId', 'otherOptionKey', 'hint', 'maxLength', 'multiline', 'textKey', 'precision'] as $ck) { + foreach (['otherNextQuestionId', 'otherOptionKey', 'hint', 'maxLength', 'multiline', 'textKey', 'precision', 'scaleType'] as $ck) { if (isset($q['config'][$ck])) { $config[$ck] = $q['config'][$ck]; } diff --git a/website/js/pages/editor.js b/website/js/pages/editor.js index a6ba455..07e3ec1 100644 --- a/website/js/pages/editor.js +++ b/website/js/pages/editor.js @@ -123,13 +123,22 @@ function configFormHTML(layout, config, prefix) { `; break; - case 'glass_scale_question': + case 'glass_scale_question': { + const scaleType = config.scaleType || 'glass'; html = ` +
+ + +
`; break; + } case 'value_spinner': html = `
@@ -254,6 +263,8 @@ function readConfigFromForm(layout, prefix) { break; } case 'glass_scale_question': { + const st = val('scaleType') || 'glass'; + if (st && st !== 'glass') config.scaleType = st; const raw = val('symptoms'); const syms = raw.split('\n').map(s => s.trim()).filter(Boolean); if (syms.length) config.symptoms = syms; diff --git a/website/temp-assets/questionnaire_0_readme.json b/website/temp-assets/questionnaire_0_readme.json index c75af54..efbb9ca 100644 --- a/website/temp-assets/questionnaire_0_readme.json +++ b/website/temp-assets/questionnaire_0_readme.json @@ -76,6 +76,16 @@ }, + { + "id": "q5b", + "_comment": "Glas-Skala (Symptome als Zeilen, 5 Stufen). scaleType: glass (Standard) oder thermometer.", + "layout": "glass_scale_question", + "question": "example_symptom_scale", + "scaleType": "thermometer", + "symptoms": ["symptom_a", "symptom_b"] + }, + + { "id": "q6", "_comment": "Frage mit Spinner, dessen Antwortmöglichkeiten über range selbst definiert werden können.",