Example #1
0
 public function display()
 {
     // Disable VCR Control
     $this->ev->showVCRControl = false;
     // Default Team as Global
     if (empty($this->bean->id) && !$this->ev->isDuplicate) {
         $this->bean->team_id = 1;
         $this->bean->team_set_id = 1;
     }
     // Load TinyMCE
     require_once 'include/SugarTinyMCE.php';
     $tiny = new SugarTinyMCE();
     $tiny->defaultConfig['apply_source_formatting'] = true;
     $tiny->defaultConfig['cleanup_on_startup'] = true;
     $tiny->defaultConfig['relative_urls'] = false;
     $tiny->defaultConfig['convert_urls'] = false;
     $ed = $tiny->getInstance('body_html');
     $this->ss->assign('tiny_script', $ed);
     // Load Fields for main module
     if (empty($this->bean->base_module)) {
         $modulesList = PdfManagerHelper::getAvailableModules();
         $this->bean->base_module = key($modulesList);
     }
     $fieldsForSelectedModule = PdfManagerHelper::getFields($this->bean->base_module, true);
     $this->ss->assign('fieldsForSelectedModule', $fieldsForSelectedModule);
     parent::display();
 }
/**
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 */
function get_body(&$ss, $vardef)
{
    $edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
    $ss->assign('MOD', $edit_mod_strings);
    if (!empty($cf)) {
        $ss->assign('cf', $cf);
    }
    ///////////////////////////////////
    require_once 'include/SugarTinyMCE.php';
    $tiny = new SugarTinyMCE();
    $tiny->defaultConfig['width'] = 300;
    $tiny->defaultConfig['height'] = 300;
    $tiny->buttonConfig = "code,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,\n                         justifyfull,separator,forecolor,backcolor,\n                         ";
    $tiny->buttonConfig2 = "pastetext,pasteword,fontselect,fontsizeselect,";
    $tiny->buttonConfig3 = "";
    $ed = $tiny->getInstance('htmlarea');
    $ss->assign("tiny", $ed);
    $edValue = '';
    if (!empty($vardef['default_value'])) {
        $edValue = $vardef['default_value'];
        $edValue = str_replace(array("\r\n", "\n"), " ", $edValue);
    }
    $ss->assign('HTML_EDITOR', $edValue);
    $ss->assign('preSave', 'document.popup_form.presave();');
    ///////////////////////////////////
    return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/html.tpl');
}
Example #3
0
 public static function setUpBeforeClass()
 {
     if (file_exists(self::$customConfigFile)) {
         rename(self::$customConfigFile, self::$customConfigFile . ".bak");
     }
     if (file_exists(self::$customDefaultConfigFile)) {
         rename(self::$customDefaultConfigFile, self::$customDefaultConfigFile . ".bak");
     }
     file_put_contents(self::$customConfigFile, "<?php\n\t\t\t\$buttonConfigs = array('default' => array('buttonConfig' =>'testcase',\n\t\t\t\t\t\t\t\t\t'buttonConfig2' => 'cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,\n\t                     \t\t\t\t\tindent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap,\n\t                     \t\t\t\t\tvisualaid', \n\t                    \t\t\t'buttonConfig3' => 'tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview'),\n\t\t\t\t\t\t\t\t\t'badkey1' => 'bad data1');\n\t\t\t?>");
     file_put_contents(self::$customDefaultConfigFile, "<?php\n\t\t\t\$defaultConfig = array('extended_valid_elements' => 'upload[testlength|ratio|initialtest|mintestsize|threads|maxchunksize|maxchunkcount],download[testlength|initialtest|mintestsize|threads|maximagesize]',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'badkey2' => 'bad data2');\n\t\t\t?>");
     $tinySugar = new SugarTinyMCE();
     self::$MCE = $tinySugar->getInstance();
 }
