From 04e09afcccbf4e7f3eafa540ea35ac22b38f5bc0 Mon Sep 17 00:00:00 2001
From: filip <filip@ispconfig3>
Date: Mon, 27 Sep 2010 07:31:33 -0400
Subject: [PATCH] Implemented new FAQ functionality in help module
---
interface/lib/classes/listform.inc.php | 62 +++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index a3946eb..7ac6f81 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -38,7 +38,6 @@
private $pagingValues;
private $searchChanged = 0;
private $module;
- private $dateformat = 'Y-m-d H:i';
public $wordbook;
public function loadListDef($file, $module = '')
@@ -92,6 +91,8 @@
//$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
$app->uses('tform');
$querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring);
+ $querystring = str_replace("{AUTHSQL-A}",$app->tform->getAuthSQL('r','a'),$querystring);
+ $querystring = str_replace("{AUTHSQL-B}",$app->tform->getAuthSQL('r','b'),$querystring);
//* Getting the records
$tmp_records = $app->db->queryAllRecords($querystring);
@@ -128,14 +129,22 @@
//* Get config variable
$list_name = $this->listDef['name'];
$search_prefix = $this->listDef['search_prefix'];
+
+ if(isset($_REQUEST['Filter']) && !isset($_SESSION['search'][$list_name])) {
+ //* Jump back to page 1 of the list when a new search gets started.
+ $_SESSION['search'][$list_name]['page'] = 0;
+ }
//* store retrieval query
foreach($this->listDef['item'] as $i) {
$field = $i['field'];
- //*TODO: comment = hat sich die suche ge�ndert
+ //* The search string has been changed
if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
$this->searchChanged = 1;
+
+ //* Jump back to page 1 of the list when search has changed.
+ $_SESSION['search'][$list_name]['page'] = 0;
}
//* Store field in session
@@ -279,8 +288,36 @@
$record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
break;
- case 'DATE':
- $record[$key] = ($record[$key] > 0) ? date($this->dateformat,$record[$key]) : '';
+ case 'DATETSTAMP':
+ if ($record[$key] > 0) {
+ // is value int?
+ if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
+ $record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+ } else {
+ $record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+ }
+ }
+ break;
+ case 'DATE':
+ if ($record[$key] > 0) {
+ // is value int?
+ if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
+ $record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+ } else {
+ $record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+ }
+ }
+ break;
+
+ case 'DATETIME':
+ if ($record[$key] > 0) {
+ // is value int?
+ if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
+ $record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
+ } else {
+ $record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+ }
+ }
break;
case 'INTEGER':
@@ -320,10 +357,21 @@
}
break;
- case 'DATE':
+ case 'DATETSTAMP':
if($record[$key] > 0) {
- list($tag,$monat,$jahr) = explode('.',$record[$key]);
- $record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+ $record[$key] = date('Y-m-d',strtotime($record[$key]));
+ }
+ break;
+
+ case 'DATE':
+ if($record[$key] != '' && $record[$key] != '0000-00-00') {
+ $record[$key] = $record[$key];
+ }
+ break;
+
+ case 'DATETIME':
+ if($record[$key] > 0) {
+ $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
}
break;
--
Gitblit v1.9.1