[Vtigercrm-commits] [vtiger-commits] r7578 - in /vtigercrm/trunk: Smarty/templates/ComposeEmail.tpl include/utils/EditViewUtils.php modules/Contacts/DelImage.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Jun 27 09:46:58 EDT 2006


Author: richie
Date: Tue Jun 27 07:46:51 2006
New Revision: 7578

Log:
Attachment delete has been added to email modules

Modified:
    vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl
    vtigercrm/trunk/include/utils/EditViewUtils.php
    vtigercrm/trunk/modules/Contacts/DelImage.php

Modified: vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl Tue Jun 27 07:46:51 2006
@@ -20,6 +20,7 @@
 <link REL="SHORTCUT ICON" HREF="include/images/vtigercrm_icon.ico">	
 <style type="text/css">@import url("themes/{$THEME}/style.css");</style>
 <script language="javascript" type="text/javascript" src="include/scriptaculous/prototype.js"></script>
+<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
 <script type="text/javascript" src="include/fckeditor/fckeditor.js"></script>
 </head>
 <body marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
@@ -77,14 +78,13 @@
 	<td class="dvtCellLabel" style="padding: 5px;">
 		<input name="ccmail" class="txtBox" type="text" value="{$CC_MAIL}" style="width:99%">&nbsp;
 	</td>	
-	<td class="dvtCellLabel">&nbsp;</td>
+	<td valign="top" class="dvtCellLabel" rowspan="4"><div id="attach_cont" class="addEventInnerBox" style="overflow:auto;height:110px;width:100%;position:relative;left:0px;top:0px;"></div>
    </tr>
    <tr>
 	<td class="lvtCol" style="padding: 5px;" align="right">{$MOD.LBL_BCC}</td>
 	<td class="dvtCellLabel" style="padding: 5px;">
 		<input name="bccmail" class="txtBox" type="text" value="{$BCC_MAIL}" style="width:99%">&nbsp;
 	</td>
-	<td class="dvtCellLabel">&nbsp;</td>
    </tr>
 	{elseif $elements.2.0 eq 'subject'}
    <tr>
@@ -94,17 +94,22 @@
         {else}
                 <td class="dvtCellLabel" style="padding: 5px;"><input type="text" class="txtBox" name="{$elements.2.0}" value="{$elements.3.0}" id="{$elements.2.0}" style="width:99%"></td>
         {/if}
-	<td class="dvtCellLabel">&nbsp;</td>
    </tr>
 	{elseif $elements.2.0 eq 'filename'}
 
    <tr>
 	<td class="lvtCol" style="padding: 5px;" align="right" nowrap>{$elements.1.0}  :</td>
 	<td class="dvtCellLabel" style="padding: 5px;">
-		<input name="{$elements.2.0}"  type="file" class="small" value="{$elements.3.1}" size="78"/>
-		<input type="hidden" name="id" value=""/>{$elements.3.0}
-	</td>
-	<td class="dvtCellLabel">&nbsp;</td>
+		<input name="{$elements.2.0}"  type="file" class="small" value="" size="78"/>
+		<div id="attach_temp_cont" style="display:none;">
+		<table class="small" width="100% ">
+		{foreach item="attach_files" key="attach_id" from=$elements.3}	
+			<tr id="row_{$attach_id}"><td width="90%">{$attach_files}</td><td><img src="{$IMAGE_PATH}no.gif" onClick="delAttachments({$attach_id})" alt="{$APP.LBL_DELETE_BUTTON}" title="{$APP.LBL_DELETE_BUTTON}" style="cursor:pointer;"></td></tr>	
+		{/foreach}	
+		</table>	
+		</div>	
+		{$elements.3.0}
+	</td>
    </tr>
 	{elseif $elements.2.0 eq 'description'}
    <tr>
@@ -182,7 +187,22 @@
                 }
         );
 }
-
+$('attach_cont').innerHTML = $('attach_temp_cont').innerHTML;
+function delAttachments(id)
+{
+    new Ajax.Request(
+        'index.php',
+        {queue: {position: 'end', scope: 'command'},
+            method: 'post',
+            postBody: 'module=Contacts&action=ContactsAjax&file=DelImage&attachmodule=Emails&recordid='+id,
+            onComplete: function(response)
+            {
+		Effect.Fade('row_'+id);	                
+            }
+        }
+    );
+
+}
 </script>
 <script type="text/javascript" defer="1">
 var oFCKeditor = null;

