Commit 730e7fb2 authored by jan.koester's avatar jan.koester
Browse files

test

parent 9545a007
Loading
Loading
Loading
Loading
+100 −0
Changes for data/template/default/editor.html: 100 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@
        REMOVE_FORMATTING: '${I18N_REMOVE_FORMATTING}',
        CANCEL: '${I18N_CANCEL}',
        SAVE: '${I18N_SAVE_BTN}',
        CUSTOM_COLOR: '${I18N_CUSTOM_COLOR}',
        THEME_VARIABLE: '${I18N_THEME_VARIABLE}',
    };
    </script>
    <script src="https://cdn.tailwindcss.com"></script>
@@ -1724,6 +1726,25 @@
                    }
                }
            }
            // Also init color_var fields (only init BlogiCP when mode is "custom")
            var cvFields = schema.filter(function(f) { return f.type === 'color_var'; });
            for (var i = 0; i < cvFields.length; i++) {
                var key = cvFields[i].key;
                var inputId = 'prop-' + key;
                var modeSelect = document.getElementById(inputId + '-mode');
                var wrap = document.getElementById(inputId + '_wrap');
                if (modeSelect && modeSelect.value === 'custom' && wrap) {
                    new BlogiCP(inputId);
                }
                if (cvFields[i].responsive) {
                    var mId = 'prop-m_' + key;
                    var mMode = document.getElementById(mId + '-mode');
                    var mWrap = document.getElementById(mId + '_wrap');
                    if (mMode && mMode.value === 'custom' && mWrap) {
                        new BlogiCP(mId);
                    }
                }
            }
        }

        /**
@@ -1747,6 +1768,47 @@
            if (typeof scheduleAutoSave === 'function') scheduleAutoSave();
        }

        /**
         * Switches between none / theme var / custom color modes for a color_var field.
         */
        function switchColorVarMode(inputId) {
            var modeSelect = document.getElementById(inputId + '-mode');
            var varSelect = document.getElementById(inputId + '-varselect');
            var wrap = document.getElementById(inputId + '_wrap');
            var hd = document.getElementById(inputId);
            if (!modeSelect) return;
            var mode = modeSelect.value;
            if (mode === 'none') {
                if (varSelect) varSelect.style.display = 'none';
                if (wrap) { wrap.style.display = 'none'; wrap.innerHTML = ''; }
                if (hd) hd.value = '';
            } else if (mode === 'var') {
                if (varSelect) varSelect.style.display = '';
                if (wrap) { wrap.style.display = 'none'; wrap.innerHTML = ''; }
                applyColorVarSelect(inputId);
            } else if (mode === 'custom') {
                if (varSelect) varSelect.style.display = 'none';
                if (wrap) {
                    wrap.style.display = '';
                    wrap.innerHTML = '';
                    new BlogiCP(inputId);
                }
            }
            if (typeof scheduleAutoSave === 'function') scheduleAutoSave();
        }

        /**
         * Called when a theme variable is selected from the color_var dropdown.
         */
        function applyColorVarSelect(inputId) {
            var varSelect = document.getElementById(inputId + '-varselect');
            var hd = document.getElementById(inputId);
            if (varSelect && hd) {
                hd.value = varSelect.value;
            }
            if (typeof scheduleAutoSave === 'function') scheduleAutoSave();
        }

        /**
         * Renders a single form field based on its type.
         */
@@ -1766,6 +1828,39 @@
                    html += `<label style="display:flex;align-items:center;gap:4px;font-size:0.85rem;color:#ccc;margin-top:4px;"><input type="checkbox" id="${inputId}-none"${isNone ? ' checked' : ''} onchange="toggleBlogiCPNone('${inputId}')"> ${I18N.NONE}</label>`;
                    break;
                }
                case 'color_var': {
                    const isNone = (!val || val === 'none' || val === '');
                    const isVar = typeof val === 'string' && val.startsWith('var(');
                    const isCustom = !isNone && !isVar;
                    // Hidden input holds the actual value (var(...) or rgba/hex or empty)
                    html += `<input type="hidden" id="${inputId}" name="${field.key}" value="${isNone ? '' : escapeHtml(String(val))}">`;
                    // Mode selector: none / theme var / custom color
                    html += `<select class="prop-select" id="${inputId}-mode" onchange="switchColorVarMode('${inputId}')" style="margin-bottom:6px;">`;
                    html += `<option value="none"${isNone ? ' selected' : ''}>${I18N.NONE}</option>`;
                    html += `<option value="var"${isVar ? ' selected' : ''}>${I18N.THEME_VARIABLE}</option>`;
                    html += `<option value="custom"${isCustom ? ' selected' : ''}>${I18N.CUSTOM_COLOR}</option>`;
                    html += `</select>`;
                    // Theme variable dropdown (shown when mode=var)
                    html += `<select class="prop-select" id="${inputId}-varselect" onchange="applyColorVarSelect('${inputId}')" style="display:${isVar ? '' : 'none'}; margin-bottom:6px;">`;
                    const cvThemeVars = [
                        { v: 'var(--blogi-bg)',         label: 'Background (--blogi-bg)' },
                        { v: 'var(--blogi-surface)',    label: 'Surface (--blogi-surface)' },
                        { v: 'var(--blogi-surface-a)',  label: 'Surface Alpha (--blogi-surface-a)' },
                        { v: 'var(--blogi-text)',       label: 'Text (--blogi-text)' },
                        { v: 'var(--blogi-accent)',     label: 'Accent (--blogi-accent)' },
                        { v: 'var(--blogi-nav-active)', label: 'Nav Active (--blogi-nav-active)' },
                        { v: 'var(--blogi-nav-hover)',  label: 'Nav Hover (--blogi-nav-hover)' },
                        { v: 'var(--blogi-nav-border)', label: 'Nav Border (--blogi-nav-border)' },
                    ];
                    for (const tv of cvThemeVars) {
                        const sel = (val === tv.v) ? ' selected' : '';
                        html += `<option value="${tv.v}"${sel}>${tv.label}</option>`;
                    }
                    html += `</select>`;
                    // Color picker wrapper (shown when mode=custom)
                    html += `<div id="${inputId}_wrap" style="display:${isCustom ? '' : 'none'};"></div>`;
                    break;
                }
                case 'select':
                    html += `<select class="prop-select" id="${inputId}" name="${field.key}">`;
                    // If responsive, add empty option for "inherit"
@@ -1903,6 +1998,9 @@
                } else if (field.type === 'color') {
                    const noneBox = document.getElementById(`prop-${field.key}-none`);
                    properties[field.key] = (noneBox && noneBox.checked) ? 'none' : (el.value || 'none');
                } else if (field.type === 'color_var') {
                    // color_var: value already set in hidden input by mode/select handlers
                    properties[field.key] = el.value || 'none';
                } else {
                    properties[field.key] = el.value;
                }
@@ -1915,6 +2013,8 @@
                        if (field.type === 'color') {
                            const mNoneBox = document.getElementById(`prop-${mKey}-none`);
                            properties[mKey] = (mNoneBox && mNoneBox.checked) ? 'none' : (mEl.value || 'none');
                        } else if (field.type === 'color_var') {
                            properties[mKey] = mEl.value || 'none';
                        } else if (field.type === 'checkbox') {
                            properties[mKey] = mEl.checked;
                        } else {

plugins/media/media.cpp.bak

deleted100644 → 0
+0 −1082

File deleted.

Preview size limit exceeded, changes collapsed.

plugins/media/media.cpp.bak2

deleted100644 → 0
+0 −1475

File deleted.

Preview size limit exceeded, changes collapsed.

+5 −5
Changes for src/mail.cpp: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -60,11 +60,11 @@ json_object* blogi::SettingsMail(dbpp::Database &db,libhttppp::HttpRequest &req,
            }
    }

    getConfig(db,"SMTPHOST",host);
    getConfig(db,"SMTPPORT",port);
    getConfig(db,"SMTPUSER",user);
    getConfig(db,"SMTPPASSWORD",pass);
    getConfig(db,"SMTPSENDER",sender);
    try { getConfig(db,"SMTPHOST",host); } catch(...) {}
    try { getConfig(db,"SMTPPORT",port); } catch(...) {}
    try { getConfig(db,"SMTPUSER",user); } catch(...) {}
    try { getConfig(db,"SMTPPASSWORD",pass); } catch(...) {}
    try { getConfig(db,"SMTPSENDER",sender); } catch(...) {}

    json_object *jroot = json_object_new_object();
    json_object_object_add(jroot, "title", json_object_new_string("Smtp Settings"));
+4 −0
Changes for src/translations.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -321,6 +321,8 @@ namespace blogi {
            {"I18N_REMOVE_FORMATTING",   "Formatierung entfernen"},
            {"I18N_CANCEL",              "Abbrechen"},
            {"I18N_SAVE_BTN",            "Speichern"},
            {"I18N_CUSTOM_COLOR",        "Eigene Farbe"},
            {"I18N_THEME_VARIABLE",      "Theme-Variable"},
            // Plugin: contact
            {"Mail sent!",           "Mail versandt!"},
            {"Name:",                "Name:"},
@@ -597,6 +599,8 @@ namespace blogi {
            {"I18N_REMOVE_FORMATTING",   "Remove Formatting"},
            {"I18N_CANCEL",              "Cancel"},
            {"I18N_SAVE_BTN",            "Save"},
            {"I18N_CUSTOM_COLOR",        "Custom Color"},
            {"I18N_THEME_VARIABLE",      "Theme Variable"},
            // Plugin strings that need HTML entities or special formatting
            {"Do you want to remove this media type? All files of this type will also be removed!", "Do you want to remove this media type? All files of this type will also be removed!"},
            {"Do you want to remove this navigation?", "Do you want to remove this navigation?"},
Loading