Loading src/edit.cpp +42 −0 Changes for src/edit.cpp: 42 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2408,6 +2408,11 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "xml", json_object_new_string(printer.CStr())); handled = true; } else if (strcmp(command, "SaveTemplateDb") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Save current template to database with revision json_object *param_obj = nullptr; std::string tplName = "untitled"; Loading Loading @@ -2437,7 +2442,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "message", json_object_new_string(e.what())); } handled = true; } } else if (strcmp(command, "LoadTemplateDb") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Load a template from database (optionally a specific revision) json_object *param_obj = nullptr; std::string templateId = ""; Loading Loading @@ -2471,7 +2482,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "ListTemplates") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // List all saved templates from database try { json_object *templates = listTemplates(tid); Loading @@ -2482,7 +2499,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "message", json_object_new_string(e.what())); } handled = true; } } else if (strcmp(command, "GetRevisions") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Get revision history for a template json_object *param_obj = nullptr; std::string templateId = ""; Loading @@ -2507,7 +2530,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "list_publish_targets") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_PUBLISH)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Publish Content")); handled = true; } else { // List all plugins that support publishing json_object *targets = json_object_new_array(); if (plugins) { Loading @@ -2527,7 +2556,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "status", json_object_new_string("success")); json_object_object_add(single_response, "targets", targets); handled = true; } } else if (strcmp(command, "publish") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_PUBLISH)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Publish Content")); handled = true; } else { // Publish rendered HTML to a target plugin json_object *param_obj = nullptr; std::string targetPlugin; Loading Loading @@ -2689,7 +2724,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "share_post") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_SHARE)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Share Posts")); handled = true; } else { // Manually share a URL to social networks via sharePost broadcast std::string shareUrl, shareTitle, shareDesc; json_object *param_obj = nullptr; Loading Loading @@ -2721,6 +2762,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } handled = true; } } // The original code had the plugin loading here, which is now moved. Loading Loading
src/edit.cpp +42 −0 Changes for src/edit.cpp: 42 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2408,6 +2408,11 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "xml", json_object_new_string(printer.CStr())); handled = true; } else if (strcmp(command, "SaveTemplateDb") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Save current template to database with revision json_object *param_obj = nullptr; std::string tplName = "untitled"; Loading Loading @@ -2437,7 +2442,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "message", json_object_new_string(e.what())); } handled = true; } } else if (strcmp(command, "LoadTemplateDb") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Load a template from database (optionally a specific revision) json_object *param_obj = nullptr; std::string templateId = ""; Loading Loading @@ -2471,7 +2482,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "ListTemplates") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // List all saved templates from database try { json_object *templates = listTemplates(tid); Loading @@ -2482,7 +2499,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "message", json_object_new_string(e.what())); } handled = true; } } else if (strcmp(command, "GetRevisions") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_TEMPLATES)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Manage Templates")); handled = true; } else { // Get revision history for a template json_object *param_obj = nullptr; std::string templateId = ""; Loading @@ -2507,7 +2530,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "list_publish_targets") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_PUBLISH)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Publish Content")); handled = true; } else { // List all plugins that support publishing json_object *targets = json_object_new_array(); if (plugins) { Loading @@ -2527,7 +2556,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_object_add(single_response, "status", json_object_new_string("success")); json_object_object_add(single_response, "targets", targets); handled = true; } } else if (strcmp(command, "publish") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_PUBLISH)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Publish Content")); handled = true; } else { // Publish rendered HTML to a target plugin json_object *param_obj = nullptr; std::string targetPlugin; Loading Loading @@ -2689,7 +2724,13 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } handled = true; } } else if (strcmp(command, "share_post") == 0) { if(!checkEditorGPO(request, GPO_EDITOR_SHARE)){ json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("GPO denied: Share Posts")); handled = true; } else { // Manually share a URL to social networks via sharePost broadcast std::string shareUrl, shareTitle, shareDesc; json_object *param_obj = nullptr; Loading Loading @@ -2721,6 +2762,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } handled = true; } } // The original code had the plugin loading here, which is now moved. Loading