[Vtigercrm-commits] [vtiger-commits] r10618 - in /vtigercrm/branches/5.0.3: Smarty/templates/ modules/Campaigns/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 10 11:02:30 EDT 2007


Author: saraj
Date: Tue Apr 10 09:02:20 2007
New Revision: 10618

Log:
fix for Leads CustView - Set as Default affects in Campaigns RelatedList also. Fixes #3063 --minnie

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/RelatedListNew.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/RelatedLists.tpl
    vtigercrm/branches/5.0.3/modules/Campaigns/CallRelatedList.php
    vtigercrm/branches/5.0.3/modules/Campaigns/DetailView.php
    vtigercrm/branches/5.0.3/modules/Campaigns/LoadList.php

Modified: vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl Tue Apr 10 09:02:20 2007
@@ -64,7 +64,7 @@
 				{/if}
 			{elseif $header eq 'Leads'}
 				{if $MODULE eq 'Campaigns'}
-				{$LEADCVCOMBO} <span id="lead_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
+				{$LEADCVCOMBO}<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="loadCvList('Leads','{$ID}')">
 				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Lead}" LANGUAGE=javascript onclick='return window.open("index.php?module=Leads&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
 				{/if}
 				{if $MODULE eq 'Products'}
@@ -83,7 +83,7 @@
 					<input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
 					<input title="Change" accessKey="" class="crmbutton small create" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module=Emails&action=Popup&popuptype=detailview&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
 				{elseif $MODULE eq 'Campaigns'}
-					{$CONTCVCOMBO}  <span id="contact_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
+					{$CONTCVCOMBO}<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="loadCvList('Contacts','{$ID}')">
 					<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
 					<input title="{$APP.LBL_ADD_NEW} {$APP.Contact}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Contacts'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Contact}"></td>
 				{elseif $MODULE eq 'Products'}

Modified: vtigercrm/branches/5.0.3/Smarty/templates/RelatedListNew.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RelatedListNew.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RelatedListNew.tpl Tue Apr 10 09:02:20 2007
@@ -51,11 +51,22 @@
 {/literal}
 
 function loadCvList(type,id) {ldelim}
+        $("status").style.display="inline";
 	if(type === 'Leads')
 	{ldelim}
 		if($("lead_cv_list").value != 'None')
 		{ldelim}
-			$("lead_list_button").innerHTML = '<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="window.location.href=\'index.php?action=LoadList&module=Campaigns&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("lead_cv_list").value+'\'">';
+			new Ajax.Request(
+                        'index.php',
+                        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module=Campaigns&action=CampaignsAjax&file=LoadList&ajax=true&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("lead_cv_list").value,
+                                onComplete: function(response) {ldelim}
+                                        $("status").style.display="none";
+                                        $("RLContents").innerHTML= response.responseText;
+                                {rdelim}
+                        {rdelim}
+                );
 		{rdelim}
 	{rdelim}
 
@@ -63,7 +74,17 @@
 	{ldelim}
 		if($("cont_cv_list").value != 'None')
 		{ldelim}
-		$("contact_list_button").innerHTML = '<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="window.location.href=\'index.php?action=LoadList&module=Campaigns&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("cont_cv_list").value+'\'">';
+			new Ajax.Request(
+                        'index.php',
+                        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module=Campaigns&action=CampaignsAjax&file=LoadList&ajax=true&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("cont_cv_list").value,
+                                onComplete: function(response) {ldelim}
+                                        $("status").style.display="none";
+                                        $("RLContents").innerHTML= response.responseText;
+                                {rdelim}
+                        {rdelim}
+                );
 		{rdelim}
 	{rdelim}
 {rdelim}

Modified: vtigercrm/branches/5.0.3/Smarty/templates/RelatedLists.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RelatedLists.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RelatedLists.tpl Tue Apr 10 09:02:20 2007
@@ -51,21 +51,41 @@
 {/literal}
 
 function loadCvList(type,id) {ldelim}
