[Vtigercrm-commits] [vtiger-commits] r5710 - in /vtigercrm/trunk/modules/Webmails: DetailView.php EditView.php ListView.php body.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed May 3 08:01:00 EDT 2006


Author: richie
Date: Wed May  3 06:00:54 2006
New Revision: 5710

Log:
mbox construction changed to older format.
Commented out the javascript in body.php as it 
was repeatedly invoking the page due to which the
system would crash frequently

Modified:
    vtigercrm/trunk/modules/Webmails/DetailView.php
    vtigercrm/trunk/modules/Webmails/EditView.php
    vtigercrm/trunk/modules/Webmails/ListView.php
    vtigercrm/trunk/modules/Webmails/body.php

Modified: vtigercrm/trunk/modules/Webmails/DetailView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/DetailView.php (original)
+++ vtigercrm/trunk/modules/Webmails/DetailView.php Wed May  3 06:00:54 2006
@@ -1,92 +1,92 @@
-<?php
-global $current_user;
-require_once('include/utils/UserInfoUtil.php');
-require_once('MailParse.php');
-require_once('Smarty_setup.php');
-require_once('data/Tracker.php');
-require_once('include/upload_file.php');
-require_once('include/database/PearDatabase.php');
-require_once('include/utils/utils.php');
-require_once('modules/Webmails/Webmail.php');
-
-global $log;
-global $app_strings;
-global $mod_strings;
-
-if($_REQUEST["record"]) {$mailid=$_REQUEST["record"];} else {$mailid=$_REQUEST["mailid"];}
-$mailInfo = getMailServerInfo($current_user);
-$temprow = $adb->fetch_array($mailInfo);
-
-$login_username= $temprow["mail_username"];
-$secretkey=$temprow["mail_password"];
-$imapServerAddress=$temprow["mail_servername"];
-$start_message=$_REQUEST["start_message"];
-$box_refresh=$temprow["box_refresh"];
-$mails_per_page=$temprow["mails_per_page"];
-$mail_protocol=$temprow["mail_protocol"];
-$ssltype=$temprow["ssltype"];
-$sslmeth=$temprow["sslmeth"];
-
-if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
-global $mbox;
-$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
-
+<?php
+global $current_user;
+require_once('include/utils/UserInfoUtil.php');
+require_once('MailParse.php');
+require_once('Smarty_setup.php');
+require_once('data/Tracker.php');
+require_once('include/upload_file.php');
+require_once('include/database/PearDatabase.php');
+require_once('include/utils/utils.php');
+require_once('modules/Webmails/Webmail.php');
+
+global $log;
+global $app_strings;
+global $mod_strings;
+if($_REQUEST["record"]) {$mailid=$_REQUEST["record"];} else {$mailid=$_REQUEST["mailid"];}
+$mailInfo = getMailServerInfo($current_user);
+$temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
+$imapServerAddress=$temprow["mail_servername"];
+$start_message=$_REQUEST["start_message"];
+$box_refresh=$temprow["box_refresh"];
+$mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+
+if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
+global $mbox;
+//$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
+$mbox = @imap_open('{'.$imapServerAddress.'/'.$mail_protocol.'}'.$mailbox, $login_username, $secretkey) or die("Connection to server failed with: ".imap_last_error())
+
+echo ' after  in DetailView ';
 $email = new Webmail($mbox, $mailid);
 $from = $email->from;
