/** * Renders the frame for emails */ function displayEmailFrame() { require_once "include/OutboundEmail/OutboundEmail.php"; global $app_strings, $app_list_strings; global $mod_strings; global $sugar_config; global $current_user; global $locale; global $timedate; global $theme; global $sugar_version; global $sugar_flavor; global $current_language; global $server_unique_key; $this->preflightUserCache(); $ie = new InboundEmail(); // focus listView $list = array('mbox' => 'Home', 'ieId' => '', 'name' => 'Home', 'unreadChecked' => 0, 'out' => array()); $this->_generateComposeConfigData('email_compose'); //Check quick create module access $QCAvailableModules = $this->_loadQuickCreateModules(); //Get the quickSearch js needed for assigned user id on Search Tab require_once 'include/QuickSearchDefaults.php'; $qsd = QuickSearchDefaults::getQuickSearchDefaults(); $qsd->setFormName('advancedSearchForm'); $quicksearchAssignedUser = "******"; $quicksearchAssignedUser .= "sqs_objects['advancedSearchForm_assigned_user_name']=" . json_encode($qsd->getQSUser()) . ";"; $qsd->setFormName('Distribute'); $quicksearchAssignedUser .= "sqs_objects['Distribute_assigned_user_name']=" . json_encode($qsd->getQSUser()) . ";"; $this->smarty->assign('quickSearchForAssignedUser', $quicksearchAssignedUser); /////////////////////////////////////////////////////////////////////// //// BASIC ASSIGNS $this->smarty->assign("currentUserId", $current_user->id); $this->smarty->assign("CURRENT_USER_EMAIL", $current_user->email1); $this->smarty->assign("currentUserName", $current_user->name); $this->smarty->assign('yuiPath', 'modules/Emails/javascript/yui-ext/'); $this->smarty->assign('app_strings', $app_strings); $this->smarty->assign('mod_strings', $mod_strings); $this->smarty->assign('theme', $theme); $this->smarty->assign('sugar_config', $sugar_config); $this->smarty->assign('is_admin', $current_user->is_admin); $this->smarty->assign('sugar_version', $sugar_version); $this->smarty->assign('sugar_flavor', $sugar_flavor); $this->smarty->assign('current_language', $current_language); $this->smarty->assign('server_unique_key', $server_unique_key); $this->smarty->assign('qcModules', json_encode($QCAvailableModules)); $extAllDebugValue = "ext-all.js"; $this->smarty->assign('extFileName', $extAllDebugValue); // settings: general $e2UserPreferences = $this->getUserPrefsJS(); $emailSettings = $e2UserPreferences['emailSettings']; /////////////////////////////////////////////////////////////////////// //// USER SETTINGS // settings: accounts $cuDatePref = $current_user->getUserDateTimePreferences(); $this->smarty->assign('dateFormat', $cuDatePref['date']); $this->smarty->assign('dateFormatExample', str_replace(array("Y", "m", "d"), array("yyyy", "mm", "dd"), $cuDatePref['date'])); $this->smarty->assign('calFormat', $timedate->get_cal_date_format()); $this->smarty->assign('TIME_FORMAT', $timedate->get_user_time_format()); $ieAccounts = $ie->retrieveByGroupId($current_user->id); $ieAccountsOptions = "<option value=''>{$app_strings['LBL_NONE']}</option>\n"; foreach ($ieAccounts as $k => $v) { $disabled = !$v->is_personal ? "DISABLED" : ""; $group = !$v->is_personal ? $app_strings['LBL_EMAIL_GROUP'] . "." : ""; $ieAccountsOptions .= "<option value='{$v->id}' {$disabled}>{$group}{$v->name}</option>\n"; } $this->smarty->assign('ieAccounts', $ieAccountsOptions); $this->smarty->assign('rollover', $this->rolloverStyle); $protocol = filterInboundEmailPopSelection($app_list_strings['dom_email_server_type']); $this->smarty->assign('PROTOCOL', get_select_options_with_id($protocol, '')); $this->smarty->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '')); $this->smarty->assign('ie_mod_strings', return_module_language($current_language, 'InboundEmail')); $charsetSelectedValue = isset($emailSettings['defaultOutboundCharset']) ? $emailSettings['defaultOutboundCharset'] : false; if (!$charsetSelectedValue) { $charsetSelectedValue = $current_user->getPreference('default_export_charset', 'global'); if (!$charsetSelectedValue) { $charsetSelectedValue = $locale->getPrecedentPreference('default_email_charset'); } } $charset = array('options' => $locale->getCharsetSelect(), 'selected' => $charsetSelectedValue); $this->smarty->assign('charset', $charset); $emailCheckInterval = array('options' => $app_strings['LBL_EMAIL_CHECK_INTERVAL_DOM'], 'selected' => $emailSettings['emailCheckInterval']); $this->smarty->assign('emailCheckInterval', $emailCheckInterval); $this->smarty->assign('attachmentsSearchOptions', $app_list_strings['checkbox_dom']); $this->smarty->assign('sendPlainTextChecked', $emailSettings['sendPlainText'] == 1 ? 'CHECKED' : ''); $this->smarty->assign('showNumInList', get_select_options_with_id($app_list_strings['email_settings_num_dom'], $emailSettings['showNumInList'])); //// END USER SETTINGS /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// //// SIGNATURES $prependSignature = $current_user->getPreference('signature_prepend') ? 'true' : 'false'; $defsigID = $current_user->getPreference('signature_default'); $this->smarty->assign('signatures', $current_user->getSignatures(false, $defsigID)); $this->smarty->assign('signaturesSettings', $current_user->getSignatures(false, $defsigID, false)); $signatureButtons = $current_user->getSignatureButtons('SUGAR.email2.settings.createSignature', !empty($defsigID)); if (!empty($defsigID)) { $signatureButtons = $signatureButtons . '<span name="delete_sig" id="delete_sig" style="visibility:inherit;"><input class="button" onclick="javascript:SUGAR.email2.settings.deleteSignature();" value="' . $app_strings['LBL_EMAIL_DELETE'] . '" type="button" tabindex="392"> </span>'; } else { $signatureButtons = $signatureButtons . '<span name="delete_sig" id="delete_sig" style="visibility:hidden;"><input class="button" onclick="javascript:SUGAR.email2.settings.deleteSignature();" value="' . $app_strings['LBL_EMAIL_DELETE'] . '" type="button" tabindex="392"> </span>'; } $this->smarty->assign('signatureButtons', $signatureButtons); $this->smarty->assign('signaturePrepend', $prependSignature == 'true' ? 'CHECKED' : ''); //// END SIGNATURES /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// //// EMAIL TEMPLATES $email_templates_arr = $this->getEmailTemplatesArray(); natcasesort($email_templates_arr); $this->smarty->assign('EMAIL_TEMPLATE_OPTIONS', get_select_options_with_id($email_templates_arr, '')); //// END EMAIL TEMPLATES /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// //// FOLDERS & TreeView $this->smarty->assign('groupUserOptions', $ie->getGroupsWithSelectOptions(array('' => $app_strings['LBL_EMAIL_CREATE_NEW']))); $tree = $this->getMailboxNodes(); // preloaded folder $preloadFolder = 'lazyLoadFolder = '; $focusFolderSerial = $current_user->getPreference('focusFolder', 'Emails'); if (!empty($focusFolderSerial)) { $focusFolder = unserialize($focusFolderSerial); //$focusFolder['ieId'], $focusFolder['folder'] $preloadFolder .= json_encode($focusFolder) . ";"; } else { $preloadFolder .= "new Object();"; } //// END FOLDERS /////////////////////////////////////////////////////////////////////// $out = ""; $out .= $this->smarty->fetch("modules/Emails/templates/_baseEmail.tpl"); $out .= $tree->generate_header(); $out .= $tree->generateNodesNoInit(true, 'email2treeinit'); $out .= <<<eoq \t\t\t<script type="text/javascript" language="javascript"> \t\t\t\tvar loader = new YAHOO.util.YUILoader({ \t\t\t\t require : [ \t\t\t\t \t"layout", "element", "tabview", "menu", \t\t\t\t \t"cookie", "sugarwidgets" \t\t\t\t ], \t\t\t\t loadOptional: true, \t\t\t\t skin: { base: 'blank', defaultSkin: '' }, \t\t\t\t onSuccess: email2init, \t\t\t\t allowRollup: true, \t\t\t\t base: "include/javascript/yui/build/" \t\t\t\t}); \t\t\t\tloader.addModule({ \t\t\t\t name :"sugarwidgets", \t\t\t\t type : "js", \t\t\t\t fullpath: "include/javascript/sugarwidgets/SugarYUIWidgets.js", \t\t\t\t varName: "YAHOO.SUGAR", \t\t\t\t requires: ["datatable", "dragdrop", "treeview", "tabview", "calendar"] \t\t\t\t}); \t\t\t\tloader.insert(); \t\t\t\t{$preloadFolder}; \t\t\t</script> eoq; return $out; }
$xtpl->assign('NAME', $focus->name); $xtpl->assign('STATUS', $status); $xtpl->assign('SERVER_URL', $focus->server_url); $xtpl->assign('USER', $focus->email_user); $xtpl->assign('ORIGIN_ID', isset($origin_id) ? $origin_id : ''); // Don't send password back $xtpl->assign('HAS_PASSWORD', empty($focus->email_password) ? 0 : 1); $xtpl->assign('TRASHFOLDER', $trashFolder); $xtpl->assign('SENTFOLDER', $sentFolder); $xtpl->assign('MAILBOX', $mailbox); $xtpl->assign('TLS', $tls); $xtpl->assign('NOTLS', $notls); $xtpl->assign('CERT', $cert); $xtpl->assign('NOVALIDATE_CERT', $novalidate_cert); $xtpl->assign('SSL', $ssl); $protocol = filterInboundEmailPopSelection($app_list_strings['dom_email_server_type']); $xtpl->assign('PROTOCOL', get_select_options_with_id($protocol, $focus->protocol)); $xtpl->assign('MARK_READ', $mark_read); $xtpl->assign('MAILBOX_TYPE', $focus->mailbox_type); $xtpl->assign('TEMPLATE_ID', $focus->template_id); $xtpl->assign('EMAIL_TEMPLATE_OPTIONS', get_select_options_with_id($email_templates_arr, $focus->template_id)); $xtpl->assign('ONLY_SINCE', $only_since); $xtpl->assign('FILTER_DOMAIN', $filterDomain); $xtpl->assign('EMAIL_NUM_AUTOREPLIES_24_HOURS', $email_num_autoreplies_24_hours); if (!empty($focus->port)) { $xtpl->assign('PORT', $focus->port); } // groups $groupId = ""; $is_auto_import = ""; $allow_outbound = '';
public function testFilterInboundEmailPopSelectionWhenItShouldBethere() { $protocals = array('imap' => 'IMAP'); if (isset($GLOBALS['sugar_config']['allow_pop_inbound'])) { $oldsetting = $GLOBALS['sugar_config']['allow_pop_inbound']; } $GLOBALS['sugar_config']['allow_pop_inbound'] = true; $protocals = filterInboundEmailPopSelection($protocals); if (isset($oldsetting)) { $GLOBALS['sugar_config']['allow_pop_inbound'] = $oldsetting; } else { unset($GLOBALS['sugar_config']['allow_pop_inbound']); } $this->assertEquals(array('imap' => 'IMAP', 'pop3' => 'POP3'), $protocals); }