added scaleType configuration to questionnaire import and display
This commit is contained in:
@ -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'];
|
||||
|
||||
@ -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'];
|
||||
|
||||
@ -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];
|
||||
}
|
||||
|
||||
@ -123,13 +123,22 @@ function configFormHTML(layout, config, prefix) {
|
||||
<input type="number" id="${prefix}_minSelection" value="${config.minSelection || 0}" min="0">
|
||||
</div>`;
|
||||
break;
|
||||
case 'glass_scale_question':
|
||||
case 'glass_scale_question': {
|
||||
const scaleType = config.scaleType || 'glass';
|
||||
html = `
|
||||
<div class="form-group">
|
||||
<label>Scale display</label>
|
||||
<select id="${prefix}_scaleType">
|
||||
<option value="glass" ${scaleType === 'glass' ? 'selected' : ''}>Glass (pain scale)</option>
|
||||
<option value="thermometer" ${scaleType === 'thermometer' ? 'selected' : ''}>Thermometer</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Symptom keys (one per line)</label>
|
||||
<textarea id="${prefix}_symptoms" rows="5" style="font-family:monospace;font-size:.85rem">${(config.symptoms || []).join('\n')}</textarea>
|
||||
</div>`;
|
||||
break;
|
||||
}
|
||||
case 'value_spinner':
|
||||
html = `
|
||||
<div class="form-row">
|
||||
@ -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;
|
||||
|
||||
@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user