diff options
Diffstat (limited to 'modules-available/dozmod/templates')
-rw-r--r-- | modules-available/dozmod/templates/mailconfig.html | 2 | ||||
-rw-r--r-- | modules-available/dozmod/templates/runtimeconfig.html | 93 | ||||
-rw-r--r-- | modules-available/dozmod/templates/templates.html | 95 |
3 files changed, 97 insertions, 93 deletions
diff --git a/modules-available/dozmod/templates/mailconfig.html b/modules-available/dozmod/templates/mailconfig.html index 56850637..69622796 100644 --- a/modules-available/dozmod/templates/mailconfig.html +++ b/modules-available/dozmod/templates/mailconfig.html @@ -6,8 +6,6 @@ </div> <div class="panel-body"> <p>{{lang_mailDescription}}</p> - <p>[BETA] Diese Funktionalität ist neu. Wir bitten um Nachsicht, falls es Situationen gibt, in denen zu viele - oder zu wenige Nachrichten verschickt werden.</p> <form action="?do=DozMod" method="post" id="mailconf"> <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-200px" tabindex="-1"> <input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-200px" tabindex="-1"> diff --git a/modules-available/dozmod/templates/runtimeconfig.html b/modules-available/dozmod/templates/runtimeconfig.html index eced5784..011fcac4 100644 --- a/modules-available/dozmod/templates/runtimeconfig.html +++ b/modules-available/dozmod/templates/runtimeconfig.html @@ -5,90 +5,97 @@ {{lang_runtimeConfig}} </div> <div class="panel-body"> - <p> {{lang_descriptionRuntimeConfig}}</p> + <h3>{{lang_defaultPermissions}}</h3> + <p><i>{{lang_descriptionPermissionConfig}}</i></p> <form action="?do=DozMod" method="post" id="runtimeconf" role="form"> <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-200px" tabindex="-1"> <input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-200px" tabindex="-1"> <fieldset class="form-group"> - <h4>{{lang_defaultLecturePermissions}}</h4> + <legend>{{lang_defaultLecturePermissions}}</legend> - <input type="hidden" name="defaultLecturePermissions[edit]" value="0"/> - <input type="hidden" name="defaultLecturePermissions[admin]" value="0"/> + <input type="hidden" name="defaultLecturePermissions[edit]" value="0"/> + <input type="hidden" name="defaultLecturePermissions[admin]" value="0"/> - <div class="checkbox"> - <input type="checkbox" name="defaultLecturePermissions[edit]" value="1" {{defaultLecturePermissions.edit}} id ="lecture_edit" class="form-control"/> - <label> - {{lang_lecturePermissionEdit}}* - </label> - </div> <div class="checkbox"> - <input type="checkbox" name="defaultLecturePermissions[admin]" value="1" {{defaultLecturePermissions.admin}} id ="lecture_admin" class="form-control"/> - <label> - {{lang_lecturePermissionAdmin}}* + <input type="checkbox" name="defaultLecturePermissions[admin]" value="1" {{defaultLecturePermissions.admin}} id ="lecture_admin" class="form-control"> + <label> + {{lang_lecturePermissionAdmin}} + </label> + </div> + <div class="checkbox"> + <input type="checkbox" name="defaultLecturePermissions[edit]" value="1" {{defaultLecturePermissions.edit}} id ="lecture_edit" class="form-control"> + <label> + {{lang_lecturePermissionEdit}} </label> </div> </fieldset> - <fieldset class="xform-group"> - <h4>{{lang_defaultImagePermissions}}</h4> + <fieldset class="form-group"> + <legend>{{lang_defaultImagePermissions}}</legend> <input type="hidden" name="defaultImagePermissions[edit]" value="0"/> <input type="hidden" name="defaultImagePermissions[admin]" value="0"/> <input type="hidden" name="defaultImagePermissions[download]" value="0"/> <input type="hidden" name="defaultImagePermissions[link]" value="0"/> <div class="checkbox"> - <input type="checkbox" name="defaultImagePermissions[edit]" value="1" {{defaultImagePermissions.edit}} id ="image_edit" class="form-control"/> - <label> - {{lang_defaultImagePermissionEdit}} * + <input type="checkbox" name="defaultImagePermissions[admin]" value="1" {{defaultImagePermissions.admin}} id ="image_admin" class="form-control"> + <label class="" for="image_admin"> + {{lang_defaultImagePermissionAdmin}} </label> </div> <div class="checkbox"> - <input type="checkbox" name="defaultImagePermissions[admin]" value="1" {{defaultImagePermissions.admin}} id ="image_admin" class="form-control"/ > - <label class="" for="image_admin"> - {{lang_defaultImagePermissionAdmin}} * + <input type="checkbox" name="defaultImagePermissions[edit]" value="1" {{defaultImagePermissions.edit}} id ="image_edit" class="form-control"> + <label> + {{lang_defaultImagePermissionEdit}} </label> </div> - <div class="checkbox"> - <input type="checkbox" name="defaultImagePermissions[download]" value="1" {{defaultImagePermissions.download}} id ="image_download" class="form-control"/ > + <input type="checkbox" name="defaultImagePermissions[download]" value="1" {{defaultImagePermissions.download}} id ="image_download" class="form-control"> <label> - {{lang_defaultImagePermissionDownload}} * + {{lang_defaultImagePermissionDownload}} </label> </div> <div class="checkbox"> - <input type="checkbox" name="defaultImagePermissions[link]" value="1" {{defaultImagePermissions.link}} id ="image_link" class="form-control"/ > + <input type="checkbox" name="defaultImagePermissions[link]" value="1" {{defaultImagePermissions.link}} id ="image_link" class="form-control"> <label> - {{lang_defaultImagePermissionLink}} * + {{lang_defaultImagePermissionLink}} </label> </div> - - </fieldset> - <fieldset> - <h4>{{lang_runtimeConfigLimits}}</h4> - <div class="input-group"> - <label class="input-group-addon slx-ga2" for="max_image_validity">{{lang_maxImageValidity}} *</label> - <input name="maxImageValidityDays" id ="max_image_validity" class="form-control" type="number" value="{{maxImageValidityDays}}"></input> - </div> - <div class="input-group"> - <label class="input-group-addon slx-ga2" for="max_lecture_validity">{{lang_maxLectureVisibility}} *</label> - <input name="maxLectureValidityDays" id ="max_lecture_validity" class="form-control" type="number" value="{{maxLectureValidityDays}}"></input> - </div> - <div class="input-group"> - <label class="input-group-addon slx-ga2" for="max_transfers">{{lang_maxTransfers}} *</label> - <input name="maxTransfers" id ="max_transfers" class="form-control" type="number" value="{{maxTransfers}}"></input> - </div> + <fieldset> + <h3>{{lang_runtimeConfigLimits}}</h3> + <p><i>{{lang_descriptionRuntimeLimits}}</i></p> + <table class="table-input-group"> + <tr class="input-group"> + <td class="input-group-addon" for="max_image_validity">{{lang_maxImageValidity}}</td> + <td> + <input name="maxImageValidityDays" id="max_image_validity" class="form-control" type="number" value="{{maxImageValidityDays}}" min="7" max="999" pattern="^\d+$"> + </td> + </tr> + <tr class="input-group"> + <td class="input-group-addon" for="max_lecture_validity">{{lang_maxLectureVisibility}}</td> + <td> + <input name="maxLectureValidityDays" id="max_lecture_validity" class="form-control" type="number" value="{{maxLectureValidityDays}}" min="1" max="999" pattern="^\d+$"> + </td> + </tr> + <tr class="input-group"> + <td class="input-group-addon" for="max_transfers">{{lang_maxTransfers}}</td> + <td> + <input name="maxTransfers" id="max_transfers" class="form-control" type="number" value="{{maxTransfers}}" min="1" max="10" pattern="^\d+$"> + </td> + </tr> + </table> </fieldset> <br> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="runtime"> - <button class="btn btn-primary btn-sm" type="submit" name="button" value="save">{{lang_save}}</button> + <button class="btn btn-primary" type="submit" name="button" value="save">{{lang_save}}</button> </form> </div> </div> diff --git a/modules-available/dozmod/templates/templates.html b/modules-available/dozmod/templates/templates.html index e8e3f592..3b2a003f 100644 --- a/modules-available/dozmod/templates/templates.html +++ b/modules-available/dozmod/templates/templates.html @@ -1,15 +1,18 @@ -<h1> Templates</h1> +<h1>{{lang_mailTemplates}}</h1> -<form id="templateForm" role="form" method="POST" action="?do=dozmod§ion=templates&action=save"> +<p><i>{{lang_templatePageDescription}}</i></p> + +<form id="templateForm" role="form" method="POST" action="?do=dozmod&section=templates"> <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="save"> <div class="panel-group" id="accordion"> {{#templates}} - <div class="panel panel-default"> - <div id="heading_{{name}}" class="panel-heading"> + <div id="frame_{{name}}" class="panel panel-default"> + <div class="panel-heading"> <div class="panel-title"> <h4> <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#panel_{{name}}"> @@ -24,21 +27,26 @@ <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"/> - + <div class="form-group"> + <input id="n_{{name}}" name="templates[{{name}}][name]" value="{{name}}" class="form-control"/> + </div> + <label for="d_{{name}}">{{lang_description}}</label> + <div class="form-group"> + <input id="d_{{name}}" name="templates[{{name}}][description]" value="{{description}}" class="form-control"/> + </div> + --> <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> + <div class="form-group"> + <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> + </div> - <h3>{{lang_placeholders}}</h3> + <h4>{{lang_placeholders}}</h4> <select name="templates[{{name}}][mandatory_variables]" multiple="multiple" class="hidden"> {{{html_mandatoryVariables}}} </select> @@ -56,16 +64,25 @@ {{/templates}} </div> - <div class="btn-group"> - <button type="button" onclick="sendForm()" class="btn btn-primary">{{lang_save}}</button> + <div class="pull-left"> + <button type="submit" onclick="return validateForm()" class="btn btn-primary">{{lang_save}}</button> </div> </form> +<form method="POST" action="?do=dozmod&section=templates"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="reset"> + <div> + <button type="submit" onclick="return confirm('{{lang_reallyResetTemplates}}')" class="btn btn-danger">{{lang_loadDefaults}}</button> + </div> +</form> +<div class="clearfix"></div> <script type="application/javascript"><!-- /* check that all necessary placeholders are used */ function validateForm() { var ok = true; + var $toppest = false; $('.templateEditor').each(function (i, editor) { @@ -76,7 +93,7 @@ function validateForm() { /* ? */ - if (mandatory.length == 1 && mandatory[0] == "") { + if (mandatory.length === 1 && mandatory[0] === "") { mandatory = []; } @@ -87,54 +104,36 @@ function validateForm() { missing.push(v); } }); - console.log("missing are"); - console.log(missing); var $msgBox = $("#msgbox_" + setting); - var $panel = $("#panel_" + setting); - var $header = $("#heading_" + setting); - + var $frame = $("#frame_" + 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()); + var msg="<strong>{{lang_error}}:</strong> {{lang_followingPlaceholdersUnused}}: " +missingL; $msgBox.html('<div class="alert alert-danger">' + msg + '</div>'); - $panel.addClass('witherror'); - $header.addClass('witherror'); + $frame.addClass('witherror'); + if ($toppest === false || $toppest.offset().top > $frame.offset().top) { + $toppest = $frame; + } /* overall result */ ok = false; } else { $msgBox.html(""); - $panel.removeClass('witherror'); - $header.removeClass('witherror'); + $frame.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"); + if ($toppest !== false) { + $toppest[0].scrollIntoView(); } + return ok; } document.addEventListener("DOMContentLoaded", function () { - - - + validateForm(); // Do once in case invalid templates are in DB }); -</script> + +//--></script> |