Modified: vtigercrm/trunk/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/EditViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/EditViewUtils.php Tue Jun 27 07:46:51 2006
@@ -511,20 +511,38 @@
 		{
 			$assigned_user_id = $current_user->id;
 		}
-		if($col_fields['record_id'] != '')
-		{
-			$attachmentid=$adb->query_result($adb->query("select * from vtiger_seattachmentsrel where crmid = ".$col_fields['record_id']),0,'attachmentsid');
-			if($col_fields[$fieldname] == '' && $attachmentid != '')
-			{
-				$attachquery = "select * from vtiger_attachments where attachmentsid=".$attachmentid;
-				$value = $adb->query_result($adb->query($attachquery),0,'name');
-			}
-		}
-		if($value!='')
-			$filename=' [ '.$value. ' ]';
-		$editview_label[]=$mod_strings[$fieldlabel];
-		$fieldvalue[] = $filename;
-		$fieldvalue[] = $value;
+		if($module_name == 'Emails')
+		{
+			$attach_result = $adb->query("select * from vtiger_seattachmentsrel where crmid = ".$col_fields['record_id']);
+			for($ii=0;$ii < $adb->num_rows($attach_result);$ii++)
+			{
+				$attachmentid = $adb->query_result($attach_result,$ii,'attachmentsid');
+				if($attachmentid != '')
+				{
+					$attachquery = "select * from vtiger_attachments where attachmentsid=".$attachmentid;
+					$attachmentsname = $adb->query_result($adb->query($attachquery),0,'name');
+					if($attachmentsname != '')	
+						$fieldvalue[$attachmentid] = '[ '.$attachmentsname.' ]';
+				}
+
+			}
+		}else
+		{
+			if($col_fields['record_id'] != '')
+			{
+				$attachmentid=$adb->query_result($adb->query("select * from vtiger_seattachmentsrel where crmid = ".$col_fields['record_id']),0,'attachmentsid');
+				if($col_fields[$fieldname] == '' && $attachmentid != '')
+				{
+					$attachquery = "select * from vtiger_attachments where attachmentsid=".$attachmentid;
+					$value = $adb->query_result($adb->query($attachquery),0,'name');
+				}
+			}
+			if($value!='')
+				$filename=' [ '.$value. ' ]';
+			$fieldvalue[] = $filename;
+			$fieldvalue[] = $value;
+		}
+		$editview_label[]=$mod_strings[$fieldlabel];
 	}
 	elseif($uitype == 69)
 	{

Modified: vtigercrm/trunk/modules/Contacts/DelImage.php
==============================================================================
--- vtigercrm/trunk/modules/Contacts/DelImage.php (original)
+++ vtigercrm/trunk/modules/Contacts/DelImage.php Tue Jun 27 07:46:51 2006
@@ -1,32 +1,43 @@
 <?php
-
-	function DelImage($id)
-	{
-		global $adb;
-		$query="delete from vtiger_attachments where attachmentsid=(select attachmentsid from seattachmentsrel where crmid=".$id.")";
-		$adb->query($query);
-
-		$query="delete from vtiger_seattachmentsrel where crmid=".$id;
-		$adb->query($query);
-	}
-
-$id = $_REQUEST["recordid"];
-
-DelImage($id);
-echo '';
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ *
+ ********************************************************************************/
 
 
 
+function DelImage($id)
+{
+	global $adb;
+	$query="delete from vtiger_attachments where attachmentsid=(select attachmentsid from vtiger_seattachmentsrel where crmid=".$id.")";
+	$adb->query($query);
 
+	$query="delete from vtiger_seattachmentsrel where crmid=".$id;
+	$adb->query($query);
+}
 
+function DelAttachment($id)
+{
+	global $adb;
+	$query="delete from vtiger_seattachmentsrel where attachmentsid=".$id;
+	$adb->query($query);
+	$query="delete from vtiger_attachments where attachmentsid=".$id.")";
+	$adb->query($query);
 
-
-
-
-
-
-
-
-
-
+}
+$id = $_REQUEST["recordid"];
+if(isset($_REQUEST["attachmodule"]) && $_REQUEST["attachmodule"]=='Emails')
+{
+	DelAttachment($id);
+}
+else
+{
+	DelImage($id);
+}
+echo 'SUCESS';
 ?>





More information about the vtigercrm-commits mailing list