[Vtigercrm-commits] [vtiger-commits] r6511 - in /vtigercrm/trunk: Popup.php Smarty/templates/Popup.tpl Smarty/templates/PopupContents.tpl modules/Users/ListView.php modules/Users/Popup.php modules/Users/User.php themes/blue/images/popupHdr.jpg

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri May 26 20:34:19 EDT 2006


Author: don
Date: Fri May 26 18:34:08 2006
New Revision: 6511

Log:
new UI for Popup and popup search has been implemented

Added:
    vtigercrm/trunk/Smarty/templates/PopupContents.tpl
    vtigercrm/trunk/themes/blue/images/popupHdr.jpg   (with props)
Modified:
    vtigercrm/trunk/Popup.php
    vtigercrm/trunk/Smarty/templates/Popup.tpl
    vtigercrm/trunk/modules/Users/ListView.php
    vtigercrm/trunk/modules/Users/Popup.php
    vtigercrm/trunk/modules/Users/User.php

Modified: vtigercrm/trunk/Popup.php
==============================================================================
--- vtigercrm/trunk/Popup.php (original)
+++ vtigercrm/trunk/Popup.php Fri May 26 18:34:08 2006
@@ -32,7 +32,6 @@
 
 $popuptype = '';
 $popuptype = $_REQUEST["popuptype"];
-
 switch($currentModule)
 {
 	case 'Contacts':
@@ -46,8 +45,8 @@
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 		else
 			$smarty->assign("RETURN_MODULE",'Emails');
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
 		if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
 		break;
 	case 'Accounts':
 		require_once("modules/$currentModule/Account.php");
@@ -61,8 +60,7 @@
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 		else
 			$smarty->assign("RETURN_MODULE",'Emails');
-		$sorder = $focus->getSortOrder();
-		$order_by = $focus->getOrderBy();
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','accountname','true','basic',$popuptype,"","","");
 		break;
 	case 'Leads':
 		require_once("modules/$currentModule/Lead.php");
@@ -78,7 +76,7 @@
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 		else
 			$smarty->assign("RETURN_MODULE",'Emails');
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
 		break;
 	case 'Potentials':
 		require_once("modules/$currentModule/Opportunity.php");
@@ -89,10 +87,9 @@
 				,'sales_stage'=>'sales_stage_dom');
 		$comboFieldArray = getComboArray($comboFieldNames);
 		$smarty->assign("SINGLE_MOD",'Opportunity');
-		if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')
-			$sorder = $_REQUEST['sorder'];
-		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
-			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
+		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
+			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','potentialname','true','basic',$popuptype,"","","");
 		break;
 	case 'Quotes':
 		require_once("modules/$currentModule/Quote.php");	
@@ -101,8 +98,7 @@
 		$comboFieldNames = Array('quotestage'=>'quotestage_dom');
 		$comboFieldArray = getComboArray($comboFieldNames);
 		$smarty->assign("SINGLE_MOD",'Quote');