-$subject=$email->subject;
-$date=$email->date;
-
-$to = $email->to_name[0]." &lt;".$email->to[0]."&gt;";
-for($l=1;$l<count($email->to);$l++) {
-	$to .= "; ".$email->to_name[$l]." &lt;".$email->to[$l]."&gt;";
-}
-$cc_list = $email->cc_list_name[0]." &lt;".$email->cc_list[0]."&gt;";
-for($l=1;$l<count($email->cc_list);$l++) {
-	$cc_list .= "; ".$email->cc_list_name[$l]." &lt;".$email->cc_list[$l]."&gt;";
-}
-$bcc_list = $email->bcc_list_name[0]." &lt;".$email->bcc_list[0]."&gt;";
-for($l=1;$l<count($email->bcc_list);$l++) {
-	$bcc_list .= "; ".$email->bcc_list_name[$l]." &lt;".$email->bcc_list[$l]."&gt;";
+$subject=$email->subject;
+$date=$email->date;
+
+$to = $email->to_name[0]." &lt;".$email->to[0]."&gt;";
+for($l=1;$l<count($email->to);$l++) {
+	$to .= "; ".$email->to_name[$l]." &lt;".$email->to[$l]."&gt;";
+}
+$cc_list = $email->cc_list_name[0]." &lt;".$email->cc_list[0]."&gt;";
+for($l=1;$l<count($email->cc_list);$l++) {
+	$cc_list .= "; ".$email->cc_list_name[$l]." &lt;".$email->cc_list[$l]."&gt;";
+}
+$bcc_list = $email->bcc_list_name[0]." &lt;".$email->bcc_list[0]."&gt;";
+for($l=1;$l<count($email->bcc_list);$l++) {
+	$bcc_list .= "; ".$email->bcc_list_name[$l]." &lt;".$email->bcc_list[$l]."&gt;";
 }
 $reply_to = $from." <".$email->reply_to[0].">";
 
 for($l=1;$l<count($email->reply_to);$l++) {
 	$reply_to .= "; ".$email->reply_to_name[$l]." &lt;".$email->reply_to[$l]."&gt;";
 }
-
-$email->loadMail();
-$body = $email->body;
-$attachments=$email->attachments;
-$inline=$email->inline;
-
-$atL="Attachments";
-$at="<i>None</i>";
-$atd="";
-$cnt=1;
-if($attachments || $inline) {
-    $at='<table width="100%" cellpadding="0" cellspacing="0">';
-    for($i=0;$i<count($attachments);$i++) {
-	if(strlen($attachments[$i]["filename"]) > 25)
-		$fname=substr($attachments[$i]["filename"],0,25)."...";
-	else
-		$fname=$attachments[$i]["filename"];
-
-	$filesize = $attachments[$i]["filesize"]." bytes";
-	if($attachments[$i]["filesize"] > 1000000)
-		$filesize= substr((($attachments[$i]["filesize"]/1024)/1024),0,5)." megabytes";
-	elseif ($attachments[$i]["filesize"] > 1024)
-		$filesize= substr(($attachments[$i]["filesize"]/1024),0,5)." kilobytes";
-
-	$at.=" <tr><td width='100%' nowrap>".$cnt.") <a target='_blank' href='index.php?module=Webmails&action=dlAttachments&mailid=".$mailid."&num=".$i."'>".$fname."</a></b><br><i>".$filesize."</i></td></tr>";
-	$cnt++;
-    }
-    for($i=0;$i<count($inline);$i++) {
-	$at.=" <tr><td width='100%' nowrap>".$cnt.") <a href='modules/Webmails/tmp/".$_SESSION["authenticated_user_id"]."/".$inline[$i]["filename"]."'>".$inline[$i]["filename"]."</a></td></tr>";
-	$cnt++;
-    }
-    $at.="</table>";
-    $tmp = (count($inline)+count($attachments));
-    $atL= $tmp." Attachment(s)";
+
+$email->loadMail();
+$body = $email->body;
+$attachments=$email->attachments;
+$inline=$email->inline;
+
+$atL="Attachments";
+$at="<i>None</i>";
+$atd="";
+$cnt=1;
+if($attachments || $inline) {
+    $at='<table width="100%" cellpadding="0" cellspacing="0">';
+    for($i=0;$i<count($attachments);$i++) {
+	if(strlen($attachments[$i]["filename"]) > 25)
+		$fname=substr($attachments[$i]["filename"],0,25)."...";
+	else
+		$fname=$attachments[$i]["filename"];
+
+	$filesize = $attachments[$i]["filesize"]." bytes";
+	if($attachments[$i]["filesize"] > 1000000)
+		$filesize= substr((($attachments[$i]["filesize"]/1024)/1024),0,5)." megabytes";
+	elseif ($attachments[$i]["filesize"] > 1024)
+		$filesize= substr(($attachments[$i]["filesize"]/1024),0,5)." kilobytes";
+
+	$at.=" <tr><td width='100%' nowrap>".$cnt.") <a target='_blank' href='index.php?module=Webmails&action=dlAttachments&mailid=".$mailid."&num=".$i."'>".$fname."</a></b><br><i>".$filesize."</i></td></tr>";
+	$cnt++;
+    }
+    for($i=0;$i<count($inline);$i++) {
+	$at.=" <tr><td width='100%' nowrap>".$cnt.") <a href='modules/Webmails/tmp/".$_SESSION["authenticated_user_id"]."/".$inline[$i]["filename"]."'>".$inline[$i]["filename"]."</a></td></tr>";
+	$cnt++;
+    }
+    $at.="</table>";
+    $tmp = (count($inline)+count($attachments));
+    $atL= $tmp." Attachment(s)";
 
 ?>
 <script type="text/javascript">
@@ -117,31 +117,31 @@
 $block["Email Information"][] = array("Email Body:"=>array("ui"=>82,"value"=>'<iframe src="index.php?module=Webmails&action=body&mailid='.$mailid.'&mailbox='.$mailbox.'" width="100%" height="100%" frameborder="0">You must enabled iframes</iframe>'));
 
 
-echo '<input type="hidden" name="mailid" value="'.$mailid.'">';
-//echo '<pre>';print_r($block);echo "</pre>";
-
-$repbutton = '<table border="0" width="25%"><tr>';
-$repbutton .= '<td><a href="index.php?module=Webmails&action=EditView&mailbox='.$mailbox.'&mailid='.$mailid.'&reply=single"><img src="modules/Webmails/images/stock_mail-reply.png" alt="reply" width="16" height="16"  border="0"><br>Reply</a></td>';
-$repbutton .= '<td><a href="index.php?module=Webmails&action=EditView&mailbox='.$mailbox.'&mailid='.$mailid.'&reply=all"><img src="modules/Webmails/images/stock_mail-reply.png" alt="reply" width="16" height="16"  border="0"><br>Reply To All</a></td>';
-$delbutton = '<td><a href="index.php?module=Webmails&action=index&delete_msg='.$mailid.'"><img src="modules/Webmails/images/stock_trash_full.png" border="0" width="14" height="14" alt="del"><br>Delete</a></td></tr></table>';
-
-
-$smarty = new vtigerCRM_Smarty;
-$smarty->assign("MOD", $mod_strings);
-$smarty->assign("APP", $app_strings);
-$smarty->assign("THEME", $theme);
-$smarty->assign("IMAGE_PATH", $image_path);
-$smarty->assign("CATEGORY","My Home Page");
-$smarty->assign("SINGLE_MOD","Webmails");
-$smarty->assign("NAME", "From: ".$from);
-$smarty->assign("ID", $mailid);
-$smarty->assign("UPCOMING_ACTIVITIES",$atL);
-$smarty->assign("ACTIVITY_TITLE",$at);
-$smarty->assign("BLOCKS",$block);
-$smarty->assign("EDITBUTTON",$repbutton);
-$smarty->assign("DELETEBUTTON",$delbutton);
-$smarty->assign("SINGLE_MOD","Webmails");
-$smarty->assign("MODULE","Webmails");
-$smarty->display("DetailView.tpl");
-imap_close($mbox);
-?>
+echo '<input type="hidden" name="mailid" value="'.$mailid.'">';
+//echo '<pre>';print_r($block);echo "</pre>";
+
+$repbutton = '<table border="0" width="25%"><tr>';
+$repbutton .= '<td><a href="index.php?module=Webmails&action=EditView&mailbox='.$mailbox.'&mailid='.$mailid.'&reply=single"><img src="modules/Webmails/images/stock_mail-reply.png" alt="reply" width="16" height="16"  border="0"><br>Reply</a></td>';
+$repbutton .= '<td><a href="index.php?module=Webmails&action=EditView&mailbox='.$mailbox.'&mailid='.$mailid.'&reply=all"><img src="modules/Webmails/images/stock_mail-reply.png" alt="reply" width="16" height="16"  border="0"><br>Reply To All</a></td>';
+$delbutton = '<td><a href="index.php?module=Webmails&action=index&delete_msg='.$mailid.'"><img src="modules/Webmails/images/stock_trash_full.png" border="0" width="14" height="14" alt="del"><br>Delete</a></td></tr></table>';
+
+
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("CATEGORY","My Home Page");
+$smarty->assign("SINGLE_MOD","Webmails");
+$smarty->assign("NAME", "From: ".$from);
+$smarty->assign("ID", $mailid);
+$smarty->assign("UPCOMING_ACTIVITIES",$atL);
+$smarty->assign("ACTIVITY_TITLE",$at);
+$smarty->assign("BLOCKS",$block);
+$smarty->assign("EDITBUTTON",$repbutton);
+$smarty->assign("DELETEBUTTON",$delbutton);
+$smarty->assign("SINGLE_MOD","Webmails");
+$smarty->assign("MODULE","Webmails");
+$smarty->display("DetailView.tpl");
+imap_close($mbox);
+?>

Modified: vtigercrm/trunk/modules/Webmails/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/EditView.php (original)
+++ vtigercrm/trunk/modules/Webmails/EditView.php Wed May  3 06:00:54 2006
@@ -1,13 +1,13 @@
 <script type="text/javascript" src="include/fckeditor/fckeditor.js"></script>
 <form name="Reply" method="POST" action="index.php">
 <input type="hidden" name="send_mail">
-<?php
-require_once('Smarty_setup.php');
-require_once('data/Tracker.php');
-require_once('modules/Emails/Email.php');
-require_once('modules/Emails/Forms.php');
-require_once('include/utils/utils.php');
-require_once('include/FormValidationUtil.php');
+<?php
+require_once('Smarty_setup.php');
+require_once('data/Tracker.php');
+require_once('modules/Emails/Email.php');
+require_once('modules/Emails/Forms.php');
+require_once('include/utils/utils.php');
+require_once('include/FormValidationUtil.php');
 if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
 
 if($_REQUEST["record"] && $_REQUEST["record"] != "") {$mailid=$_REQUEST["record"];} else {$mailid=$_REQUEST["mailid"];}
@@ -18,153 +18,154 @@
 	<?
 }
 
-
-global $log;
-global $app_strings;
-global $app_list_strings;
-global $mod_strings;
-global $current_user;
-
-$submenu = array('LBL_EMAILS_TITLE'=>'index.php?module=Webmails&action=index','LBL_WEBMAILS_TITLE'=>'index.php?module=Webmailsaction=index');
-
-$sec_arr = array('index.php?module=Emails&action=index'=>'Emails ','index.php?module=Webmails&action=index'=>'Webmails'); 
-echo '<br>';
-
-$focus = new Email();
-$smarty = new vtigerCRM_Smarty();
-
-if($_REQUEST['upload_error'] == true)
-{
-        echo '<br><b><font color="red"> The selected file has no data or a invalid file.</font></b><br>';
-}
-
-//Email Error handling
-if($_REQUEST['mail_error'] != '') 
-{
-	require_once("modules/Emails/mail.php");
-	echo parseEmailErrorString($_REQUEST['mail_error']);
-}
-
-
-global $theme;
-
-$theme_path="themes/".$theme."/";
-$image_path=$theme_path."images/";
-require_once($theme_path.'layout_utils.php');
-
-$disp_view = getView($focus->mode);
-$smarty->assign("MODULE","Webmails");
-$smarty->assign("SINGLE_MOD","Webmails");
-
-$tmp_theme = $theme;
-$msgData='';
-global $mbox;
-
-//WEBMAIL FUNCTIONS
-define('SM_PATH','modules/Webmails/');
-require_once(SM_PATH . 'Webmail.php');
-require_once('include/utils/UserInfoUtil.php');
-
-$mailInfo = getMailServerInfo($current_user);
-$temprow = $adb->fetch_array($mailInfo);
-$login_username= $temprow["mail_username"];
-$secretkey=$temprow["mail_password"];
-$imapServerAddress=$temprow["mail_servername"];
-$start_message=$_REQUEST["start_message"];
-$box_refresh=$temprow["box_refresh"];
-$mails_per_page=$temprow["mails_per_page"];
-$mail_protocol=$temprow["mail_protocol"];
-$ssltype=$temprow["ssltype"];
-$sslmeth=$temprow["sslmeth"];
-
-$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
+
+global $log;
+global $app_strings;
+global $app_list_strings;
+global $mod_strings;
+global $current_user;
+
+$submenu = array('LBL_EMAILS_TITLE'=>'index.php?module=Webmails&action=index','LBL_WEBMAILS_TITLE'=>'index.php?module=Webmailsaction=index');
+
+$sec_arr = array('index.php?module=Emails&action=index'=>'Emails ','index.php?module=Webmails&action=index'=>'Webmails'); 
+echo '<br>';
+
+$focus = new Email();
+$smarty = new vtigerCRM_Smarty();
+
+if($_REQUEST['upload_error'] == true)
+{
+        echo '<br><b><font color="red"> The selected file has no data or a invalid file.</font></b><br>';
+}
+
+//Email Error handling
+if($_REQUEST['mail_error'] != '') 
+{
+	require_once("modules/Emails/mail.php");
+	echo parseEmailErrorString($_REQUEST['mail_error']);
+}
+
+
+global $theme;
+
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once($theme_path.'layout_utils.php');
+
+$disp_view = getView($focus->mode);
+$smarty->assign("MODULE","Webmails");
+$smarty->assign("SINGLE_MOD","Webmails");
+
+$tmp_theme = $theme;
+$msgData='';
+global $mbox;
+
+//WEBMAIL FUNCTIONS
+define('SM_PATH','modules/Webmails/');
+require_once(SM_PATH . 'Webmail.php');
+require_once('include/utils/UserInfoUtil.php');
+
+$mailInfo = getMailServerInfo($current_user);
+$temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
+$imapServerAddress=$temprow["mail_servername"];
+$start_message=$_REQUEST["start_message"];
+$box_refresh=$temprow["box_refresh"];
+$mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+
+//$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
+$mbox = @imap_open('{'.$imapServerAddress.'/'.$mail_protocol.'}'.$mailbox, $login_username, $secretkey) or die("Connection to server failed with: ".imap_last_error());
 $webmail = new Webmail($mbox,$mailid);
-$webmail->loadMail();
-$focus->column_fields['description'] = strip_tags($webmail->body);
-$focus->column_fields['subject'] = $webmail->subject;
-for($i=0;$i<count($webmail->reply_to);$i++) {
-	$reply_to .= $webmail->reply_to[$i].";";
-}
-for($i=0;$i<count($webmail->to);$i++) {
-	$to .= $webmail->to[$i].";";
-}
-for($i=0;$i<count($webmail->cc_list);$i++) {
-	$cc .= $webmail->cc_list[$i].";";
-}
-for($i=0;$i<count($webmail->bcc_list);$i++) {
-	$bcc .= $webmail->bcc_list[$i].";";
-}
-
-$body = "<br /><br /><br /><br /><strong>In reply to the message sent by ";
-$body .= $webmail->fromname." &lt; ".$webmail->from." &gt; on ".$webmail->date.": </strong><br />";
-$body .= "<blockquote type='cite'>".$webmail->body."</blockquote>";
-
-$theme = $tmp_theme;
-
-//get Email Information
-$ddate = date("Y-m-d");
-$dtime = date("h:m");
-if($_REQUEST["reply"] == "all")
+$webmail->loadMail();
+$focus->column_fields['description'] = strip_tags($webmail->body);
+$focus->column_fields['subject'] = $webmail->subject;
+for($i=0;$i<count($webmail->reply_to);$i++) {
+	$reply_to .= $webmail->reply_to[$i].";";
+}
+for($i=0;$i<count($webmail->to);$i++) {
+	$to .= $webmail->to[$i].";";
+}
+for($i=0;$i<count($webmail->cc_list);$i++) {
+	$cc .= $webmail->cc_list[$i].";";
+}
+for($i=0;$i<count($webmail->bcc_list);$i++) {
+	$bcc .= $webmail->bcc_list[$i].";";
+}
+
+$body = "<br /><br /><br /><br /><strong>In reply to the message sent by ";
+$body .= $webmail->fromname." &lt; ".$webmail->from." &gt; on ".$webmail->date.": </strong><br />";
+$body .= "<blockquote type='cite'>".$webmail->body."</blockquote>";
+
+$theme = $tmp_theme;
+
+//get Email Information
+$ddate = date("Y-m-d");
+$dtime = date("h:m");
+if($_REQUEST["reply"] == "all")
 	$tmp = $reply_to."".$to;
-else
-	$tmp = $reply_to;
-
-
-$block["Email Information"][0][] = array(array(6),array("Date &amp; Time Sent:"),array("date_start"),array(array($ddate=>$dtime),array("%Y-%m-%d"=>"yyyy-mm-dd 24:00")));
-$block["Email Information"][0][] = array(array(53),array("Assigned To:"),array("assigned_user_id"),array(array(1=>array($current_user->user_name=>"selected"))));
-
-$block["Email Information"][1][] = array(array(21),array("To:"),array("to_list"),array($tmp));
-$block["Email Information"][1][] = array(array(21),array("CC:"),array("cc_list"),array($cc));
-
-$block["Email Information"][3][] = array(array(1),array("Subject:"),array("subject"),array($webmail->subject));
-
-$block["Email Information"][3][] = array(array(1),array("BCC:"),array("bcc_list"),array($bcc));
-$block["Email Information"][4][] = array(array(19),array("Body :"),array("email_body"),array($body));
-
-//$block["Email Information"][2][0] = array(array(357),array(array("Disabled"=>"selected")),array("parent_id"),array($tmp),array());
-//echo '<pre>';print_r($block);echo '</pre><br><br>';
-$smarty->assign("BLOCKS",$block);
-
-//$smarty->assign("BLOCKS",getBlocks("Emails",$disp_view,$mode,$focus->column_fields));
-//echo '<pre>';print_r(getBlocks("Emails",$disp_view,$mode,$focus->column_fields));echo '</pre>';
-$smarty->assign("OP_MODE",$disp_view);
-
-$disp_view = getView($focus->mode);
-
-//needed when creating a new email with default values passed in
-if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) 
-{
-	$focus->contact_name = $_REQUEST['contact_name'];
-}
-if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) 
-{
-	$focus->contact_id = $_REQUEST['contact_id'];
-}
-if (isset($_REQUEST['parent_name']) && is_null($focus->parent_name)) 
-{
-	$focus->parent_name = $_REQUEST['parent_name'];
-}
-if (isset($_REQUEST['parent_id']) && is_null($focus->parent_id)) 
-{
-	$focus->parent_id = $_REQUEST['parent_id'];
-}
-if (isset($_REQUEST['parent_type'])) 
-{
-	$focus->parent_type = $_REQUEST['parent_type'];
-}
-if (isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true') 
-{
-        $focus->filename = $_REQUEST['filename'];
-}
-elseif (is_null($focus->parent_type)) 
-{
-	$focus->parent_type = $app_list_strings['record_type_default_key'];
-}
-
-$log->info("Email detail view");
-
-$smarty->assign("MOD", $mod_strings);
-$smarty->assign("APP", $app_strings);
+else
+	$tmp = $reply_to;
+
+
+$block["Email Information"][0][] = array(array(6),array("Date &amp; Time Sent:"),array("date_start"),array(array($ddate=>$dtime),array("%Y-%m-%d"=>"yyyy-mm-dd 24:00")));
+$block["Email Information"][0][] = array(array(53),array("Assigned To:"),array("assigned_user_id"),array(array(1=>array($current_user->user_name=>"selected"))));
+
+$block["Email Information"][1][] = array(array(21),array("To:"),array("to_list"),array($tmp));
+$block["Email Information"][1][] = array(array(21),array("CC:"),array("cc_list"),array($cc));
+
+$block["Email Information"][3][] = array(array(1),array("Subject:"),array("subject"),array($webmail->subject));
+
+$block["Email Information"][3][] = array(array(1),array("BCC:"),array("bcc_list"),array($bcc));
+$block["Email Information"][4][] = array(array(19),array("Body :"),array("email_body"),array($body));
+
+//$block["Email Information"][2][0] = array(array(357),array(array("Disabled"=>"selected")),array("parent_id"),array($tmp),array());
+//echo '<pre>';print_r($block);echo '</pre><br><br>';
+$smarty->assign("BLOCKS",$block);
+
+//$smarty->assign("BLOCKS",getBlocks("Emails",$disp_view,$mode,$focus->column_fields));
+//echo '<pre>';print_r(getBlocks("Emails",$disp_view,$mode,$focus->column_fields));echo '</pre>';
+$smarty->assign("OP_MODE",$disp_view);
+
+$disp_view = getView($focus->mode);
+
+//needed when creating a new email with default values passed in
+if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) 
+{
+	$focus->contact_name = $_REQUEST['contact_name'];
+}
+if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) 
+{
+	$focus->contact_id = $_REQUEST['contact_id'];
+}
+if (isset($_REQUEST['parent_name']) && is_null($focus->parent_name)) 
+{
+	$focus->parent_name = $_REQUEST['parent_name'];
+}
+if (isset($_REQUEST['parent_id']) && is_null($focus->parent_id)) 
+{
+	$focus->parent_id = $_REQUEST['parent_id'];
+}
+if (isset($_REQUEST['parent_type'])) 
+{
+	$focus->parent_type = $_REQUEST['parent_type'];
+}
+if (isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true') 
+{
+        $focus->filename = $_REQUEST['filename'];
+}
+elseif (is_null($focus->parent_type)) 
+{
+	$focus->parent_type = $app_list_strings['record_type_default_key'];
+}
+
+$log->info("Email detail view");
+
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
 
 ?>
 <script type="text/javascript" defer="1">
@@ -179,26 +180,26 @@
 </script>
 <?
 
-if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
-else $smarty->assign("NAME", "");
-
-if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
-else $smarty->assign("RETURN_MODULE",'Emails');
-if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
-else $smarty->assign("RETURN_ACTION",'index');
-if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", $_REQUEST['return_id']);
-if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']);
-
-
-$smarty->assign("THEME", $theme);
-$smarty->assign("IMAGE_PATH", $image_path);
-$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
-$smarty->assign("JAVASCRIPT", get_set_focus_js().get_validate_record_js());
-$smarty->assign("ID", $focus->id);
-//$smarty->assign("ENTITY_ID", $_REQUEST["record"]);
-$smarty->assign("ENTITY_TYPE",$_REQUEST["email_directing_module"]);
-$tabid = getTabid("Webmails");
-$category = getParentTab();
-$smarty->assign("CATEGORY",$category);
-$smarty->display("salesEditView.tpl");
-?>
+if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
+else $smarty->assign("NAME", "");
+
+if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
+else $smarty->assign("RETURN_MODULE",'Emails');
+if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
+else $smarty->assign("RETURN_ACTION",'index');
+if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", $_REQUEST['return_id']);
+if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']);
+
+
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+$smarty->assign("JAVASCRIPT", get_set_focus_js().get_validate_record_js());
+$smarty->assign("ID", $focus->id);
+//$smarty->assign("ENTITY_ID", $_REQUEST["record"]);
+$smarty->assign("ENTITY_TYPE",$_REQUEST["email_directing_module"]);
+$tabid = getTabid("Webmails");
+$category = getParentTab();
+$smarty->assign("CATEGORY",$category);
+$smarty->display("salesEditView.tpl");
+?>

Modified: vtigercrm/trunk/modules/Webmails/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/ListView.php (original)
+++ vtigercrm/trunk/modules/Webmails/ListView.php Wed May  3 06:00:54 2006
@@ -40,32 +40,32 @@
 	);
 }
 </script>
