diff --git a/install/sql/incremental/upd_0040.sql b/install/sql/incremental/upd_0040.sql index d613681f184c478c4f77806d9cc9e36ed5729fe1..423772e86c2fc2e74743c8d275e0567ef2f450e8 100644 --- a/install/sql/incremental/upd_0040.sql +++ b/install/sql/incremental/upd_0040.sql @@ -2,3 +2,23 @@ -- Removal of the domain module UPDATE sys_user SET startmodule = 'dashboard' WHERE startmodule = 'domain'; UPDATE sys_user SET modules = replace(modules, ',domain', '') WHERE modules like '%domain%'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `directive_snippets` +-- + +CREATE TABLE IF NOT EXISTS `directive_snippets` ( + `directive_snippets_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `type` varchar(255) DEFAULT NULL, + `snippet` mediumtext, + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`directive_snippets_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 205840800f88aca4a0ab6dcf030340e57ab2d760..2817f7558e81ed26db88012e7ad02333c18a2ff7 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -347,6 +347,26 @@ CREATE TABLE `cron` ( -- -------------------------------------------------------- +-- +-- Table structure for table `directive_snippets` +-- + +CREATE TABLE IF NOT EXISTS `directive_snippets` ( + `directive_snippets_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `type` varchar(255) DEFAULT NULL, + `snippet` mediumtext, + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`directive_snippets_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + -- -- Table structure for table `dns_rr` -- diff --git a/interface/web/admin/directive_snippets_del.php b/interface/web/admin/directive_snippets_del.php new file mode 100644 index 0000000000000000000000000000000000000000..ee1ab8b273cd67ed7b897514ea8f4ae2e6b532e8 --- /dev/null +++ b/interface/web/admin/directive_snippets_del.php @@ -0,0 +1,51 @@ +<?php + +/* +Copyright (c) 2007, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/directive_snippets.list.php"; +$tform_def_file = "form/directive_snippets.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +//* Check permissions for module +$app->auth->check_module_permissions('admin'); + +$app->uses("tform_actions"); +$app->tform_actions->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php new file mode 100644 index 0000000000000000000000000000000000000000..317dc58bbcd0f37e38b80358dbe3d2de94f8aa99 --- /dev/null +++ b/interface/web/admin/directive_snippets_edit.php @@ -0,0 +1,53 @@ +<?php +/* +Copyright (c) 2007, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/****************************************** +* Begin Form configuration +******************************************/ + +$tform_def_file = "form/directive_snippets.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +//* Check permissions for module +$app->auth->check_module_permissions('admin'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); + +// let tform_actions handle the page +$app->tform_actions->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/admin/directive_snippets_list.php b/interface/web/admin/directive_snippets_list.php new file mode 100644 index 0000000000000000000000000000000000000000..4f411942cefad2f1c42ded4c68db8ca9f07813c5 --- /dev/null +++ b/interface/web/admin/directive_snippets_list.php @@ -0,0 +1,52 @@ +<?php + +/* +Copyright (c) 2008, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/directive_snippets.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +//* Check permissions for module +$app->auth->check_module_permissions('admin'); + +$app->uses('listform_actions'); + +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/admin/form/directive_snippets.tform.php b/interface/web/admin/form/directive_snippets.tform.php new file mode 100644 index 0000000000000000000000000000000000000000..a8b43b534d5aa052ae9c8413001e9f1461dcfd45 --- /dev/null +++ b/interface/web/admin/form/directive_snippets.tform.php @@ -0,0 +1,101 @@ +<?php + +/* + Form Definition + + Tabledefinition + + Datatypes: + - INTEGER (Forces the input to Int) + - DOUBLE + - CURRENCY (Formats the values to currency notation) + - VARCHAR (no format check, maxlength: 255) + - TEXT (no format check) + - DATE (Dateformat, automatic conversion to timestamps) + + Formtype: + - TEXT (Textfield) + - TEXTAREA (Textarea) + - PASSWORD (Password textfield, input is not shown when edited) + - SELECT (Select option field) + - RADIO + - CHECKBOX + - CHECKBOXARRAY + - FILE + + VALUE: + - Wert oder Array + + Hint: + The ID field of the database table is not part of the datafield definition. + The ID field must be always auto incement (int or bigint). + + +*/ + +$form["title"] = "Directive Snippets"; +$form["description"] = ""; +$form["name"] = "directive_snippets"; +$form["action"] = "directive_snippets_edit.php"; +$form["db_table"] = "directive_snippets"; +$form["db_table_idx"] = "directive_snippets_id"; +$form["db_history"] = "yes"; +$form["tab_default"] = "directive_snippets"; +$form["list_default"] = "directive_snippets_list.php"; +$form["auth"] = 'yes'; // yes / no + +$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['directive_snippets'] = array ( + 'title' => "Directive Snippets", + 'width' => 100, + 'template' => "templates/directive_snippets_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'directive_snippets_name_empty'), + 1 => array ( 'type' => 'UNIQUE', + 'errmsg'=> 'directive_snippets_name_error_unique'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('apache' => 'Apache','nginx' => 'nginx','php' => 'PHP'), + ), + 'snippet' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n',1 => 'y') + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + + +?> \ No newline at end of file diff --git a/interface/web/admin/lib/lang/de.lng b/interface/web/admin/lib/lang/de.lng index a90537e1aecf2b30d692f2c9923c8ed673a3a933..bec98adf5ba3b5faab2265aa3d3f6cb13077ea66 100644 --- a/interface/web/admin/lib/lang/de.lng +++ b/interface/web/admin/lib/lang/de.lng @@ -28,6 +28,7 @@ $wb['Jailkit'] = 'Jailkit'; $wb['Rescue'] = 'Rescue'; $wb['Server IP addresses'] = 'Server IP-Adressen'; $wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen'; +$wb['Directive Snippets'] = 'Direktiven-Schnipsel'; $wb['Firewall'] = 'Firewall'; $wb['Interface'] = 'Interface'; $wb['Interface Config'] = 'Main Config'; diff --git a/interface/web/admin/lib/lang/de_directive_snippets.lng b/interface/web/admin/lib/lang/de_directive_snippets.lng new file mode 100644 index 0000000000000000000000000000000000000000..b0417fedf0dae0714bfa9ba6e7f47db582bff190 --- /dev/null +++ b/interface/web/admin/lib/lang/de_directive_snippets.lng @@ -0,0 +1,9 @@ +<?php +$wb["Directive Snippets"] = 'Direktiven-Schnipsel'; +$wb["name_txt"] = 'Name des Schnipsels'; +$wb["type_txt"] = 'Typ'; +$wb["snippet_txt"] = 'Schnipsel'; +$wb["active_txt"] = 'Aktiv'; +$wb["directive_snippets_name_empty"] = 'Bitte geben Sie einen Namen für den Schnipsel an.'; +$wb["directive_snippets_name_error_unique"] = 'Es existiert schon ein Direktiven-Schnipsel mit diesem Namen.'; +?> \ No newline at end of file diff --git a/interface/web/admin/lib/lang/de_directive_snippets_list.lng b/interface/web/admin/lib/lang/de_directive_snippets_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..a928a4d76661fb70599ca8556dab8da3bc3a91c6 --- /dev/null +++ b/interface/web/admin/lib/lang/de_directive_snippets_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Direcktiven-Schnipsel'; +$wb["active_txt"] = 'Aktiv'; +$wb["name_txt"] = 'Name des Schnipsels'; +$wb["type_txt"] = 'Typ'; +$wb["add_new_record_txt"] = 'Direcktiven-Schnipsel hinzufügen'; +?> \ No newline at end of file diff --git a/interface/web/admin/lib/lang/en.lng b/interface/web/admin/lib/lang/en.lng index 3cbf996e21ef3eff904c090adc38ac4a51899db8..d9cbc7f8392567bfc902daa51cd6c30788faf29c 100644 --- a/interface/web/admin/lib/lang/en.lng +++ b/interface/web/admin/lib/lang/en.lng @@ -36,6 +36,7 @@ $wb['Server Config'] = 'Server Config'; $wb['Rescue'] = 'Rescue'; $wb['Server IP addresses'] = 'Server IP addresses'; $wb['Additional PHP Versions'] = 'Additional PHP Versions'; +$wb['Directive Snippets'] = 'Directive Snippets'; $wb['Firewall'] = 'Firewall'; $wb['Interface'] = 'Interface'; diff --git a/interface/web/admin/lib/lang/en_directive_snippets.lng b/interface/web/admin/lib/lang/en_directive_snippets.lng new file mode 100644 index 0000000000000000000000000000000000000000..ee40ab06f9c236b846ebe8daec35f7603aefe520 --- /dev/null +++ b/interface/web/admin/lib/lang/en_directive_snippets.lng @@ -0,0 +1,9 @@ +<?php +$wb["Directive Snippets"] = 'Directive Snippets'; +$wb["name_txt"] = 'Name of Snippet'; +$wb["type_txt"] = 'Type'; +$wb["snippet_txt"] = 'Snippet'; +$wb["active_txt"] = 'Active'; +$wb["directive_snippets_name_empty"] = 'Please specify a name for the snippet.'; +$wb["directive_snippets_name_error_unique"] = 'There is already a directive snippet with this name.'; +?> \ No newline at end of file diff --git a/interface/web/admin/lib/lang/en_directive_snippets_list.lng b/interface/web/admin/lib/lang/en_directive_snippets_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..702e7e250480306e6f717010d84662c0e03d41e1 --- /dev/null +++ b/interface/web/admin/lib/lang/en_directive_snippets_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Directive Snippets'; +$wb["active_txt"] = 'Active'; +$wb["name_txt"] = 'Name of Snippet'; +$wb["type_txt"] = 'Type'; +$wb["add_new_record_txt"] = 'Add Directive Snippet'; +?> \ No newline at end of file diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php index 91a9401f1ac5ed0d61170b53edefa4cad3f1e96e..489daacf2df23e91e9adbc8211efc49403bd706c 100644 --- a/interface/web/admin/lib/module.conf.php +++ b/interface/web/admin/lib/module.conf.php @@ -47,6 +47,11 @@ $items[] = array( 'title' => 'Additional PHP Versions', 'target' => 'content', 'link' => 'admin/server_php_list.php', 'html_id' => 'server_php_list'); + +$items[] = array( 'title' => 'Directive Snippets', + 'target' => 'content', + 'link' => 'admin/directive_snippets_list.php', + 'html_id' => 'directive_snippets_list'); $items[] = array( 'title' => 'Firewall', 'target' => 'content', diff --git a/interface/web/admin/list/directive_snippets.list.php b/interface/web/admin/list/directive_snippets.list.php new file mode 100644 index 0000000000000000000000000000000000000000..ec023c1ec8bca8b2bf33b4c624d8cc5f788d3e53 --- /dev/null +++ b/interface/web/admin/list/directive_snippets.list.php @@ -0,0 +1,78 @@ +<?php + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + + + +// Name of the list +$liste["name"] = "directive_snippets"; + +// Database table +$liste["table"] = "directive_snippets"; + +// Index index field of the database table +$liste["table_idx"] = "directive_snippets_id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = "15"; + +// Script File of the list +$liste["file"] = "directive_snippets_list.php"; + +// Script file of the edit form +$liste["edit_file"] = "directive_snippets_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "directive_snippets_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "yes"; + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste["item"][] = array( 'field' => "active", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>")); + + +$liste["item"][] = array( 'field' => "name", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "type", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP')); + +?> \ No newline at end of file diff --git a/interface/web/admin/templates/directive_snippets_edit.htm b/interface/web/admin/templates/directive_snippets_edit.htm new file mode 100644 index 0000000000000000000000000000000000000000..0d57c06d519195ebc9d29256b637e1536d1ebd4b --- /dev/null +++ b/interface/web/admin/templates/directive_snippets_edit.htm @@ -0,0 +1,38 @@ +<h2><tmpl_var name="list_head_txt"></h2> +<p><tmpl_var name="list_desc_txt"></p> + +<div class="panel panel_directive_snippets"> + + <div class="pnl_formsarea"> + <fieldset class="inlineLabels"> + <div class="ctrlHolder"> + <label for="name">{tmpl_var name='name_txt'}</label> + <input name="name" id="name" value="{tmpl_var name='name'}" size="30" maxlength="255" type="text" class="textInput" /> + </div> + <div class="ctrlHolder"> + <label for="type">{tmpl_var name='type_txt'}</label> + <select name="type" id="type" class="selectInput"> + {tmpl_var name='type'} + </select> + </div> + <div class="ctrlHolder"> + <label for="snippet">{tmpl_var name='snippet_txt'}</label> + <textarea name="snippet" id="snippet" rows='10' cols='50' style="width:400px;">{tmpl_var name='snippet'}</textarea> + </div> + <div class="ctrlHolder"> + <p class="label">{tmpl_var name='active_txt'}</p> + <div class="multiField"> + {tmpl_var name='active'} + </div> + </div> + </fieldset> + + <input type="hidden" name="id" value="{tmpl_var name='id'}"> + + <div class="buttonHolder buttons"> + <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onclick="submitForm('pageForm','admin/directive_snippets_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button> + <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('admin/directive_snippets_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> + </div> + </div> + +</div> \ No newline at end of file diff --git a/interface/web/admin/templates/directive_snippets_list.htm b/interface/web/admin/templates/directive_snippets_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..e3db36ed75e279ee93a36cba35120c03640ae6f1 --- /dev/null +++ b/interface/web/admin/templates/directive_snippets_list.htm @@ -0,0 +1,57 @@ +<h2><tmpl_var name="list_head_txt"></h2> +<p><tmpl_var name="list_desc_txt"></p> + +<div class="panel panel_list_directive_snippets"> + + <div class="pnl_toolsarea"> + <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> + <div class="buttons"> + <button class="button iconstxt icoAdd" type="button" onclick="loadContent('admin/directive_snippets_edit.php');"> + <span>{tmpl_var name="add_new_record_txt"}</span> + </button> + </div> + </fieldset> + </div> + + <div class="pnl_listarea"> + <fieldset><legend><tmpl_var name="list_head_txt"></legend> + <table class="list"> + <thead> + <tr class="caption"> + <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th> + <th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th> + <th class="tbl_col_type" scope="col"><tmpl_var name="type_txt"></th> + <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th> + </tr> + <tr class="filter"> + <td class="tbl_col_active"><select name="search_active">{tmpl_var name='search_active'}</select></td> + <td class="tbl_col_name"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" /></td> + <td class="tbl_col_type"><select name="search_type">{tmpl_var name='search_type'}</select></td> + <td class="tbl_col_buttons"> + <button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','admin/directive_snippets_list.php');"><span>{tmpl_var name="filter_txt"}</span></button> + </td> + </tr> + </thead> + <tbody> + <tmpl_loop name="records"> + <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + <td class="tbl_col_active"><a href="#" onclick="loadContent('admin/directive_snippets_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a></td> + <td class="tbl_col_name"><a href="#" onclick="loadContent('admin/directive_snippets_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td> + <td class="tbl_col_type"><a href="#" onclick="loadContent('admin/directive_snippets_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="type"}</a></td> + <td class="tbl_col_buttons"> + <a class="button icons16 icoDelete" href="javascript: del_record('admin/directive_snippets_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> + </td> + </tr> + </tmpl_loop> + </tbody> + + <tfoot> + <tr> + <td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td> + </tr> + </tfoot> + </table> + </fieldset> + </div> + +</div> \ No newline at end of file diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php index e550b472f1da25d579d7fc7d91dee83f2b2e1324..caa717e6d68344aec9cdbfee2f99967de048b1c5 100644 --- a/interface/web/js/scrigo.js.php +++ b/interface/web/js/scrigo.js.php @@ -638,6 +638,12 @@ jQuery('.addPlaceholder').live("click", function(){ var template = jQuery(this).siblings(':input'); template.insertAtCaret(placeholderText); }); + +jQuery('.addPlaceholderContent').live("click", function(){ + var placeholderContentText = jQuery(this).find('.addPlaceholderContent').text(); + var template2 = jQuery(this).siblings(':input'); + template2.insertAtCaret(placeholderContentText); +}); jQuery.fn.extend({ insertAtCaret: function(myValue){ diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng index 8e79f9c911042f811061f2a502a46fed815b5859..81aea7e6a747a4b255d5f1ccc80828ffcd017268 100644 --- a/interface/web/sites/lib/lang/de_web_domain.lng +++ b/interface/web/sites/lib/lang/de_web_domain.lng @@ -105,4 +105,7 @@ $wb['generate_password_txt'] = 'Passwort erzeugen'; $wb['repeat_password_txt'] = 'Passwort wiederholen'; $wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.'; $wb['password_match_txt'] = 'Die Passwörter stimmen überein.'; +$wb['available_php_directive_snippets_txt'] = 'Verfügbare PHP-Direktiven-Schnipsel:'; +$wb['available_apache_directive_snippets_txt'] = 'Verfügbare Apache-Direktiven-Schnipsel:'; +$wb['available_nginx_directive_snippets_txt'] = 'Verfügbare nginx-Direktiven-Schnipsel:'; ?> diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng index 87462db5677f9c1da1d903ba5a91e291a168c8c7..641f15f7d842c57dd24bb5f39bbb2487ffee12c3 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -105,4 +105,7 @@ $wb['generate_password_txt'] = 'Generate Password'; $wb['repeat_password_txt'] = 'Repeat Password'; $wb['password_mismatch_txt'] = 'The passwords do not match.'; $wb['password_match_txt'] = 'The passwords do match.'; +$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:'; +$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:'; +$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:'; ?> \ No newline at end of file diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm index f61cf500c7dfdb72e298686a33df400795b7f696..fec38c5b3f21a208890e5cebd000b8167e4e1d2a 100644 --- a/interface/web/sites/templates/web_domain_advanced.htm +++ b/interface/web/sites/templates/web_domain_advanced.htm @@ -67,15 +67,15 @@ </div> <div class="ctrlHolder"> <label for="custom_php_ini">{tmpl_var name='custom_php_ini_txt'}</label> - <textarea name="custom_php_ini" id="custom_php_ini" rows='10' cols='50' style="width:400px;">{tmpl_var name='custom_php_ini'}</textarea> + <textarea name="custom_php_ini" id="custom_php_ini" rows='10' cols='50' style="width:400px;">{tmpl_var name='custom_php_ini'}</textarea> <b>{tmpl_var name="available_php_directive_snippets_txt"}</b><br><br> {tmpl_var name="php_directive_snippets_txt"} </div> <div class="ctrlHolder apache"> <label for="apache_directives">{tmpl_var name='apache_directives_txt'}</label> - <textarea name="apache_directives" id="apache_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='apache_directives'}</textarea> + <textarea name="apache_directives" id="apache_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='apache_directives'}</textarea> <b>{tmpl_var name="available_apache_directive_snippets_txt"}</b><br><br> {tmpl_var name="apache_directive_snippets_txt"} </div> <div class="ctrlHolder nginx"> <label for="nginx_directives">{tmpl_var name='nginx_directives_txt'}</label> - <textarea name="nginx_directives" id="nginx_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='nginx_directives'}</textarea> + <textarea name="nginx_directives" id="nginx_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='nginx_directives'}</textarea> <b>{tmpl_var name="available_nginx_directive_snippets_txt"}</b><br><br> {tmpl_var name="nginx_directive_snippets_txt"} </div> </fieldset> diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 8a684d0d1101a45ac5fd905c8b87499c09dae5ca..6a4735c9fadaff615b170c7082e508d15468a3c1 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -343,6 +343,41 @@ class page_action extends tform_actions { $app->tpl->setVar("client_group_id",$client_select); foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); + + // Directive Snippets + $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'"); + $php_directive_snippets_txt = ''; + if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){ + foreach($php_directive_snippets as $php_directive_snippet){ + $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> '; + } + } + if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------'; + $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt); + + if($server_type == 'apache'){ + $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'"); + $apache_directive_snippets_txt = ''; + if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){ + foreach($apache_directive_snippets as $apache_directive_snippet){ + $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> '; + } + } + if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------'; + $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt); + } + + if($server_type = 'nginx'){ + $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'"); + $nginx_directive_snippets_txt = ''; + if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){ + foreach($nginx_directive_snippets as $nginx_directive_snippet){ + $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> '; + } + } + if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------'; + $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt); + } } $ssl_domain_select = '';