From dd0130670fe3cab4c7e2c1ab4f3bf0d2b2d512b0 Mon Sep 17 00:00:00 2001
From: Denny Bortfeldt <denny@bortfeldt.net>
Date: Mon, 27 Jun 2016 18:02:16 -0400
Subject: [PATCH] When uploading a logo which is smaller than the current ispconfig one, then the logo will be on the left side of the header. In my opinion it will look better when it's centered. You could vote about it ;)

---
 interface/web/admin/directive_snippets_edit.php |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php
index 06cea79..de80358 100644
--- a/interface/web/admin/directive_snippets_edit.php
+++ b/interface/web/admin/directive_snippets_edit.php
@@ -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 {
+
+	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