-
Notifications
You must be signed in to change notification settings - Fork 4
/
edit.php
73 lines (57 loc) · 1.93 KB
/
edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
require("../../global/library.php");
use FormTools\Core;
use FormTools\Modules;
$module = Modules::initModulePage("admin");
$L = $module->getLangStrings();
$root_url = Core::getRootUrl();
$tinymce_available = Modules::checkModuleAvailable("field_type_tinymce");
$page_id = isset($request["page_id"]) ? $request["page_id"] : "";
$g_success = true;
$g_message = "";
if (isset($_POST["add_page"])) {
list($g_success, $g_message, $page_id) = $module->addPage($_POST);
}
if (empty($page_id)) {
header("location: index.php");
exit;
}
if (isset($_POST["update_page"])) {
list($g_success, $g_message) = $module->updatePage($_POST["page_id"], $_POST);
}
$page_info = $module->getPage($page_id);
// this stores the default editor in the page. The values are either "codemirror", "tinymce": all
// code editing is done through one of those editors
$editor = ($page_info["content_type"] == "html" && $page_info["use_wysiwyg"] == "yes") ? "tinymce" : "codemirror";
$page_vars = array(
"g_success" => $g_success,
"g_message" => $g_message,
"head_title" => $L["phrase_edit_page"],
"page_id" => $page_id,
"page_info" => $page_info,
"tinymce_available" => ($tinymce_available ? "yes" : "no")
);
if ($tinymce_available) {
$page_vars["js_files"] = array("$root_url/modules/field_type_tinymce/tinymce/tinymce.min.js");
}
$page_vars["head_css"] =<<< END
body .mce-ico {
font-size: 13px;
}
body .mce-btn button {
padding: 3px 5px 3px 7px;
}
END;
$page_vars["head_js"] =<<< END
if (typeof pages_ns == undefined) {
var pages_ns = {};
}
pages_ns.current_editor = "$editor";
var rules = [];
rsv.onCompleteHandler = function() {
$("#use_wysiwyg_hidden").val($("#uwe").attr("checked") ? "yes" : "no");
ft.select_all(document.pages_form["selected_client_ids[]"]);
return true;
}
END;
$module->displayPage("templates/edit.tpl", $page_vars);