-		if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')
-			$sorder = $_REQUEST['sorder'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'Invoice':
 		require_once("modules/$currentModule/Invoice.php");
@@ -110,12 +106,11 @@
 		$smarty->assign("SINGLE_MOD",'Invoice');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'Products':
 		require_once("modules/$currentModule/Product.php");
 		$focus = new Product();
-		//echo '<pre>';print_r($_REQUEST);echo '</pre>';
 		$smarty->assign("SINGLE_MOD",'Product');
 		if(isset($_REQUEST['curr_row']))
 		{
@@ -125,21 +120,13 @@
 		}
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
-		if(isset($_REQUEST['smodule']) && $_REQUEST['smodule'] !='')
-		{
-			$smarty->assign("SMODULE",$_REQUEST['smodule']);
-			$smodule = $_REQUEST['smodule'];
-			$url_string = '&smodule=VENDOR';
-			$search_query .= " and vendor_id=''";
-		}
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','productname','true','basic',$popuptype,"","","");
 		break;
 	case 'Vendors':
 		require_once("modules/$currentModule/Vendor.php");
 		$focus = new Vendor();
 		$smarty->assign("SINGLE_MOD",'Vendor');
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
-		if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')
-			$sorder = $_REQUEST['sorder'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','vendorname','true','basic',$popuptype,"","","");
 		break;
 	case 'SalesOrder':
 		require_once("modules/$currentModule/SalesOrder.php");
@@ -147,7 +134,7 @@
 		$smarty->assign("SINGLE_MOD",'SalesOrder');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'PurchaseOrder':
 		require_once("modules/$currentModule/PurchaseOrder.php");
@@ -155,7 +142,7 @@
 		$smarty->assign("SINGLE_MOD",'PurchaseOrder');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'PriceBooks':
 		require_once("modules/$currentModule/PriceBook.php");
@@ -163,12 +150,13 @@
 		$smarty->assign("SINGLE_MOD",'PriceBook');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
-		if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
-		break;
-
-}
-
-
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','bookname','true','basic',$popuptype,"","","");
+		break;
+
+
+}
+
+/*
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 {
 	$url_string .="&query=true";
@@ -474,7 +462,7 @@
 	$log->info("Here is the where clause for the list view: $where");
 
 }
-
+*/
 
 $theme_path="themes/".$theme."/";
 $image_path=$theme_path."images/";
@@ -497,18 +485,23 @@
         $query = getListQuery($currentModule,$where_relquery);
 }
 			
+
+list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
+
 if(isset($where) && $where != '')
 {
         $query .= ' and '.$where;
 }
 
+if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
+if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')	$sorder = $_REQUEST['sorder'];
+
 if(isset($order_by) && $order_by != '')
 {
         $query .= ' ORDER BY '.$order_by.' '.$sorder;
 }
 
 $list_result = $adb->query($query);
-
 //Retreiving the no of rows
 $noofrows = $adb->num_rows($list_result);
 
@@ -561,6 +554,12 @@
 
 $focus->list_mode="search";
 $focus->popup_type=$popuptype;
+$url_string .='&popuptype='.$popuptype;
+$listview_header_search=getSearchListHeaderValues($focus,"$currentModule",$url_string,$sorder,$order_by);
+$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
+
+$smarty->assign("ALPHABETICAL", $alphabetical);
+
 
 $listview_header = getSearchListViewHeader($focus,"$currentModule",$url_string,$sorder,$order_by);
 $smarty->assign("LISTHEADER", $listview_header);
@@ -568,18 +567,17 @@
 
 $listview_entries = getSearchListViewEntries($focus,"$currentModule",$list_result,$navigation_array);
 $smarty->assign("LISTENTITY", $listview_entries);
-
-if($order_by !='')
-$url_string .="&order_by=".$order_by;
-if($sorder !='')
-$url_string .="&sorder=".$sorder;
 
 $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,$currentModule,"Popup");
 $smarty->assign("NAVIGATION", $navigationOutput);
 $smarty->assign("RECORD_COUNTS", $record_string);
-
-
-$smarty->display("Popup.tpl");
+$smarty->assign("POPUP_TYPE", $popuptype);
+
+
+if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
+	$smarty->display("PopupContents.tpl");
+else
+	$smarty->display("Popup.tpl");
 
 ?>
 

Modified: vtigercrm/trunk/Smarty/templates/Popup.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/Popup.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/Popup.tpl Fri May 26 18:34:08 2006
@@ -15,6 +15,7 @@
 <link rel="stylesheet" type="text/css" href="{$THEME_PATH}style.css"/>
 <script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
 <script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/ajax.js"></script>
 <script type="text/javascript">
 function add_data_to_relatedlist(entity_id,recordid) {ldelim}
 
@@ -22,62 +23,94 @@
 {rdelim}
 </script>
 
-<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+<table width="100%" border="0" cellspacing="0" cellpadding="0" class="small">
 	<tr>
