Commit f336e48f authored by jan.koester's avatar jan.koester
Browse files

test

parent ec021e3f
Loading
Loading
Loading
Loading
+88 −0
Changes for editor/html/css/editor.css: 88 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1321,3 +1321,91 @@ dialog label {
    word-break: break-all;
    line-height: 1.3;
}

/* ============================================================
   Survey Manager
   ============================================================ */

.survey-manager-dialog {
    width: min(92vw, 960px);
    max-height: 90vh;
}

.survey-manager-dialog .set-modal {
    min-height: 480px;
}

.sm-survey-list {
    max-height: 300px;
    overflow-y: auto;
}

.sm-survey-item {
    padding: 0.4em 0.6em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-survey-item:hover {
    background: var(--bg-tertiary);
}

.sm-survey-item.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.sm-content {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    overflow: auto;
}

.sm-editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1em;
    align-items: start;
}

@media (max-width: 680px) {
    .sm-editor-layout {
        grid-template-columns: 1fr;
    }
}

.sm-canvas-wrap canvas {
    display: block;
    cursor: pointer;
}

.sm-q-panel {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8em;
    background: var(--bg-secondary);
    min-height: 160px;
}

.sm-q-panel .set-field {
    margin-bottom: 0.5em;
}

.sm-q-panel label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.2em;
}

.sm-q-panel input,
.sm-q-panel select,
.sm-q-panel textarea {
    width: 100%;
    box-sizing: border-box;
}
+60 −0
Changes for editor/html/index.html: 60 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
            <button id="btn-import-html" data-i18n-title="I18N_IMPORT_HTML">&#x2B07; <span data-i18n="I18N_IMPORT_HTML">Import HTML</span></button>
            <button id="btn-export-html" data-i18n-title="I18N_EXPORT_HTML">&#x2B06; <span data-i18n="I18N_EXPORT_HTML">Export HTML</span></button>
            <button id="btn-conn-manager" data-i18n-title="I18N_CONNECTIONS">&#x1F517; <span data-i18n="I18N_CONNECTIONS">Verbindungen</span></button>
            <button id="btn-survey-manager" title="Umfragen verwalten">&#x1F4CB; <span>Umfragen</span></button>
        </div>
        <div class="toolbar-group">
            <button id="btn-ai" data-i18n-title="I18N_AI_TITLE">&#x1F916; <span data-i18n="I18N_AI">KI</span></button>
@@ -386,12 +387,71 @@
        </div>
    </dialog>

    <!-- Survey Manager Dialog -->
    <dialog id="survey-manager-dialog" class="settings-dialog survey-manager-dialog">
        <div class="set-modal">
            <div class="set-sidebar">
                <h3>Umfragen</h3>
                <div id="sm-survey-list" class="sm-survey-list"></div>
                <button id="btn-sm-new-survey" class="set-save-btn" style="margin-top:0.5em;width:100%">+ Neue Umfrage</button>
            </div>
            <div class="set-content sm-content">
                <div id="sm-form-area" style="display:none">
                    <input type="hidden" id="sm-survey-id">
                    <div style="display:flex;gap:0.5em;align-items:flex-end;flex-wrap:wrap;margin-bottom:0.8em">
                        <div class="set-field" style="flex:1;min-width:140px;margin:0">
                            <label>Name (intern)</label>
                            <input type="text" id="sm-survey-name" placeholder="kundenzufriedenheit">
                        </div>
                        <div class="set-field" style="flex:2;min-width:180px;margin:0">
                            <label>Titel (Anzeige)</label>
                            <input type="text" id="sm-survey-title" placeholder="Kundenzufriedenheit">
                        </div>
                        <div style="display:flex;gap:0.4em;align-items:center">
                            <button id="btn-sm-save-survey" class="set-save-btn">Speichern</button>
                            <button id="btn-sm-delete-survey" class="set-save-btn" style="background:#c00">Löschen</button>
                            <span id="sm-save-status" class="set-status"></span>
                        </div>
                    </div>

                    <div class="sm-editor-layout">
                        <!-- Canvas tree -->
                        <div class="sm-canvas-wrap">
                            <div style="display:flex;align-items:center;gap:0.5em;margin-bottom:0.4em">
                                <strong style="font-size:0.85rem">Fragebaum</strong>
                                <button id="btn-sm-add-question" class="set-save-btn" style="padding:0.15em 0.5em;font-size:0.8rem">+ Frage hinzufügen</button>
                            </div>
                            <div style="overflow:auto;border:1px solid var(--border);border-radius:6px;background:var(--bg-primary);min-height:160px">
                                <canvas id="sm-canvas"></canvas>
                            </div>
                        </div>

                        <!-- Question editor -->
                        <div class="sm-q-panel">
                            <strong style="font-size:0.85rem;display:block;margin-bottom:0.5em">Fragedetails</strong>
                            <div id="sm-q-editor">
                                <p class="hint">Frage im Baum auswählen oder neue hinzufügen.</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="sm-placeholder" style="">
                    <p class="hint">Umfrage auswählen oder neue erstellen.</p>
                </div>
            </div>
        </div>
        <div class="dialog-actions">
            <button id="btn-sm-close">Schließen</button>
        </div>
    </dialog>

    <script src="js/i18n.js"></script>
    <script src="js/api.js"></script>
    <script src="js/tree.js"></script>
    <script src="js/properties.js"></script>
    <script src="js/preview.js"></script>
    <script src="js/media-browser.js"></script>
    <script src="js/survey-manager.js"></script>
    <script src="js/editor.js"></script>
