[Vtigercrm-commits] [vtiger-commits] r10516 - in /vtigercrm/branches/5.0.3: Smarty/templates/Webmails.tpl include/js/en_us.lang.js modules/Webmails/ListView.php modules/Webmails/Webmails.js modules/Webmails/Webmails.php modules/Webmails/language/en_us.lang.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu Mar 22 05:34:27 EDT 2007
Author: jerrydgeorge
Date: Thu Mar 22 03:33:40 2007
New Revision: 10516
Log:
Issues in Webmails has been fixed
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl
vtigercrm/branches/5.0.3/include/js/en_us.lang.js
vtigercrm/branches/5.0.3/modules/Webmails/ListView.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/language/en_us.lang.php
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 Thu Mar 22 03:33:40 2007
@@ -115,15 +115,8 @@
{if $DEGRADED_SERVICE eq 'false'}
<td width="50%" align="right" nowrap>
<font color="#000000">{$APP.LBL_SEARCH}</font>
- <input type="text" name="srch" class="importBox" id="search_input" value="{$SEARCH_VALUE}"/>
- <select name="optionSel" class="importBox" id="search_type">
- <option selected value="SUBJECT">{$MOD.IN_SUBJECT}</option>
- <option value="BODY">{$MOD.IN_BODY}</option>
- <option value="TO">{$MOD.IN_TO}</option>
- <option value="CC">{$MOD.IN_CC}</option>
- <option value="BCC">{$MOD.IN_BCC}</option>
- <option value="FROM">{$MOD.IN_FROM}</option>
- </select>
+ <input type="text" name="srch" class="importBox" id="search_input" value="{$SEARCH_VALUE}"/>
+ {$SEARCH_HTML}
</td>
<td width="5%">
<input type="button" name="find" value=" {$APP.LBL_FIND_BUTTON} " class="crmbutton small create" onclick="search_emails();" />
@@ -253,9 +246,9 @@
{rdelim}
var gselected_mail = '';
{if $smarty.request.mailbox.value neq ''}
-var gCurrentFolder = '{$smarty.request.mailbox}';
+ var gCurrentFolder = '{$smarty.request.mailbox}';
{else}
-var gCurrentFolder = 'INBOX';
+ var gCurrentFolder = 'INBOX';
{/if}
{literal}
function makeSelected(rowId)
Modified: vtigercrm/branches/5.0.3/include/js/en_us.lang.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/en_us.lang.js (original)
+++ vtigercrm/branches/5.0.3/include/js/en_us.lang.js Thu Mar 22 03:33:40 2007
@@ -94,7 +94,7 @@
SELECTED_MORE_THAN_ONCE:'You have selected the following product(s) more than once.',
YES:'yes',
NO:'no',
-
+ MAIL:'mail',
EQUALS:'equals',
NOT_EQUALS_TO:'not equal to',
STARTS_WITH:'starts with',
@@ -104,5 +104,4 @@
GREATER_THAN:'greater than',
LESS_OR_EQUALS:'less or equal',
GREATER_OR_EQUALS:'greater or equal',
-
};
Modified: vtigercrm/branches/5.0.3/modules/Webmails/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/ListView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/ListView.php Thu Mar 22 03:33:40 2007
@@ -186,7 +186,14 @@
global $displayed_msgs;
// AJAX commands (should be moved)
if($_POST["command"] == "move_msg" && $_POST["ajax"] == "true") {
- imap_mail_move($MailBox->mbox,$_REQUEST["mailid"],$_REQUEST["mvbox"]);
+ if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != '')
+ {
+ $mailids = explode(':',$_REQUEST["mailid"]);
+ }
+ foreach($mailids as $mailid)
+ {
+ imap_mail_move($MailBox->mbox,$mailid,$_REQUEST["mvbox"]);
+ }
imap_close($MailBox->mbox);
echo "SUCCESS";
flush();
@@ -253,7 +260,7 @@
foreach ($overview as $val)
{
$mails[$val->msgno] = $val;
- $hdr = @imap_headerinfo($MailBox->mbox, $val->msgno);
+ $hdr = @imap_headerinfo($MailBox->mbox, $val->msgno);
//Added to get the UTF-8 string - 30-11-06 - Mickie
//we have to do this utf8 decode for the fields which may contains special characters -- Mickie - 02-02-07
$val->from = utf8_decode(imap_utf8(addslashes($val->from)));
@@ -274,6 +281,7 @@
}
echo "</script>";
+$search_fields = Array("SUBJECT","BODY","TO","CC","BCC","FROM");
$listview_header = array("<th width='10%'>".$mod_strings['LBL_INFO']."</th>","<th width='45%'>".$mod_strings['LBL_LIST_SUBJECT']."</th>","<th width='25%'>".$mod_strings['LABEL_DATE']."</th>","<th width='10%'>".$mod_strings['LABEL_FROM']."</th>","<th>".$mod_strings['LBL_DEL']."</th>");
$listview_entries = array();
@@ -283,40 +291,59 @@
$listview_entries[0][] = '<td colspan="6" width="100%" align="center"><b>'.$mod_strings['LBL_NO_EMAILS'].'</b></td>';
else {
-if(isset($_REQUEST["search"])) {
- $searchstring = $_REQUEST["search_type"].' "'.$_REQUEST["search_input"].'"';
- //echo $searchstring."<br>";
- $searchlist = imap_search($MailBox->mbox,$searchstring);
- if(is_array($searchlist))
+ if(isset($_REQUEST["search"]) && trim($_REQUEST["search_input"]) != '') {
+ $searchstring = $_REQUEST["search_type"].' "'.$_REQUEST["search_input"].'"';
+ //echo $searchstring."<br>";
+ $searchlist = Array();
+ $searchlist = imap_search($MailBox->mbox,$searchstring);
+
+ if(is_array($searchlist))
+ {
+ $num_searches = count($searchlist);
+ $c=$numEmails;
+ }
+
+ while ($i<=$c) {
+ if(is_array($searchlist)) {
+ for($l=0;$l<$num_searches;$l++) {
+ if($mails[$start_message]->msgno == $searchlist[$l])
+ $listview_entries[] = show_msg($mails,$start_message);
+ }
+ }
+ $i++;
+ $start_message--;
+ }
+ }else
{
- $num_searches = count($searchlist);
- $c=$numEmails;
- }
-}
-
-flush();
-// MAIN LOOP
-// Main loop to create listview entries
-
-$i=1;
-while ($i<=$c) {
- if(is_array($searchlist)) {
- for($l=0;$l<$num_searches;$l++) {
- if($mails[$start_message]->msgno == $searchlist[$l])
+ $i=1;
+ while ($i<=$c) {
+ if($start_message > 0)
+ {
$listview_entries[] = show_msg($mails,$start_message);
- }
- } else {
+ if($displayed_msgs == $MailBox->mails_per_page) {break;}
+ }
+ $i++;
+ $start_message--;
+ }
+
+ }
+
+ flush();
+ // MAIN LOOP
+ // Main loop to create listview entries
+
+}
+
+$search_html = '<select name="optionSel" class="importBox" id="search_type">';
+foreach($search_fields as $searchfield)
+{
+ if($_REQUEST['search_type'] == $searchfield)
+ $search_html .= '<option selected value="'.$searchfield.'">'.$mod_strings["IN"].' '.$mod_strings[$searchfield].'</option>';
+ else
+ $search_html .= '<option value="'.$searchfield.'">'.$mod_strings["IN"].' '.$mod_strings[$searchfield].'</option>';
- if($start_message > 0)
- {
- $listview_entries[] = show_msg($mails,$start_message);
- if($displayed_msgs == $MailBox->mails_per_page) {break;}
- }
- }
- $i++;
- $start_message--;
-}
-}
+}
+$search_html .= '</select>';
// Build folder list and move_to dropdown box
$list = imap_getmailboxes($MailBox->mbox, "{".$MailBox->imapServerAddress."}", "*");
@@ -336,9 +363,13 @@
$i++;
+ if($_REQUEST["mailbox"] == '')
+ $_REQUEST["mailbox"] = 'INBOX';
+
if ($_REQUEST["mailbox"] == $tmpval) {
- if($tmpval != "INBOX")
+ /* if($tmpval != "INBOX")
$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
+ */
$_SESSION["mailboxes"][$tmpval] = $new_msgs;
if($numEmails==0) {$num=$numEmails;} else {$num=($numEmails-1);}
@@ -370,6 +401,7 @@
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("LISTHEADER", $listview_header);
+$smarty->assign("SEARCH_HTML", $search_html);
$smarty->assign("MODULE","Webmails");
$smarty->assign("SINGLE_MOD",'Webmails');
$smarty->assign("BUTTONS",$other_text);
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 Thu Mar 22 03:33:40 2007
@@ -99,12 +99,14 @@
// TODO: present the user with a simple DHTML div to
// choose what type of relationship they would like to create
// before creating it.
- alert(alert_arr.WISH_TO_QUALIFY_MAIL_AS_CONTACT);
- add_to_vtiger(mid);
+ if(confirm(alert_arr.WISH_TO_QUALIFY_MAIL_AS_CONTACT))
+ add_to_vtiger(mid);
}
function add_to_vtiger(mid) {
// TODO: update this function to allow you to set what entity type
// you would like to associate to
+ var rowId = "row_"+mid;
+ $(rowId).className = "unread_email";
$("status").style.display="block";
new Ajax.Request(
'index.php',
@@ -113,6 +115,7 @@
postBody: 'module=Webmails&action=Save&mailid='+mid+'&ajax=true',
onComplete: function(t) {
$("status").style.display="block";
+ setTimeout('makeSelected("'+rowId+'");',3000);
}
}
);
@@ -164,12 +167,11 @@
}
function check_for_new_mail(mbox) {
window.location=window.location;
-/*
if(degraded_service == 'true') {
- window.location=window.location;
return;
}
$("status").style.display="block";
+/*
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
@@ -310,7 +312,7 @@
}
}
);
-*/
+ */
}
function periodic_event() {
// NOTE: any functions you put in here may race. This could probably
@@ -372,22 +374,35 @@
$("status").style.display = "block";
var chkname=document.getElementsByName("selected_id");
var mvmbox = $("mailbox_select").value;
+ var nid = Array();
+ var i=0;
for(var m=0;m<chkname.length;m++)
{
if(chkname[m].checked)
- nid = chkname[m].value;
+ nid[i++] = chkname[m].value;
}
- new Ajax.Request(
- 'index.php',
- {queue: {position: 'end', scope: 'command'},
- method: 'post',
- postBody: 'module=Webmails&action=WebmailsAjax&file=ListView&mailbox=INBOX&command=move_msg&ajax=true&mailid='+nid+'&mvbox='+mvmbox,
- onComplete: function(t) {
- window.location=window.location.href;
- $("status").style.display = "none";
- }
- }
- );
+
+ if(nid.length > 0)
+ {
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: 'module=Webmails&action=WebmailsAjax&file=ListView&mailbox='+gCurrentFolder+'&command=move_msg&ajax=true&mailid='+nid.join(":")+'&mvbox='+mvmbox,
+ onComplete: function(t) {
+ for(i=0;i<nid.length;i++)
+ {
+ var oRow = $('row_'+nid[i]);
+ new Effect.Fade(oRow,{queue: {position: 'end', scope: 'effect'},duration: '0.5'});
+ }
+ $("status").style.display = "none";
+ }
+ }
+ );
+ }else
+ {
+ alert("Please select a mail and then move..");
+ }
}
/*function move_messages() {
@@ -425,9 +440,14 @@
window.location = "index.php?module=Webmails&action=index&search=true&search_type="+search_type+"&search_input="+search_query;
}
function runEmailCommand(com,id) {
- $("status").style.display="block";
command=com;
id=id;
+ if(com == 'delete_msg')
+ {
+ if(!confirm(alert_arr.DELETE+" "+alert_arr.MAIL+" ?"))
+ return;
+ }
+ $("status").style.display="block";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
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 Thu Mar 22 03:33:40 2007
@@ -700,17 +700,17 @@
function load_mail($attach_tab)
{
// parse the message
- $ref_contenu_message = imap_headerinfo($this->mbox, $this->mailid);
+ $ref_contenu_message = imap_headerinfo($this->mbox, $this->mailid);
$struct_msg = imap_fetchstructure($this->mbox, $this->mailid);
$mail = $this->mbox;
$ev = $this->mailid;
-$conf->display_rfc822 = true;
+ $conf->display_rfc822 = true;
if ($struct_msg->type == 3 || (isset($struct_msg->parts) && (sizeof($struct_msg->parts) > 0)))
- {
+ {
$this->GetPart($attach_tab, $struct_msg, NULL, $conf->display_rfc822);
- }
+ }
else
- {
+ {
$pop_fetchheader_mail_ev = imap_fetchheader($mail, $ev);
$pop_body_mail_ev = imap_body($mail, $ev);
GetSinglePart($attach_tab, $struct_msg, $pop_fetchheader_mail_ev, $pop_body_mail_ev);
@@ -725,17 +725,17 @@
if ($struct_msg->type == 3)
{
$body = '';
- }
+ }
else
- {
+ {
$body = imap_fetchbody($mail,$ev,$tmpvar['number']);
- }
+ }
if (eregi('text/html', $tmpvar['mime']) || eregi('text/plain', $tmpvar['mime']))
- {
+ {
if ($tmpvar['transfer'] == 'QUOTED-PRINTABLE')
$body = imap_qprint($body);
if ($tmpvar['transfer'] == 'BASE64')
@@ -746,30 +746,30 @@
if (strtolower($body_charset) == "us-ascii") {
$body_charset = "ISO-8859-1";
- }
+ }
if ($body_charset == "" || $body_charset == null) {
if (isset($conf->default_charset) && $conf->default_charset != "") {
$body_charset = $conf->default_charset;
} else {
$body_charset = "ISO-8859-1";
- }
- }
+ }
+ }
if (isset($_REQUEST['user_charset']) && $_REQUEST['user_charset'] != '') {
$body_charset = $_REQUEST['user_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'];
- }
- else
- {
+ }
+ else
+ {
array_push($attach_tab, $tmpvar);
- }
+ }
$link_att = '';
-$conf->display_part_no = true;
+ $conf->display_part_no = true;
if ($struct_msg->subtype != 'ALTERNATIVE' && $struct_msg->subtype != 'RELATED')
{
switch (sizeof($attach_tab))
@@ -787,7 +787,7 @@
}else
{
$link_att = '<span id="webmail_cont" style="display:none;"><tr><th class="mailHeaderLabel right"></th><td class="mailHeaderData"></td></tr></span>';
- }
+ }
$struct_msg = imap_fetchstructure($mail, $ev);
$msg_charset = '';
@@ -804,64 +804,64 @@
}
- $subject_header = str_replace('x-unknown', $msg_charset, $ref_contenu_message->subject);
- $subject_array = $this->mime_header_decode($subject_header);
- for ($j = 0; $j < count($subject_array); $j++)
+ $subject_header = str_replace('x-unknown', $msg_charset, $ref_contenu_message->subject);
+ $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++)
- $from .= $from_array[$j]->text;
-
- $to_header = str_replace('x-unknown', $msg_charset, $ref_contenu_message->toaddress);
- $to_array = $this->mime_header_decode($to_header);
- for ($j = 0; $j < count($to_array); $j++)
- $to .= $to_array[$j]->text;
- $to = str_replace(',', ', ', $to);
-
- $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;
- if ($cc_array != 0) {
- for ($j = 0; $j < count($cc_array); $j++)
- $cc .= $cc_array[$j]->text;
- }
- $cc = str_replace(',', ', ', $cc);
-
- $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;
- if ($reply_to_array != 0) {
- for ($j = 0; $j < count($reply_to_array); $j++)
- $reply_to .= $reply_to_array[$j]->text;
- }
-
- $timestamp = chop($ref_contenu_message->udate);
- $date = format_date($timestamp, $lang);
- $time = format_time($timestamp, $lang);
- $content = Array(
- 'from' => $from,
- 'to' => $to,
- 'cc' => $cc,
- 'reply_to' => $reply_to,
- 'subject' => $subject,
- 'date' => $date,
- 'time' => $time,
- 'complete_date' => $date,
- 'att' => $link_att,
- 'body' => $this->graphicalsmilies($body),
- 'body_mime' => $this->convertLang2Html($tmpvar['mime']),
- 'body_transfer' => $this->convertLang2Html($tmpvar['transfer']),
- 'header' => $header,
- 'verbose' => $verbose,
- 'prev' => $prev_msg,
- 'next' => $next_msg,
- 'msgnum' => $mail,
- 'attachtab' => $attach_tab,
- 'charset' => $body_charset
- );
-return ($content);
+ $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++)
+ $from .= $from_array[$j]->text;
+
+ $to_header = str_replace('x-unknown', $msg_charset, $ref_contenu_message->toaddress);
+ $to_array = $this->mime_header_decode($to_header);
+ for ($j = 0; $j < count($to_array); $j++)
+ $to .= $to_array[$j]->text;
+ $to = str_replace(',', ', ', $to);
+
+ $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;
+ if ($cc_array != 0) {
+ for ($j = 0; $j < count($cc_array); $j++)
+ $cc .= $cc_array[$j]->text;
+ }
+ $cc = str_replace(',', ', ', $cc);
+
+ $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;
+ if ($reply_to_array != 0) {
+ for ($j = 0; $j < count($reply_to_array); $j++)
+ $reply_to .= $reply_to_array[$j]->text;
+ }
+
+ $timestamp = chop($ref_contenu_message->udate);
+ $date = format_date($timestamp, $lang);
+ $time = format_time($timestamp, $lang);
+ $content = Array(
+ 'from' => $from,
+ 'to' => $to,
+ 'cc' => $cc,
+ 'reply_to' => $reply_to,
+ 'subject' => $subject,
+ 'date' => $date,
+ 'time' => $time,
+ 'complete_date' => $date,
+ 'att' => $link_att,
+ 'body' => $this->graphicalsmilies($body),
+ 'body_mime' => $this->convertLang2Html($tmpvar['mime']),
+ 'body_transfer' => $this->convertLang2Html($tmpvar['transfer']),
+ 'header' => $header,
+ 'verbose' => $verbose,
+ 'prev' => $prev_msg,
+ 'next' => $next_msg,
+ 'msgnum' => $mail,
+ 'attachtab' => $attach_tab,
+ 'charset' => $body_charset
+ );
+ return ($content);
}
Modified: vtigercrm/branches/5.0.3/modules/Webmails/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/language/en_us.lang.php Thu Mar 22 03:33:40 2007
@@ -147,12 +147,13 @@
'LBL_ALLMAILS'=>'All Mails',
'LBL_TO_USERS'=>'To Users',
'LBL_TO_GROUPS'=>'To Groups',
-'IN_SUBJECT' => 'in Subject',
-'IN_BODY' => 'in Body',
-'IN_TO' => 'in To:',
-'IN_CC' => 'in CC:',
-'IN_BCC' => 'in BCC:',
-'IN_FROM' => 'in From:',
+'SUBJECT' => 'Subject',
+'BODY' => 'Body',
+'TO' => 'To:',
+'CC' => 'CC:',
+'BCC' => 'BCC:',
+'FROM' => 'From:',
+'IN'=>'in',
'ADD_FOLDER' => 'Add Folder[X]',
);
More information about the vtigercrm-commits
mailing list