Commit ef55b578 authored by Falko Timme's avatar Falko Timme
Browse files

- New feature: you can now add directive snippets for Apache, nginx, and PHP...

- 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.
parent cece69b0
...@@ -2,3 +2,23 @@ ...@@ -2,3 +2,23 @@
-- Removal of the domain module -- Removal of the domain module
UPDATE sys_user SET startmodule = 'dashboard' WHERE startmodule = 'domain'; UPDATE sys_user SET startmodule = 'dashboard' WHERE startmodule = 'domain';
UPDATE sys_user SET modules = replace(modules, ',domain', '') WHERE modules like '%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 ;
...@@ -347,6 +347,26 @@ CREATE TABLE `cron` ( ...@@ -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` -- Table structure for table `dns_rr`
-- --
......
<?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
<?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
<?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
<?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
...@@ -28,6 +28,7 @@ $wb['Jailkit'] = 'Jailkit'; ...@@ -28,6 +28,7 @@ $wb['Jailkit'] = 'Jailkit';
$wb['Rescue'] = 'Rescue'; $wb['Rescue'] = 'Rescue';
$wb['Server IP addresses'] = 'Server IP-Adressen'; $wb['Server IP addresses'] = 'Server IP-Adressen';
$wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen'; $wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen';
$wb['Directive Snippets'] = 'Direktiven-Schnipsel';
$wb['Firewall'] = 'Firewall'; $wb['Firewall'] = 'Firewall';
$wb['Interface'] = 'Interface'; $wb['Interface'] = 'Interface';
$wb['Interface Config'] = 'Main Config'; $wb['Interface Config'] = 'Main Config';
......
<?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
<?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
...@@ -36,6 +36,7 @@ $wb['Server Config'] = 'Server Config'; ...@@ -36,6 +36,7 @@ $wb['Server Config'] = 'Server Config';
$wb['Rescue'] = 'Rescue'; $wb['Rescue'] = 'Rescue';
$wb['Server IP addresses'] = 'Server IP addresses'; $wb['Server IP addresses'] = 'Server IP addresses';
$wb['Additional PHP Versions'] = 'Additional PHP Versions'; $wb['Additional PHP Versions'] = 'Additional PHP Versions';
$wb['Directive Snippets'] = 'Directive Snippets';
$wb['Firewall'] = 'Firewall'; $wb['Firewall'] = 'Firewall';
$wb['Interface'] = 'Interface'; $wb['Interface'] = 'Interface';
......
<?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
<?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
...@@ -47,6 +47,11 @@ $items[] = array( 'title' => 'Additional PHP Versions', ...@@ -47,6 +47,11 @@ $items[] = array( 'title' => 'Additional PHP Versions',
'target' => 'content', 'target' => 'content',
'link' => 'admin/server_php_list.php', 'link' => 'admin/server_php_list.php',
'html_id' => 'server_php_list'); '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', $items[] = array( 'title' => 'Firewall',
'target' => 'content', 'target' => 'content',
......
<?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
<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
<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
...@@ -638,6 +638,12 @@ jQuery('.addPlaceholder').live("click", function(){ ...@@ -638,6 +638,12 @@ jQuery('.addPlaceholder').live("click", function(){
var template = jQuery(this).siblings(':input'); var template = jQuery(this).siblings(':input');
template.insertAtCaret(placeholderText); 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({ jQuery.fn.extend({
insertAtCaret: function(myValue){ insertAtCaret: function(myValue){
......