[Vtigercrm-commits] [vtiger-commits] r6226 - in /vtigercrm/trunk: Smarty/templates/ include/ include/utils/ modules/Accounts/ modules/Emails/ modules/Leads/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sat May 20 06:55:12 EDT 2006
Author: saraj
Date: Sat May 20 04:54:59 2006
New Revision: 6226
Log:
Pagination and Sorting for related list added
Modified:
vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
vtigercrm/trunk/include/RelatedListView.php
vtigercrm/trunk/include/utils/ListViewUtils.php
vtigercrm/trunk/modules/Accounts/CallRelatedList.php
vtigercrm/trunk/modules/Emails/Email.php
vtigercrm/trunk/modules/Emails/ListView.php
vtigercrm/trunk/modules/Leads/CallRelatedList.php
Modified: vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/RelatedLists.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/RelatedLists.tpl Sat May 20 04:54:59 2006
@@ -13,7 +13,17 @@
-->*}
<script language="JavaScript" type="text/javascript" src="modules/PriceBooks/PriceBook.js"></script>
<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-
+<script>
+function getListViewEntries_js(module,url)
+{ldelim}
+ //Var ajaxObj = new Ajax(ajaxSaveResponse);
+ var urlstring ="module={$MODULE}&action={$MODULE}Ajax&record={$ID}&file=CallRelatedList&ajax=true&"+url+"&rmodule="+module;
+ //alert(urlstring);
+ //ajaxObj.process("index.php?",urlstring);
+
+{rdelim}
+
+</script>
{include file='Buttons_List1.tpl'}
<!-- Contents -->
@@ -66,10 +76,14 @@
{include file='RelatedListsHidden.tpl'}
{foreach key=header item=detail from=$RELATEDLISTS}
- <table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
- <tr >
- <td valign=bottom style="border-bottom:1px solid #999999;padding:5px;" ><b>{$header}</b></td>
- <td align=right style="border-bottom:1px solid #999999;padding:5px;">
+ <table border=0 cellspacing=0 cellpadding=0 width=100% class="small" style="border-bottom:1px solid #999999;padding:5px;">
+ <tr>
+ <td valign=bottom><b>{$header}</b></td>
+ {if $detail ne ''}
+ <td align=center>{$detail.navigation.0}</td>
+ {$detail.navigation.1}
+ {/if}
+ <td align=right>
{if $header eq 'Potentials'}
<input title="New Potential" accessyKey="F" class="small" onclick="this.form.action.value='EditView';this.form.module.value='Potentials'" type="submit" name="button" value="Add new Potential"></td>
Modified: vtigercrm/trunk/include/RelatedListView.php
==============================================================================
--- vtigercrm/trunk/include/RelatedListView.php (original)
+++ vtigercrm/trunk/include/RelatedListView.php Sat May 20 04:54:59 2006
@@ -1,8 +1,9 @@
<?php
require_once('include/utils/UserInfoUtil.php');
require_once("include/utils/utils.php");
-
-function GetRelatedList($module,$relatedmodule,$focus,$query,$button,$returnset,$edit_val='',$del_val='')
+require_once("include/ListView/ListViewSession.php");
+
+function GetRelatedList($module,$relatedmodule,$focus,$query,$button,$returnset,$id='',$edit_val='',$del_val='')
{
$log = LoggerManager::getLogger('account_list');
$log->debug("Entering GetRelatedList(".$module.",".$relatedmodule.",".$focus.",".$query.",".$button.",".$returnset.",".$edit_val.",".$del_val.") method ...");
@@ -30,8 +31,11 @@
global $focus_list;
$smarty = new vtigerCRM_Smarty;
if (!isset($where)) $where = "";
-
- if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+
+ if(method_exists($focus,getSortOrder))
+ $sorder = $focus->getSortOrder();
+ if(method_exists($focus,getOrderBy))
+ $order_by = $focus->getOrderBy();
$button = '<table cellspacing=0 cellpadding=2><tr><td>'.$button.'</td></tr></table>';
@@ -74,14 +78,18 @@
}
-
-
-
if(isset($where) && $where != '')
{
$query .= ' and '.$where;
}
-
+
+ if(!$_SESSION['rlvs'][$module][$relatedmodule])
+ {
+ $modObj = new ListViewSession();
+ $modObj->sorder = $sorder;
+ $modObj->sortby = $order_by;
+ $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
+ }
//$url_qry = getURLstring($focus);
@@ -93,18 +101,18 @@
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
-
- //Retreiving the start value from request
- if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
- {
- $start = $_REQUEST['start'];
- }
- else
- {
-
- $start = 1;
- }
- //Retreive the Navigation array
+
+ //Storing Listview session object
+ if(isset($_REQUEST['relmodule']) && $_REQUEST['relmodule']!='')
+ {
+ $relmodule = $_REQUEST['relmodule'];
+ if($_SESSION['rlvs'][$module][$relmodule])
+ {
+ setSessionVar($_SESSION['rlvs'][$module][$relmodule],$noofrows,$list_max_entries_per_page,$module,$relmodule);
+ }
+ }
+ $start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
+
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
//Retreive the List View Table Header
@@ -114,14 +122,14 @@
}
else
{
- $listview_header = getListViewHeader($focus,$relatedmodule,'','','','relatedlist');//"Accounts");
+ $listview_header = getListViewHeader($focus,$relatedmodule,'',$sorder,$order_by,'relatedlist');//"Accounts");
if ($noofrows > 15)
{
$smarty->assign('SCROLLSTART','<div style="overflow:auto;height:315px;width:100%;">');
$smarty->assign('SCROLLSTOP','</div>');
}
$smarty->assign("LISTHEADER", $listview_header);
-
+
if($module == 'PriceBook' && $relatedmodule == 'Products')
{
$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,$edit_val,$del_val);
@@ -137,8 +145,14 @@
{
$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset);
}
- $related_entries = array('header'=>$listview_header,'entries'=>$listview_entries);
- $navigationOutput = getTableHeaderNavigation($navigation_array, $url_qry,$relatedmodule);
+ $start_rec = $navigation_array['start'];
+ $end_rec = $navigation_array['end_val'];
+
+ $navigationOutput = Array();
+ $navigationOutput[] = $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
+ $module_rel = $module.'&relmodule='.$relatedmodule.'&record='.$id;
+ $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
+ $related_entries = array('header'=>$listview_header,'entries'=>$listview_entries,'navigation'=>$navigationOutput);
$log->debug("Exiting GetRelatedList method ...");
return $related_entries;
}
Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Sat May 20 04:54:59 2006
@@ -42,19 +42,6 @@
global $theme;
global $app_strings;
global $mod_strings;
- //Seggregating between module and smodule
- if(isset($_REQUEST['smodule']) && $_REQUEST['smodule'] == 'VENDOR')
- {
- $smodule = 'Vendor';
- }
- elseif(isset($_REQUEST['smodule']) && $_REQUEST['smodule'] == 'PRICEBOOK')
- {
- $smodule = 'PriceBook';
- }
- else
- {
- $smodule = $module;
- }
$arrow='';
$qry = getURLstring($focus);
@@ -63,7 +50,7 @@
$list_header = Array();
//Get the tabid of the module
- $tabid = getTabid($smodule);
+ $tabid = getTabid($module);
global $current_user;
//added for customview 27/5
if($oCv)
@@ -158,7 +145,7 @@
{
$temp_sorder = 'ASC';
}
- if($relatedlist !='')
+ /* if($relatedlist !='')
{
if($app_strings[$name])
{
@@ -170,7 +157,7 @@
}
}
else
- {
+ {*/
if($app_strings[$name])
{
$lbl_name = $app_strings[$name];
@@ -190,7 +177,7 @@
$name = "<a href='javascript:;' onClick='getListViewEntries_js(\"".$module."\",\"order_by=".$col."&sorder=".$temp_sorder."\");' class='listFormHeaderLinks'>".$lbl_name." ".$arrow."</a>";
$arrow = '';
- }
+ //}
}
else
{ if($app_strings[$name])
@@ -2564,7 +2551,7 @@
Return type void.
*/
-function setSessionVar($lv_array,$noofrows,$max_ent)
+function setSessionVar($lv_array,$noofrows,$max_ent,$module='',$related='')
{
$start = '';
if(isset($_REQUEST['start']) && $_REQUEST['start'] !='')
@@ -2575,12 +2562,16 @@
if(isset($_REQUEST['viewname']) && $_REQUEST['viewname'] !='')
$lv_array['viewname']=$_REQUEST['viewname'];
- $_SESSION['lvs'][$_REQUEST['module']]=$lv_array;
-
+ if($related=='')
+ $_SESSION['lvs'][$_REQUEST['module']]=$lv_array;
+ else
+ $_SESSION['rlvs'][$module][$related] = $lv_array;
+
if ($start < ceil ($noofrows / $max_ent) && $start !='')
{
$start = ceil ($noofrows / $max_ent);
- $_SESSION['lvs'][$currentModule]['start'] = $start;
+ if($related=='')
+ $_SESSION['lvs'][$currentModule]['start'] = $start;
}
}
Modified: vtigercrm/trunk/modules/Accounts/CallRelatedList.php
==============================================================================
--- vtigercrm/trunk/modules/Accounts/CallRelatedList.php (original)
+++ vtigercrm/trunk/modules/Accounts/CallRelatedList.php Sat May 20 04:54:59 2006
@@ -39,6 +39,12 @@
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
+
+ if(!$_SESSION['rlvs'][$module])
+ {
+ unset($_SESSION['rlvs']);
+ }
+
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
Modified: vtigercrm/trunk/modules/Emails/Email.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Email.php (original)
+++ vtigercrm/trunk/modules/Emails/Email.php Sat May 20 04:54:59 2006
@@ -71,7 +71,7 @@
var $column_fields = Array();
- var $sortby_fields = Array();
+ var $sortby_fields = Array('subject','date_start','smownerid');
//Added these variables which are used as default order by and sortorder in ListView
var $default_order_by = 'subject';
@@ -111,6 +111,45 @@
return GetRelatedList('Emails','Contacts',$focus,$query,$button,$returnset);
}
+ /** Returns the column name that needs to be sorted
+ * Portions created by vtigerCRM are Copyright (C) vtigerCRM.
+ * All Rights Reserved..
+ * Contributor(s): Mike Crowe
+ */
+
+ function getSortOrder()
+ {
+ global $log;
+ $log->debug("Entering getSortOrder() method ...");
+ if(isset($_REQUEST['sorder']))
+ $sorder = $_REQUEST['sorder'];
+ else
+ $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($this->default_sort_order));
+
+ $log->debug("Exiting getSortOrder method ...");
+ return $sorder;
+ }
+
+ /** Returns the order in which the records need to be sorted
+ * Portions created by vtigerCRM are Copyright (C) vtigerCRM.
+ * All Rights Reserved..
+ * Contributor(s): Mike Crowe
+ */
+
+ function getOrderBy()
+ {
+ global $log;
+ $log->debug("Entering getOrderBy() method ...");
+ if (isset($_REQUEST['order_by']))
+ $order_by = $_REQUEST['order_by'];
+ else
+ $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($this->default_order_by));
+
+ $log->debug("Exiting getOrderBy method ...");
+ return $order_by;
+ }
+ // Mike Crowe Mod --------------------------------------------------------
+
/** Returns a list of the associated users
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
* All Rights Reserved..
Modified: vtigercrm/trunk/modules/Emails/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/ListView.php (original)
+++ vtigercrm/trunk/modules/Emails/ListView.php Sat May 20 04:54:59 2006
@@ -112,7 +112,7 @@
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView("Emails");
-$viewid = 20;
+$viewid = $oCustomView->getViewId($currentModule);
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
Modified: vtigercrm/trunk/modules/Leads/CallRelatedList.php
==============================================================================
--- vtigercrm/trunk/modules/Leads/CallRelatedList.php (original)
+++ vtigercrm/trunk/modules/Leads/CallRelatedList.php Sat May 20 04:54:59 2006
@@ -41,6 +41,12 @@
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
+
+ if(!$_SESSION['rlvs'][$module])
+ {
+ unset($_SESSION['rlvs']);
+ }
+
$sql1 = $adb->query('select campaignid from leaddetails where leadid='.$focus->id);
$campaignid = $adb->query_result($sql1,0,'campaignid');
if($campaignid == 0) $campaignid='';
More information about the vtigercrm-commits
mailing list