Alexander Nicolaysen Sørnes : db_filter_ui: Show help text when users don't select a filter criterion
Chris Morgan
cmorgan at winehq.org
Fri Jun 20 17:37:28 CDT 2008
Module: appdb
Branch: master
Commit: 2c49f28671cedcea973566ee62dcfc5615f855c9
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=2c49f28671cedcea973566ee62dcfc5615f855c9
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Fri Jun 20 21:01:22 2008 +0200
db_filter_ui: Show help text when users don't select a filter criterion
---
include/db_filter_ui.php | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/db_filter_ui.php b/include/db_filter_ui.php
index 7fe459d..cbe69cf 100644
--- a/include/db_filter_ui.php
+++ b/include/db_filter_ui.php
@@ -105,6 +105,7 @@ class FilterInterface
private $oFilterSet;
private $aEscapeChars;
private $aEscapeCharsWith;
+ private $sErrors; // Used to inform the user about errors (and to give advice)
public function FilterInterface($sTableName = '')
{
@@ -112,6 +113,7 @@ class FilterInterface
$this->oFilterSet = new FilterSet(query_escape_string($sTableName));
$this->aEscapeChars = array('.');
$this->aEscapeCharsWith = array('-');
+ $this->sErrors = '';
}
public function AddFilterObject(Filter $oFilter)
@@ -358,6 +360,11 @@ class FilterInterface
}
$shNewItemsEditor .= '<b>Add new filter</b> <i>(You don’t have to fill out all rows.)</i><br />';
+
+ /* Show errors, if any */
+ if($this->sErrors)
+ $shNewItemsEditor .= "<font color=\"red\">{$this->sErrors}</font>";
+
foreach($this->aFilterInfo as $oOption)
{
$oDummyFilter = new Filter($oOption->getColumn(), 0, '');
@@ -428,6 +435,11 @@ class FilterInterface
{
$oFilter = new Filter($oOption->getColumn(), $iOp, $sData);
$aReturn[] = $oFilter;
+ } else if(!$iOp && $sData)
+ {
+ /* The user probably meant to add a filter, but forgot to seelect
+ a filter criterion */
+ $this->sErrors .= 'You need to select a filter criterion from the drop-down list<br />';
}
}
More information about the wine-cvs
mailing list