From 7d52e00a51450bc4a080d4e21b7dda02c0a65191 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 05:42:06 -0500
Subject: [PATCH] Fixed list sorting

---
 interface/web/sites/form/database.tform.php |   56 ++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/interface/web/sites/form/database.tform.php b/interface/web/sites/form/database.tform.php
index 9bef109..58ce040 100644
--- a/interface/web/sites/form/database.tform.php
+++ b/interface/web/sites/form/database.tform.php
@@ -29,6 +29,11 @@
 	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).
+	
+	Search:
+	- searchable = 1 or searchable = 2 include the field in the search
+	- searchable = 1: this field will be the title of the search result
+	- searchable = 2: this field will be included in the description of the search result
 
 
 */
@@ -74,11 +79,11 @@
 			'formtype'	=> 'SELECT',
 			'default'	=> '',
 			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
 										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
+										'valuefield'=> 'parent_domain'
 									 ),
-			'value'		=> array('0' => $app->tform->lng('select_site_txt'))
+			'value'		=> array('0' => 'select_site_txt')
 		),
 		'type' => array (
 			'datatype'	=> 'VARCHAR',
@@ -98,32 +103,38 @@
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
-			'maxlength'	=> '255'
+			'maxlength'	=> '255',
+			'searchable' => 1
 		),
-		'database_user' => array (
+		'database_name_prefix' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'database_user_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'database_user_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
-														'errmsg'=> 'database_user_error_regex'),
-									),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
-			'maxlength'	=> '255'
+			'maxlength'	=> '25'
 		),
-		'database_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
-			'encryption' => 'MYSQL',
+		'database_user_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
 			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+										'keyfield'=> 'database_user_id',
+										'valuefield'=> 'database_user'
+									 ),
+			'value'		=> array('0' => 'select_dbuser_txt')
+		),
+		'database_ro_user_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+										'keyfield'=> 'database_user_id',
+										'valuefield'=> 'database_user'
+									 ),
+			'value'		=> array('0' => 'no_dbuser_txt')
 		),
 		'database_charset' => array (
 			'datatype'	=> 'VARCHAR',
@@ -153,7 +164,8 @@
 	                             ),
 	      'default' => '',
 	      'value'   => '',
-	      'width'   => '60'
+	      'width'   => '60',
+		  'searchable' => 2
 	    ),
 	##################################
 	# ENDE Datatable fields

--
Gitblit v1.9.1