[Vtigercrm-commits] [vtiger-commits] r7163 - in /vtigercrm/trunk: Popup.php Smarty/templates/DisplayFields.tpl include/utils/EditViewUtils.php include/utils/ListViewUtils.php modules/Users/Popup.php modules/Users/User.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Jun 16 03:56:28 EDT 2006


Author: don
Date: Fri Jun 16 01:56:18 2006
New Revision: 7163

Log:
user popup from Popup.php

Modified:
    vtigercrm/trunk/Popup.php
    vtigercrm/trunk/Smarty/templates/DisplayFields.tpl
    vtigercrm/trunk/include/utils/EditViewUtils.php
    vtigercrm/trunk/include/utils/ListViewUtils.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 Jun 16 01:56:18 2006
@@ -174,6 +174,14 @@
 		}
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','bookname','true','basic',$popuptype,"","","");
 		break;
+	case 'Users':
+                require_once("modules/$currentModule/User.php");
+                $focus = new User();
+                $smarty->assign("SINGLE_MOD",'Users');
+                if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
+                    $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
+                $alphabetical = AlphabeticalSearch($currentModule,'Popup','user_name','true','basic',$popuptype,"","","");
+                break;	
 
 
 }

Modified: vtigercrm/trunk/Smarty/templates/DisplayFields.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/DisplayFields.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/DisplayFields.tpl Fri Jun 16 01:56:18 2006
@@ -537,7 +537,7 @@
 			       {$fldlabel}
 	            </td>
 				<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name='{$fldname}' class="small" type="text" value='{$fldvalue}'><input name='reports_to_id' type="hidden" value='{$fldvalue}'>&nbsp;<input title="Change [Alt+C]" accessKey="C" type="button" class="small" value='{$UMOD.LBL_CHANGE}' name=btn1 LANGUAGE=javascript onclick='return window.open("index.php?module=Users&action=Popup&form=UsersEditView&form_submit=false","test","width=640,height=522,resizable=0,scrollbars=0");'>
+				<input readonly name='reports_to_name' class="small" type="text" value='{$fldvalue}'><input name='reports_to_id' type="hidden" value='{$secondvalue}'>&nbsp;<input title="Change [Alt+C]" accessKey="C" type="button" class="small" value='{$UMOD.LBL_CHANGE}' name=btn1 LANGUAGE=javascript onclick='return window.open("index.php?module=Users&action=Popup&form=UsersEditView&form_submit=false","test","width=640,height=522,resizable=0,scrollbars=0");'>
 	            </td>
 			{elseif $uitype eq 116}<!-- for currency in users details-->	
 			<td width="20%" class="dvtCellLabel" align=right>

Modified: vtigercrm/trunk/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/EditViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/EditViewUtils.php Fri Jun 16 01:56:18 2006
@@ -1124,6 +1124,11 @@
 			}
 		else
 			$fieldvalue[] = '';
