Commit 59118c7c authored by Falko Timme's avatar Falko Timme
Browse files

- Added further tables to global search.

- Added translations to global search.
parent 86985d07
......@@ -246,6 +246,13 @@ class app {
$this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
$this->tpl->setVar('logout_txt', $this->lng('logout_txt'));
}
/* Global Search */
$this->tpl->setVar('globalsearch_resultslimit_of_txt', $this->lng('globalsearch_resultslimit_of_txt'));
$this->tpl->setVar('globalsearch_resultslimit_results_txt', $this->lng('globalsearch_resultslimit_results_txt'));
$this->tpl->setVar('globalsearch_noresults_text_txt', $this->lng('globalsearch_noresults_text_txt'));
$this->tpl->setVar('globalsearch_noresults_limit_txt', $this->lng('globalsearch_noresults_limit_txt'));
$this->tpl->setVar('globalsearch_searchfield_watermark_txt', $this->lng('globalsearch_searchfield_watermark_txt'));
}
} // end class
......
......@@ -70,4 +70,9 @@ $wb['datepicker_nextText'] = 'Vor';
$wb['datepicker_prevText'] = 'Zurück';
$wb['logout_txt'] = 'LOGOUT';
$wb['submit_confirmation'] = 'Wollen Sie diese Aktion wirlich ausführen?';
$wb['globalsearch_resultslimit_of_txt'] = "von";
$wb['globalsearch_resultslimit_results_txt'] = "Treffern";
$wb['globalsearch_noresults_text_txt'] = "Keine Treffer.";
$wb['globalsearch_noresults_limit_txt'] = "0 Treffer";
$wb['globalsearch_searchfield_watermark_txt'] = "Suche";
?>
......@@ -71,4 +71,9 @@ $wb['monthnamesshort_dec'] = "Dec";
$wb['datepicker_nextText'] = "Next";
$wb['datepicker_prevText'] = "Prev";
$wb['submit_confirmation'] = "Do you really want to perform this action?";
$wb['globalsearch_resultslimit_of_txt'] = "of";
$wb['globalsearch_resultslimit_results_txt'] = "results";
$wb['globalsearch_noresults_text_txt'] = "No results.";
$wb['globalsearch_noresults_limit_txt'] = "0 results";
$wb['globalsearch_searchfield_watermark_txt'] = "Search";
?>
......@@ -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
*/
......@@ -90,7 +95,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'contact_name' => array (
'datatype' => 'VARCHAR',
......@@ -104,7 +110,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 1
),
'customer_no' => array (
'datatype' => 'VARCHAR',
......@@ -115,7 +122,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'username' => array (
'datatype' => 'VARCHAR',
......@@ -140,7 +148,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'password' => array (
'datatype' => 'VARCHAR',
......@@ -185,7 +194,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'zip' => array (
'datatype' => 'VARCHAR',
......@@ -196,7 +206,8 @@ $form["tabs"]['address'] = array (
'width' => '10',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'city' => array (
'datatype' => 'VARCHAR',
......@@ -207,7 +218,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'state' => array (
'datatype' => 'VARCHAR',
......@@ -218,7 +230,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'country' => array (
'datatype' => 'VARCHAR',
......@@ -241,7 +254,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'mobile' => array (
'datatype' => 'VARCHAR',
......@@ -252,7 +266,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'fax' => array (
'datatype' => 'VARCHAR',
......@@ -263,7 +278,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'email' => array (
'datatype' => 'VARCHAR',
......@@ -274,7 +290,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'internet' => array (
'datatype' => 'VARCHAR',
......@@ -285,7 +302,8 @@ $form["tabs"]['address'] = array (
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
'cols' => '',
'searchable' => 2
),
'icq' => array (
'datatype' => 'VARCHAR',
......
......@@ -46,17 +46,22 @@ $type = $_GET["type"];
$authsql = " AND ".$app->tform->getAuthSQL('r');
$modules = explode(',', $_SESSION['s']['user']['modules']);
$result = array();
// clients
$result_clients = _search('client', 'client');
$result[] = _search('client', 'client', "AND limit_client = 0");
// resellers
$result[] = _search('client', 'reseller', "AND limit_client != 0");
// web sites
$result_webs = _search('sites', 'web_domain');
$result[] = _search('sites', 'web_domain');
// FTP users
$result_ftp_users = _search('sites', 'ftp_user');
$result[] = _search('sites', 'ftp_user');
// shell users
$result_shell_users = _search('sites', 'shell_user');
$result[] = _search('sites', 'shell_user');
// databases
/*
......@@ -81,42 +86,60 @@ $type = $_GET["type"];
}
}
*/
$result_databases = _search('sites', 'database');
$result[] = _search('sites', 'database');
// email domains
$result_email_domains = _search('mail', 'mail_domain');
$result[] = _search('mail', 'mail_domain');
// email alias domains
$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
// email mailboxes
$result_email_mailboxes = _search('mail', 'mail_user');
$result[] = _search('mail', 'mail_user');
// email aliases
$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
// email forwards
$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
// email catchalls
$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
// email transports
$result[] = _search('mail', 'mail_transport');
// mailinglists
$result[] = _search('mail', 'mail_mailinglist');
// getmails
$result[] = _search('mail', 'mail_get');
// dns zones
$result_dns_zones = _search('dns', 'dns_soa');
$result[] = _search('dns', 'dns_soa');
// secondary dns zones
$result_secondary_dns_zones = _search('dns', 'dns_slave');
$result[] = _search('dns', 'dns_slave');
// virtual machines
$result_vms = _search('vm', 'openvz_vm');
$result[] = _search('vm', 'openvz_vm');
// virtual machines os templates
$result_vm_ostemplates = _search('vm', 'openvz_ostemplate');
$result[] = _search('vm', 'openvz_ostemplate');
// virtual machines vm templates
$result_vm_vmtemplates = _search('vm', 'openvz_template');
$result[] = _search('vm', 'openvz_template');
// virtual machines ip addresses
$result_vm_ip_addresses = _search('vm', 'openvz_ip');
$result[] = _search('vm', 'openvz_ip');
$json = $app->functions->json_encode(array($result_clients, $result_webs, $result_ftp_users, $result_shell_users, $result_databases, $result_email_domains, $result_email_mailboxes, $result_dns_zones, $result_secondary_dns_zones, $result_vms, $result_vm_ostemplates, $result_vm_vmtemplates, $result_vm_ip_addresses));
$json = $app->functions->json_encode($result);
}
//}
function _search($module, $section){
function _search($module, $section, $additional_sql = ''){
global $app, $q, $authsql, $modules;
//$q = $app->db->quote($_GET["q"]);
//$authsql = " AND ".$app->tform->getAuthSQL('r');
//$user_modules = explode(',', $_SESSION['s']['user']['modules']);
$result_array = array('cheader' => array(), 'cdata' => array());
if(in_array($module, $modules)){
......@@ -159,10 +182,13 @@ function _search($module, $section){
// valid SQL query which returns an empty result set
$where_clause = '1 = 0';
}
if($where_clause != '') $where_clause = '('.$where_clause.')';
if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
$order_clause = '';
if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
$results = $app->db->queryAllRecords("SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause);
$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
$results = $app->db->queryAllRecords($sql);
if(is_array($results) && !empty($results)){
$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
......
......@@ -36,8 +36,10 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cssPrefix: 'gs-',
fillSearchField: false,
fillSearchFieldWith: 'title',
resultsText: '$ of % results',
resultsLimit: '$ of % results',
noResultsText: 'No results.',
noResultsLimit: '0 results',
searchFieldWatermark: 'Search',
displayEmptyCategories: false,
runJS: true
};
......@@ -48,6 +50,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
settings.resultBox = $(this).attr('id')+settings.resultBox;
$(this).attr('autocomplete', 'off');
$(this).val(settings.searchFieldWatermark);
$(this).wrap('<div class="'+settings.cssPrefix+'container" />');
$(this).after('<ul id="'+settings.resultBox+'" class="'+settings.cssPrefix+'resultbox" style="display:none;"></ul>');
var searchField = $(this);
......@@ -91,7 +94,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
if (!resultsFound){
output += '<li class="'+settings.cssPrefix+'cheader"><p class="'+settings.cssPrefix+'cheader-title">'+settings.noResultsText+'</p><p class="'+settings.cssPrefix+'cheader-limit">0 results</p></li>';
output += '<li class="'+settings.cssPrefix+'cheader"><p class="'+settings.cssPrefix+'cheader-title">'+settings.noResultsText+'</p><p class="'+settings.cssPrefix+'cheader-limit">'+settings.noResultsLimit+'</p></li>';
} else {
$.each(data, function(i, category){
......@@ -100,7 +103,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var limit = category['cheader']['limit'];
var cnt = 0;
output += '<li class="'+settings.cssPrefix+'cheader"><p class="'+settings.cssPrefix+'cheader-title">'+category['cheader']['title']+'</p><p class="'+settings.cssPrefix+'cheader-limit">'+settings.resultsText.replace("%", category['cheader']['total']).replace("$", (category['cheader']['limit'] < category['cdata'].length ? category['cheader']['limit'] : category['cdata'].length))+'</p></li>';
output += '<li class="'+settings.cssPrefix+'cheader"><p class="'+settings.cssPrefix+'cheader-title">'+category['cheader']['title']+'</p><p class="'+settings.cssPrefix+'cheader-limit">'+settings.resultsLimit.replace("%", category['cheader']['total']).replace("$", (category['cheader']['limit'] < category['cdata'].length ? category['cheader']['limit'] : category['cdata'].length))+'</p></li>';
var fillSearchFieldCode = (settings.fillSearchField) ? 'document.getElementById(\''+searchField.attr('id')+'\').value = \'%\';' : '';
//var fillSearchFieldCode = 'document.getElementById(\''+searchField.attr('id')+'\').value = \'%\';';
......@@ -137,11 +140,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
searchField.blur(function(){
resultBox.fadeOut();
if (searchField.val() == ''){
searchField.val(settings.searchFieldWatermark);
}
});
searchField.focus(function(){
if (searchField.val() == previousQ && searchField.val() != ''){
resultBox.fadeIn();
} else if(searchField.val() == settings.searchFieldWatermark){
searchField.val('');
} else if (searchField.val() != ''){
searchField.trigger('keyup');
}
......
......@@ -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
*/
......@@ -75,7 +80,8 @@ $form["tabs"]['alias'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'destination' => array (
'datatype' => 'VARCHAR',
......@@ -89,7 +95,8 @@ $form["tabs"]['alias'] = array (
'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
'errmsg'=> 'destination_error_isemail'),
),
'value' => ''
'value' => '',
'searchable' => 2
),
'type' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -80,7 +85,8 @@ $form["tabs"]['alias'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'destination' => array (
'datatype' => 'VARCHAR',
......@@ -88,7 +94,8 @@ $form["tabs"]['alias'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'type' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -80,7 +85,8 @@ $form["tabs"]['catchall'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'destination' => array (
'datatype' => 'VARCHAR',
......@@ -94,7 +100,8 @@ $form["tabs"]['catchall'] = array (
'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
'errmsg'=> 'destination_error_isemail'),
),
'value' => ''
'value' => '',
'searchable' => 2
),
'type' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -75,7 +80,8 @@ $form["tabs"]['forward'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'destination' => array (
'datatype' => 'VARCHAR',
......@@ -83,7 +89,8 @@ $form["tabs"]['forward'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'type' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -73,7 +78,8 @@ $form["tabs"]['mailget'] = array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('pop3' => 'POP3','imap'=>'IMAP','pop3ssl' => 'POP3SSL','imapssl'=>'IMAPSSL')
'value' => array('pop3' => 'POP3','imap'=>'IMAP','pop3ssl' => 'POP3SSL','imapssl'=>'IMAPSSL'),
'searchable' => 2
),
'source_server' => array (
'datatype' => 'VARCHAR',
......@@ -87,7 +93,8 @@ $form["tabs"]['mailget'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'source_username' => array (
'datatype' => 'VARCHAR',
......@@ -98,7 +105,8 @@ $form["tabs"]['mailget'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'source_password' => array (
'datatype' => 'VARCHAR',
......@@ -135,7 +143,8 @@ $form["tabs"]['mailget'] = array (
'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
'errmsg'=> 'destination_error_isemail'),
),
'value' => ''
'value' => '',
'searchable' => 1
),
'active' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -81,7 +86,8 @@ $form["tabs"]['mailinglist'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'listname' => array (
'datatype' => 'VARCHAR',
......@@ -92,7 +98,8 @@ $form["tabs"]['mailinglist'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'email' => array (
'datatype' => 'VARCHAR',
......@@ -103,7 +110,8 @@ $form["tabs"]['mailinglist'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'password' => array (
'datatype' => 'VARCHAR',
......
......@@ -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
*/
......@@ -75,7 +80,8 @@ $form["tabs"]['transport'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 1
),
'transport' => array (
'datatype' => 'VARCHAR',
......@@ -83,7 +89,8 @@ $form["tabs"]['transport'] = array (
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
'maxlength' => '255',
'searchable' => 2
),
'sort_order' => array (
'datatype' => 'INTEGER',
......
......@@ -10,4 +10,5 @@ $wb['limit_mailalias_txt'] = 'Die maximale Anzahl an E-Mail-Aliassen für ihr Ko
$wb['duplicate_mailbox_txt'] = 'Es existiert bereits eine Mailbox mit dieser E-Mail-Adresse.';
$wb['domain_txt'] = 'Domain';
$wb['duplicate_email_alias_txt'] = 'Dieser E-Mail-Alias existiert bereits.';
$wb["source_txt"] = 'Alias';