[Vtigercrm-commits] [vtiger-commits] r10799 - in /vtigercrm/branches/5.0.3: Smarty/templates/ modules/Emails/ modules/Webmails/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 27 10:22:10 EDT 2007
Author: richie
Date: Fri Apr 27 08:21:59 2007
New Revision: 10799
Log:
* Fixed the issues with character set and some other issues
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl
vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl
vtigercrm/branches/5.0.3/modules/Emails/EditView.php
vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php
vtigercrm/branches/5.0.3/modules/Webmails/DetailView.php
vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js
vtigercrm/branches/5.0.3/modules/Webmails/Webmails.php
vtigercrm/branches/5.0.3/modules/Webmails/body.php
Modified: vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl Fri Apr 27 08:21:59 2007
@@ -62,7 +62,7 @@
<td class="cellText" style="padding: 5px;">
<input name="{$elements.2.0}" type="hidden" value="{$IDLISTS}">
<input type="hidden" name="saved_toid" value="{$TO_MAIL}">
- <input id="parent_name" name="to_add" readonly class="txtBox" type="text" value="{$TO_MAIL}" style="width:99%">
+ <input id="parent_name" name="parent_name" readonly class="txtBox" type="text" value="{$TO_MAIL}" style="width:99%">
</td>
<td class="cellText" style="padding: 5px;" align="left" nowrap>
<select name="parent_type">
Modified: vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl Fri Apr 27 08:21:59 2007
@@ -33,7 +33,7 @@
</td>
<td width="10%">
<img src="{$IMAGE_PATH}compose.gif" align="absmiddle" />
- <a href="javascript:;" onclick="OpenCompose('','create');" class="webMnu">{$MOD.LBL_COMPOSE}</a>
+ <a href="javascript:;" onclick="OpenComposer('','create');" class="webMnu">{$MOD.LBL_COMPOSE}</a>
</td>
<td width="20%" nowrap>
<img src="{$IMAGE_PATH}webmail_settings.gif" align="absmiddle" />
@@ -180,23 +180,12 @@
</tr>
<tr style="visibility:hidden" class="previewWindow">
<td height="300" bgcolor="#FFFFFF" valign="top" style="padding-top:10px;">
-
- <!-- Table to display the Header details (From, To, Subject and date) - Starts -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr><td width="20%" align="right"><b>{$MOD.LBL_FROM}</b></td><td id="from_addy"> </td></tr>
- <tr><td width="20%" align="right"><b>{$MOD.LBL_TO}</b></td><td id="to_addy"> </td></tr>
-<tr><td width="20%" align="right"><b>{$MOD.LBL_CC}</b></td><td id="webmail_cc"> </td></tr>
-
- <tr><td align="right"><b>{$MOD.LBL_SUBJECT}</b></td><td id="webmail_subject"></td></tr>
- <tr><td align="right"><b>{$MOD.LBL_DATE}</b></td><td id="webmail_date"></td>
- <tr><td align="right"><b>{$MOD.LBL_ATTACHMENT}:</b></td><td id="webmail_attachment"></td>
- <td id="full_view"><a href="javascript:;"> Full Email View</a></td></tr>
- <tr><td align="right" style="border-bottom:1px solid #666666;" colspan="3"> </td></tr>
</table>
<!-- Table to display the Header details (From, To, Subject and date) - Ends -->
-
+ <div>
<span id="body_area" style="width:95%">
- <iframe id="email_description" width="100%" height="210" frameBorder="0"></iframe>
+ <iframe id="email_description" width="100%" height="350" frameBorder="0"></iframe>
</span>
</td>
</tr>
Modified: vtigercrm/branches/5.0.3/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/EditView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/EditView.php Fri Apr 27 08:21:59 2007
@@ -164,7 +164,7 @@
$smarty->assign('WEBMAIL',"true");
if($_REQUEST["reply"] == "all") {
$smarty->assign('TO_MAIL',$webmail->fromaddr);
- $smarty->assign('CC_MAIL',$hdr->ccaddress);
+ $smarty->assign('CC_MAIL',str_replace(" ","",$hdr->ccaddress));
/*if(is_array($webmail->cc_list))
{
$smarty->assign('CC_MAIL',implode(",",$webmail->cc_list).",".implode(",",$webmail->to));
Modified: vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php Fri Apr 27 08:21:59 2007
@@ -9,7 +9,7 @@
********************************************************************************/
require_once("modules/Emails/mail.php");
-
+$mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],'','','all',$focus->id);
$mail_status = send_mail('Emails',$_REQUEST["parent_name"],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST["ccmail"],$_REQUEST["bccmail"],'all',$focus->id);
$query = 'update vtiger_emaildetails set email_flag ="SENT" where emailid='.$focus->id;
Modified: vtigercrm/branches/5.0.3/modules/Webmails/DetailView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/DetailView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/DetailView.php Fri Apr 27 08:21:59 2007
@@ -28,7 +28,7 @@
echo '<td>';
-echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
+/*echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
echo '<tr><td width="10%">'.$mod_strings['LBL_FROM'].'</td><td>'.$elist->from.'</td></tr>';
echo '<tr><td width="10%">'.$mod_strings['LBL_TO'].'</td><td>'.$elist->to.'</td></tr>';
@@ -37,14 +37,14 @@
echo '<tr><td width="10%">'.$mod_strings['LBL_SUBJECT'].'</td><td>'.$elist->subject.'</td></tr>';
echo '<tr><td width="10%">'.$mod_strings['LBL_DATE'].'</td><td>'.$elist->date.'</td></tr>';
-echo '</table>';
+echo '</table>';*/
echo '</td></tr>';
$array_tab = Array();
$webmail->loadMail($array_tab);
-echo '<tr><td align="center"><iframe src="index.php?module=Webmails&action=body&mailid='.$mailid.'&mailbox='.$mailbox.'" width="100%" height="450" frameborder="0" style="border:1px solid gray">'.$mod_strings['LBL_NO_IFRAMES_SUPPORTED'].'</iframe></td></tr>';
-if($webmail->has_attachments)
+echo '<tr><td align="center"><iframe src="index.php?module=Webmails&action=body&mailid='.$mailid.'&mailbox='.$mailbox.'" width="100%" height="500" frameborder="0" style="border:1px solid gray">'.$mod_strings['LBL_NO_IFRAMES_SUPPORTED'].'</iframe></td></tr>';
+/*if($webmail->has_attachments)
{
//check for attachments
echo "<tr><td><p style='font-weight:bold'>".$mod_strings['LBL_EMAIL_ATTACHMENTS']."</p></td></tr>";
Modified: vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js Fri Apr 27 08:21:59 2007
@@ -37,12 +37,12 @@
$("unread_img_"+mid).removeChild($("unread_img_"+mid).firstChild);
$("unread_img_"+mid).appendChild(Builder.node('a',
- {href: 'javascript:;', onclick: 'OpenCompose('+mid+',"reply")'},
+ {href: 'javascript:;', onclick: 'OpenComposer('+mid+',"reply")'},
[Builder.node('img',{src: 'modules/Webmails/images/stock_mail-read.png', border: '0', width: '10', height: '11'})]
));
}
node.className='read_email';
- if(webmail2 == null){
+ /*if(webmail2 == null){
$("from_addy").innerHTML = " "+webmail[mid]["from"];
$("to_addy").innerHTML = " "+webmail[mid]["to"];
$("webmail_subject").innerHTML = " "+webmail[mid]["subject"];
@@ -55,7 +55,7 @@
$("webmail_subject").innerHTML = " "+webmail2[mid]["subject"];
$("webmail_date").innerHTML = " "+webmail2[mid]["date"];
$("webmail_cc").innerHTML = " "+webmail2[mid]["cc"];
- }
+ }*/
//Fix for webmails body display in IE - dartagnanlaf
/*
new Ajax.Request(
@@ -85,13 +85,13 @@
$("delete_button").appendChild(Builder.node('input',{type: 'button', name: 'Button', value: 'Delete', className: 'crmbutton small delete', onclick: 'runEmailCommand(\'delete_msg\','+mid+')'}));
$("reply_button_all").removeChild($("reply_button_all").firstChild);
- $("reply_button_all").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To All ', className: 'crmbutton small create', onclick: 'OpenCompose('+mid+',\'replyall\')'}));
+ $("reply_button_all").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To All ', className: 'crmbutton small create', onclick: 'OpenComposer('+mid+',\'replyall\')'}));
$("reply_button").removeChild($("reply_button").firstChild);
- $("reply_button").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To Sender ', className: 'crmbutton small create', onclick: 'OpenCompose('+mid+',\'reply\')'}));
+ $("reply_button").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To Sender ', className: 'crmbutton small create', onclick: 'OpenComposer('+mid+',\'reply\')'}));
$("forward_button").removeChild($("forward_button").firstChild);
- $("forward_button").appendChild(Builder.node('input',{type: 'button', name: 'forward', value: ' Forward ', className: 'crmbutton small create', onclick: 'OpenCompose('+mid+',\'forward\')'}));
+ $("forward_button").appendChild(Builder.node('input',{type: 'button', name: 'forward', value: ' Forward ', className: 'crmbutton small create', onclick: 'OpenComposer('+mid+',\'forward\')'}));
$("qualify_button").removeChild($("qualify_button").firstChild);
$("qualify_button").appendChild(Builder.node('input',{type: 'button', name: 'Qualify2', value: ' Qualify ', className: 'crmbutton small save', onclick: 'showRelationships('+mid+')'}));
@@ -99,15 +99,15 @@
$("download_attach_button").removeChild($("download_attach_button").firstChild);
$("download_attach_button").appendChild(Builder.node('input',{type: 'button', name: 'download', value: ' Download Attachments ', className: 'crmbutton small save', onclick: 'displayAttachments('+mid+')'}));
- $("full_view").removeChild($("full_view").firstChild);
- $("full_view").appendChild(Builder.node('a',{href: 'javascript:;', onclick: 'OpenCompose('+mid+',\'full_view\')'},'Full Email View'));
+ //$("full_view").removeChild($("full_view").firstChild);
+ // $("full_view").appendChild(Builder.node('a',{href: 'javascript:;', onclick: 'OpenComposer('+mid+',\'full_view\')'},'Full Email View'));
makeSelected(node.id)
}
function displayAttachments(mid) {
var url = "index.php?module=Webmails&action=dlAttachments&mailid="+mid+"&mailbox="+mailbox;
window.open(url,"Download Attachments",'menubar=no,toolbar=no,location=no,status=no,resizable=no,width=450,height=450');
}
-function OpenCompose(id,mode)
+function OpenComposer(id,mode)
{
switch(mode)
{
Modified: vtigercrm/branches/5.0.3/modules/Webmails/Webmails.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/Webmails.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/Webmails.php Fri Apr 27 08:21:59 2007
@@ -646,20 +646,27 @@
{
sort($attach_tab);
$link = '';
+ $ct = 0;
while ($tmp = array_shift($attach_tab))
if (!empty($tmp['name']))
{
$mime = str_replace('/', '-', $tmp['mime']);
if ($display_part_no == true)
- $link .= $tmp['number']-1 . ' ';
+ //$link .= $tmp['number']-1 . ' ';
unset($att_name);
$att_name_array = imap_mime_header_decode($tmp['name']);
for ($i=0; $i<count($att_name_array); $i++) {
$att_name .= $att_name_array[$i]->text;
}
+ if(!preg_match("/unknown/",$att_name))
+ $this->attname[$ct] = $att_name;
$att_name_dl = $att_name;
$att_name = $this->convertLang2Html($att_name);
- $link .= '<a href="index.php?module=Webmails&action=download&part=' . $tmp['number'] . '&mailid='.$ev.'&transfer=' . $tmp['transfer'] . '&filename=' . base64_encode($att_name_dl) . '&mime=' . $mime . '">' . $att_name . '</a> ' . $tmp['mime'] . ' ' . $tmp['size'] . '<br/>';
+ if(!preg_match("/unknown/",$att_name)){
+ $link .= ($ct+1).'. <a href="index.php?module=Webmails&action=download&part=' . $tmp['number'] . '&mailid='.$ev.'&transfer=' . $tmp['transfer'] . '&filename=' . base64_encode($att_name_dl) . '&mime=' . $mime . '">' . $att_name . '</a> ' . $tmp['mime'] . ' ' . $tmp['size'] . '<br/>';
+ $this->anchor_arr[$ct] = ($ct+1).'. <a href="index.php?module=Webmails&action=download&part=' . $tmp['number'] . '&mailid='.$ev.'&transfer=' . $tmp['transfer'] . '&filename=' . base64_encode($att_name_dl) . '&mime=' . $mime . '">';
+ $ct++;
+ }
}
return ($link);
}
@@ -762,7 +769,7 @@
if (isset($_REQUEST['user_charset']) && $_REQUEST['user_charset'] != '') {
$body_charset = $_REQUEST['user_charset'];
}
-
+ $this->charsets = $body_charset;
$body_converted = @iconv( $body_charset, $GLOBALS['charset'], $body);
$body = ($body_converted===FALSE) ? $body : $body_converted;
$tmpvar['charset'] = ($body_converted===FALSE) ? $body_charset : $GLOBALS['charset'];
@@ -814,7 +821,7 @@
$subject_array = $this->mime_header_decode($subject_header);
for ($j = 0; $j < count($subject_array); $j++)
$subject .= $subject_array[$j]->text;
-
+
$from_header = str_replace('x-unknown', $msg_charset, $ref_contenu_message->fromaddress);
$from_array = $this->mime_header_decode($from_header);
for ($j = 0; $j < count($from_array); $j++)
@@ -825,7 +832,7 @@
for ($j = 0; $j < count($to_array); $j++)
$to .= $to_array[$j]->text;
$to = str_replace(',', ', ', $to);
-
+ $this->to_header = $to_header;
$cc_header = isset($ref_contenu_message->ccaddress) ? $ref_contenu_message->ccaddress : '';
$cc_header = str_replace('x-unknown', $msg_charset, $cc_header);
$cc_array = isset($ref_contenu_message->ccaddress) ? imap_mime_header_decode($cc_header) :0;
@@ -834,7 +841,7 @@
$cc .= $cc_array[$j]->text;
}
$cc = str_replace(',', ', ', $cc);
-
+ $this->cc_header = $cc_header;
$reply_to_header = isset($ref_contenu_message->reply_toaddress) ? $ref_contenu_message->reply_toaddress : '';
$reply_to_header = str_replace('x-unknown', $msg_charset, $reply_to_header);
$reply_to_array = isset($ref_contenu_message->reply_toaddress) ? imap_mime_header_decode($reply_to_header) : 0;
@@ -846,6 +853,8 @@
$timestamp = chop($ref_contenu_message->udate);
$date = format_date($timestamp, $lang);
$time = format_time($timestamp, $lang);
+ $this->date = $date;
+ $this->time = $time;
$content = Array(
'from' => $from,
'to' => $to,
Modified: vtigercrm/branches/5.0.3/modules/Webmails/body.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/body.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/body.php Fri Apr 27 08:21:59 2007
@@ -30,8 +30,40 @@
$mail = $MailBox->mbox;
$email = new Webmails($MailBox->mbox,$mailid);
$status=imap_setflag_full($MailBox->mbox,$mailid,"\\Seen");
+$attach_tab=array();
+$email->loadMail($attach_tab);
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$email->charsets."\">\n";
+$subject = decode_header($email->subject);
+$from = decode_header($email->from);
+$to = decode_header($email->to_header);
+$cc = decode_header($email->cc_header);
+$date = decode_header($email->date);
+/*for($i=0;$i<count($email->attname);$i++){
+ $attachment_links .= $email->anchor_arr[$i].decode_header($email->attname[$i])."</a></br>";
+}*/
+$content['body'] = '<span id="webmail_body">'.$email->body.'</span>';
+$content['attachtab'] = $email->attachtab;
+
?>
+<script src="modules/Webmails/Webmails.js" type="text/javascript"></script>
+<script src="include/js/general.js" type="text/javascript"></script>
+<!-- Table to display the Header details (From, To, Subject and date) - Starts -->
+
+ <table style="font-size:15px" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td width="20%" align="right"><b><?php echo $mod_strings['LBL_FROM'];?></b></td><td id="from_addy"><?php echo $from;?></td></tr>
+ <tr><td width="20%" align="right"><b><?php echo $mod_strings['LBL_TO'];?></b></td><td id="to_addy"><?php echo $to;?></td></tr>
+<tr><td width="20%" align="right"><b><?php echo $mod_strings['LBL_CC'];?></b></td><td id="webmail_cc"><?php echo $cc;?></td></tr>
+
+ <tr><td align="right"><b><?php echo $mod_strings['LBL_SUBJECT'];?></b></td><td id="webmail_subject"><?php echo $subject;?></td></tr>
+ <tr><td align="right"><b><?php echo $mod_strings['MOD.LBL_DATE'];?></b></td><td id="webmail_date"><?php echo $date;?></td>
+ <tr>
+ <td> </td> <td id="full_view"><span style="float:right" colspan="2"><a href="javascript:;" onclick="OpenComposer('<?php echo $mailid;?>','full_view')"> Full Email View</a></span></td></tr>
+ <tr><td align="right" style="border-bottom:1px solid #666666;" colspan="3"> </td></tr>
+ </table>
+ <!-- Table to display the Header details (From, To, Subject and date) - Ends -->
+
<script type="text/javascript">
+mailbox = "<?php echo $mailbox;?>";
function show_inline(num) {
var el = document.getElementById("block_"+num);
if(el.style.display == 'block')
@@ -52,11 +84,7 @@
$str = nl2br($text);
return ($str);
}
-$attach_tab=array();
-$email->loadMail($attach_tab);
-$content['body'] = '<span id="webmail_body">'.$email->body.'</span>';
-$content['attachtab'] = $email->attachtab;
-//Need to put this along with the subject block
+//Need to put this along with the subject block*/
echo $email->att;
echo $content['body'];
@@ -111,7 +139,12 @@
//test ended by Richie
imap_close($MailBox->mbox);
-
+function decode_header($string){
+ $elements = imap_mime_header_decode($string);
+ for ($i=0; $i<count($elements); $i++) {
+ $result .= $elements[$i]->text;
+ }
+ return $result;
+}
?>
-<script>parent.document.getElementById('webmail_attachment').innerHTML=document.getElementById('webmail_cont').innerHTML</script>
More information about the vtigercrm-commits
mailing list