Example #4
0
    function displayTMCE()
    {
        require_once "include/SugarTinyMCE.php";
        global $locale;
        $tiny = new SugarTinyMCE();
        $tinyMCE = $tiny->getConfig();
        $js = <<<JS
\t\t<script language="javascript" type="text/javascript">
\t\t{$tinyMCE}
\t\tvar df = '{$locale->getPrecedentPreference('default_date_format')}';

 \t\ttinyMCE.init({
    \t\ttheme : "advanced",
    \t\ttheme_advanced_toolbar_align : "left",
    \t\tmode: "exact",
\t\t\telements : "description",
\t\t\ttheme_advanced_toolbar_location : "top",
\t\t\ttheme_advanced_buttons1: "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleprops,styleselect,formatselect,fontselect,fontsizeselect",
\t\t\ttheme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,separator,sub,sup,separator,charmap,visualaid",
\t\t\ttheme_advanced_buttons3: "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,pagebreak",
\t\t\ttheme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Helvetica Neu=helveticaneue,sans-serif;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
\t\t\tplugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style,pagebreak",
\t\t\theight:"auto",
\t\t\twidth: "auto",
\t\t\tinline_styles : true,
\t\t\tdirectionality : "ltr",
\t\t\tremove_redundant_brs : true,
\t\t\tentity_encoding: 'raw',
\t\t\tcleanup_on_startup : true,
\t\t\tstrict_loading_mode : true,
\t\t\tconvert_urls : false,
\t\t\tplugin_insertdate_dateFormat : '{DATE '+df+'}',
\t\t\tpagebreak_separator : "<pagebreak />",
\t\t\textended_valid_elements : "textblock",
\t\t\tcustom_elements: "textblock",
\t\t});
\t\t</script>

JS;
        echo $js;
    }
Example #5
0
 function display(){
     parent::display();
     global $sugar_config;
     $new = empty($this->bean->id);
     if($new){
         ?>
         <script>
             $(document).ready(function(){
                 $('#update_text').closest('td').html('');
                 $('#update_text_label').closest('td').html('');
                 $('#internal').closest('td').html('');
                 $('#internal_label').closest('td').html('');
                 $('#addFileButton').closest('td').html('');
                 $('#case_update_form_label').closest('td').html('');
             });
         </script>
     <?php
     }
     $tiny = new SugarTinyMCE();
     echo $tiny->getInstance('update_text,description', 'email_compose_light');
 }
Example #6
0
 function display()
 {
     global $app_strings, $current_user, $mod_strings, $theme;
     if (is_dir("themes/{$theme}/ext/resources/css")) {
         $cssDir = opendir("themes/{$theme}/ext/resources/css");
     }
     $smarty = new Sugar_Smarty();
     $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : 'main';
     $mbt = false;
     $admin = false;
     $mb = strtolower($type);
     $smarty->assign('TYPE', $type);
     $smarty->assign('app_strings', $app_strings);
     $smarty->assign('mod', $mod_strings);
     //Replaced by javascript function "setMode"
     switch ($type) {
         case 'studio':
             //$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
             require_once 'modules/ModuleBuilder/Module/StudioTree.php';
             $mbt = new StudioTree();
             break;
         case 'mb':
             //$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=")');
             require_once 'modules/ModuleBuilder/MB/MBPackageTree.php';
             $mbt = new MBPackageTree();
             break;
         case 'dropdowns':
             // $admin = is_admin($current_user);
             require_once 'modules/ModuleBuilder/Module/DropDownTree.php';
             $mbt = new DropDownTree();
             break;
         default:
             //$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=home")');
             require_once 'modules/ModuleBuilder/Module/MainTree.php';
             $mbt = new MainTree();
     }
     $smarty->assign('TEST_STUDIO', displayStudioForCurrentUser());
     $smarty->assign('ADMIN', is_admin($current_user));
     $smarty->display('modules/ModuleBuilder/tpls/includes.tpl');
     if ($mbt) {
         $smarty->assign('TREE', $mbt->fetch());
         $smarty->assign('TREElabel', $mbt->getName());
     }
     $userPref = $current_user->getPreference('mb_assist', 'Assistant');
     if (!$userPref) {
         $userPref = "na";
     }
     $smarty->assign('userPref', $userPref);
     ///////////////////////////////////
     require_once 'include/SugarTinyMCE.php';
     $tiny = new SugarTinyMCE();
     $tiny->defaultConfig['width'] = 300;
     $tiny->defaultConfig['height'] = 300;
     $tiny->buttonConfig = "code,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,\n\t                         justifyfull,separator,forecolor,backcolor,\n\t                         ";
     $tiny->buttonConfig2 = "pastetext,pasteword,fontselect,fontsizeselect,";
     $tiny->buttonConfig3 = "";
     $ed = $tiny->getInstance();
     $smarty->assign("tiny", $ed);
     $smarty->display('modules/ModuleBuilder/tpls/index.tpl');
 }