-<?php
-global $current_user;
-require_once('Smarty_setup.php');
-require_once("data/Tracker.php");
-require_once('themes/'.$theme.'/layout_utils.php');
-require_once('include/logging.php');
-require_once('include/utils/utils.php');
-require_once('include/utils/UserInfoUtil.php');
-require_once("modules/Webmails/MailParse.php");
+<?php
+global $current_user;
+require_once('Smarty_setup.php');
+require_once("data/Tracker.php");
+require_once('themes/'.$theme.'/layout_utils.php');
+require_once('include/logging.php');
+require_once('include/utils/utils.php');
+require_once('include/utils/UserInfoUtil.php');
+require_once("modules/Webmails/MailParse.php");
 require_once('modules/CustomView/CustomView.php');
 
-$mailInfo = getMailServerInfo($current_user);
+$mailInfo = getMailServerInfo($current_user);
 if($adb->num_rows($mailInfo) < 1) {
 	echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
 	exit();
 }
 
-$temprow = $adb->fetch_array($mailInfo);
-$login_username= $temprow["mail_username"];
-$secretkey=$temprow["mail_password"];
-$imapServerAddress=$temprow["mail_servername"];
-$box_refresh=$temprow["box_refresh"];
-$mails_per_page=$temprow["mails_per_page"];
-$mail_protocol=$temprow["mail_protocol"];
-$ssltype=$temprow["ssltype"];
-$sslmeth=$temprow["sslmeth"];
+$temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
+$imapServerAddress=$temprow["mail_servername"];
+$box_refresh=$temprow["box_refresh"];
+$mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
 $account_name=$temprow["account_name"];
 $show_hidden=$_REQUEST["show_hidden"];
 ?>
