From 73813a4bd2c3d3fcefecbd73416e8bb27273225f Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Fri, 24 Jan 2014 11:36:39 -0500
Subject: [PATCH] Merged domains, vhost subdomains and vhost aliasdomains into vhost domains

---
 interface/web/sites/web_vhost_domain_list.php |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_vhost_domain_list.php
similarity index 64%
rename from interface/web/sites/web_domain_list.php
rename to interface/web/sites/web_vhost_domain_list.php
index 301ec96..f2089e2 100644
--- a/interface/web/sites/web_domain_list.php
+++ b/interface/web/sites/web_vhost_domain_list.php
@@ -35,7 +35,7 @@
 * Begin Form configuration
 ******************************************/
 
-$list_def_file = "list/web_domain.list.php";
+$list_def_file = "list/web_vhost_domain.list.php";
 
 /******************************************
 * End Form configuration
@@ -46,13 +46,37 @@
 
 $app->load('listform_actions');
 
+//* Get and set the vhost domain type - store in session
+$query_type = 'vhost';
+$show_type = 'domain';
+if(isset($_GET['type']) && $_GET['type'] == 'subdomain') {
+	$show_type = 'subdomain';
+	$query_type = 'vhostsubdomain';
+} elseif(isset($_GET['type']) && $_GET['type'] == 'aliasdomain') {
+	$show_type = 'aliasdomain';
+	$query_type = 'vhostalias';
+} elseif(!isset($_GET['type']) && isset($_SESSION['s']['var']['vhostdomain_type']) && $_SESSION['s']['var']['vhostdomain_type'] == 'subdomain') {
+	$show_type = 'subdomain';
+	$query_type = 'vhostsubdomain';
+} elseif(!isset($_GET['type']) && isset($_SESSION['s']['var']['vhostdomain_type']) && $_SESSION['s']['var']['vhostdomain_type'] == 'aliasdomain') {
+	$show_type = 'aliasdomain';
+	$query_type = 'vhostalias';
+}
+
+$_SESSION['s']['var']['vhostdomain_type'] = $show_type;
 
 class list_action extends listform_actions {
+	function onShow() {
+		global $app;
+		$app->tpl->setVar('vhostdomain_type', $_SESSION['s']['var']['vhostdomain_type']);
+		
+		parent::onShow();
+	}
 
 }
 
 $list = new list_action;
-$list->SQLExtWhere = "web_domain.type = 'vhost' AND web_domain.parent_domain_id = '0'";
+$list->SQLExtWhere = "web_domain.type = '" . $query_type . "'" . ($show_type != 'domain' ? " AND web_domain.parent_domain_id = '0'" : "");
 $list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 

--
Gitblit v1.9.1