示例#1
0
 /**
  * Generate the config data needed for the Full Compose UI and the Quick Compose UI.  The set of config data
  * returned is the minimum set needed by the quick compose UI.
  *
  * @param String $type Drives which tinyMCE options will be included.
  */
 function _generateComposeConfigData($type = "email_compose_light")
 {
     global $app_list_strings, $current_user, $app_strings, $mod_strings, $current_language, $locale;
     //Link drop-downs
     $parent_types = $app_list_strings['record_type_display'];
     $disabled_parent_types = ACLController::disabledModuleList($parent_types, false, 'list');
     foreach ($disabled_parent_types as $disabled_parent_type) {
         unset($parent_types[$disabled_parent_type]);
     }
     asort($parent_types);
     $linkBeans = json_encode(get_select_options_with_id($parent_types, ''));
     //TinyMCE Config
     require_once "include/SugarTinyMCE.php";
     $tiny = new SugarTinyMCE();
     $tinyConf = $tiny->getConfig($type);
     //Generate Language Packs
     $lang = "var app_strings = new Object();\n";
     foreach ($app_strings as $k => $v) {
         if (strpos($k, 'LBL_EMAIL_') !== false) {
             $lang .= "app_strings.{$k} = '{$v}';\n";
         }
     }
     //Get the email mod strings but don't use the global variable as this may be overridden by
     //other modules when the quick create is rendered.
     $email_mod_strings = return_module_language($current_language, 'Emails');
     $modStrings = "var mod_strings = new Object();\n";
     foreach ($email_mod_strings as $k => $v) {
         $v = str_replace("'", "\\'", $v);
         $modStrings .= "mod_strings.{$k} = '{$v}';\n";
     }
     $lang .= "\n\n{$modStrings}\n";
     //Grab the Inboundemail language pack
     $ieModStrings = "var ie_mod_strings = new Object();\n";
     $ie_mod_strings = return_module_language($current_language, 'InboundEmail');
     foreach ($ie_mod_strings as $k => $v) {
         $v = str_replace("'", "\\'", $v);
         $ieModStrings .= "ie_mod_strings.{$k} = '{$v}';\n";
     }
     $lang .= "\n\n{$ieModStrings}\n";
     $this->smarty->assign('linkBeans', $linkBeans);
     $this->smarty->assign('linkBeansOptions', $parent_types);
     $this->smarty->assign('tinyMCE', $tinyConf);
     $this->smarty->assign('lang', $lang);
     $this->smarty->assign('app_strings', $app_strings);
     $this->smarty->assign('mod_strings', $email_mod_strings);
     $ie1 = new InboundEmail();
     //Signatures
     $defsigID = $current_user->getPreference('signature_default');
     $defaultSignature = $current_user->getDefaultSignature();
     $sigJson = !empty($defaultSignature) ? json_encode(array($defaultSignature['id'] => from_html($defaultSignature['signature_html']))) : "new Object()";
     $this->smarty->assign('defaultSignature', $sigJson);
     $this->smarty->assign('signatureDefaultId', isset($defaultSignature['id']) ? $defaultSignature['id'] : "");
     //User Preferences
     $this->smarty->assign('userPrefs', json_encode($this->getUserPrefsJS()));
     //Get the users default outbound id
     $defaultOutID = $ie1->getUsersDefaultOutboundServerId($current_user);
     $this->smarty->assign('defaultOutID', $defaultOutID);
     //Character Set
     $charsets = json_encode($locale->getCharsetSelect());
     $this->smarty->assign('emailCharsets', $charsets);
     //Relateable List of People for address book search
     //#20776 jchi
     $peopleTables = array("users", "contacts", "leads", "prospects", "accounts");
     $filterPeopleTables = array();
     global $app_list_strings, $app_strings;
     $filterPeopleTables['LBL_DROPDOWN_LIST_ALL'] = $app_strings['LBL_DROPDOWN_LIST_ALL'];
     foreach ($peopleTables as $table) {
         $module = ucfirst($table);
         $class = substr($module, 0, strlen($module) - 1);
         require_once "modules/{$module}/{$class}.php";
         $person = new $class();
         if (!$person->ACLAccess('list')) {
             continue;
         }
         $filterPeopleTables[$person->table_name] = $app_list_strings['moduleList'][$person->module_dir];
     }
     $this->smarty->assign('listOfPersons', get_select_options_with_id($filterPeopleTables, ''));
 }
 public function testSetAndGetUsersDefaultOutboundServerId()
 {
     $inboundEmail = new InboundEmail();
     $user = new User();
     $user->retrieve(1);
     //set a Outbound Server Id
     $inboundEmail->setUsersDefaultOutboundServerId($user, '123');
     //retrieve Outbound Server Id back and verify
     $result = $inboundEmail->getUsersDefaultOutboundServerId($user);
     $this->assertEquals('123', $result);
 }