[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Emails/ -> EditView.php (source)

   1  <?php
   2  /*********************************************************************************
   3   * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
   4   * ("License"); You may not use this file except in compliance with the
   5   * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
   6   * Software distributed under the License is distributed on an  "AS IS"  basis,
   7   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   8   * the specific language governing rights and limitations under the License.
   9   * The Original Code is:  SugarCRM Open Source
  10   * The Initial Developer of the Original Code is SugarCRM, Inc.
  11   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
  12   * All Rights Reserved.
  13   * Contributor(s): ______________________________________.
  14   ********************************************************************************/
  15  /*********************************************************************************
  16   * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/EditView.php,v 1.25 2005/04/18 10:37:49 samk Exp $
  17   * Description: TODO:  To be written.
  18   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  19   * All Rights Reserved.
  20   * Contributor(s): ______________________________________..
  21   ********************************************************************************/
  22  
  23  require_once ('Smarty_setup.php');
  24  require_once ('data/Tracker.php');
  25  require_once ('modules/Emails/Emails.php');
  26  require_once ('include/utils/utils.php');
  27  require_once ('include/utils/UserInfoUtil.php');
  28  require_once ('include/FormValidationUtil.php');
  29  
  30  global $log;
  31  global $app_strings;
  32  global $app_list_strings;
  33  global $mod_strings;
  34  global $current_user;
  35  global $currentModule;
  36  
  37  $focus = new Emails();
  38  $smarty = new vtigerCRM_Smarty();
  39  
  40  if($_REQUEST['upload_error'] == true)
  41  {
  42          echo '<br><b><font color="red"> The selected file has no data or a invalid file.</font></b><br>';
  43  }
  44  
  45  //Email Error handling
  46  if($_REQUEST['mail_error'] != '') 
  47  {
  48      require_once ("modules/Emails/mail.php");
  49      echo parseEmailErrorString($_REQUEST['mail_error']);
  50  }
  51  
  52  
  53  if(isset($_REQUEST['record']) && $_REQUEST['record'] !='') 
  54  {
  55      $focus->id = $_REQUEST['record'];
  56      $focus->mode = 'edit';
  57      $focus->retrieve_entity_info($_REQUEST['record'],"Emails");
  58      if(isset($_REQUEST['forward']) && $_REQUEST['forward'] != '')
  59      {
  60          $focus->mode = '';
  61      }else
  62      {
  63          $query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid ='.$focus->id;
  64          $result = $adb->query($query);
  65          $smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email'));    
  66          $to_email = ereg_replace('###',',',$adb->query_result($result,0,'to_email'));
  67          $smarty->assign('TO_MAIL',$to_email);    
  68          $smarty->assign('CC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'cc_email')));    
  69          $smarty->assign('BCC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'bcc_email')));    
  70          $smarty->assign('IDLISTS',ereg_replace('###',',',$adb->query_result($result,0,'idlists')));    
  71      }
  72      $log->info("Entity info successfully retrieved for EditView.");
  73      $focus->name=$focus->column_fields['name'];        
  74  }
  75  elseif(isset($_REQUEST['sendmail']) && $_REQUEST['sendmail'] !='')
  76  {
  77      $mailids = get_to_emailids($_REQUEST['pmodule']);
  78      $smarty->assign('TO_MAIL',$mailids['mailds']);
  79      $smarty->assign('IDLISTS',$mailids['idlists']);    
  80      $focus->mode = '';
  81  }
  82  
  83  // INTERNAL MAILER
  84  if($_REQUEST["internal_mailer"] == "true") {
  85      $smarty->assign('INT_MAILER',"true");
  86      $rec_type = $_REQUEST["type"];
  87      $rec_id = $_REQUEST["rec_id"];
  88  
  89      if($rec_type == "record_id") {
  90          $rs = $adb->query("select setype from vtiger_crmentity where crmid='".$rec_id."'");
  91          $type = $adb->query_result($rs,0,'setype');
  92  
  93          if($type == "Leads") 
  94              $q = "select email as email1 from vtiger_leaddetails where leadid='".$rec_id."'";
  95          elseif ($type == "Contacts")
  96              $q = "select email as email1 from vtiger_contactdetails where contactid='".$rec_id."'";
  97          elseif ($type == "Accounts")
  98              $q = "select email1,email2 from vtiger_account where accountid='".$rec_id."'";
  99  
 100          $email1 = $adb->query_result($adb->query($q),0,"email1");
 101      } elseif ($rec_type == "email_addy") {
 102          $email1 = $_REQUEST["email_addy"];
 103      }
 104  
 105      $smarty->assign('TO_MAIL',$email1);
 106      $smarty->assign('BCC_MAIL',$current_user->email1);
 107  }
 108  
 109  // Webmails
 110  if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") {
 111      $mailid = $_REQUEST["mailid"];
 112      $mailbox = $_REQUEST["mailbox"];
 113      require_once ('include/utils/UserInfoUtil.php');
 114      require_once ("modules/Webmails/Webmail.php");
 115      require_once ("modules/Webmails/MailParse.php");
 116      require_once ('modules/Webmails/MailBox.php');
 117  
 118      $mailInfo = getMailServerInfo($current_user);
 119      $temprow = $adb->fetch_array($mailInfo);
 120  
 121      $MailBox = new MailBox($mailbox);
 122      $mbox = $MailBox->mbox;
 123  
 124      $webmail = new Webmail($mbox,$mailid);
 125      $webmail->loadMail();
 126  
 127      $smarty->assign('WEBMAIL',"true");
 128      if($_REQUEST["reply"] == "all") {
 129          $smarty->assign('TO_MAIL',$webmail->fromaddr);    
 130          if(is_array($webmail->cc_list))
 131              $smarty->assign('CC_MAIL',implode(",",$webmail->cc_list).",".implode(",",$webmail->to));
 132          else
 133              $smarty->assign('CC_MAIL',implode(",",$webmail->to));
 134          if(preg_match("/RE:/i", $webmail->subject))
 135              $smarty->assign('SUBJECT',$webmail->subject);
 136          else
 137              $smarty->assign('SUBJECT',"RE: ".$webmail->subject);
 138  
 139      } elseif($_REQUEST["reply"] == "single") {
 140          $smarty->assign('TO_MAIL',$webmail->reply_to[0]);    
 141          $smarty->assign('BCC_MAIL',$webmail->to[0]);
 142          if(preg_match("/RE:/i", $webmail->subject))
 143              $smarty->assign('SUBJECT',$webmail->subject);
 144          else
 145              $smarty->assign('SUBJECT',"RE: ".$webmail->subject);
 146  
 147      } elseif($_REQUEST["forward"] == "true") {
 148          $smarty->assign('TO_MAIL',$webmail->reply_to[0]);    
 149          $smarty->assign('BCC_MAIL',$webmail->to[0]);
 150          if(preg_match("/FW:/i", $webmail->subject))
 151              $smarty->assign('SUBJECT',$webmail->subject);
 152          else
 153              $smarty->assign('SUBJECT',"FW: ".$webmail->subject);
 154      }
 155      $smarty->assign('DESCRIPTION',$webmail->replyBody());
 156      $focus->mode='';
 157  }
 158  
 159  global $theme;
 160  $theme_path="themes/".$theme."/";
 161  $image_path=$theme_path."images/";
 162  require_once ($theme_path.'layout_utils.php');
 163  
 164  $disp_view = getView($focus->mode);
 165  $details = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields);
 166  $smarty->assign("BLOCKS",$details['Email Information']);
 167  $smarty->assign("MODULE",$currentModule);
 168  $smarty->assign("SINGLE_MOD",$app_strings['Email']);
 169  
 170  
 171  //needed when creating a new email with default values passed in
 172  if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) 
 173  {
 174      $focus->contact_name = $_REQUEST['contact_name'];
 175  }
 176  if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) 
 177  {
 178      $focus->contact_id = $_REQUEST['contact_id'];
 179  }
 180  if (isset($_REQUEST['parent_name']) && is_null($focus->parent_name)) 
 181  {
 182      $focus->parent_name = $_REQUEST['parent_name'];
 183  }
 184  if (isset($_REQUEST['parent_id']) && is_null($focus->parent_id)) 
 185  {
 186      $focus->parent_id = $_REQUEST['parent_id'];
 187  }
 188  if (isset($_REQUEST['parent_type'])) 
 189  {
 190      $focus->parent_type = $_REQUEST['parent_type'];
 191  }
 192  if (isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true') 
 193  {
 194          $focus->filename = $_REQUEST['filename'];
 195  }
 196  elseif (is_null($focus->parent_type)) 
 197  {
 198      $focus->parent_type = $app_list_strings['record_type_default_key'];
 199  }
 200  
 201  $log->info("Email detail view");
 202  
 203  $smarty->assign("MOD", $mod_strings);
 204  $smarty->assign("APP", $app_strings);
 205  if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
 206  else $smarty->assign("NAME", "");
 207  
 208  
 209  //Added to set the cc when click reply all
 210  if(isset($_REQUEST['msg_cc']) && $_REQUEST['msg_cc'] != '')
 211  {
 212          $smarty->assign("MAIL_MSG_CC", $_REQUEST['msg_cc']);
 213  }
 214  
 215  if($focus->mode == 'edit')
 216  {
 217      $smarty->assign("UPDATEINFO",updateInfo($focus->id));
 218          $smarty->assign("MODE", $focus->mode);
 219  }
 220  
 221  // Unimplemented until jscalendar language vtiger_files are fixed
 222  
 223  $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
 224  $smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
 225  
 226  if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
 227  else $smarty->assign("RETURN_MODULE",'Emails');
 228  if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
 229  else $smarty->assign("RETURN_ACTION",'index');
 230  if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", $_REQUEST['return_id']);
 231  if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']);
 232  
 233  
 234  $smarty->assign("THEME", $theme);
 235  $smarty->assign("IMAGE_PATH", $image_path);
 236  $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
 237  $smarty->assign("ID", $focus->id);
 238  $smarty->assign("ENTITY_ID", $_REQUEST["record"]);
 239  $smarty->assign("ENTITY_TYPE",$_REQUEST["email_directing_module"]);
 240  $smarty->assign("OLD_ID", $old_id );
 241  //Display the FCKEditor or not? -- configure $FCKEDITOR_DISPLAY in config.php 
 242  $smarty->assign("FCKEDITOR_DISPLAY",$FCKEDITOR_DISPLAY);
 243  
 244  if(empty($focus->filename))
 245  {
 246          $smarty->assign("FILENAME_TEXT", "");
 247          $smarty->assign("FILENAME", "");
 248  }
 249  else
 250  {
 251          $smarty->assign("FILENAME_TEXT", "(".$focus->filename.")");
 252          $smarty->assign("FILENAME", $focus->filename);
 253  }
 254  
 255  $check_button = Button_Check($module);
 256  $smarty->assign("CHECK", $check_button);
 257  
 258  $smarty->display("ComposeEmail.tpl");
 259  ?>
 260  


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7