+	}elseif($uitype == 101)
+	{
+		$editview_label[]=$mod_strings[$fieldlabel];
+        $fieldvalue[] = getUserName($value);
+        $fieldvalue[] = $value;
 	}
 	else
 	{

Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Fri Jun 16 01:56:18 2006
@@ -828,7 +828,14 @@
 		{
 
 			//Getting the entityid
-			$entity_id = $adb->query_result($list_result,$i-1,"crmid");
+			if($module != 'Users')	
+			{
+				$entity_id = $adb->query_result($list_result,$i-1,"crmid");
+			}else
+			{
+				$entity_id = $adb->query_result($list_result,$i-1,"id");
+			}	
+				
 			$list_header=Array();
 
 			foreach($focus->search_fields as $name=>$tableinfo)
@@ -949,7 +956,6 @@
 		$uitype = $key;
 		$colname = $value;
         }
-
 	//added for getting event status in Custom view - Jaguar
 	if($module == 'Activities' && $colname == "status")
 	{
@@ -997,7 +1003,7 @@
 	{
 		$value = '<a href="http://'.$temp_val.'" target="_blank">'.$temp_val.'</a>';
 	}
-	elseif($uitype == 13)
+	elseif($uitype == 13 || $uitype == 104)
         {
 		if(useInternalMailer() == 1)
                 	$value = '<a href="javascript:InternalMailer('.$entity_id.',\'record_id\')">'.$temp_val.'</a>';
@@ -1354,7 +1360,6 @@
 					{
 						$name = $adb->query_result($list_result,$list_result_count,'accountname');
 						$accid =$adb->query_result($list_result,$list_result_count,'accountid');
-						//$value = '<a href="javascript: submitform('.$accid.');">'.$temp_val.'</a>';
 						$emailaddress=$adb->query_result($list_result,$list_result_count,"email1");
 						if($emailaddress == '')
 							$emailaddress=$adb->query_result($list_result,$list_result_count,"email2");
@@ -1380,11 +1385,19 @@
 						//Change this index 0 - to get the vtiger_fieldid based on email or yahooid
 						$fieldid = $adb->query_result($queryres,0,'fieldid');
 
-						//$value = '<a href="javascript: submitform('.$entity_id.');">'.$name.'</a>';
 						$value = '<a href="a" LANGUAGE=javascript onclick=\'return set_return_emails('.$entity_id.','.$fieldid.',"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
 
-
+					}else
+					{
+						$firstname=$adb->query_result($list_result,$list_result_count,"first_name");
+						$lastname=$adb->query_result($list_result,$list_result_count,"last_name");
+						$name=$lastname.' '.$firstname;
+						$emailaddress=$adb->query_result($list_result,$list_result_count,"email1");
+
+						$value = '<a href="a" LANGUAGE=javascript onclick=\'return set_return_emails('.$entity_id.',-1,"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
+						
 					}
+						
 				}	
 				elseif($popuptype == "specific_vendor_address")
 				{

Modified: vtigercrm/trunk/modules/Users/Popup.php
==============================================================================
--- vtigercrm/trunk/modules/Users/Popup.php (original)
+++ vtigercrm/trunk/modules/Users/Popup.php Fri Jun 16 01:56:18 2006
@@ -1,180 +1,20 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the 
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Popup.php,v 1.5 2005/04/27 09:51:34 rank Exp $
- * Description:  TODO: To be written.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
-// This file is used for all popups on this module
-// The popup_picker.html file is used for generating a list from which to find and choose one instance.
-
-global $theme;
-require_once('modules/Users/User.php');
-require_once('themes/'.$theme.'/layout_utils.php');
-require_once('include/logging.php');
-require_once('XTemplate/xtpl.php');
-require_once('include/utils/utils.php');
-require_once('include/ListView/ListView.php');
-
-global $mod_strings;
-global $app_strings;
-
-global $list_max_entries_per_page;
-global $urlPrefix;
-global $currentModule;
-
-$log = LoggerManager::getLogger('user');
-
-$seed_object = new User();
-
-
-$where = "";
-if(isset($_REQUEST['query']))
-{
-	$search_fields = Array("first_name", "last_name", "user_name");
-
-	$where_clauses = Array();
-
-	append_where_clause($where_clauses, "first_name", "users.first_name");
-	append_where_clause($where_clauses, "last_name", "users.last_name");
-	append_where_clause($where_clauses, "user_name", "users.user_name");
-
-	$where = generate_where_statement($where_clauses);
-}
-
-
-$image_path = 'themes/'.$theme.'/images';
-
-////////////////////////////////////////////////////////
-// Start the output
-////////////////////////////////////////////////////////
-if (!isset($_REQUEST['html'])) {
-	if($_REQUEST['popuptype'] != 'set_return_emails')
-		$form =new XTemplate ('modules/Users/Popup_picker.html');
-	else
-		$form =new XTemplate ('modules/Users/Popup_picker_emails.html');
-	$log->debug("using file modules/Users/Popup_picker.html");
-}
-else {
-	if($_REQUEST['popuptype'] != 'set_return_emails')
-		$form =new XTemplate ('modules/Users/'.$_REQUEST['html'].'.html');
-	else
-		$form =new XTemplate ('modules/Users/Popup_picker_emails.html');
-	$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
-if(!isset($_REQUEST['form']))
-	die("Missing 'form' parameter");
-
-
-// This code should always return an answer.
-// The form name should be made into a parameter and not be hard coded in this file.
-if(isset($_REQUEST['form_submit']) && $_REQUEST['popuptype'] == 'detailview' && $_REQUEST['form_submit'] == 'true')
-{
-	$the_javascript  = "<script type='text/javascript' language='JavaScript'>\n";
-	$the_javascript .= "function set_return(user_id, user_name) {\n";
-	//$the_javascript .= 'opener.document.location.href="index.php?module='.$return_module.'&action=updateRelations&entityid="+user_id+"&parid='.$recordid.'"; \n';
-	$the_javascript .= "	window.opener.document.form.user_id.value = user_id; \n";
-	$the_javascript .= "	window.opener.document.form.return_module.value = window.opener.document.form.return_module.value; \n";
-	//$the_javascript .= "	window.opener.document.DetailView.return_action.value = 'DetailView'; \n";
-	$the_javascript .= "	window.opener.document.form.return_id.value = window.opener.document.form.record.value; \n";
-	$the_javascript .= "   window.opener.document.form.module.value = window.opener.document.form.return_module.value; \n";
-	$the_javascript .= "	window.opener.document.form.action.value = 'updateRelations'; \n";
-	$the_javascript .= "	window.opener.document.form.submit(); \n";
-	$the_javascript .= "}\n";
-	$the_javascript .= "</script>\n";
-}
-elseif ($_REQUEST['form'] == 'UsersEditView') 
-{
-	$the_javascript  = "<script type='text/javascript' language='JavaScript'>\n";
-	$the_javascript .= "function set_return(user_id, user_name) {\n";
-	$the_javascript .= "	window.opener.document.EditView.reports_to_name.value = user_name;\n";
-	$the_javascript .= "	window.opener.document.EditView.reports_to_id.value = user_id;\n";
-	$the_javascript .= "}\n";
-	$the_javascript .= "</script>\n";
-}
-elseif($_REQUEST['popuptype'] == 'set_return_emails')
-{
-	$the_javascript = "<script type='text/javascript' src='include/js/Mail.js'></script>";	
-}
-else // ($_REQUEST['form'] == 'EditView') 
-{
-	$the_javascript  = "<script type='text/javascript' language='JavaScript'>\n";
-	$the_javascript .= "function set_return(user_id, user_name) {\n";
-	$the_javascript .= "	window.opener.document.EditView.user_name.value = user_name;\n";
-	$the_javascript .= "	window.opener.document.EditView.user_id.value = user_id;\n";
-	$the_javascript .= "}\n";
-	$the_javascript .= "</script>\n";
-}	
-
-$form->assign("SET_RETURN_JS", $the_javascript);
-
-$form->assign("THEME", $theme);
-$form->assign("IMAGE_PATH", $image_path);
-$form->assign("MODULE_NAME", $currentModule);
-$form->assign("FORM_SUBMIT", $_REQUEST['form_submit']);
-$form->assign("FORM", $_REQUEST['form']);
-
-insert_popup_header($theme);
-
-// Quick search.
-echo "<form>";
-echo get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], "", false);
-
-if (isset($_REQUEST['first_name'])) $last_search['FIRST_NAME'] = $_REQUEST['first_name'];
-if (isset($_REQUEST['last_name'])) $last_search['LAST_NAME'] = $_REQUEST['last_name'];
-if (isset($_REQUEST['user_name'])) $last_search['USER_NAME'] = $_REQUEST['user_name'];
-if (isset($last_search)) $form->assign("LAST_SEARCH", $last_search);
-
-$form->parse("main.SearchHeader");
-$form->out("main.SearchHeader");
-
-echo get_form_footer();
-
-$form->parse("main.SearchHeaderEnd");
-$form->out("main.SearchHeaderEnd");
-
-// Reset the sections that are already in the page so that they do not print again later.
-$form->reset("main.SearchHeader");
-$form->reset("main.SearchHeaderEnd");
-
-// start the form before the form header to avoid creating a gap in IE
-$button  = "<table cellspacing='0' cellpadding='1' border='0'><form border='0' action='index.php' method='post' name='form' id='form'>\n";
-$button .= "<tr><td>&nbsp;</td>";
-/*if ($_REQUEST['form_submit'] != 'true') $button .= "<td><input title='".$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accessyKey='".$app_strings['LBL_CLEAR_BUTTON_KEY']."' class='button' LANGUAGE=javascript onclick=\"window.opener.document.EditView.account_name.value = '';window.opener.document.EditView.account_id.value = ''; window.close()\" type='submit' name='button' value='  Clear  '></td>\n";
-$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']);
-//$ListView->setHeaderText($button);
-$ListView->setQuery($where, "", "user_name", "USER");
-$ListView->setModStrings($mod_strings);
-$ListView->processListView($seed_object, "main", "USER");
-
-
-
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the 
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Leads/Popup.php,v 1.7 2005/03/23 14:19:48 samk Exp $
+ * Description:  TODO: To be written.
+ ********************************************************************************/
+require_once('Popup.php');
+?>

Modified: vtigercrm/trunk/modules/Users/User.php
==============================================================================
--- vtigercrm/trunk/modules/Users/User.php (original)
+++ vtigercrm/trunk/modules/Users/User.php Fri Jun 16 01:56:18 2006
@@ -90,13 +90,19 @@
 	var $table_name = "vtiger_users";
 
 	// This is the list of fields that are in the lists.
-	var $list_link_field= '';
+	var $list_link_field= 'last_name';
 
 	var $list_mode;
 	var $popup_type;
 
-	var $search_fields = Array();
-	var $search_fields_name = Array();
+	var $search_fields = Array(
+		'Name'=>Array('vtiger_users'=>'last_name'),
+		'Email'=>Array('vtiger_users'=>'email1')
+	);
+	var $search_fields_name = Array(
+		'Name'=>'last_name',
+		'Email'=>'email1'
+	);
 
 	var $module_name = "Users";
 
@@ -113,7 +119,7 @@
 	// This is used to retrieve related fields from form posts.
 	var $additional_column_fields = Array('reports_to_name');		
 
-	var $sortby_fields = Array('status','email1','phone_work','is_admin','user_name');	  
+	var $sortby_fields = Array('status','email1','phone_work','is_admin','user_name','last_name');	  
 
 	// This is the list of vtiger_fields that are in the lists.
 	var $list_fields = Array(





More information about the vtigercrm-commits mailing list