if (!empty($focus->body)) {
    $xtpl->assign("ALT_CHECKED", 'checked');
}
if (isset($focus->body)) {
    $xtpl->assign("BODY", $focus->body);
} else {
    $xtpl->assign("BODY", "");
}
if (isset($focus->body_html)) {
    $xtpl->assign("BODY_HTML", $focus->body_html);
} else {
    $xtpl->assign("BODY_HTML", "");
}
//////////////////////////////////
require_once 'include/SugarTinyMCE.php';
$tiny = new SugarTinyMCE();
$tiny->defaultConfig['apply_source_formatting'] = true;
$tiny->defaultConfig['cleanup_on_startup'] = true;
$tiny->defaultConfig['relative_urls'] = false;
$tiny->defaultConfig['convert_urls'] = false;
$ed = $tiny->getInstance('body_text');
$xtpl->assign("tiny", $ed);
$edValue = $focus->body_html;
$xtpl->assign("HTMLAREA", $edValue);
$xtpl->parse("main.htmlarea");
//////////////////////////////////
//Add Custom Fields
require_once 'modules/DynamicFields/templates/Files/EditView.php';
/*
Only allowed the related module dynamic fields 
if the config setting "show_related" in this file is set to true
Example #8
0
    /**
     * 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();
        $json = getJSONobj();
        $ie = new InboundEmail();
        $out = '<script type="text/javascript" language="Javascript" src="modules/Emails/javascript/vars.js"></script>';
        // focus listView
        $list = array('mbox' => 'Home', 'ieId' => '', 'name' => 'Home', 'unreadChecked' => 0, 'out' => array());
        // lang pack
        $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";
            }
        }
        $modStrings = "var mod_strings = new Object();\n";
        foreach ($mod_strings as $k => $v) {
            $v = str_replace("'", "\\'", $v);
            $modStrings .= "mod_strings.{$k} = '{$v}';\n";
        }
        $lang .= "\n\n{$modStrings}\n";
        // link drop-down
        $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]);
        }
        $linkBeans = $json->encode(get_select_options_with_id($parent_types, ''));
        //TinyMCE Config
        require_once "include/SugarTinyMCE.php";
        $tiny = new SugarTinyMCE();
        $tinyConf = $tiny->getConfig();
        //Check quick create module access
        $QCAvailibleModules = array();
        $QCModules = array('Bugs', 'Cases', 'Contacts', 'Leads', 'Tasks');
        foreach ($QCModules as $module) {
            $class = substr($module, 0, strlen($module) - 1);
            require_once "modules/{$module}/{$class}.php";
            if ($class == "Case") {
                $class = "aCase";
            }
            $seed = new $class();
            if ($seed->ACLAccess('edit')) {
                $QCAvailibleModules[] = $module;
            }
        }
        ///////////////////////////////////////////////////////////////////////
        ////	BASIC ASSIGNS
        $charsets = $json->encode($locale->getCharsetSelect());
        $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('lang', $lang);
        $this->smarty->assign('linkBeans', $linkBeans);
        $this->smarty->assign('sugar_config', $sugar_config);
        $this->smarty->assign('emailCharsets', $charsets);
        $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('tinyMCE', $tinyConf);
        $this->smarty->assign('qcModules', $json->encode($QCAvailibleModules));
        $extAllDebugValue = "ext-all.js";
        $this->smarty->assign('extFileName', $extAllDebugValue);
        //#20776 jchi
        $peopleTables = array("users", "contacts", "leads", "prospects");
        $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, ''));
        // 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());
        $viewRawEmail = 'false';
        if (isset($sugar_config['email_inbound_save_raw']) && $sugar_config['email_inbound_save_raw'] == true) {
            $viewRawEmail = 'true';
        }
        $this->smarty->assign('viewRawSource', $viewRawEmail);
        $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);
        $this->smarty->assign('PROTOCOL', get_select_options_with_id($app_list_strings['dom_email_server_type'], ''));
        $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'));
        // outbound opts
        $oe = new OutboundEmail();
        $outbounds = $oe->getUserMailers($current_user);
        $smtpOptions = "SUGAR.mailers = ";
        $smtpOptions .= $json->encode($outbounds, false);
        $charset = array('options' => $locale->getCharsetSelect(), 'selected' => $emailSettings['defaultOutboundCharset']);
        $this->smarty->assign('charset', $charset);
        $emailCheckInterval = array('options' => $app_strings['LBL_EMAIL_CHECK_INTERVAL_DOM'], 'selected' => $emailSettings['emailCheckInterval']);
        $this->smarty->assign('emailCheckInterval', $emailCheckInterval);
        $emailSettings['layoutStyle'] == '2rows' ? $this->smarty->assign('rowsChecked', 'CHECKED') : $this->smarty->assign('colsChecked', 'CHECKED');
        //$this->smarty->assign('autoImportChecked', ($emailSettings['autoImport'] == 1) ? 'CHECKED' : "");
        $this->smarty->assign('alwaysSaveOutboundChecked', $emailSettings['alwaysSaveOutbound'] ? 'CHECKED' : "");
        $this->smarty->assign('sendPlainTextChecked', $emailSettings['sendPlainText'] == 1 ? 'CHECKED' : '');
        $this->smarty->assign('tabPositionChecked', $emailSettings['tabPosition'] == 'bottom' ? 'CHECKED' : '');
        $this->smarty->assign('showNumInList', get_select_options_with_id($app_strings['LBL_EMAIL_SETTING_NUM_DOM'], $emailSettings['showNumInList']));
        $this->smarty->assign('fullScreenChecked', $emailSettings['fullScreen'] == 1 ? "CHECKED" : "");
        $this->smarty->assign('userPrefs', $json->encode($this->getUserPrefsJS()));
        ////	END USER SETTINGS
        ///////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////
        ////	SIGNATURES
        $prependSignature = $current_user->getPreference('signature_prepend') ? 'true' : 'false';
        $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('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">&nbsp;
					</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">&nbsp;
					</span>';
        }
        $this->smarty->assign('signatureButtons', $signatureButtons);
        $this->smarty->assign('signaturePrepend', $prependSignature == 'true' ? 'CHECKED' : '');
        $this->smarty->assign('signatureDefaultId', isset($defaultSignature['id']) ? $defaultSignature['id'] : "");
        ////	END SIGNATURES
        ///////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////
        ////	EMAIL TEMPLATES
        $email_templates_arr = $this->getEmailTemplatesArray();
        $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
        ///////////////////////////////////////////////////////////////////////
        $fullscreen = '';
        if ($emailSettings['fullScreen'] == 1) {
            $fullscreen = 'SUGAR.ui.toggleHeader();';
        }
        $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\t{$fullscreen}

\t\t\t\tvar loader = new YAHOO.util.YUILoader({
\t\t\t\t    require : ["layout", "element", "tabview", "menu", "cookie", "sugarwidgets"],
\t\t\t\t    loadOptional: true,
\t\t\t\t    filter: 'debug',
\t\t\t\t    skin: "",
\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"]
\t\t\t\t});
\t\t\t\tloader.insert();

\t\t\t\t{$preloadFolder};
\t\t\t\t{$smtpOptions};
\t\t\t</script>
eoq;
        return $out;
    }
}
$Web_To_Lead_Form_html .= "</table >";
$Web_To_Lead_Form_html .= "</form>";
$Web_To_Lead_Form_html .= "<script type='text/javascript'>\n function submit_form(){\n \tif(typeof(validateCaptchaAndSubmit)!='undefined'){\n \t\tvalidateCaptchaAndSubmit();\n \t}else{\n \t\tcheck_webtolead_fields();\n \t}\n }\n function check_webtolead_fields(){\n     if(document.getElementById('bool_id') != null){\n        var reqs=document.getElementById('bool_id').value;\n        bools = reqs.substring(0,reqs.lastIndexOf(';'));\n        var bool_fields = new Array();\n        var bool_fields = bools.split(';');\n        nbr_fields = bool_fields.length;\n        for(var i=0;i<nbr_fields;i++){\n          if(document.getElementById(bool_fields[i]).value == 'on'){\n             document.getElementById(bool_fields[i]).value = 1;\n          }\n          else{\n             document.getElementById(bool_fields[i]).value = 0;\n          }\n        }\n      }\n    if(document.getElementById('req_id') != null){\n        var reqs=document.getElementById('req_id').value;\n        reqs = reqs.substring(0,reqs.lastIndexOf(';'));\n        var req_fields = new Array();\n        var req_fields = reqs.split(';');\n        nbr_fields = req_fields.length;\n        var req = true;\n        for(var i=0;i<nbr_fields;i++){\n          if(document.getElementById(req_fields[i]).value.length <=0 || document.getElementById(req_fields[i]).value==0){\n           req = false;\n           break;\n          }\n        }\n        if(req){\n            document.WebToLeadForm.submit();\n            return true;\n        }\n        else{\n          alert('{$web_form_required_fileds_msg}');\n          return false;\n         }\n        return false\n   }\n   else{\n    document.WebToLeadForm.submit();\n   }\n}\nfunction validateEmailAdd(){\n\tif(document.getElementById('email1') && document.getElementById('email1').value.length >0) {\n\t\tif(document.getElementById('email1').value.match({$regex}) == null){\n\t\t  alert('{$web_not_valid_email_address}');\n\t\t}\n\t}\n\tif(document.getElementById('email2') && document.getElementById('email2').value.length >0) {\n\t\tif(document.getElementById('email2').value.match({$regex}) == null){\n\t\t  alert('{$web_not_valid_email_address}');\n\t\t}\n\t}\n}\n</script>";
if (isset($Web_To_Lead_Form_html)) {
    $xtpl->assign("BODY", $Web_To_Lead_Form_html);
} else {
    $xtpl->assign("BODY", "");
}
if (isset($Web_To_Lead_Form_html)) {
    $xtpl->assign("BODY_HTML", $Web_To_Lead_Form_html);
} else {
    $xtpl->assign("BODY_HTML", "");
}
require_once 'include/SugarTinyMCE.php';
$tiny = new SugarTinyMCE();
$tiny->defaultConfig['height'] = 400;
$tiny->defaultConfig['apply_source_formatting'] = true;
$tiny->defaultConfig['cleanup'] = false;
$ed = $tiny->getInstance('body_html');
$xtpl->assign("tiny", $ed);
$xtpl->parse("main.textarea");
$xtpl->assign("INSERT_VARIABLE_ONCLICK", "insert_variable_html(document.EditView.variable_text.value)");
$xtpl->parse("main.variable_button");
$xtpl->parse("main");
$xtpl->out("main");
function ifRadioButton($customFieldName)
{
    $custRow = null;
    $query = "select id,type from fields_meta_data where deleted = 0 and name = '{$customFieldName}'";
    $result = $GLOBALS['db']->query($query);
Example #10
0
    function displayTMCE()
    {
        require_once "include/SugarTinyMCE.php";
        global $locale, $current_user;
        $tiny = new SugarTinyMCE();
        $tinyMCE = $tiny->getConfig();
        $js = <<<JS
        <script language="javascript" type="text/javascript">
        {$tinyMCE}
        var df = '{$locale->getPrecedentPreference('default_date_format')}';

        tinyMCE.init({
            theme : tinyConfig.theme,
            theme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align,
            mode: tinyConfig.mode,
            elements : "description",
            theme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location,
            theme_advanced_buttons1: tinyConfig.theme_advanced_buttons1,
            theme_advanced_buttons2: tinyConfig.theme_advanced_buttons2,
            theme_advanced_buttons3: tinyConfig.theme_advanced_buttons3,
            theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Helvetica Neu=helveticaneue,sans-serif;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
            plugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style,pagebreak,openmanager,inlinepopups",
            height: tinyConfig.height,
            width: tinyConfig.width ,
            inline_styles : true,
            directionality : "ltr",
            remove_redundant_brs : true,
            entity_encoding: 'raw',
            cleanup_on_startup : true,
            strict_loading_mode : true,
            convert_urls : false,
            plugin_insertdate_dateFormat : '{DATE '+df+'}',
            pagebreak_separator : "<pagebreak />",
            extended_valid_elements : "textblock",
            custom_elements: "textblock",
            file_browser_callback : tinyConfig.file_browser_callback,
            open_manager_upload_path : tinyConfig.open_manager_upload_path ,

        });

        tinyMCE.init({
            theme : tinyConfig.theme,
            theme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align,
            mode: tinyConfig.mode,
            elements : "pdfheader,pdffooter",
            theme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location,
            theme_advanced_buttons1: tinyConfig.theme_advanced_buttons1,
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Helvetica Neu=helveticaneue,sans-serif;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
            plugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style",
            width: tinyConfig.width,
            inline_styles : true,
            directionality : "ltr",
            entity_encoding: 'raw',
            cleanup_on_startup : true,
            strict_loading_mode : true,
            convert_urls : false,
            remove_redundant_brs : true,
            plugin_insertdate_dateFormat : '{DATE '+df+'}',
            extended_valid_elements : "textblock",
            custom_elements: "textblock",
        });

        </script>

JS;
        echo $js;
    }
    //get the closing tag after marker ">";
    //extract the input tag string
    $working_str = substr($bodyHTML, $marker - 3, $end_border - ($marker - 3));
    //replace input markup with text areas markups
    $new_str = str_replace('input', 'textarea', $working_str);
    $new_str = str_replace("type='text'", ' ', $new_str);
    $new_str = $new_str . '> </textarea';
    //replace the marker with generic term
    $new_str = str_replace('ta_replace', 'sugarslot', $new_str);
    //merge the processed string back into bodyhtml string
    $bodyHTML = str_replace($working_str, $new_str, $bodyHTML);
}
//<<<----------end replacing marked text inputs with text area tags
$guid = create_guid();
$form_file = "upload://{$guid}";
$SugarTiny = new SugarTinyMCE();
$html = $SugarTiny->cleanEncodedMCEHtml($bodyHTML);
//Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML.
if (stripos($html, "<html") === false) {
    $langHeader = get_language_header();
    $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
}
file_put_contents($form_file, $html);
$xtpl = new XTemplate('modules/Campaigns/WebToLeadDownloadForm.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$webformlink = "<b>{$mod_strings['LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM']}</b><br/>";
$webformlink .= "<a href=\"index.php?entryPoint=download&id={$guid}&isTempFile=1&tempName=WebToLeadForm.html&type=temp\">{$mod_strings['LBL_DOWNLOAD_WEB_TO_LEAD_FORM']}</a>";
$xtpl->assign("LINK_TO_WEB_FORM", $webformlink);
$xtpl->assign("RAW_SOURCE", htmlspecialchars($html));
$xtpl->parse("main.copy_source");
Example #12
0
// signatures
if ($sig = $current_user->getDefaultSignature()) {
    if (!$focus->hasSignatureInBody($sig) && $focus->type != 'draft') {
        if ($current_user->getPreference('signature_prepend')) {
            $description_html = '<br />' . from_html($sig['signature_html']) . '<br /><br />' . $description_html;
            $description = "\n" . $sig['signature'] . "\n\n" . $description;
        } else {
            $description_html .= '<br /><br />' . from_html($sig['signature_html']);
            $description = $description . "\n\n" . $sig['signature'];
        }
    }
}
$xtpl->assign('DESCRIPTION', $description);
// sigs
/////////////////////////////////////////////////
$tiny = new SugarTinyMCE();
$ed = $tiny->getInstance("description_html");
$xtpl->assign("TINY", $ed);
$xtpl->assign("DESCRIPTION_HTML", $description_html);
$xtpl->parse('main.htmlarea');
////	END TEXT EDITOR
///////////////////////////////////////
///////////////////////////////////////
////	SPECIAL INBOUND LANDING SCREEN ASSIGNS
if (!empty($_REQUEST['inbound_email_id'])) {
    if (!empty($_REQUEST['start'])) {
        $parts = $focus->getStartPage(base64_decode($_REQUEST['start']));
        $xtpl->assign('RETURN_ACTION', $parts['action']);
        $xtpl->assign('RETURN_MODULE', $parts['module']);
        $xtpl->assign('GROUP', $parts['group']);
    }
Example #13
0
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'include/formbase.php';
require_once 'include/SugarTinyMCE.php';
global $mod_strings;
global $app_strings;
$rawsource = false;
if (!empty($_REQUEST['body_html'])) {
    $dir_path = "{$GLOBALS['sugar_config']['cache_dir']}generated_forms/";
    if (!file_exists($dir_path)) {
        sugar_mkdir($dir_path, 0777);
    }
    //Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML.
    $rawsource = $_REQUEST['body_html'];
    $SugarTiny = new SugarTinyMCE();
    $rawsource = $SugarTiny->cleanEncodedMCEHtml($rawsource);
    $html = from_html($rawsource);
    if (stripos($html, "<html") === false) {
        $html = "<html><body>" . $html . "</body></html>";
    }
    $file = $dir_path . 'WebToLeadForm_' . time() . '.html';
    $fp = sugar_fopen($file, 'wb');
    fwrite($fp, $html);
    fclose($fp);
}
$xtpl = new XTemplate('modules/Campaigns/WebToLeadDownloadForm.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$webformlink = "<b>{$mod_strings['LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM']}</b><br/>";
$webformlink .= "<a href={$GLOBALS['sugar_config']['cache_dir']}generated_forms/WebToLeadForm_" . time() . ".html>{$mod_strings['LBL_DOWNLOAD_WEB_TO_LEAD_FORM']}</a>";
Example #14
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, ''));
 }
Example #15
0
 function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass = true)
 {
     parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass);
     $editor = "";
     if ($vardef['editor'] == "html") {
         if (!isset($displayParams['htmlescape'])) {
             $displayParams['htmlescape'] = false;
         }
         if ($_REQUEST['action'] == "EditView") {
             require_once "include/SugarTinyMCE.php";
             $tiny = new SugarTinyMCE();
             $editor = $tiny->getInstance($vardef['name'], 'email_compose_light');
         }
         $this->ss->assign("tinymce", $editor);
     } else {
         $this->ss->assign("tinymce", $editor);
     }
 }
Example #16
0
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
$xtpl->assign('CANCEL_SCRIPT', 'window.close()');
if (isset($_REQUEST['return_module'])) {
    $xtpl->assign('RETURN_MODULE', $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
    $xtpl->assign('RETURN_ACTION', $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign('RETURN_ID', $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $xtpl->assign('RETURN_ACTION', 'index');
}
$xtpl->assign('INPOPUPWINDOW', 'true');
$xtpl->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']);
$xtpl->assign('JAVASCRIPT', get_set_focus_js());
$xtpl->assign('ID', $focus->id);
$xtpl->assign('NAME', $focus->name);
$xtpl->assign('SIGNATURE_TEXT', !empty($focus->signature_html) ? $focus->signature_html : $focus->signature);
if (isset($_REQUEST['the_user_id'])) {
    $xtpl->assign('THE_USER_ID', $_REQUEST['the_user_id']);
}
$tiny = new SugarTinyMCE();
$xtpl->assign("tinyjs", $tiny->getInstance('sigText'));
$xtpl->parse('main.textarea');
//Add Custom Fields
$xtpl->parse('main');
$xtpl->out('main');
    function displayJS()
    {
        require_once "include/JSON.php";
        require_once "include/SugarTinyMCE.php";
        global $locale;
        $tiny = new SugarTinyMCE();
        $tinyMCE = $tiny->getConfig();
        $locationHref = 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
        $js = <<<JS
\t\t<script language="javascript" type="text/javascript">
\t\t{$tinyMCE}
\t\tvar location_href = '{$locationHref}';
\t\tvar df = '{$locale->getPrecedentPreference('default_date_format')}';
 \t\t
 \t\ttinyMCE.baseURL = location_href+'/include/javascript/tiny_mce';
\t\ttinyMCE.srcMode = '';
 \t\ttinyMCE.init({
    \t\t\ttheme : "advanced",
    \t\t\ttheme_advanced_toolbar_align : "left",
    \t\t\tmode: "exact",
\t\t\telements : "description",
\t\t\ttheme_advanced_toolbar_location : "top",
\t\t\ttheme_advanced_buttons1: "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleprops,styleselect,formatselect,fontselect,fontsizeselect",
\t\t\ttheme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap,visualaid",
\t\t\ttheme_advanced_buttons3: "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,pagebreak",
\t\t\tplugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style,pagebreak",
\t\t\theight:"500",
\t\t\twidth: "100%",
\t\t\tinline_styles : true,
\t\t\tdirectionality : "ltr",
\t\t\tremove_redundant_brs : true,
\t\t\tentity_encoding: 'raw',
\t\t\tcleanup_on_startup : true,
\t\t\tstrict_loading_mode : true,
\t\t\tconvert_urls : false,
\t\t\tplugin_insertdate_dateFormat : '{DATE '+df+'}',
\t\t\tpagebreak_separator : "<pagebreak />",
\t\t});
\t\t
\t\ttinyMCE.init({
    \t\t\ttheme : "advanced",
    \t\t\ttheme_advanced_toolbar_align : "left",
    \t\t\tmode: "exact",
\t\t\telements : "pdfheader,pdffooter",
\t\t\ttheme_advanced_toolbar_location : "top",
\t\t\ttheme_advanced_buttons1: "code,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,undo,redo,separator,forecolor,backcolor,separator,styleprops,styleselect,formatselect,fontselect,fontsizeselect,separator,insertdate",
\t\t\ttheme_advanced_buttons2 : "",
    \t\t\ttheme_advanced_buttons3 : "",
\t\t\tplugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style",
\t\t\twidth: "100%",
\t\t\tinline_styles : true,
\t\t\tdirectionality : "ltr",
\t\t\tentity_encoding: 'raw',
\t\t\tcleanup_on_startup : true,
\t\t\tstrict_loading_mode : true,
\t\t\tconvert_urls : false,
\t\t\tremove_redundant_brs : true,
\t\t\tplugin_insertdate_dateFormat : '{DATE '+df+'}',
\t\t});

\t\t</script>

JS;
        echo $js;
    }
Example #18
0
$xtpl->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['record_type_display'], $focus->parent_type));
//$xtpl->assign("DEFAULT_MODULE","Accounts");
if (isset($focus->body)) {
    $xtpl->assign("BODY", $focus->body);
} else {
    $xtpl->assign("BODY", "");
}
if (isset($focus->body_html)) {
    $xtpl->assign("BODY_HTML", $focus->body_html);
} else {
    $xtpl->assign("BODY_HTML", "");
}
if (true) {
    if (!isTouchScreen()) {
        require_once "include/SugarTinyMCE.php";
        $tiny = new SugarTinyMCE();
        $tiny->defaultConfig['cleanup_on_startup'] = true;
        $tiny->defaultConfig['height'] = 600;
        $tinyHtml = $tiny->getInstance();
        $xtpl->assign("tiny", $tinyHtml);
    }
    ///////////////////////////////////////
    ////	MACRO VARS
    $xtpl->assign("INSERT_VARIABLE_ONCLICK", "insert_variable(document.EditView.variable_text.value)");
    if (!$inboundEmail) {
        $xtpl->parse("main.NoInbound.variable_button");
    }
    ///////////////////////////////////////
    ////	CAMPAIGNS
    if ($has_campaign || $inboundEmail) {
        $xtpl->assign("INPOPUPWINDOW", 'true');
Example #19
0
    function displayJS()
    {
        require_once "include/SugarTinyMCE.php";
        require_once "include/JSON.php";
        $tiny = new SugarTinyMCE();
        $tinyMCE = $tiny->getConfig();
        $locationHref = 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
        $js = <<<JS
<script type="text/javascript">
\t{$tinyMCE}
\tvar location_href = '{$locationHref}';
\tif(typeof(tinyMCE) != 'undefined') {
\t\ttinyMCE.baseURL = location_href+'/include/javascript/tiny_mce';
\t\ttinyMCE.srcMode = '';
\t\tif(navigator.appName != 'Netscape') {
\t\t\ttinyMCE.init({
\t\t\t\ttheme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align,
\t\t\t\tclean : false,
\t\t\t\tclean_on_startup : false,
\t\t\t\twidth: tinyConfig.width,
\t\t\t\ttheme: tinyConfig.theme,
\t\t\t\ttheme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location,
\t\t\t\ttheme_advanced_buttons1: "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleselect,formatselect,fontselect,fontsizeselect",
\t\t\t\ttheme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap,visualaid",
\t\t\t\ttheme_advanced_buttons3: "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview",
\t\t\t\tstrict_loading_mode: true,
\t\t\t\tmode: "exact",
\t\t\t\tlanguage: "en",
\t\t\t\tplugins : tinyConfig.plugins,
\t\t\t\telements : tinyConfig.elements,
\t\t\t\textended_valid_elements : tinyConfig.extended_valid_elements,
\t\t\t\tmode: tinyConfig.mode
\t\t\t});
\t\t} else {
\t\t\ttinyMCE.init({
\t\t\t\ttheme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align,
\t\t\t\twidth: tinyConfig.width,
\t\t\t\ttheme: tinyConfig.theme,
\t\t\t\ttheme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location,
\t\t\t\ttheme_advanced_buttons1: "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleselect,formatselect,fontselect,fontsizeselect",
\t\t\t\ttheme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap,visualaid",
\t\t\t\ttheme_advanced_buttons3: "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview",
\t\t\t\tstrict_loading_mode: true,
\t\t\t\tmode: "exact",
\t\t\t\tlanguage: "en",
\t\t\t\tplugins : tinyConfig.plugins,
\t\t\t\telements : tinyConfig.elements,
\t\t\t\textended_valid_elements : tinyConfig.extended_valid_elements,
\t\t\t\tmode: tinyConfig.mode,
\t\t\t\tstrict_loading_mode : true
\t\t\t});
\t\t}
\t}
</script>
<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/langs/en.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/plugins/insertdatetime/editor_plugin.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/plugins/preview/editor_plugin.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/plugins/searchreplace/editor_plugin.js"></script>


<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/plugins/advhr/langs/en.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/tiny_mce/plugins/paste/langs/en.js"></script>
<script language="javascript">
\tif(typeof(tinyMCE) != 'undefined') {\t
\t\t var t = tinyMCE.getInstanceById('description');
\t\t if(typeof(t) == 'undefined')  {
            
            var nav = new String(navigator.appVersion);

            tinyMCE.execCommand('mceAddControl', false, 'description');
            var instance =  tinyMCE.getInstanceById('description');
            var tableEl = document.getElementById(instance.editorId + '_parent').firstChild;
            var toolbar = document.getElementById(instance.editorId + '_toolbar');
            if (tinyMCE.isMSIE) {
                instance.iframeElement.style.height = "100%";
                instance.iframeElement.height = "100%";
            } else {
                instance.iframeElement.style.height = "100%";
            }
            tableEl.style.height = "100%";
        }
\t}
\t//alert(JSON);
</script>
JS;
        echo $js;
    }