SF.net SVN: postfixadmin:[1757] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2015-03-19 22:57:30
|
Revision: 1757 http://sourceforge.net/p/postfixadmin/code/1757 Author: christian_boltz Date: 2015-03-19 22:57:23 +0000 (Thu, 19 Mar 2015) Log Message: ----------- PFAHandler.php: - add getPagebrowser() (returns an array of pagebrowser keys) AliasHandler.php: - change getList() to work with empty $condition - add getPagebrowser() to filter out mailboxes list-virtual.php: - replace $alias_pagebrowser_query and the create_page_browser() call with $handler->getPagebrowser() Modified Paths: -------------- trunk/list-virtual.php trunk/model/AliasHandler.php trunk/model/PFAHandler.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2015-03-19 22:05:49 UTC (rev 1756) +++ trunk/list-virtual.php 2015-03-19 22:57:23 UTC (rev 1757) @@ -119,14 +119,9 @@ $sql_domain = db_in_clause("$table_alias.domain", $list_domains); } -$alias_pagebrowser_query = " - FROM $table_alias - WHERE $sql_domain AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) AND ( $list_param ) - ORDER BY address -"; - $handler = new AliasHandler(0, $admin_username); $handler->getList($list_param, array(), $page_size, $fDisplay); +$pagebrowser_alias = $handler->getPagebrowser($list_param, array()); $tAlias = $handler->result(); @@ -397,7 +392,7 @@ } } -$pagebrowser_alias = create_page_browser("$table_alias.address", $alias_pagebrowser_query); + $nav_bar_alias = new cNav_bar ($PALANG['pOverview_alias_title'], $fDisplay, $CONF['page_size'], $pagebrowser_alias, $search); $nav_bar_alias->url = '&domain='.$fDomain; Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2015-03-19 22:05:49 UTC (rev 1756) +++ trunk/model/AliasHandler.php 2015-03-19 22:57:23 UTC (rev 1757) @@ -292,9 +292,23 @@ public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) { # only list aliases that do not belong to mailboxes # TODO: breaks if $condition is an array - return parent::getList( "__mailbox_username IS NULL AND ( $condition )", $searchmode, $limit, $offset); + if ($condition != '') { + $condition = " AND ( $condition ) "; + } + return parent::getList( "__mailbox_username IS NULL $condition", $searchmode, $limit, $offset); } + public function getPagebrowser($condition, $searchmode = array()) { + # only list aliases that do not belong to mailboxes + # TODO: breaks if $condition is an array + if ($condition != '') { + $condition = " AND ( $condition ) "; + } + return parent::getPagebrowser( "__mailbox_username IS NULL $condition", $searchmode); + } + + + protected function _validate_goto($field, $val) { if (count($val) == 0) { # empty is ok for mailboxes - this is checked in setmore() which can clear the error message Modified: trunk/model/PFAHandler.php =================================================================== --- trunk/model/PFAHandler.php 2015-03-19 22:05:49 UTC (rev 1756) +++ trunk/model/PFAHandler.php 2015-03-19 22:57:23 UTC (rev 1757) @@ -613,6 +613,18 @@ } /** + * getPagebrowser + * + * @param array or string condition (see build_select_query() for details) + * @param array searchmode - (see build_select_query() for details) + * @return array - pagebrowser keys ("aa-cz", "de-pf", ...) + */ + public function getPagebrowser($condition, $searchmode) { + $queryparts = $this->build_select_query($condition, $searchmode); + return create_page_browser($this->label_field, $queryparts['from_where_order']); + } + + /** * read_from_db * * reads all fields specified in $this->struct from the database This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |