summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod/templates
diff options
context:
space:
mode:
authorChristian Klinger2016-08-02 15:56:37 +0200
committerChristian Klinger2016-08-02 15:56:37 +0200
commit7b366ecc2a107d77ce274790207a3e65866a8184 (patch)
treefcb7699882ef9b91f21bb73d891b5f4d1809767d /modules-available/dozmod/templates
parentdozmod runtimeconfig. (diff)
downloadslx-admin-7b366ecc2a107d77ce274790207a3e65866a8184.tar.gz
slx-admin-7b366ecc2a107d77ce274790207a3e65866a8184.tar.xz
slx-admin-7b366ecc2a107d77ce274790207a3e65866a8184.zip
mail template editor.
Diffstat (limited to 'modules-available/dozmod/templates')
-rw-r--r--modules-available/dozmod/templates/images-delete.html4
-rw-r--r--modules-available/dozmod/templates/runtimeconfig.html2
-rw-r--r--modules-available/dozmod/templates/templates.html140
-rw-r--r--modules-available/dozmod/templates/userlist.html4
4 files changed, 145 insertions, 5 deletions
diff --git a/modules-available/dozmod/templates/images-delete.html b/modules-available/dozmod/templates/images-delete.html
index 99ffb85d..f8836b83 100644
--- a/modules-available/dozmod/templates/images-delete.html
+++ b/modules-available/dozmod/templates/images-delete.html
@@ -5,7 +5,7 @@
{{lang_subHeading}}
</div>
<div class="panel-body">
- <p>{{lang_description}}</p>
+ <p>{{lang_description_delete_images}}</p>
<div class="table-responsive">
<form id="delform" method="post" action="?do=DozMod" onsubmit="return slxPostdel()">
<input type="hidden" name="token" value="{{token}}">
@@ -85,4 +85,4 @@ document.addEventListener("DOMContentLoaded", function() {
slxChangeSingle();
}, false);
---> </script> \ No newline at end of file
+--> </script>
diff --git a/modules-available/dozmod/templates/runtimeconfig.html b/modules-available/dozmod/templates/runtimeconfig.html
index 06de8d8f..eced5784 100644
--- a/modules-available/dozmod/templates/runtimeconfig.html
+++ b/modules-available/dozmod/templates/runtimeconfig.html
@@ -1,4 +1,4 @@
-<h2>{{lang_runtimeConfigHeadline}}</h2>
+<h2 id="runtime-configuration">{{lang_runtimeConfigHeadline}}</h2>
<div class="panel panel-default">
<div class="panel-heading">
diff --git a/modules-available/dozmod/templates/templates.html b/modules-available/dozmod/templates/templates.html
new file mode 100644
index 00000000..e8e3f592
--- /dev/null
+++ b/modules-available/dozmod/templates/templates.html
@@ -0,0 +1,140 @@
+<h1> Templates</h1>
+
+<form id="templateForm" role="form" method="POST" action="?do=dozmod&section=templates&action=save">
+ <input type="hidden" name="token" value="{{token}}">
+
+
+ <div class="panel-group" id="accordion">
+
+ {{#templates}}
+
+ <div class="panel panel-default">
+ <div id="heading_{{name}}" class="panel-heading">
+ <div class="panel-title">
+ <h4>
+ <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#panel_{{name}}">
+ {{name}}
+ </a>
+ </h4>
+ <small>{{description}}</small>
+
+ </div>
+ </div>
+ <div id="panel_{{name}}" class="panel-collapse collapse">
+ <div class="panel-body">
+ <div id="msgbox_{{name}}">
+ </div>
+ <label for="n_{{name}}">{{lang_name}}</label>
+ <input name="templates[{{name}}][name]" value="{{name}}" class="form-control"/>
+
+ <label for="n_{{description}}">{{lang_description}}</label>
+ <input name="templates[{{name}}][description]" value="{{description}}" class="form-control"/>
+
+
+
+ <label for="ta_{{name}}">{{lang_template}}</label>
+ <br/>
+ <textarea data-mandatory="{{list_mandatoryVariables}}" name="templates[{{name}}][template]" data-setting="{{name}}" id="ta_{{name}}"
+ class="form-control templateEditor" style="min-height:200px"
+ >{{template}}</textarea>
+
+ <h3>{{lang_placeholders}}</h3>
+ <select name="templates[{{name}}][mandatory_variables]" multiple="multiple" class="hidden">
+ {{{html_mandatoryVariables}}}
+ </select>
+ <select name="templates[{{name}}][optional_variables]" multiple="multiple" class="hidden">
+ {{{html_optionalVariables}}}
+ </select>
+ <ul>
+ {{{html_availableVariables}}}
+ </ul>
+ </div>
+ </div>
+ </div>
+
+
+ {{/templates}}
+ </div>
+
+ <div class="btn-group">
+ <button type="button" onclick="sendForm()" class="btn btn-primary">{{lang_save}}</button>
+ </div>
+</form>
+<script type="application/javascript"><!--
+
+
+/* check that all necessary placeholders are used */
+function validateForm() {
+ var ok = true;
+
+ $('.templateEditor').each(function (i, editor) {
+
+ var id = $(editor).attr('id');
+ var setting = $(editor).attr('data-setting');
+ var mandatory = $(editor).attr('data-mandatory').split(",");
+ var value = $(editor).val();
+
+
+ /* ? */
+ if (mandatory.length == 1 && mandatory[0] == "") {
+ mandatory = [];
+ }
+
+ var missing = [];
+
+ mandatory.forEach(function (v,i) {
+ if (value.indexOf("%" + v + "%") == -1) {
+ missing.push(v);
+ }
+ });
+ console.log("missing are");
+ console.log(missing);
+
+ var $msgBox = $("#msgbox_" + setting);
+ var $panel = $("#panel_" + setting);
+ var $header = $("#heading_" + setting);
+
+
+ if (missing.length > 0) {
+ /* add errors */
+ var missingL = missing.join(", ");
+ var msg="<strong>Fehler:</strong> Folgende wichtige Platzhalter wurden nicht verwendet: " +missingL;
+ console.log("msg box has " + $msgBox.size());
+ $msgBox.html('<div class="alert alert-danger">' + msg + '</div>');
+ $panel.addClass('witherror');
+ $header.addClass('witherror');
+ /* overall result */
+ ok = false;
+ } else {
+ $msgBox.html("");
+ $panel.removeClass('witherror');
+ $header.removeClass('witherror');
+ }
+
+
+ });
+ return ok;
+}
+
+function submitForm() {
+ console.log('sending form');
+ $('#templateForm').submit();
+}
+
+
+function sendForm() {
+ var ok = validateForm();
+ if (ok) {
+ console.log("is ok");
+ submitForm();
+ } else {
+ console.log("form is not ok");
+ }
+}
+
+document.addEventListener("DOMContentLoaded", function () {
+
+
+
+});
+</script>
diff --git a/modules-available/dozmod/templates/userlist.html b/modules-available/dozmod/templates/userlist.html
index a76eae5e..3ccff4d9 100644
--- a/modules-available/dozmod/templates/userlist.html
+++ b/modules-available/dozmod/templates/userlist.html
@@ -1,4 +1,4 @@
-<h2>{{lang_userList}}</h2>
+<h2 id="users">{{lang_userList}}</h2>
<div class="panel panel-default">
<div class="panel-heading">
@@ -59,4 +59,4 @@ function setu(action, el, uid) {
});
}
---> </script> \ No newline at end of file
+--> </script>