-	        <td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-
-        	<td class="showPanelBg" valign=top width=100%>
-                	<div class="small" style="padding:20px">
-			       <form name="selectall" method="POST">
-		               <table border=0 cellspacing=1 cellpadding=0 width=100% class="lvtBg">
-                		<tr style="background-color:#efefef">
-                        		<td >
-						<table border=0 cellspacing=0 cellpadding=2 width=100%>
-		                                <tr>
-		           		                <input name="module" type="hidden" value="{$RETURN_MODULE}">
-		                                <input name="action" type="hidden" value="{$RETURN_ACTION}">
-                  		                <input name="pmodule" type="hidden" value="{$MODULE}">
-										<input type="hidden" name="curr_row" value="{$CURR_ROW}">	
-		                                <input name="entityid" type="hidden" value="">
-		                                <input name="idlist" type="hidden" value="">
-						{if $SELECT eq 'enable'}
-						  <td><input class="small" type="button" value="Add Contacts" onclick="if(SelectAll()) window.close();"/></td>
-						{/if}
-                        	                  <td style="padding-right:20px" class="small" nowrap>&nbsp;{$RECORD_COUNTS}</td>
-			                          <td class="small" nowrap>{$NAVIGATION}</td>
-						 </tr>
-						</table>
-						<div  style="overflow:auto;width:100%;height:300px; border-top:1px solid #999999;border-bottom:1px solid #999999">
-			                        <table border=0 cellspacing=1 cellpadding=3 width=100% class=small>
-                        				<tr>	
-							{if $SELECT eq 'enable'}
-								<td class="lvtCol"><input type="checkbox"  name="selectall" onClick=toggleSelect(this.checked,"selected_id")></td>
-							{/if}
-
-                        				{foreach item=header from=$LISTHEADER}
-							         <td class="lvtCol">{$header}</td>
-					                {/foreach}
-				                        </tr>
-							{foreach key=entity_id item=entity from=$LISTENTITY}
-			                                <tr bgcolor=white onMouseOver="this.className='lvtColDataHover'" onMouseOut="this.className='lvtColData'"  >
-							{if $SELECT eq 'enable'}
-								<td><input type="checkbox" NAME="selected_id" value= '{$entity_id}' onClick=toggleSelectAll(this.name,"selectall")></td>
-							{/if}
-                                				{foreach item=data from=$entity}
-			                                        <td>
-                        			                        {$data}
-			                                        </td>
-                        				        {/foreach}
-			                                </tr>
-                        				{/foreach}
-                        			</table>
-                       				</div>
-					</td>
-				 </tr>
-				</table>
-				</form>    
-			</div>
+		<td background="{$IMAGE_PATH}popupHdr.jpg" height="70" style="padding-left:20px;">
+		<span style="color:#FFFFFF;font:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;">
+		{$MODULE}
+		</span> 
 		</td>
 	</tr>
+	<tr>
+	  	<td style="padding:10px;" >
+			<form name="basicSearch" action="index.php">
+			<table width="100%" cellpadding="5" cellspacing="0" style="border-top:1px dashed #CCCCCC;border-bottom:1px dashed #CCCCCC;">
+			<tr>
+				<td width="20%" class="dvtCellLabel"><img src="{$IMAGE_PATH}basicSearchLens.gif"></td>
+				<td width="30%" class="dvtCellLabel"><input type="text" name="search_text" class="txtBox"> </td>
+				<td width="30%" class="dvtCellLabel"><b>In</b>&nbsp;
+					<select name ="search_field" class="txtBox">
+		                         {html_options  options=$SEARCHLISTHEADER }
+                		        </select>
+								<input type="hidden" name="searchtype" value="BasicSearch">
+		                        <input type="hidden" name="module" value="{$MODULE}">
+								<input type="hidden" name="action" value="Popup">
+		    	                <input type="hidden" name="query" value="true">
+								<input type="hidden" name="search_cnt">
+
+				</td>
+				<td width="20%" class="dvtCellLabel">
+					<input type="button" name="search" value=" &nbsp;Search&nbsp; " onClick="callSearch('Basic');" class="classBtn">
+				</td>
+			</tr>
+			 <tr>
+				<td colspan="4" align="center">
+					<table width="100%">
+					<tr>	
+						{$ALPHABETICAL}
+					</tr>
+					</table>
+				</td>
+			</tr>
+			</table>
+			</form>
+  		</td>
+  	</tr>
 </table>
