From ef55b578effea959ed4fdcdb0fd4bbab38209fef Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Thu, 06 Sep 2012 11:21:32 -0400
Subject: [PATCH] - New feature: you can now add directive snippets for Apache, nginx, and PHP under System > Directive Snippets. These snippets are then available on the Options tab of a web site where they can be easily added to the respective textarea by simply clicking the name of the directive snippet.
---
interface/web/admin/directive_snippets_edit.php | 53 +++++
interface/web/sites/templates/web_domain_advanced.htm | 6
interface/web/admin/directive_snippets_list.php | 52 +++++
interface/web/admin/lib/lang/en_directive_snippets.lng | 9
interface/web/sites/lib/lang/de_web_domain.lng | 3
interface/web/admin/list/directive_snippets.list.php | 78 +++++++
interface/web/sites/lib/lang/en_web_domain.lng | 3
install/sql/incremental/upd_0040.sql | 20 ++
interface/web/sites/web_domain_edit.php | 35 +++
interface/web/admin/directive_snippets_del.php | 51 +++++
interface/web/admin/templates/directive_snippets_edit.htm | 38 +++
install/sql/ispconfig3.sql | 20 ++
interface/web/admin/form/directive_snippets.tform.php | 101 ++++++++++
interface/web/admin/templates/directive_snippets_list.htm | 57 +++++
interface/web/admin/lib/lang/de.lng | 1
interface/web/admin/lib/lang/en_directive_snippets_list.lng | 7
interface/web/admin/lib/lang/de_directive_snippets_list.lng | 7
interface/web/admin/lib/module.conf.php | 5
interface/web/admin/lib/lang/de_directive_snippets.lng | 9
interface/web/admin/lib/lang/en.lng | 1
interface/web/js/scrigo.js.php | 6
21 files changed, 559 insertions(+), 3 deletions(-)
diff --git a/install/sql/incremental/upd_0040.sql b/install/sql/incremental/upd_0040.sql
index d613681..423772e 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 2058408..2817f75 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -348,6 +348,26 @@
-- --------------------------------------------------------
--
+-- 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 0000000..ee1ab8b
--- /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 0000000..317dc58
--- /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 0000000..4f41194
--- /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 0000000..a8b43b5
--- /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 a90537e..bec98ad 100644
--- a/interface/web/admin/lib/lang/de.lng
+++ b/interface/web/admin/lib/lang/de.lng
@@ -28,6 +28,7 @@
$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 0000000..b0417fe
--- /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 0000000..a928a4d
--- /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 3cbf996..d9cbc7f 100644
--- a/interface/web/admin/lib/lang/en.lng
+++ b/interface/web/admin/lib/lang/en.lng
@@ -36,6 +36,7 @@
$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 0000000..ee40ab0
--- /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 0000000..702e7e2
--- /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 91a9401..489daac 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -47,6 +47,11 @@
'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 0000000..ec023c1
--- /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 0000000..0d57c06
--- /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 0000000..e3db36e
--- /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 e550b47..caa717e 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -638,6 +638,12 @@
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 8e79f9c..81aea7e 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['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 87462db..641f15f 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['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 f61cf50..fec38c5 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 8a684d0..6a4735c 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -343,6 +343,41 @@
$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 = '';
--
Gitblit v1.9.1