@@ -76,8 +76,8 @@
 <script language="JavaScript" type="text/javascript" src="include/js/prototype.js"></script>
 
 <script type="text/Javascript">
-var box_refresh=<?php echo $box_refresh;?>;
-var timer = window.onload=window.setTimeout("refresh_list()",box_refresh);
+//var box_refresh=<?php echo $box_refresh;?>;
+//var timer = window.onload=window.setTimeout("refresh_list()",box_refresh);
 function reset_timer() {
 	timer = window.setTimeout("refresh_list()",box_refresh);
 }
@@ -158,8 +158,9 @@
 
 
 global $mbox;
-$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
-
+//$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
+
+$mbox = @imap_open('{'.$imapServerAddress.'/'.$mail_protocol.'}'.$mailbox, $login_username, $secretkey) or die("Connection to server failed with: ".imap_last_error());
 
 function SureRemoveDir($dir) {
    if(!$dh = @opendir($dir)) return;
@@ -177,10 +178,9 @@
 $save_path='/usr/local/share/vtiger/modules/Webmails/tmp';
 $user_dir=$save_path."/".$_SESSION["authenticated_user_id"];
 
-$elist = fullMailList($mbox);
-//print_r($elist);
-$numEmails = $elist["count"];
-$headers = $elist["headers"];
+$elist = fullMailList($mbox);
+$numEmails = $elist["count"];
+$headers = $elist["headers"];
 
 $start_message=$numEmails;
 $c=$numEmails;
@@ -219,13 +219,13 @@
 echo "</script>";
 
 $listview_header = array("Info","Subject","Date","From","Del");
-$listview_entries = array();
-
-if($numEmails <= 0)
-	$listview_entries[0][] = '<td colspan="6" width="100%" align="center"><b>No Emails In This Folder</b></td>';
-else {
-$i=1;
-    // Main loop to create listview entries
+$listview_entries = array();
+
+if($numEmails <= 0)
+	$listview_entries[0][] = '<td colspan="6" width="100%" align="center"><b>No Emails In This Folder</b></td>';
+else {
+$i=1;
+    // Main loop to create listview entries
     while ($i<$c) {
   	$num = $mails[$start_message]->msgno;
   	// TODO: scan the current db tables to find a
@@ -256,24 +256,26 @@
 
   	// read/unread/forwarded/replied
   	if(!$mails[$start_message]->seen || $mails[$start_message]->recent)
-  		$flags.='<a href="index.php?module=Webmails&action=DetailView&'.$detailParams.'"><img src="modules/Webmails/images/stock_mail-unread.png" border="0" width="10" height="14"></a>&nbsp;';
+		{
+  		$flags.='<a href="sssindex.php?module=Webmails&action=DetailView&'.$detailParams.'"><img src="modules/Webmails/images/stock_mail-unread.png" border="0" width="10" height="14"></a>&nbsp;';
+	}
   	elseif ($mails[$start_message]->in_reply_to || $mails[$start_message]->references || preg_match("/^re:/i",$mails[$start_message]->subject))
 		$flags.='<img src="modules/Webmails/images/stock_mail-replied.png" border="0" width="10" height="12">&nbsp;';
   	elseif (preg_match("/^fw:/i",$mails[$start_message]->subject))
 		$flags.='<img src="modules/Webmails/images/stock_mail-forward.png" border="0" width="10" height="13">&nbsp;';
   	else
-  		$flags.='<a href="index.php?module=Webmails&action=DetailView&'.$detailParams.'"><img src="modules/Webmails/images/stock_mail-read.png" border="0" width="10" height="11"></a>&nbsp;';
-
-  	// Add to Vtiger
+  		$flags.='<a href="xindex.php?module=Webmails&action=DetailView&'.$detailParams.'"><img src="modules/Webmails/images/stock_mail-read.png" border="0" width="10" height="11"></a>&nbsp;';
+
+  	// Add to Vtiger
   	if($mails[$start_message]->flagged)
 		$flags.='<span id="clear_td_'.$num.'"><a href="javascript:runEmailCommand(\'clear_flag\','.$num.');"><img src="modules/Webmails/images/stock_mail-priority-high.png" border="0" width="11" height="11" id="clear_flag_img_'.$num.'"></a></span>';
   	else 
 		$flags.='<span id="set_td_'.$num.'"><a href="javascript:void(0);" onclick="runEmailCommand(\'set_flag\','.$num.');"><img src="modules/Webmails/images/plus.gif" border="0" width="11" height="11" id="set_flag_img_'.$num.'"></a></span>';
 
   	
-  	$tmp=imap_mime_header_decode($mails[$start_message]->from);
-  	$from = $tmp[0]->text;
-  	$listview_entries[$num] = array();
+  	$tmp=imap_mime_header_decode($mails[$start_message]->from);
+  	$from = $tmp[0]->text;
+  	$listview_entries[$num] = array();
 
 	$listview_entries[$num][] = $flags."</td>";
 
@@ -307,14 +309,14 @@
  </td></tr>
 </table>
 <?
-$navigationOutput = getTableHeaderNavigation($navigation_array,'&parenttab=My%20Home%20Page&mailbox='.$mailbox,"Webmails","index",$viewid);
-$navigationOutput .= '<td size="10%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align="right"><a href="index.php?module=Webmails&action=index&'.$defaultParams.'">Check for new e-Mails</a></td>';
-
-$list = imap_getmailboxes($mbox, "{".$imapServerAddress."}", "*");
-sort($list);
-if (is_array($list)) {
-	$boxes = '<select name="mailbox">';
-        foreach ($list as $key => $val) {
+$navigationOutput = getTableHeaderNavigation($navigation_array,'&parenttab=My%20Home%20Page&mailbox='.$mailbox,"Webmails","index",$viewid);
+$navigationOutput .= '<td size="10%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align="right"><a href="index.php?module=Webmails&action=index&'.$defaultParams.'">Check for new e-Mails</a></td>';
+
+$list = imap_getmailboxes($mbox, "{".$imapServerAddress."}", "*");
+sort($list);
+if (is_array($list)) {
+	$boxes = '<select name="mailbox">';
+        foreach ($list as $key => $val) {
 		$tmpval = preg_replace(array("/\{.*?\}/i"),array(""),$val->name);
 		if(preg_match("/trash/i",$tmpval))
 			$img = "webmail_trash.gif";
@@ -322,42 +324,42 @@
 			$img = "webmail_uparrow.gif";
 		else
 			$img = "webmail_downarrow.gif";
-		if ($_REQUEST["mailbox"] == $tmpval) {
-         		$boxes .= '<option value="'.$tmpval.'" SELECTED>'.$tmpval;
+		if ($_REQUEST["mailbox"] == $tmpval) {
+         		$boxes .= '<option value="'.$tmpval.'" SELECTED>'.$tmpval;
 			$folders .= '<li><img src="'.$image_path.'/'.$img.'" align="absmiddle" />&nbsp;&nbsp;<a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu">'.$tmpval.'</a>&nbsp;<b>('.$numEmails.')</b></li>';
 		} else {
          		$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
 			$folders .= '<li><img src="'.$image_path.'/'.$img.'" align="absmiddle" />&nbsp;&nbsp;<a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu">'.$tmpval.'</a>&nbsp;</li>';
 		}
  	}
-	$boxes .= '</select>';
-}
-$navigationOutput .= '<td size="100%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
-$navigationOutput .= $boxes;
-$navigationOutput .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
-$navigationOutput .= '<td align="right">Viewing Messages: <b>'.($start_message+$c).'</b> to <b>'.$start_message.'</b> ('.$numEmails.' Total)</td>';
-
-imap_close($mbox);
-//print_r($listview_entries);
+	$boxes .= '</select>';
+}
+$navigationOutput .= '<td size="100%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
+$navigationOutput .= $boxes;
+$navigationOutput .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
+$navigationOutput .= '<td align="right">Viewing Messages: <b>'.($start_message+$c).'</b> to <b>'.$start_message.'</b> ('.$numEmails.' Total)</td>';
+
+imap_close($mbox);
+//print_r($listview_entries);
 $smarty = new vtigerCRM_Smarty;
 
 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
-$smarty->assign("MOD", $mod_strings);
-$smarty->assign("APP", $app_strings);
-$smarty->assign("IMAGE_PATH",$image_path);
-$smarty->assign("LISTENTITY", $listview_entries);
-$smarty->assign("LISTHEADER", $listview_header);
-$smarty->assign("MODULE","Webmails");
-$smarty->assign("SINGLE_MOD",'Webmails');
-$smarty->assign("BUTTONS",$other_text);
-$smarty->assign("CATEGORY","My  Home Page");
-$smarty->assign("NAVIGATION", $navigationOutput);
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("IMAGE_PATH",$image_path);
+$smarty->assign("LISTENTITY", $listview_entries);
+$smarty->assign("LISTHEADER", $listview_header);
+$smarty->assign("MODULE","Webmails");
+$smarty->assign("SINGLE_MOD",'Webmails');
+$smarty->assign("BUTTONS",$other_text);
+$smarty->assign("CATEGORY","My  Home Page");
+$smarty->assign("NAVIGATION", $navigationOutput);
 $smarty->assign("FOLDER_SELECT", $boxes);
-$smarty->assign("NUM_EMAILS", $numEmails);
+$smarty->assign("NUM_EMAILS", $numEmails);
 $smarty->assign("MAILBOX", $mailbox);
 $smarty->assign("ACCOUNT", $account_name);
 $smarty->assign("BOXLIST",$folders);
-$smarty->display("Webmails.tpl");
-//$smarty->display("ListView.tpl");
-
-?>
+$smarty->display("Webmails.tpl");
+//$smarty->display("ListView.tpl");
+
+?>

Modified: vtigercrm/trunk/modules/Webmails/body.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/body.php (original)
+++ vtigercrm/trunk/modules/Webmails/body.php Wed May  3 06:00:54 2006
@@ -21,8 +21,8 @@
 if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
 
 global $mbox;
-$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
-
+//$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey) or die("Connection to server failed");
+$mbox = @imap_open('{'.$imapServerAddress.'/'.$mail_protocol.'}'.$mailbox, $login_username, $secretkey) or die("Connection to server failed with: ".imap_last_error());
 $email = new Webmail($mbox,$mailid);
 $email->loadMail();
 





More information about the vtigercrm-commits mailing list