-	if(type === 'Leads')
-	{ldelim}
-		if($("lead_cv_list").value != 'None')
-		{ldelim}
-			$("lead_list_button").innerHTML = '<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="window.location.href=\'index.php?action=LoadList&module=Campaigns&return_id='+id+'&list_type='+type+'&cvid='+$("lead_cv_list").value+'\'">';
+	$("status").style.display="inline";
+        if(type === 'Leads')
+        {ldelim}
+                if($("lead_cv_list").value != 'None')
+                {ldelim}
+                        new Ajax.Request(
+                        'index.php',
+                        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module=Campaigns&action=CampaignsAjax&file=LoadList&ajax=true&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("lead_cv_list").value,
+                                onComplete: function(response) {ldelim}
+                                        $("status").style.display="none";
+                                        $("RLContents").innerHTML= response.responseText;
+                                {rdelim}
+                        {rdelim}
+                );
+                {rdelim}
+        {rdelim}
+        if(type === 'Contacts')
+        {ldelim}
+        if($("cont_cv_list").value != 'None')
+                {ldelim}
+                        new Ajax.Request(
+                        'index.php',
+                        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module=Campaigns&action=CampaignsAjax&file=LoadList&ajax=true&return_action=DetailView&return_id='+id+'&list_type='+type+'&cvid='+$("cont_cv_list").value,
+                                onComplete: function(response) {ldelim}
+                                        $("status").style.display="none";
+                                        $("RLContents").innerHTML= response.responseText;
+                                {rdelim}
+                        {rdelim}
+                );
 		{rdelim}
-	{rdelim}
-
-	if(type === 'Contacts')
-	{ldelim}
-		if($("cont_cv_list").value !='None')
-		{ldelim}
-			$("contact_list_button").innerHTML = '<input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button" onclick="window.location.href=\'index.php?action=LoadList&module=Campaigns&return_id='+id+'&list_type='+type+'&cvid='+$("cont_cv_list").value+'\'">';
-		{rdelim}
-	{rdelim}
+        {rdelim}
 {rdelim}
 </script>
 	{include file='Buttons_List1.tpl'}

Modified: vtigercrm/branches/5.0.3/modules/Campaigns/CallRelatedList.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Campaigns/CallRelatedList.php (original)
+++ vtigercrm/branches/5.0.3/modules/Campaigns/CallRelatedList.php Tue Apr 10 09:02:20 2007
@@ -12,7 +12,6 @@
 
 require_once('Smarty_setup.php');
 require_once('modules/Campaigns/Campaigns.php');
-require_once('modules/CustomView/CustomView.php');
 require_once('include/utils/utils.php');
 //Redirecting Header for single page layout 
 require_once('user_privileges/default_module_view.php');
@@ -38,7 +37,7 @@
 }
 
 global $mod_strings;
-global $app_strings;
+global $app_strings,$adb;
 global $theme;
 global $currentModule;
 $theme_path="themes/".$theme."/";
@@ -57,13 +56,29 @@
 $related_array=getRelatedLists($currentModule,$focus);
 $smarty->assign("RELATEDLISTS", $related_array);
 
-$cvObj = new CustomView("Contacts");
-$cvcombo = $cvObj->getCustomViewCombo();
-$smarty->assign("CONTCVCOMBO","<select id='cont_cv_list' onchange='loadCvList(\"Contacts\",".$_REQUEST["record"].");'><option value='None'>-- ".$mod_strings['Select One']." --</option>".$cvcombo."</select>");
+/* To get Contacts CustomView -START */
+$sql = "select vtiger_customview.* from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype where vtiger_tab.tabid=".getTabid('Contacts');
+$result = $adb->query($sql);
+$chtml = "<select id='cont_cv_list'><option value='None'>-- ".$mod_strings['Select One']." --</option>";
+while($cvrow=$adb->fetch_array($result))
+{
+	 $chtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
+}
+$chtml .= "</select>";
+$smarty->assign("CONTCVCOMBO",$chtml);
+/* To get Contacts CustomView -END */
 
-$cvObj = new CustomView("Leads");
-$cvcombo = $cvObj->getCustomViewCombo();
-$smarty->assign("LEADCVCOMBO","<select id='lead_cv_list' onchange='loadCvList(\"Leads\",".$_REQUEST["record"].");'> <option value='None'>-- ".$mod_strings['Select One']." --</option>".$cvcombo."</select>");
+/* To get Leads CustomView -START */
+$sql = "select vtiger_customview.* from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype where vtiger_tab.tabid=".getTabid('Leads');
+$result = $adb->query($sql);
+$lhtml = "<select id='lead_cv_list'><option value='None'>-- ".$mod_strings['Select One']." --</option>";
+while($cvrow=$adb->fetch_array($result))
+{
+	 $lhtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
+}
+$lhtml .= "</select>";
+$smarty->assign("LEADCVCOMBO",$lhtml);
+/* To get Leads CustomView -END */
 
 $category = getParentTab();
 $smarty->assign("CATEGORY",$category);
