From 28cd07d1a75c4e9dcaecac49efee0091f2fc62fa Mon Sep 17 00:00:00 2001
From: A. Täffner <darkalex@firesplash.de>
Date: Thu, 07 Apr 2016 05:30:49 -0400
Subject: [PATCH] Implemented a checkbox "enable DNSSEC" in DNS-Wizard. This Checkbox can be enabled or disabled by template.
---
interface/web/admin/directive_snippets_edit.php | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php
index 317dc58..de80358 100644
--- a/interface/web/admin/directive_snippets_edit.php
+++ b/interface/web/admin/directive_snippets_edit.php
@@ -38,8 +38,8 @@
* End Form configuration
******************************************/
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('admin');
@@ -47,7 +47,56 @@
// Loading classes
$app->uses('tpl,tform,tform_actions');
-// let tform_actions handle the page
-$app->tform_actions->onLoad();
+class page_action extends tform_actions {
-?>
\ No newline at end of file
+ function onShow() {
+ 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']);
+ }
+ unset($record);
+ }
+
+ parent::onShow();
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $is_master = false;
+ if($this->id > 0){
+ if($this->dataRecord['master_directive_snippets_id'] > 0){
+ $is_master = true;
+ $app->tpl->setVar("name", $this->dataRecord['name']);
+ $app->tpl->setVar("type", $this->dataRecord['type']);
+ $app->tpl->setVar("snippet", $this->dataRecord['snippet']);
+ }
+ }
+ $app->tpl->setVar("is_master", $is_master);
+
+ 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']);
+ }
+ unset($record);
+ }
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
--
Gitblit v1.9.1