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

test

parent 11360e30
Loading
Loading
Loading
Loading
+18 −30
Changes for plugins/media/media.cpp: 18 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -303,26 +303,7 @@ namespace blogi {
            json_object_array_add(jnav, jback);
            json_object_object_add(jroot, "nav", jnav);

            // URL config form
            json_object *jform = json_object_new_object();
            json_object_object_add(jform, "method", json_object_new_string("POST"));
            json_object_object_add(jform, "action", json_object_new_string(
                Args->config->buildurl("settings/media/config").c_str()));

            json_object *jfields = json_object_new_array();

            json_object *jfUrl = json_object_new_object();
            json_object_object_add(jfUrl, "name", json_object_new_string("mediadb_url"));
            json_object_object_add(jfUrl, "label", json_object_new_string(tr(_lang,"MediaDB URL").c_str()));
            json_object_object_add(jfUrl, "type", json_object_new_string("text"));
            json_object_object_add(jfUrl, "value", json_object_new_string(_mdbUrl.c_str()));
            json_object_array_add(jfields, jfUrl);

            json_object_object_add(jform, "fields", jfields);
            json_object_object_add(jform, "submit", json_object_new_string(tr(_lang,"save").c_str()));
            json_object_object_add(jroot, "form", jform);

            // Stores table
            // Stores table with remove actions
            json_object *jtable = json_object_new_object();
            json_object *jheaders = json_object_new_array();
            json_object_array_add(jheaders, json_object_new_string(tr(_lang,"Store Name").c_str()));
@@ -350,30 +331,37 @@ namespace blogi {
            json_object_object_add(jtable, "rows", jrows);
            json_object_object_add(jroot, "table", jtable);

            // Add store form
            json_object *jform2 = json_object_new_object();
            json_object_object_add(jform2, "method", json_object_new_string("POST"));
            json_object_object_add(jform2, "action", json_object_new_string(
            // Combined form: URL config + add store
            json_object *jform = json_object_new_object();
            json_object_object_add(jform, "method", json_object_new_string("POST"));
            json_object_object_add(jform, "action", json_object_new_string(
                Args->config->buildurl("settings/media/config").c_str()));

            json_object *jfields2 = json_object_new_array();
            json_object *jfields = json_object_new_array();

            json_object *jfUrl = json_object_new_object();
            json_object_object_add(jfUrl, "name", json_object_new_string("mediadb_url"));
            json_object_object_add(jfUrl, "label", json_object_new_string(tr(_lang,"MediaDB URL").c_str()));
            json_object_object_add(jfUrl, "type", json_object_new_string("text"));
            json_object_object_add(jfUrl, "value", json_object_new_string(_mdbUrl.c_str()));
            json_object_array_add(jfields, jfUrl);

            json_object *jfAction = json_object_new_object();
            json_object_object_add(jfAction, "name", json_object_new_string("action"));
            json_object_object_add(jfAction, "type", json_object_new_string("hidden"));
            json_object_object_add(jfAction, "value", json_object_new_string("add_store"));
            json_object_array_add(jfields2, jfAction);
            json_object_array_add(jfields, jfAction);

            json_object *jfStore = json_object_new_object();
            json_object_object_add(jfStore, "name", json_object_new_string("store_name"));
            json_object_object_add(jfStore, "label", json_object_new_string(tr(_lang,"New Store Name").c_str()));
            json_object_object_add(jfStore, "type", json_object_new_string("text"));
            json_object_object_add(jfStore, "value", json_object_new_string(""));
            json_object_array_add(jfields2, jfStore);
            json_object_array_add(jfields, jfStore);

            json_object_object_add(jform2, "fields", jfields2);
            json_object_object_add(jform2, "submit", json_object_new_string(tr(_lang,"Add Store").c_str()));
            json_object_object_add(jroot, "form2", jform2);
            json_object_object_add(jform, "fields", jfields);
            json_object_object_add(jform, "submit", json_object_new_string(tr(_lang,"Save").c_str()));
            json_object_object_add(jroot, "form", jform);

            return jroot;
        }