@@ -79,6 +94,9 @@
 $check_button = Button_Check($module);
 $smarty->assign("CHECK", $check_button);
 
-$smarty->display("RelatedLists.tpl");
+if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
+        $smarty->display("RelatedListContents.tpl");
+else
+	$smarty->display("RelatedLists.tpl");
 }
 ?>

Modified: vtigercrm/branches/5.0.3/modules/Campaigns/DetailView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Campaigns/DetailView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Campaigns/DetailView.php Tue Apr 10 09:02:20 2007
@@ -12,7 +12,6 @@
 require_once('include/database/PearDatabase.php');
 require_once('Smarty_setup.php');
 require_once('modules/Campaigns/Campaigns.php');
-require_once('modules/CustomView/CustomView.php');
 require_once('include/utils/utils.php');
 require_once('user_privileges/default_module_view.php');
 
@@ -29,7 +28,7 @@
 {
         $focus->id = "";
 }
-global $app_strings,$mod_strings,$theme,$currentModule,$default_module_view;
+global $app_strings,$mod_strings,$theme,$currentModule,$default_module_view,$adb;
 
 $theme_path="themes/".$theme."/";
 $image_path=$theme_path."images/";
@@ -76,13 +75,30 @@
 {
 	$related_array = getRelatedLists($currentModule,$focus);
 	$smarty->assign("RELATEDLISTS", $related_array);
-	$cvObj = new CustomView("Contacts");
-	$cvcombo = $cvObj->getCustomViewCombo();
-	$smarty->assign("CONTCVCOMBO","<select id='cont_cv_list' onchange='loadCvList(\"Contacts\",".$_REQUEST["record"].");'><option value='None'>-- ".$mod_strings['Select One']." --</option>".$cvcombo."</select>");
+	/* To get Contacts CustomView -START */
+	$sql = "select vtiger_customview.* from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype where vtiger_tab.tabid=".getTabid('Contacts');
+	$result = $adb->query($sql);
+	$chtml = "<select id='cont_cv_list'><option value='None'>-- ".$mod_strings['Select One']." --</option>";
+	while($cvrow=$adb->fetch_array($result))
+	{
+		$chtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
+	}
+	$chtml .= "</select>";
+	$smarty->assign("CONTCVCOMBO",$chtml);
+	/* To get Contacts CustomView -END */
+	
+	/* To get Leads CustomView -START */
+	$sql = "select vtiger_customview.* from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype where vtiger_tab.tabid=".getTabid('Leads');
+	$result = $adb->query($sql);
+	$lhtml = "<select id='lead_cv_list'><option value='None'>-- ".$mod_strings['Select One']." --</option>";
+	while($cvrow=$adb->fetch_array($result))
+	{
+		$lhtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
+	}
+	$lhtml .= "</select>";
+	$smarty->assign("LEADCVCOMBO",$lhtml);
+	/* To get Leads CustomView -END */
 
-	$cvObj = new CustomView("Leads");
-	$cvcombo = $cvObj->getCustomViewCombo();
-	$smarty->assign("LEADCVCOMBO","<select id='lead_cv_list' onchange='loadCvList(\"Leads\",".$_REQUEST["record"].");'> <option value='None'>-- ".$mod_strings['Select One']." --</option>".$cvcombo."</select>");
 }
 
 $smarty->assign("SinglePane_View", $singlepane_view);

Modified: vtigercrm/branches/5.0.3/modules/Campaigns/LoadList.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Campaigns/LoadList.php (original)
+++ vtigercrm/branches/5.0.3/modules/Campaigns/LoadList.php Tue Apr 10 09:02:20 2007
@@ -28,24 +28,6 @@
 	$adb->query("INSERT INTO ".$reltable." VALUES('".$_REQUEST["return_id"]."','".$row["crmid"]."')");
 }
 
-if ($singlepane_view == 'true')
-{
+header("Location: index.php?module=Campaigns&action=CampaignsAjax&file=CallRelatedList&ajax=true&record=".$_REQUEST['return_id']);
+
 ?>
-<script>
-addOnloadEvent(function() {
-	window.location.href = "index.php?action=DetailView&module=Campaigns&record=<?php echo $_REQUEST['return_id'];?>";
-});
-</script>
-<?php
-}
-else
-{
-?>
-<script>
-addOnloadEvent(function() {
-	window.location.href = "index.php?action=CallRelatedList&module=Campaigns&record=<?php echo $_REQUEST['return_id'];?>";
-});
-</script>
-<?php
-}
-?>





More information about the vtigercrm-commits mailing list