[Vtigercrm-commits] [vtiger-commits] r5571 - in /vtigercrm/branches/4.2/include: RelatedListView.html RelatedListView.php uifromdbutil.php utils.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 28 02:42:09 EDT 2006
Author: allanbush
Date: Fri Apr 28 00:42:05 2006
New Revision: 5571
Log:
Added rdhital's pagination in related modules view (http://forums.vtiger.com/viewtopic.php?t=4861). Refs #750.
Modified:
vtigercrm/branches/4.2/include/RelatedListView.html (contents, props changed)
vtigercrm/branches/4.2/include/RelatedListView.php
vtigercrm/branches/4.2/include/uifromdbutil.php
vtigercrm/branches/4.2/include/utils.php
Modified: vtigercrm/branches/4.2/include/RelatedListView.html
==============================================================================
Binary files - no diff available.
Modified: vtigercrm/branches/4.2/include/RelatedListView.php
==============================================================================
--- vtigercrm/branches/4.2/include/RelatedListView.php (original)
+++ vtigercrm/branches/4.2/include/RelatedListView.php Fri Apr 28 00:42:05 2006
@@ -98,17 +98,14 @@
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
-if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
-{
- $start = $_REQUEST['start'];
-}
-else
-{
-
+$start_idx = $relatedmodule.'start';
+if(isset($_REQUEST[$start_idx]) && $_REQUEST[$start_idx] != '') {
+ $start = $_REQUEST[$start_idx];
+} else {
$start = 1;
}
//Retreive the Navigation array
-$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+$navigation_array = getRelatedNavigationValues($start, $noofrows, $list_max_entries_per_page, $relatedmodule);
//Retreive the List View Table Header
if($noofrows == 0)
@@ -118,7 +115,7 @@
else
{
$listview_header = getListViewHeader($focus,$relatedmodule,'','','','relatedlist');//"Accounts");
- if ($noofrows > 15)
+ if ($navigation_array[$relatedmodule.'end_val'] - $navigation_array[$relatedmodule.'start'] > 15)
{
$xtpl->assign('SCROLLSTART','<div style="overflow:auto;height:315px;width:100%;">');
$xtpl->assign('SCROLLSTOP','</div>');
@@ -144,10 +141,25 @@
//$listview_entries = getListViewEntries1($focus,"Accounts",$list_result,$navigation_array);
$xtpl->assign("LISTENTITY", $listview_entries);
$xtpl->assign("SELECT_SCRIPT", $view_script);
- $navigationOutput = getTableHeaderNavigation($navigation_array, $url_qry,$relatedmodule);
+ $navigationOutput = getTableHeaderNavigation($navigation_array, $url_qry,$relatedmodule, 'DetailView', '');
//echo $navigationOutput;
- //$xtpl->assign("NAVIGATION", $navigationOutput);
+ $navigationOutput = '
+<table cellpadding="0" cellspacing="0" width="100%" border="0" class="FormBorder">
+ <tr height="20">
+ <td class="listFormHeaderLinks">
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
+ <tr>'.$navigationOutput.'</tr>
+ </table>
+ </td>
+ </tr>
+</table>';
+
+
+ if($navigation_array[$relatedmodule.'allflag'] != 'All' || $navigation_array[$relatedmodule.'verylast'] > 1) {
+ // only show if navigation is possible
+ $xtpl->assign("NAVIGATION", $navigationOutput);
+ }
$xtpl->parse("main");
$xtpl->out("main");
Modified: vtigercrm/branches/4.2/include/uifromdbutil.php
==============================================================================
--- vtigercrm/branches/4.2/include/uifromdbutil.php (original)
+++ vtigercrm/branches/4.2/include/uifromdbutil.php Fri Apr 28 00:42:05 2006
@@ -137,30 +137,42 @@
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
+
+ $record = isset($_REQUEST['record']) ? $_REQUEST['record'] : '';
+ $relmodule = $_REQUEST['module'] == $module ? '' : $module;
+ $start = $relmodule.'start';
+ $end_val = $relmodule.'end_val';
+ $first = $relmodule.'first';
+ $end = $relmodule.'end';
+ $allflag = $relmodule.'allflag';
+ $current = $relmodule.'current';
+ $next = $relmodule.'next';
+ $verylast = $relmodule.'verylast';
+ $prev = $relmodule.'prev';
+ $dir_name = $_REQUEST['module'];
+
$output = '<td align="right">';
-
- $dir_name=getModuleDirName($module);
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start=1&viewname='.$viewid.'&allflag='.$navigation_array['allflag'].'" >'.$navigation_array['allflag'].'</a> ';
- if(($navigation_array['prev']) != 0) {
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start=1&viewname='.$viewid.'" title="First"><img src="'.$image_path.'start.gif" border="0" align="absmiddle"></a> ';
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start='.$navigation_array['prev'].'&viewname='.$viewid.'"><img src="'.$image_path.'previous.gif" border="0" align="absmiddle"></a> ';
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'=1&viewname='.$viewid.'&'.$allflag.'='.$navigation_array[$allflag].'" >'.$navigation_array[$allflag].'</a> ';
+ if(($navigation_array[$prev]) != 0) {
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'=1&viewname='.$viewid.'" title="First"><img src="'.$image_path.'start.gif" border="0" align="absmiddle"></a> ';
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'='.$navigation_array[$prev].'&viewname='.$viewid.'"><img src="'.$image_path.'previous.gif" border="0" align="absmiddle"></a> ';
} else {
$output .= '<img src="'.$image_path.'start_disabled.gif" border="0" align="absmiddle"> ';
$output .= '<img src="'.$image_path.'previous_disabled.gif" border="0" align="absmiddle"> ';
}
- for ($i=$navigation_array['first'];$i<=$navigation_array['end'];$i++) {
- if ($navigation_array['current']==$i) {
+ for ($i=$navigation_array[$first];$i<=$navigation_array[$end];$i++) {
+ if ($navigation_array[$current]==$i) {
$output .='<b>'.$i.'</b> ';
} else {
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start='.$i.'&viewname='.$viewid.'" >'.$i.'</a> ';
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'='.$i.'&viewname='.$viewid.'" >'.$i.'</a> ';
}
}
- if(($navigation_array['next']) !=0) {
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start='.$navigation_array['next'].'&viewname='.$viewid.'"><img src="'.$image_path.'next.gif" border="0" align="absmiddle"></a> ';
- $output .= '<a href="index.php?module='.$dir_name.'&action='.$action_val.$url_qry.'&start='.$navigation_array['verylast'].'&viewname='.$viewid.'"><img src="'.$image_path.'end.gif" border="0" align="absmiddle"></a> ';
+ if(($navigation_array[$next]) !=0) {
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'='.$navigation_array[$next].'&viewname='.$viewid.'"><img src="'.$image_path.'next.gif" border="0" align="absmiddle"></a> ';
+ $output .= '<a href="index.php?module='.$dir_name.'&record='.$record.'&action='.$action_val.$url_qry.'&'.$start.'='.$navigation_array[$verylast].'&viewname='.$viewid.'"><img src="'.$image_path.'end.gif" border="0" align="absmiddle"></a> ';
} else {
$output .= '<img src="'.$image_path.'next_disabled.gif" border="0" align="absmiddle"> ';
$output .= '<img src="'.$image_path.'end_disabled.gif" border="0" align="absmiddle"> ';
Modified: vtigercrm/branches/4.2/include/utils.php
==============================================================================
--- vtigercrm/branches/4.2/include/utils.php (original)
+++ vtigercrm/branches/4.2/include/utils.php Fri Apr 28 00:42:05 2006
@@ -2485,24 +2485,39 @@
}
return $user_id;
}
-//outlook security
+
function getNavigationValues($display, $noofrows, $limit)
+{
+ return getRelatedNavigationValues($display, $noofrows, $limit, '');
+}
+
+function getRelatedNavigationValues($display, $noofrows, $limit, $relatedmodule)
{
global $limitpage_navigation;
if(!isset($limitpage_navigation)) $limitpage_navigation = 5;
$navigation_array = Array();
- if(isset($_REQUEST['allflag']) && $_REQUEST['allflag'] == 'All') {
- $navigation_array['start'] =1;
- $navigation_array['first'] = 1;
- $navigation_array['end'] = 1;
- $navigation_array['prev'] =0;
- $navigation_array['next'] =0;
- $navigation_array['end_val'] =$noofrows;
- $navigation_array['current'] =1;
- $navigation_array['allflag'] ='Normal';
- $navigation_array['verylast'] =1;
+ $start_idx = $relatedmodule.'start';
+ $first_idx = $relatedmodule.'first';
+ $end_idx = $relatedmodule.'end';
+ $prev_idx = $relatedmodule.'prev';
+ $next_idx = $relatedmodule.'next';
+ $end_val_idx = $relatedmodule.'end_val';
+ $allflag_idx = $relatedmodule.'allflag';
+ $current_idx = $relatedmodule.'current';
+ $verylast_idx = $relatedmodule.'verylast';
+
+ if(isset($_REQUEST[$allflag_idx]) && $_REQUEST[$allflag_idx] == 'All') {
+ $navigation_array[$start_idx] =1;
+ $navigation_array[$first_idx] = 1;
+ $navigation_array[$end_idx] = 1;
+ $navigation_array[$prev_idx] =0;
+ $navigation_array[$next_idx] =0;
+ $navigation_array[$end_val_idx] =$noofrows;
+ $navigation_array[$current_idx] =1;
+ $navigation_array[$allflag_idx] ='Normal';
+ $navigation_array[$verylast_idx] =1;
return $navigation_array;
}
@@ -2537,15 +2552,15 @@
$next=0;
}
- $navigation_array['start'] = $start;
- $navigation_array['first'] = $first;
- $navigation_array['end'] = $last;
- $navigation_array['prev'] = $previous;
- $navigation_array['next'] = $next;
- $navigation_array['end_val'] = $end;
- $navigation_array['current'] = $display;
- $navigation_array['allflag'] ='All';
- $navigation_array['verylast'] =$paging;
+ $navigation_array[$start_idx] = $start;
+ $navigation_array[$first_idx] = $first;
+ $navigation_array[$end_idx] = $last;
+ $navigation_array[$prev_idx] = $previous;
+ $navigation_array[$next_idx] = $next;
+ $navigation_array[$end_val_idx] = $end;
+ $navigation_array[$current_idx] = $display;
+ $navigation_array[$allflag_idx] ='All';
+ $navigation_array[$verylast_idx] =$paging;
return $navigation_array;
}
@@ -3034,7 +3049,10 @@
}
}
- for ($i=$navigation_array['start']; $i<=$navigation_array['end_val']; $i++)
+ $relmodule = $_REQUEST['module'] == $module || $_REQUEST['module'] == 'Home' ? '' : $module;
+ $start = $relmodule.'start';
+ $end_val = $relmodule.'end_val';
+ for ($i=$navigation_array[$start]; $i<=$navigation_array[$end_val]; $i++)
{
if (($i%2)==0)
$list_header .= '<tr height=20 class=evenListRow>';
More information about the vtigercrm-commits
mailing list