fix show_sort_order_imap and fix html form tag locations in nextmatch tpl

This commit is contained in:
angles 2001-09-18 19:42:27 +00:00
parent 3985fe231d
commit 40dd0d8563
2 changed files with 473 additions and 416 deletions

View File

@ -22,6 +22,7 @@
\**************************************************************************/
/* $Id$ */
/*!
@class nextmatchs
@abstract
@ -50,8 +51,8 @@
$this->template->set_block('_nextmatchs','search_filter');
$this->template->set_block('_nextmatchs','cats_search_filter');
if(isset($phpgw_info['user']['preferences']['common']['maxmatchs']) &&
intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
if(isset($phpgw_info['user']['preferences']['common']['maxmatchs'])
&& intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
{
$this->maxmatches = intval($phpgw_info['user']['preferences']['common']['maxmatchs']);
}
@ -151,9 +152,7 @@
$hidden .= ' <input type="hidden" name="'.$var.'" value='.$param.'>'."\n";
}
}
$border = 0;
$var = Array(
'align' => $align,
'action' => ($this->action?$this->page():$phpgw->link($link)),
@ -168,7 +167,6 @@
return $this->template->fp('out','form');
}
/*!
@function show_tpl
@abstract ?
@ -298,7 +296,8 @@
$ret_str = '';
if (($start != 0) && ($start > $this->maxmatches))
if (($start != 0)
&& ($start > $this->maxmatches))
{
$extravars['start'] = 0;
$ret_str .= $this->set_link('left','first.gif',$scriptname,lang('First page'),$extravars);
@ -319,14 +318,12 @@
{
$extravars['start'] = ($start - $this->maxmatches);
}
$ret_str .= $this->set_link('left','left.gif',$scriptname,lang('Previous page'),$extravars);
}
else
{
$ret_str .= $this->set_icon('left','left-grey.gif',lang('Previous page'));
}
return $ret_str;
} /* left() */
@ -342,6 +339,30 @@
{
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
/*
$extravars = Array();
if ((isset($order)) && ($order != ''))
{
$extravars['order'] = $order;
}
if ((isset($filter)) && ($filter != ''))
{
$extravars['filter'] = $filter;
}
if ((isset($q_field)) && ($q_field != ''))
{
$extravars['q_field'] = $qfield;
}
if ((isset($sort)) && ($sort != ''))
{
$extravars['sort'] = $sort;
}
if ((isset($query)) && ($query != ''))
{
$extravars['query'] = urlencode(stripslashes($query));
}
*/
$extravars = Array(
'order' => $order,
'filter' => $filter,
@ -354,7 +375,8 @@
$ret_str = '';
if (($total > $this->maxmatches) && ($total > $start + $this->maxmatches))
if (($total > $this->maxmatches)
&& ($total > $start + $this->maxmatches))
{
$extravars['start'] = ($start + $this->maxmatches);
$ret_str .= $this->set_link('right','right.gif',$scriptname,lang('Next page'),$extravars);
@ -364,7 +386,8 @@
$ret_str .= $this->set_icon('right','right-grey.gif',lang('Next page'));
}
if (($start != $total - $this->maxmatches) && (($total - $this->maxmatches) > ($start + $this->maxmatches)))
if (($start != $total - $this->maxmatches)
&& (($total - $this->maxmatches) > ($start + $this->maxmatches)))
{
$extravars['start'] = ($total - $this->maxmatches);
$ret_str .= $this->set_link('right','last.gif',$scriptname,lang('Last page'),$extravars);
@ -373,7 +396,6 @@
{
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
}
return $ret_str;
} /* right() */
@ -385,8 +407,8 @@
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
{
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
$start = $localstart;
$start = $localstart;
$var = array(
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
'filter_value' => $filter,
@ -411,13 +433,12 @@
function cats_search_filter($search_obj=0,$filter_obj=1,$yours=0,$cat_id=0,$cat_field='fcat_id',$link='',$extra='')
{
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
$start = $localstart;
$cats = CreateObject('phpgwapi.categories');
$var = array(
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
'lang_category'=> lang('Category'),
'lang_category' => lang('Category'),
'lang_all' => lang('All'),
'lang_select' => lang('Select'),
'cat_field' => $cat_field,
@ -453,13 +474,11 @@
{
$_query = ereg_replace('"','',$_query);
}
$var = array(
'query_value' => stripslashes($_query),
'searchby' => $this->searchby($search_obj),
'lang_search' => lang('Search')
);
$this->template->set_var($var);
return $this->template->fp('out','search');
} /* search() */
@ -508,7 +527,6 @@
{
$qfield = $search_obj[$index][0];
}
$str .= '<option value="' . $search_obj[$index][0] . '"' . ($qfield == $search_obj[$index][0]?' selected':'') . '>' . lang($search_obj[$index][1]) . '</option>';
}
$str = '<select name="qfield">' . $str . '</select>' . "\n";
@ -529,19 +547,23 @@
{
if ($filter_obj == 1)
{
// $user_groups = $phpgw->accounts->membership($phpgw_info['user']['account_id']);
// $user_groups = $phpgw->accounts->membership($phpgw_info['user']['account_id']);
$indexlimit = count($user_groups);
if ($yours)
{
$filter_obj = array(array('none',lang('Show all')),
$filter_obj = array(
array('none',lang('Show all')),
array('yours',lang('Only yours')),
array('private',lang('private')));
array('private',lang('private'))
);
}
else
{
$filter_obj = array(array('none',lang('Show all')),
array('private',lang('private')));
$filter_obj = array(
array('none',lang('Show all')),
array('private',lang('private'))
);
}
for ($index=0; $index<$indexlimit; $index++)
{
@ -563,7 +585,6 @@
{
$filter = $filter_obj[$index][0];
}
$str .= ' <option value="' . $filter_obj[$index][0] . '"'.($filter == $filter_obj[$index][0]?' selected':'') . '>' . $filter_obj[$index][1] . '</option>'."\n";
}
@ -660,17 +681,52 @@
}
}
function show_sort_order_imap($sort,$order,$program,$text,$extra='')
/*!
@function show_sort_order_imap
@abstract ?
@param $old_sort : the current sort value
@param $new_sort : the sort value you want if you click on this
@param $default_order : user's preference for ordering list items (force this when a new [different] sorting is requested)
@param $order : the current order (will be flipped if old_sort = new_sort)
@param $program : script file name
@param $text : Text the link will show
@param $extra : any extra stuff you want to pass, url style
*/
function show_sort_order_imap($old_sort,$new_sort,$default_order,$order,$program,$text,$extra='')
{
global $phpgw, $filter, $qfield, $start, $query;
global $phpgw;
if (is_array($extra))
{
$extra = $this->extras_to_string($extra);
}
if ($old_sort == $new_sort)
{
// alternate order, like on outkrook, click on present sorting reverses order
if ((int)$order == 1)
{
$our_order = 0;
}
elseif ((int)$order == 0)
{
$our_order = 1;
}
else
{
// we should never get here
$our_order = 1;
}
}
else
{
//user has selected a new sort scheme, reset the order to user's default
$our_order = $default_order;
}
$extravar = 'sort='.$sort.'&order='.$order.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.$extra;
return '<a href="' . ($this->action?$this->page($extravar):$phpgw->link($program,$extravar)) . '">' . $text . '</a>';
$extravar = 'order='.$our_order.'&sort='.$new_sort.$extra;
$link = ($this->action?$this->page($extravar):$phpgw->link($program,$extravar));
return '<a href="' .$link .'">' .$text .'</a>';
}
function show_hits($total_records='',$start=0)
@ -692,5 +748,6 @@
return lang('showing x',$total_records);
}
}
} // End of nextmatchs class
}
// End of nextmatchs class
?>

View File

@ -21,9 +21,9 @@
<!-- BEGIN form -->
<td width="2%" align="{align}" valign="top">
<form method="POST" action="{action}" name="{form_name}">
{hidden}
<form method="POST" action="{action}" name="{form_name}">
<td width="2%" align="{align}" valign="top">
{hidden}
<table border="0" bgcolor="{th_bg}" cellspacing="0" cellpadding="0">
<tr>
<td align="{align}">
@ -31,8 +31,8 @@
</td>
</tr>
</table>
</form>
</td>
</td>
</form>
<!-- END form -->
@ -42,7 +42,7 @@
<!-- BEGIN link -->
<td width="2%" align="{align}" valign="top">
<td width="2%" align="{align}" valign="top">
<table border="0" bgcolor="{th_bg}" cellspacing="0" cellpadding="0">
<tr>
<td align="{align}">
@ -50,7 +50,7 @@
</td>
</tr>
</table>
</td>
</td>
<!-- END link -->