From 8662c5bdf4ab42b5db5af61ba1719c3eb4c03dee Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 30 Jan 2013 11:34:49 -0500
Subject: [PATCH] - Fixed: FS#2621 - OS update
---
interface/lib/classes/listform_actions.inc.php | 60 +++++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index e6d7d3f..ed689eb 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -33,8 +33,9 @@
private $id;
public $idx_key;
public $DataRowColor;
- public $SQLExtWhere = '';
- public $SQLOrderBy = '';
+ public $SQLExtWhere = '';
+ public $SQLOrderBy = '';
+ public $SQLExtSelect = '';
public function onLoad()
{
@@ -58,28 +59,28 @@
//* Manipulate order by for sorting / Every list has a stored value
//* Against notice error
- if(!isset($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
- $_SESSION['search'][$app->listform->listDef["name"]]['order'] = '';
+ if(!isset($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
+ $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
}
if(!empty($_GET['orderby'])){
$order = str_replace('tbl_col_','',$_GET['orderby']);
//* Check the css class submited value
if (preg_match("/^[a-z\_]{1,}$/",$order)) {
- if($_SESSION['search'][$app->listform->listDef["name"]]['order'] == $order){
- $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order.' DESC';
+ if($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] == $order){
+ $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order.' DESC';
} else {
- $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order;
+ $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order;
}
}
}
// If a manuel oder by like customers isset the sorting will be infront
- if(!empty($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
+ if(!empty($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
if(empty($this->SQLOrderBy)){
- $this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'];
+ $this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
} else {
- $this->SQLOrderBy = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'].', ',$this->SQLOrderBy);
+ $this->SQLOrderBy = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ',$this->SQLOrderBy);
}
}
@@ -141,7 +142,8 @@
if($_SESSION['s']['user']['typ'] == "admin") {
$sql_where = '';
} else {
- $sql_where = $app->tform->getAuthSQL('r').' and';
+ $sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
+ //$sql_where = $app->tform->getAuthSQL('r').' and';
}
}
if($this->SQLExtWhere != '') {
@@ -196,7 +198,7 @@
$tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
- $join .= ' JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+ $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
$order_by_sql = str_replace('web_traffic_last_month','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
@@ -204,49 +206,54 @@
$tmp_year = date('Y');
$tmp_month = date('m');
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
- $join .= ' JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+ $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
$order_by_sql = str_replace('web_traffic_this_month','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'web_traffic_last_year'){
$tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
- $join .= ' JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+ $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
$order_by_sql = str_replace('web_traffic_last_year','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'web_traffic_this_year'){
$tmp_year = date('Y');
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
- $join .= ' JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+ $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
$order_by_sql = str_replace('web_traffic_this_year','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'mail_traffic_last_month'){
$tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
- $join .= ' JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+ $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
$sql_where .= " AND mt.month like '$tmp_date%'";
$order_by_sql = str_replace('mail_traffic_last_month','traffic',$order_by_sql);
} elseif($order == 'mail_traffic_this_month'){
$tmp_date = date('Y-m');
- $join .= ' JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+ $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
$sql_where .= " AND mt.month like '$tmp_date%'";
$order_by_sql = str_replace('mail_traffic_this_month','traffic',$order_by_sql);
} elseif($order == 'mail_traffic_last_year'){
$tmp_date = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$extselect .= ', SUM(mt.traffic) as calctraffic';
- $join .= ' JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+ $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
$sql_where .= " AND mt.month like '$tmp_date%'";;
$order_by_sql = str_replace('mail_traffic_last_year','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
} elseif($order == 'mail_traffic_this_year'){
$tmp_date = date('Y');
$extselect .= ', SUM(mt.traffic) as calctraffic';
- $join .= ' JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+ $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
$sql_where .= " AND mt.month like '$tmp_date%'";
$order_by_sql = str_replace('mail_traffic_this_year','calctraffic',$order_by_sql);
$order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
}
+ }
+
+ if($this->SQLExtSelect != '') {
+ if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect;
+ $extselect .= $this->SQLExtSelect;
}
return 'SELECT '.$app->listform->listDef['table'].'.*'.$extselect.' FROM '.$app->listform->listDef['table']."$join WHERE $sql_where $order_by_sql $limit_sql";
@@ -268,20 +275,31 @@
$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
//* create options and set selected, if default -> 15 is selected
+
+ $options = '';
foreach($limits as $key => $val){
$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) && $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
}
- $app->tpl->setVar('search_limit','<select name="search_limit" style="width:50px">'.$options.'</select>');
+ $app->tpl->setVar('search_limit','<select name="search_limit" class="search_limit">'.$options.'</select>');
$app->tpl->setVar('toolsarea_head_txt',$app->lng('toolsarea_head_txt'));
$app->tpl->setVar($app->listform->wordbook);
$app->tpl->setVar('form_action', $app->listform->listDef['file']);
+ if(isset($_SESSION['show_info_msg'])) {
+ $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+ unset($_SESSION['show_info_msg']);
+ }
+ if(isset($_SESSION['show_error_msg'])) {
+ $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+ unset($_SESSION['show_error_msg']);
+ }
+
//* Parse the templates and send output to the browser
$this->onShowEnd();
}
- private function onShowEnd()
+ public function onShowEnd()
{
global $app;
$app->tpl_defaults();
--
Gitblit v1.9.1