Commit 6aa06901 authored by Florian Schaal's avatar Florian Schaal
Browse files

update affected websites when a directive snippet was updated (Implements #5632)

parent 3caef955
......@@ -62,3 +62,6 @@ ALTER TABLE `mail_user` MODIFY `move_junk` enum('y','a','n') NOT NULL DEFAULT 'y
-- Change id_rsa column to TEXT format
ALTER TABLE `client` CHANGE `id_rsa` `id_rsa` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `directive_snippets` ADD `update_sites` ENUM('y','n') NOT NULL DEFAULT 'n' ;
......@@ -470,6 +470,7 @@ CREATE TABLE IF NOT EXISTS `directive_snippets` (
`required_php_snippets` varchar(255) NOT NULL DEFAULT '',
`active` enum('n','y') NOT NULL DEFAULT 'y',
`master_directive_snippets_id` int(11) unsigned NOT NULL DEFAULT '0',
`update_sites` ENUM('y','n') NOT NULL DEFAULT 'n',
PRIMARY KEY (`directive_snippets_id`)
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......
......@@ -75,22 +75,52 @@ class page_action extends tform_actions {
$app->tpl->setVar("snippet", $this->dataRecord['snippet'], true);
}
}
$app->tpl->setVar("is_master", $is_master);
if($this->dataRecord['managed_snippet_id'] > 0) {
}
parent::onShowEnd();
}
function onSubmit() {
global $app, $conf;
if($this->id > 0){
$record = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ?", $this->id);
if($record['master_directive_snippets_id'] > 0){
unset($app->tform->formDef["tabs"]['directive_snippets']['fields']['name'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['type'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['snippet'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['required_php_snippets']);
}
if(isset($this->dataRecord['update_sites'])) {
parent::onSubmit();
} else {
$app->db->query('UPDATE directive_snippets SET name = ?, type = ?, snippet = ?, customer_viewable = ?, required_php_snippets = ?, active = ? WHERE directive_snippets_id = ?', $this->dataRecord['name'], $this->dataRecord['type'], $this->dataRecord['snippet'], $this->dataRecord['customer_viewable'], implode(',', $this->dataRecord['required_php_snippets']), $this->dataRecord['active'], $this->id);
if($_REQUEST["next_tab"] == '') {
$list_name = $_SESSION["s"]["form"]["return_to"];
if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
$_SESSION["s"]["form"]["return_to"] = '';
session_write_close();
header($redirect);
} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
$redirect = $_SESSION["s"]["form"]["return_to_url"];
$_SESSION["s"]["form"]["return_to_url"] = '';
session_write_close();
header("Location: ".$redirect);
exit;
} else {
header("Location: ".$app->tform->formDef['list_default']);
}
exit;
}
}
unset($record);
}
parent::onSubmit();
}
......
......@@ -110,6 +110,12 @@ $form["tabs"]['directive_snippets'] = array (
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'update_sites' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'required_php_snippets' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOXARRAY',
......
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'Já existe uma diretiva com este
$wb['variables_txt'] = 'Variáveis';
$wb['customer_viewable_txt'] = 'Visualização personalizada';
$wb['required_php_snippets_txt'] = 'Trecho de código exige php';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Proměnné';
$wb['customer_viewable_txt'] = 'Dostupná volba pro klienta';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'Es existiert schon ein Direktiven
$wb['variables_txt'] = 'Variablen';
$wb['customer_viewable_txt'] = 'Sichtbar für Kunden';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'Der er allerede et direktiv uddra
$wb['variables_txt'] = 'Variabler';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb["directive_snippets_name_error_unique"] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
\ No newline at end of file
......@@ -9,4 +9,5 @@ $wb['snippet_txt'] = 'Fragmento';
$wb['type_txt'] = 'Tipo';
$wb['variables_txt'] = 'Variables';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'Već postoji direktiva sa tim ime
$wb['variables_txt'] = 'Varijable';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'There is already a directive snip
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
......@@ -9,4 +9,5 @@ $wb['directive_snippets_name_error_unique'] = 'Esiste già una direttiva snippet
$wb['variables_txt'] = 'Variabili';
$wb['customer_viewable_txt'] = 'Customer viewable';
$wb['required_php_snippets_txt'] = 'Requiered PHP Snippet';
$wb['update_sites_txt'] = 'Update sites using this snippet';
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment