[Vtigercrm-commits] [vtiger-commits] r7292 - in /vtigercrm/trunk: Smarty/templates/ComposeEmail.tpl Smarty/templates/Header.tpl modules/Emails/ListView.php modules/Emails/Save.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Jun 20 03:37:25 EDT 2006
Author: saraj
Date: Tue Jun 20 01:37:17 2006
New Revision: 7292
Log:
mail server check has been added and float div integrated
Modified:
vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl
vtigercrm/trunk/Smarty/templates/Header.tpl
vtigercrm/trunk/modules/Emails/ListView.php
vtigercrm/trunk/modules/Emails/Save.php
Modified: vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ComposeEmail.tpl Tue Jun 20 01:37:17 2006
@@ -19,6 +19,7 @@
<title>Compose Mail</title>
<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>
</head>
<body marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<form name="EditView" method="POST" ENCTYPE="multipart/form-data" action="index.php">
@@ -107,7 +108,7 @@
{elseif $elements.2.0 eq 'description'}
<tr>
<td colspan="3" align="center" height="320">
- <input id="description___Config" value="" style="display: none;" type="hidden"><iframe id="description___Frame" src="include/fckeditor/editor/fckeditor.html?InstanceName=description&Toolbar=Default" frameborder="no" height="400" scrolling="no" width="100%"></iframe>
+ <input id="description___Config" value="" style="display: none;" type="hidden"><iframe id="description___Frame" src="include/fckeditor/editor/fckeditor.html?InstanceName=description&Toolbar=Default" frameborder="no" height="370" scrolling="no" width="100%"></iframe>
{if $WEBMAIL eq 'true'}
<textarea style="display: none;" class="detailedViewTextBox" name="description" cols="90" rows="8">{$DESCRIPTION}</textarea>
{else}
@@ -151,10 +152,35 @@
}
if(mode == 'send')
{
- oform.send_mail.value='true';
+ server_check()
+ }else
+ {
+ oform.action.value='Save';
+ oform.submit();
}
- oform.action.value='Save';
- oform.submit();
+}
+function server_check()
+{
+ var oform = window.document.EditView;
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:"module=Emails&action=EmailsAjax&file=Save&ajax=true&server_check=true",
+ onComplete: function(response) {
+ if(response.responseText == 'SUCESS')
+ {
+ oform.send_mail.value='true';
+ oform.action.value='Save';
+ oform.submit();
+ }else
+ {
+ alert('Please Configure Your Mail Server');
+ return false;
+ }
+ }
+ }
+ );
}
</script>
{/literal}
Modified: vtigercrm/trunk/Smarty/templates/Header.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/Header.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/Header.tpl Tue Jun 20 01:37:17 2006
@@ -9,19 +9,22 @@
*
********************************************************************************/
-->*}
-<!-- BEGIN: main -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-
-{literal}
+{literal}
+<style>
+DIV.fixedLay{
+ position:fixed;
+}
+</style>
<!--[if lte IE 6]>
<STYLE type=text/css>HTML {
- OVERFLOW: auto; HEIGHT: 100%
+ OVERFLOW: auto; HEIGHT: 100%;
}
-BODY {
+BODY {
margin:0 0 0 0;
- OVERFLOW: auto; HEIGHT: 100%
+ OVERFLOW: auto; HEIGHT: 100%;
}
DIV.fixedLay {
POSITION: absolute;
@@ -29,7 +32,6 @@
</STYLE>
<![endif]-->
{/literal}
-
<title>{$CURRENT_USER} - {$APP.$CATEGORY} - {$APP.$MODULE_NAME} - {$APP.LBL_BROWSER_TITLE}</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link REL="SHORTCUT ICON" HREF="include/images/vtigercrm_icon.ico">
@@ -462,7 +464,7 @@
</div>
-<div id="status" style="display:none;position:absolute;left:930px;top:90px;height:27px;white-space:nowrap;"><img src="{$IMAGEPATH}status.gif"></div>
+<div id="status" class="fixedLay" style="display:none;left:930px;top:88px;height:27px;white-space:nowrap;"><img src="{$IMAGEPATH}status.gif"></div>
<script>
function openwin()
{ldelim}
Modified: vtigercrm/trunk/modules/Emails/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/ListView.php (original)
+++ vtigercrm/trunk/modules/Emails/ListView.php Tue Jun 20 01:37:17 2006
@@ -162,7 +162,7 @@
//Retreive the Navigation array
$_REQUEST['allflag'] = 'All';
-$navigation_array = getNavigationValues(1, $noofrows, $list_max_entries_per_page);
+$navigation_array = getNavigationValues(1, $noofrows, $noofrows);
//Retreive the List View Table Header
if($viewid !='')
Modified: vtigercrm/trunk/modules/Emails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Save.php (original)
+++ vtigercrm/trunk/modules/Emails/Save.php Tue Jun 20 01:37:17 2006
@@ -1,199 +1,210 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/Save.php,v 1.27 2005/04/29 08:54:38 rank Exp $
- * Description: Saves an Account record and then redirects the browser to the
- * defined return URL.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
-
-//Added on 09-11-2005 to avoid loading the webmail vtiger_files in Email process
-if($_REQUEST['smodule'] != '')
-{
- define('SM_PATH','modules/squirrelmail-1.4.4/');
- /* SquirrelMail required vtiger_files. */
- require_once(SM_PATH . 'functions/strings.php');
- require_once(SM_PATH . 'functions/imap_general.php');
- require_once(SM_PATH . 'functions/imap_messages.php');
- require_once(SM_PATH . 'functions/i18n.php');
- require_once(SM_PATH . 'functions/mime.php');
- require_once(SM_PATH .'include/load_prefs.php');
- //require_once(SM_PATH . 'class/mime/Message.class.php');
- require_once(SM_PATH . 'class/mime.class.php');
- sqgetGlobalVar('key', $key, SQ_COOKIE);
- sqgetGlobalVar('username', $username, SQ_SESSION);
- sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
- $mailbox = 'INBOX';
-}
-
-require_once('modules/Emails/Email.php');
-require_once('include/logging.php');
-require_once('include/database/PearDatabase.php');
-
-$local_log =& LoggerManager::getLogger('index');
-
-$focus = new Email();
-
-global $current_user;
-setObjectValuesFromRequest(&$focus);
-//Check if the file is exist or not.
-if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '')
-{
- $file_upload_error = true;
- $_FILES = '';
-}
-if((isset($_REQUEST['deletebox']) && $_REQUEST['deletebox'] != null) && $_REQUEST['addbox'] == null)
-{
- imap_delete($mbox,$_REQUEST['deletebox']);
- imap_expunge($mbox);
- header("Location: index.php?module=Emails&action=index");
- exit();
-}
-/*if(isset($_REQUEST['fromemail']) && $_REQUEST['fromemail'] != null)
-{
- //get the list of data from the comma separated array
- $emailids = explode(",",$_REQUEST['fromemail']);
- $subjects = explode(",",$_REQUEST['subject']);
- $ids = explode(",",$_REQUEST['idlist']);
- $total = count($ids);
- for($z=0;$z<$total;$z++)
- {
- $msgData='';
- global $current_user;
- require_once('include/utils/UserInfoUtil.php');
- $mailInfo = getMailServerInfo($current_user);
- $temprow = $adb->fetch_array($mailInfo);
-
- $secretkey=$temprow["mail_password"];
- $imapServerAddress=$temprow["mail_servername"];
- $imapPort="143";
-
- $key = OneTimePadEncrypt($secretkey, $onetimepad);
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
- $mbx_response=sqimap_mailbox_select($imapConnection, $mailbox);
-
- $message = sqimap_get_message($imapConnection, $ids[$z], $mailbox);
- $header = $message->rfc822_header;
- $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
- $cnt = count($ent_ar);
- global $color;
- for ($u = 0; $u < $cnt; $u++)
- {
- $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$u], $ids[$z], $mailbox);
- $msgData = $messagebody;
- }
-
- $ctctExists = checkIfContactExists($emailids[$z]);
- if($ctctExists > 0)
- {
- $focus->column_fields['parent_id']=$ctctExists;
- }
- global $current_user;
-
- $focus->column_fields['subject']=$subjects[$z];
- $focus->column_fields["activitytype"]="Emails";
- //this line has been added to get the related list data in the contact description
- $focus->column_fields["assigned_user_id"]=$current_user->id;
- $focus->column_fields["date_start"]=$_REQUEST['adddate'];
- $focus->column_fields["time_start"]=$_REQUEST['adddate'];
-
- $focus->column_fields["description"]=$msgData;
- $focus->save("Emails");
- $return_id = $focus->id;
- $return_module='Emails';
- $return_action='DetailView';
- }
- header("Location: index.php?action=$return_action&module=$return_module&parent_id=$parent_id&record=$return_id&filename=$filename");
- return;
-}*/
-
-/** Function to check whether the contact is exist of not
- * input : contact id
- * return : contact id if contact exist, else -1 will be return
- */
-function checkIfContactExists($mailid)
-{
- global $log;
- $log->debug("Entering checkIfContactExists(".$mailid.") method ...");
- global $adb;
- $sql = "select contactid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and email= ".$adb->quote($mailid);
- $result = $adb->query($sql);
- $numRows = $adb->num_rows($result);
- if($numRows > 0)
- {
- $log->debug("Exiting checkIfContactExists method ...");
- return $adb->query_result($result,0,"contactid");
- }
- else
- {
- $log->debug("Exiting checkIfContactExists method ...");
- return -1;
- }
-}
-//assign the focus values
-$focus->filename = $_REQUEST['file_name'];
-$focus->parent_id = $_REQUEST['parent_id'];
-$focus->parent_type = $_REQUEST['parent_type'];
-$focus->column_fields["assigned_user_id"]=$current_user->id;
-$focus->column_fields["activitytype"]="Emails";
-$focus->column_fields["date_start"]= date('Y-m-d');
-$focus->save("Emails");
-
-//saving the email details in vtiger_emaildetails vtiger_table
-$return_id = $focus->id;
-$email_id = $return_id;
-$query = 'select emailid from vtiger_emaildetails where emailid ='.$email_id;
-$result = $adb->query($query);
-if(isset($_REQUEST["hidden_toid"]) && $_REQUEST["hidden_toid"]!='')
- $all_to_ids = ereg_replace(",","###",$_REQUEST["hidden_toid"]);
-if(isset($_REQUEST["saved_toid"]) && $_REQUEST["saved_toid"]!='')
- $all_to_ids .= ereg_replace(",","###",$_REQUEST["saved_toid"]);
-
-$all_cc_ids = ereg_replace(",","###",$_REQUEST["ccmail"]);
-$all_bcc_ids = ereg_replace(",","###",$_REQUEST["bccmail"]);
-if($adb->num_rows($result) > 0)
-{
- $query = 'update vtiger_emaildetails set to_email="'.$all_to_ids.'",cc_email="'.$all_cc_ids.'",bcc_email="'.$all_bcc_ids.'",idlists="'.$_REQUEST["parent_id"].'",email_flag="SAVED" where emailid = '.$email_id;
-}else
-{
- $query = 'insert into vtiger_emaildetails values ('.$email_id.',"","'.$all_to_ids.'","'.$all_cc_ids.'","'.$all_bcc_ids.'","","'.$_REQUEST["parent_id"].'","SAVED")';
-}
-$adb->query($query);
-
-
-$focus->retrieve_entity_info($return_id,"Emails");
-
-//this is to receive the data from the Select Users button
-if($_REQUEST['source_module'] == null)
-{
- $module = 'users';
-}
-//this will be the case if the Select Contact button is chosen
-else
-{
- $module = $_REQUEST['source_module'];
-}
-
-if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
-else $return_module = "Emails";
-if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
-else $return_action = "DetailView";
-if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = $_REQUEST['return_id'];
-if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "") $filename = $_REQUEST['filename'];
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/Save.php,v 1.27 2005/04/29 08:54:38 rank Exp $
+ * Description: Saves an Account record and then redirects the browser to the
+ * defined return URL.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ ********************************************************************************/
+ //check for mail server configuration thro ajax
+if(isset($_REQUEST['server_check']) && $_REQUEST['server_check'] == 'true')
+{
+ $sql="select * from vtiger_systems where server_type = 'email'";
+ $records=$adb->num_rows($adb->query($sql),0,"id");
+ if($records != '')
+ echo 'SUCESS';
+ else
+ echo 'FAILURE';
+ die;
+}
+
+//Added on 09-11-2005 to avoid loading the webmail vtiger_files in Email process
+if($_REQUEST['smodule'] != '')
+{
+ define('SM_PATH','modules/squirrelmail-1.4.4/');
+ /* SquirrelMail required vtiger_files. */
+ require_once(SM_PATH . 'functions/strings.php');
+ require_once(SM_PATH . 'functions/imap_general.php');
+ require_once(SM_PATH . 'functions/imap_messages.php');
+ require_once(SM_PATH . 'functions/i18n.php');
+ require_once(SM_PATH . 'functions/mime.php');
+ require_once(SM_PATH .'include/load_prefs.php');
+ //require_once(SM_PATH . 'class/mime/Message.class.php');
+ require_once(SM_PATH . 'class/mime.class.php');
+ sqgetGlobalVar('key', $key, SQ_COOKIE);
+ sqgetGlobalVar('username', $username, SQ_SESSION);
+ sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
+ $mailbox = 'INBOX';
+}
+
+require_once('modules/Emails/Email.php');
+require_once('include/logging.php');
+require_once('include/database/PearDatabase.php');
+
+$local_log =& LoggerManager::getLogger('index');
+
+$focus = new Email();
+
+global $current_user;
+setObjectValuesFromRequest(&$focus);
+//Check if the file is exist or not.
+if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '')
+{
+ $file_upload_error = true;
+ $_FILES = '';
+}
+if((isset($_REQUEST['deletebox']) && $_REQUEST['deletebox'] != null) && $_REQUEST['addbox'] == null)
+{
+ imap_delete($mbox,$_REQUEST['deletebox']);
+ imap_expunge($mbox);
+ header("Location: index.php?module=Emails&action=index");
+ exit();
+}
+/*if(isset($_REQUEST['fromemail']) && $_REQUEST['fromemail'] != null)
+{
+ //get the list of data from the comma separated array
+ $emailids = explode(",",$_REQUEST['fromemail']);
+ $subjects = explode(",",$_REQUEST['subject']);
+ $ids = explode(",",$_REQUEST['idlist']);
+ $total = count($ids);
+ for($z=0;$z<$total;$z++)
+ {
+ $msgData='';
+ global $current_user;
+ require_once('include/utils/UserInfoUtil.php');
+ $mailInfo = getMailServerInfo($current_user);
+ $temprow = $adb->fetch_array($mailInfo);
+
+ $secretkey=$temprow["mail_password"];
+ $imapServerAddress=$temprow["mail_servername"];
+ $imapPort="143";
+
+ $key = OneTimePadEncrypt($secretkey, $onetimepad);
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+ $mbx_response=sqimap_mailbox_select($imapConnection, $mailbox);
+
+ $message = sqimap_get_message($imapConnection, $ids[$z], $mailbox);
+ $header = $message->rfc822_header;
+ $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
+ $cnt = count($ent_ar);
+ global $color;
+ for ($u = 0; $u < $cnt; $u++)
+ {
+ $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$u], $ids[$z], $mailbox);
+ $msgData = $messagebody;
+ }
+
+ $ctctExists = checkIfContactExists($emailids[$z]);
+ if($ctctExists > 0)
+ {
+ $focus->column_fields['parent_id']=$ctctExists;
+ }
+ global $current_user;
+
+ $focus->column_fields['subject']=$subjects[$z];
+ $focus->column_fields["activitytype"]="Emails";
+ //this line has been added to get the related list data in the contact description
+ $focus->column_fields["assigned_user_id"]=$current_user->id;
+ $focus->column_fields["date_start"]=$_REQUEST['adddate'];
+ $focus->column_fields["time_start"]=$_REQUEST['adddate'];
+
+ $focus->column_fields["description"]=$msgData;
+ $focus->save("Emails");
+ $return_id = $focus->id;
+ $return_module='Emails';
+ $return_action='DetailView';
+ }
+ header("Location: index.php?action=$return_action&module=$return_module&parent_id=$parent_id&record=$return_id&filename=$filename");
+ return;
+}*/
+
+/** Function to check whether the contact is exist of not
+ * input : contact id
+ * return : contact id if contact exist, else -1 will be return
+ */
+function checkIfContactExists($mailid)
+{
+ global $log;
+ $log->debug("Entering checkIfContactExists(".$mailid.") method ...");
+ global $adb;
+ $sql = "select contactid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and email= ".$adb->quote($mailid);
+ $result = $adb->query($sql);
+ $numRows = $adb->num_rows($result);
+ if($numRows > 0)
+ {
+ $log->debug("Exiting checkIfContactExists method ...");
+ return $adb->query_result($result,0,"contactid");
+ }
+ else
+ {
+ $log->debug("Exiting checkIfContactExists method ...");
+ return -1;
+ }
+}
+//assign the focus values
+$focus->filename = $_REQUEST['file_name'];
+$focus->parent_id = $_REQUEST['parent_id'];
+$focus->parent_type = $_REQUEST['parent_type'];
+$focus->column_fields["assigned_user_id"]=$current_user->id;
+$focus->column_fields["activitytype"]="Emails";
+$focus->column_fields["date_start"]= date('Y-m-d');
+$focus->save("Emails");
+
+//saving the email details in vtiger_emaildetails vtiger_table
+$return_id = $focus->id;
+$email_id = $return_id;
+$query = 'select emailid from vtiger_emaildetails where emailid ='.$email_id;
+$result = $adb->query($query);
+if(isset($_REQUEST["hidden_toid"]) && $_REQUEST["hidden_toid"]!='')
+ $all_to_ids = ereg_replace(",","###",$_REQUEST["hidden_toid"]);
+if(isset($_REQUEST["saved_toid"]) && $_REQUEST["saved_toid"]!='')
+ $all_to_ids .= ereg_replace(",","###",$_REQUEST["saved_toid"]);
+
+$all_cc_ids = ereg_replace(",","###",$_REQUEST["ccmail"]);
+$all_bcc_ids = ereg_replace(",","###",$_REQUEST["bccmail"]);
+if($adb->num_rows($result) > 0)
+{
+ $query = 'update vtiger_emaildetails set to_email="'.$all_to_ids.'",cc_email="'.$all_cc_ids.'",bcc_email="'.$all_bcc_ids.'",idlists="'.$_REQUEST["parent_id"].'",email_flag="SAVED" where emailid = '.$email_id;
+}else
+{
+ $query = 'insert into vtiger_emaildetails values ('.$email_id.',"","'.$all_to_ids.'","'.$all_cc_ids.'","'.$all_bcc_ids.'","","'.$_REQUEST["parent_id"].'","SAVED")';
+}
+$adb->query($query);
+
+
+$focus->retrieve_entity_info($return_id,"Emails");
+
+//this is to receive the data from the Select Users button
+if($_REQUEST['source_module'] == null)
+{
+ $module = 'users';
+}
+//this will be the case if the Select Contact button is chosen
+else
+{
+ $module = $_REQUEST['source_module'];
+}
+
+if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
+else $return_module = "Emails";
+if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
+else $return_action = "DetailView";
+if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = $_REQUEST['return_id'];
+if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "") $filename = $_REQUEST['filename'];
$local_log->debug("Saved record with id of ".$return_id);
More information about the vtigercrm-commits
mailing list