</body>
</html>
+21 −0
Changes for editor/html/js/api.js: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -395,6 +395,27 @@ var EditorApi = (function() {

        exportHtml: function() {
            return request('GET', '/api/document/export-html');
        },

        // Survey management
        listSurveys: function() {
            return request('GET', '/api/surveys');
        },

        listSurveyNames: function() {
            return request('GET', '/api/survey/names');
        },

        getSurvey: function(id) {
            return request('GET', '/api/survey/' + encodeURIComponent(id));
        },

        saveSurvey: function(data) {
            return request('POST', '/api/survey/save', data);
        },

        deleteSurvey: function(id) {
            return request('DELETE', '/api/survey/delete/' + encodeURIComponent(id));
        }
    };
})();
+5 −0
Changes for editor/html/js/editor.js: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
            try { bindSettingsDialog(); } catch(e) { console.error('bindSettingsDialog:', e); }
            try { bindAiDialog(); } catch(e) { console.error('bindAiDialog:', e); }
            try { bindClipboardShortcuts(); } catch(e) { console.error('bindClipboardShortcuts:', e); }
            try { SurveyManager.init(); } catch(e) { console.error('SurveyManager.init:', e); }
            Preview.clear();

            DocumentTree.setOnSelect(function(uuid) {
@@ -249,6 +250,10 @@
            openConnectionManager();
        });

        document.getElementById('btn-survey-manager').addEventListener('click', function() {
            SurveyManager.open();
        });

        document.getElementById('btn-publish-now').addEventListener('click', function() {
            publishFromToolbar();
        });
+20 −1
Changes for editor/html/js/properties.js: 20 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -358,7 +358,26 @@ var PropertiesPanel = (function() {
                group.appendChild(label);

                var input;
                if (field.type === 'select' && field.options) {
                if (field.type === 'survey_select') {
                    input = document.createElement('select');
                    input.name = field.key;
                    var emptyOptS = document.createElement('option');
                    emptyOptS.value = '';
                    emptyOptS.textContent = '-- Umfrage wählen --';
                    input.appendChild(emptyOptS);
                    // Load survey names asynchronously
                    (function(sel, curVal) {
                        EditorApi.listSurveyNames().then(function(resp) {
                            (resp.surveys || []).forEach(function(s) {
                                var o = document.createElement('option');
                                o.value = s.name;
                                o.textContent = s.name;
                                if (curVal === s.name) o.selected = true;
                                sel.appendChild(o);
                            });
                        }).catch(function() {});
                    })(input, value);
                } else if (field.type === 'select' && field.options) {
                    input = document.createElement('select');
                    input.name = field.key;
                    var emptyOpt = document.createElement('option');
Loading