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()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1757 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 9 years ago
parent 28fe7042e8
commit 313270c00a

@ -119,14 +119,9 @@ if ($search == "") {
$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 @@ class cNav_bar
}
}
$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;

@ -292,9 +292,23 @@ class AliasHandler extends PFAHandler {
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

@ -612,6 +612,18 @@ abstract class PFAHandler {
);
}
/**
* 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
*

Loading…
Cancel
Save