-				
+<div id="ListViewContents">
+	{include file="PopupContents.tpl"}
+</div>
+<script>
+function callSearch(searchtype)
+{ldelim}
+
+        search_fld_val= document.basicSearch.search_field[document.basicSearch.search_field.selectedIndex].value;
+        search_type_val=document.basicSearch.searchtype.value;
+        search_txt_val=document.basicSearch.search_text.value;
+
+	var ajaxObj = new Ajax(ajaxSaveResponse);
+	var urlstring = '';
+        elements=document.basicSearch;
+	for(ii = 0 ; ii < elements.length; ii++)
+	{ldelim}
+	if(elements[ii].name != 'action')
+		urlstring = urlstring+''+elements[ii].name+'='+elements[ii].value+'&';
+	else
+		urlstring = urlstring+'file=Popup&';
+	{rdelim}
+	var no_rows = document.basicSearch.search_cnt.value;
+	for(jj = 0 ; jj < no_rows; jj++)
+	{ldelim}
+		var sfld_name = getObj("Fields"+jj);
+		var scndn_name= getObj("Condition"+jj);
+		var srchvalue_name = getObj("Srch_value"+jj);
+		urlstring = urlstring+'Fields'+jj+'='+sfld_name[sfld_name.selectedIndex].value+'&';
+		urlstring = urlstring+'Condition'+jj+'='+scndn_name[scndn_name.selectedIndex].value+'&';
+		urlstring = urlstring+'Srch_value'+jj+'='+srchvalue_name.value+'&';
+	{rdelim}
+	popuptype = document.getElementById('popup_type').value;
+	urlstring = urlstring +'action={$MODULE}Ajax&ajax=true&popuptype='+popuptype;	
+	ajaxObj.process("index.php?",urlstring);
+{rdelim}
+function ajaxSaveResponse(response)
+{ldelim}
+	document.getElementById("ListViewContents").innerHTML= response.responseText;
+{rdelim}
+function getListViewEntries_js(module,url)
+{ldelim}
+        var ajaxObj = new Ajax(ajaxSaveResponse);
+		popuptype = document.getElementById('popup_type').value;
+        var urlstring ="module="+module+"&action="+module+"Ajax&popuptype="+popuptype+"&file=Popup&ajax=true&"+url;
+        ajaxObj.process("index.php?",urlstring);
+{rdelim}
+</script>

Modified: vtigercrm/trunk/modules/Users/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Users/ListView.php (original)
+++ vtigercrm/trunk/modules/Users/ListView.php Fri May 26 18:34:08 2006
@@ -48,7 +48,7 @@
 $smarty->assign("APP", $app_strings);
 $smarty->assign("IMAGE_PATH",$image_path);
 $smarty->assign("CATEGORY",$category);
-$smarty->assign("LIST_HEADER",getListViewHeader($focus,"Users","",$sortorder,$sortby,"",""));
+$smarty->assign("LIST_HEADER",$focus->getUserListViewHeader());
 $smarty->assign("LIST_ENTRIES",$focus->getUserListViewEntries($navigation_array,$sortorder,$sortby));
 $smarty->assign("USER_COUNT",$no_of_users);
 $smarty->assign("RECORD_COUNTS", $record_string);

Modified: vtigercrm/trunk/modules/Users/Popup.php
==============================================================================
--- vtigercrm/trunk/modules/Users/Popup.php (original)
+++ vtigercrm/trunk/modules/Users/Popup.php Fri May 26 18:34:08 2006
@@ -67,7 +67,6 @@
 		$form =new XTemplate ('modules/Users/Popup_picker.html');
 	else
 		$form =new XTemplate ('modules/Users/Popup_picker_emails.html');
-	$form->assign("POPUPTYPE",$_REQUEST['popuptype']);
 	$log->debug("using file modules/Users/Popup_picker.html");
 }
 else {
@@ -78,8 +77,10 @@
 	$log->debug("using file modules/Users/".$_REQUEST['html'].'.html');
 	$log->debug("_REQUEST['html'] is ".$_REQUEST['html']);
 }
+	$form->assign("POPUPTYPE",$_REQUEST['popuptype']);
 
 $form->assign("MOD", $mod_strings);
+$form->assign("IMAGE_PATH", $image_path);
 $form->assign("APP", $app_strings);
 
 // the form key is required
@@ -165,6 +166,7 @@
 $button .= "<td><input title='".$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accessyKey='".$app_strings['LBL_CANCEL_BUTTON_KEY']."' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value='  ".$app_strings['LBL_CANCEL_BUTTON_LABEL']."  '></td>\n";
 $button .= "</tr></form></table>\n";
 */
+
 $ListView = new ListView();
 $ListView->setXTemplate($form);
 $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
@@ -176,11 +178,3 @@
 
 
 ?>
-
-	<tr><td COLSPAN=7><?php echo get_form_footer(); ?></td></tr>
-</form>
-	</table>
-</td></tr></tbody></table>
-</td></tr>
-
-<?php insert_popup_footer(); ?>

Modified: vtigercrm/trunk/modules/Users/User.php
==============================================================================
--- vtigercrm/trunk/modules/Users/User.php (original)
+++ vtigercrm/trunk/modules/Users/User.php Fri May 26 18:34:08 2006
@@ -95,7 +95,7 @@
 	var $tagcloud;
 	var $imagename;
 	var $defhomeview;
-	var $sortby_fields = Array('user_name','email1','last_name','is_admin','status');	
+	//var $sortby_fields = Array('user_name','email1','last_name','is_admin','status');	
 	var $column_fields = Array("id"
 		,"user_name"
 		,"user_password"
@@ -148,6 +148,9 @@
 	var $additional_column_fields = Array('reports_to_name');		
 	
 	// This is the list of fields that are in the lists.
+	var $list_fields = Array('id', 'first_name', 'last_name', 'user_name', 'status', 'department', 'yahoo_id', 'is_admin', 'email1', 'phone_work');
+	//commented as we get issues with sugarbean
+	/*
 	var $list_fields = Array(
 		'UserName'=>Array('users'=>'user_name'),
 		'Role'=>Array(''=>''),
@@ -156,7 +159,7 @@
 		'Admin'=>Array('users'=>'is_admin'),
 		'Status'=>Array('users'=>'status'),
 		'Tools'=>Array(''=>''),
-	);	
+	);*/	
 		
 	var $default_order_by = "user_name";
 	var $default_sort_order = 'ASC';
@@ -504,6 +507,13 @@
 											 "CITY","STATE","POSTALCODE","COUNTRY");	
   	return $mergeflds;
   }
+		//function added for the listview of users for 5.0 beta
+	function getUserListViewHeader()
+	{
+		global $mod_strings;
+		$header_array=array($mod_strings['LBL_LIST_USER_NAME'],$mod_strings['LBL_USER_ROLE'],$mod_strings['LBL_LIST_EMAIL'],$mod_strings['LBL_LIST_NAME'],$mod_strings['LBL_LIST_ADMIN'],$mod_strings['LBL_STATUS'],$mod_strings['LBL_LIST_TOOLS']);
+		return $header_array;
+	}
 
 	function getUserListViewEntries($navigation_array,$sorder='',$orderby='')
 	{





More information about the vtigercrm-commits mailing list