コード例 #1
0
ファイル: SugarTinyMCE.php プロジェクト: klr2003/sourceread
    /**
     * Returns the Javascript necessary to initialize a TinyMCE instance for a given <textarea> or <div>
     * @param string target Comma delimited list of DOM ID's, <textarea id='someTarget'>
     * @return string 
     */
    function getInstance($targets = "")
    {
        global $json;
        if (empty($json)) {
            $json = getJSONobj();
        }
        $config = $this->defaultConfig;
        $config['elements'] = $targets;
        $config['theme_advanced_buttons1'] = $this->buttonConfig;
        $config['theme_advanced_buttons2'] = $this->buttonConfig2;
        $config['theme_advanced_buttons3'] = $this->buttonConfig3;
        $jsConfig = $json->encode($config);
        $instantiateCall = '';
        if (!empty($targets)) {
            $exTargets = explode(",", $targets);
            foreach ($exTargets as $instance) {
                //$instantiateCall .= "tinyMCE.execCommand('mceAddControl', false, document.getElementById('{$instance}'));\n";
            }
        }
        $path = getJSPath('include/javascript/tiny_mce/tiny_mce.js');
        $ret = <<<eoq
<script type="text/javascript" language="Javascript" src="{$path}"></script>

<script type="text/javascript" language="Javascript">
tinyMCE.init({$jsConfig});
\t{$instantiateCall}\t
</script>

eoq;
        return $ret;
    }
コード例 #2
0
/**
 * Smarty {sugar_include} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_include<br>
 * Purpose:  Handles rendering the global file includes from the metadata files defined
 *           in templateMeta=>includes.
 * 
 * @author Collin Lee {clee@sugarcrm.com}
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_getjspath($params, &$smarty)
{
    if (!isset($params['file'])) {
        $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file');
    }
    return getJSPath($params['file']);
}
コード例 #3
0
 /**
  * @see DashletGenericChart::display()
  */
 public function display()
 {
     require_once 'modules/Campaigns/Charts.php';
     $roi_chart = new campaign_charts();
     $chartStr = $roi_chart->campaign_response_roi($GLOBALS['app_list_strings']['roi_type_dom'], $GLOBALS['app_list_strings']['roi_type_dom'], $this->campaign_id[0], null, true, true, true, $this->id);
     $returnStr = '<script type="text/javascript" src="' . getJSPath('include/javascript/swfobject.js') . '"></script>' . $chartStr;
     return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $returnStr . '</div><br />';
 }
コード例 #4
0
ファイル: Tree.php プロジェクト: NALSS/SuiteCRM
 function generate_header()
 {
     $ret = "<link rel='stylesheet' href='{$this->tree_style}'>\n";
     foreach ($this->_header_files as $filename) {
         $ret .= "<script language='JavaScript' src='" . getJSPath($filename) . "'></script>\n";
     }
     return $ret;
 }
コード例 #5
0
/**
 * smarty_function_overlib_includes
 * This is the constructor for the Smarty plugin.
 * 
 * @param $params The runtime Smarty key/value arguments
 * @param $smarty The reference to the Smarty object used in this invocation 
 */
function smarty_function_overlib_includes($params, &$smarty)
{
    $path = getJSPath('include/javascript/sugar_grp_overlib.js');
    return <<<EOHTML
<!-- begin includes for overlib -->
<script type="text/javascript" src="{$path}"></script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000"></div>
<!-- end includes for overlib -->
EOHTML;
}
コード例 #6
0
ファイル: view.adminwizard.php プロジェクト: MexinaD/SuiteCRM
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $themeObject = SugarThemeRegistry::current();
     $configurator = new Configurator();
     $sugarConfig = SugarConfig::getInstance();
     $focus = new Administration();
     $focus->retrieveSettings();
     $ut = $GLOBALS['current_user']->getPreference('ut');
     if (empty($ut)) {
         $this->ss->assign('SKIP_URL', 'index.php?module=Users&action=Wizard&skipwelcome=1');
     } else {
         $this->ss->assign('SKIP_URL', 'index.php?module=Home&action=index');
     }
     // Always mark that we have got past this point
     $focus->saveSetting('system', 'adminwizard', 1);
     $css = $themeObject->getCSS();
     $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     $this->ss->assign('FAVICON_URL', getJSPath($favicon));
     $this->ss->assign('SUGAR_CSS', $css);
     $this->ss->assign('MOD_USERS', return_module_language($GLOBALS['current_language'], 'Users'));
     $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
     $this->ss->assign('LANGUAGES', get_languages());
     $this->ss->assign('config', $sugar_config);
     $this->ss->assign('SUGAR_VERSION', $sugar_version);
     $this->ss->assign('settings', $focus->settings);
     $this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
     $this->ss->assign('getNameJs', $locale->getNameJs());
     $this->ss->assign('NAMEFORMATS', $locale->getUsableLocaleNameOptions($sugar_config['name_formats']));
     $this->ss->assign('JAVASCRIPT', get_set_focus_js() . get_configsettings_js());
     $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
     $this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']);
     $this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']);
     $this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']);
     $this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']);
     $this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']);
     $this->ss->assign('mail_smtpauth_req', $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : '');
     $this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
     $this->ss->assign('notify_allow_default_outbound_on', !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2 ? 'CHECKED' : '');
     $this->ss->assign('THEME', SugarThemeRegistry::current()->__toString());
     // get javascript
     ob_start();
     $this->options['show_javascript'] = true;
     $this->renderJavascript();
     $this->options['show_javascript'] = false;
     $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
     ob_end_clean();
     $this->ss->assign('langHeader', get_language_header());
     $this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome');
     $this->ss->display('modules/Configurator/tpls/adminwizard.tpl');
 }
コード例 #7
0
/**
 * Smarty {popup_init} function plugin
 *
 * Type:     function<br>
 * Name:     popup_init<br>
 * Purpose:  initialize overlib
 * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init}
 *          (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_popup_init($params, &$smarty)
{
    $zindex = 1000;
    if (!empty($params['zindex'])) {
        $zindex = $params['zindex'];
    }
    if (!empty($params['src'])) {
        return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:' . $zindex . ';"></div>' . "\n" . '<script type="text/javascript" language="JavaScript" src="' . getJSPath($params['src']) . '"></script>' . "\n";
    } else {
        $smarty->trigger_error("popup_init: missing src parameter");
    }
}
コード例 #8
0
ファイル: SugarTinyMCE.php プロジェクト: jglaine/sugar761-ent
    /**
     * Returns the Javascript necessary to initialize a TinyMCE instance for a given <textarea> or <div>
     *
     * @param string target Comma delimited list of DOM ID's, <textarea id='someTarget'>
     *
     * @return string
     */
    function getInstance($targets = "")
    {
        global $json;
        if (empty($json)) {
            $json = getJSONobj();
        }
        $config = $this->defaultConfig;
        //include tinymce lang file
        $lang = substr($GLOBALS['current_language'], 0, 2);
        if (SugarAutoLoader::existing('include/javascript/tiny_mce/langs/' . $lang . '.js')) {
            $config['language'] = $lang;
        }
        $config['directionality'] = SugarThemeRegistry::current()->directionality;
        $config['elements'] = $targets;
        $config['theme_advanced_buttons1'] = $this->buttonConfigs['default']['buttonConfig'];
        $config['theme_advanced_buttons2'] = $this->buttonConfigs['default']['buttonConfig2'];
        $config['theme_advanced_buttons3'] = $this->buttonConfigs['default']['buttonConfig3'];
        $jsConfig = $json->encode($config);
        $instantiateCall = '';
        if (!empty($targets)) {
            $exTargets = explode(",", $targets);
            foreach ($exTargets as $instance) {
                //$instantiateCall .= "tinyMCE.execCommand('mceAddControl', false, document.getElementById('{$instance}'));\n";
            }
        }
        $path = getJSPath('include/javascript/tiny_mce/tiny_mce.js');
        $ret = <<<eoq
<script type="text/javascript" language="Javascript" src="{$path}"></script>

<script type="text/javascript" language="Javascript">
<!--
if (!SUGAR.util.isTouchScreen()) {
    tinyMCE.init({$jsConfig});
\t{$instantiateCall}
}
else {
eoq;
        $exTargets = explode(",", $targets);
        foreach ($exTargets as $instance) {
            $ret .= <<<eoq
    document.getElementById('{$instance}').style.width = '100%';
    document.getElementById('{$instance}').style.height = '100px';
eoq;
        }
        $ret .= <<<eoq
}
-->
</script>

eoq;
        return $ret;
    }
コード例 #9
0
function smarty_function_ext_includes($params, &$smarty)
{
    $ret = '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/ext-all.css") . '" />' . '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/xtheme-gray.css") . '" />';
    global $theme;
    if (is_dir("themes/{$theme}/ext/resources/css")) {
        $cssDir = opendir("themes/{$theme}/ext/resources/css");
        while (($file = readdir($cssDir)) !== false) {
            if (strcasecmp(substr($file, -4), '.css' == 0)) {
                $ret .= "<link rel='stylesheet' type='text/css' href='" . getJSPath("themes/{$theme}/ext/resources/css/{$file}") . "' />";
            }
        }
    }
    return $ret;
}
コード例 #10
0
ファイル: SugarTinyMCE.php プロジェクト: aldridged/gtg-sugar
    /**
     * Returns the Javascript necessary to initialize a TinyMCE instance for a given <textarea> or <div>
     * @param string target Comma delimited list of DOM ID's, <textarea id='someTarget'>
     * @return string 
     */
    function getInstance($targets = "")
    {
        global $json;
        if (empty($json)) {
            $json = getJSONobj();
        }
        $config = $this->defaultConfig;
        $config['elements'] = $targets;
        $config['theme_advanced_buttons1'] = $this->buttonConfigs['default']['buttonConfig'];
        $config['theme_advanced_buttons2'] = $this->buttonConfigs['default']['buttonConfig2'];
        $config['theme_advanced_buttons3'] = $this->buttonConfigs['default']['buttonConfig3'];
        $jsConfig = $json->encode($config);
        $instantiateCall = '';
        if (!empty($targets)) {
            $exTargets = explode(",", $targets);
            foreach ($exTargets as $instance) {
                //$instantiateCall .= "tinyMCE.execCommand('mceAddControl', false, document.getElementById('{$instance}'));\n";
            }
        }
        $path = getJSPath('include/javascript/tiny_mce/tiny_mce.js');
        $ret = <<<eoq
<script type="text/javascript" language="Javascript" src="{$path}"></script>

<script type="text/javascript" language="Javascript">
<!--
if (!SUGAR.util.isTouchScreen()) {
    tinyMCE.init({$jsConfig});
\t{$instantiateCall}\t
}
else {
eoq;
        $exTargets = explode(",", $targets);
        foreach ($exTargets as $instance) {
            $ret .= <<<eoq
    document.getElementById('{$instance}').style.width = '100%';
    document.getElementById('{$instance}').style.height = '100px';
eoq;
        }
        $ret .= <<<eoq
}
-->
</script>

eoq;
        return $ret;
    }
コード例 #11
0
function template_cal_tabs($args)
{
    global $mod_strings, $sugar_version, $sugar_config;
    $tabs = array('day', 'week', 'month', 'year', 'shared');
    if ($args['view'] != 'day') {
        echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp_overlib.js') . '"></script>
			<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>';
    }
    ?>
<table id="cal_tabs" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php 
    $time_arr = array();
    foreach ($tabs as $tab) {
        ?>
<input type="button" <?php 
        if ($args['view'] == $tab) {
            ?>
selected="selected" <?php 
        }
        ?>
 value=" <?php 
        echo $mod_strings["LBL_" . $args['calendar']->get_view_name($tab)];
        ?>
 " id="<?php 
        echo $tab;
        ?>
_tab_id" title="<?php 
        echo $mod_strings["LBL_" . $args['calendar']->get_view_name($tab)];
        ?>
" onclick="window.location.href='index.php?module=Calendar&action=index&view=<?php 
        echo $tab;
        echo $args['calendar']->date_time->get_date_str();
        ?>
'">&nbsp;
<?php 
    }
    ?>
</td>
</tr>
</table>

<?php 
}
コード例 #12
0
/**
 * Smarty {sugar_include} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_include<br>
 * Purpose:  Handles rendering the global file includes from the metadata files defined
 *           in templateMeta=>includes.
 * 
 * @author Collin Lee {clee@sugarcrm.com}
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_include($params, &$smarty)
{
    global $app_strings;
    if (isset($params['type']) && $params['type'] == 'php') {
        if (!isset($params['file'])) {
            $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'] . 'include');
        }
        $includeFile = $params['file'];
        if (!file_exists($includeFile)) {
            $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'] . ': ' . $includeFile);
        }
        ob_start();
        require $includeFile;
        $output_html = ob_get_contents();
        ob_end_clean();
        echo $output_html;
    } else {
        if (isset($params['type']) && $params['type'] == 'smarty') {
            return $smarty->fetch($params['file']);
        } else {
            if (is_array($params['include'])) {
                $code = '';
                foreach ($params['include'] as $include) {
                    if (isset($include['file'])) {
                        $file = $include['file'];
                        if (preg_match('/[\\.]js$/si', $file)) {
                            $code .= "<script src=\"" . getJSPath($include['file']) . "\"></script>";
                        } else {
                            if (preg_match('/[\\.]php$/si', $file)) {
                                require_once $file;
                            }
                        }
                    }
                }
                //foreach
                return $code;
            }
        }
    }
    //if
}
コード例 #13
0
ファイル: Popup_picker.php プロジェクト: MexinaD/SuiteCRM
    /**
     *
     */
    function process_page()
    {
        global $theme;
        global $mod_strings;
        global $app_strings;
        global $currentModule;
        global $app_list_strings, $sugar_version, $sugar_config;
        $output_html = "<script type=\"text/javascript\" src=\"" . getJSPath('include/javascript/sugar_3.js') . "\"></script>";
        $where = '';
        if (empty($_REQUEST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'])) {
            $_POST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'] = '';
        }
        if (empty($_REQUEST['saved_associated_data'])) {
            $_POST['saved_associated_data'] = '';
        }
        $where = $this->_get_where_clause();
        // CREATE STUFF
        if ($this->_create) {
            $formBase = new $this->_popupMeta['create']['formBaseClass']();
            if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') {
                $formBase->handleSave('', false, true);
            }
            $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
            $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
            $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
            // TODO: cleanup the construction of $addform
            $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0];
            $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1];
            $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2];
            $getFormMethod = empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod'];
            $formbody = $formBase->{$getFormMethod}($prefix, $mod, $formBody);
            $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top">&nbsp;', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />';
            $formSave = <<<EOQ
\t\t\t<input type="hidden" name="create" value="true">
\t\t\t<input type="hidden" name="popup" value="true">
\t\t\t<input type="hidden" name="to_pdf" value="true">
\t\t\t<input type="hidden" name="return_module" value="{$currentModule}">
\t\t\t<input type="hidden" name="return_action" value="Popup">
\t\t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" value="  {$lbl_save_button_label}  " />
\t\t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" />
EOQ;
            // if metadata contains custom inputs for the quickcreate
            if (!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
                foreach ($this->_popupMeta['customInput'] as $key => $value) {
                    $formSave .= '<input type="hidden" name="' . $key . '" value="' . $value . '">\\n';
                }
            }
            $createButtonTranslation = translate($this->_popupMeta['create']['createButton']);
            $createButton = <<<EOQ
\t\t\t<input type="button" id="showAdd" name="showAdd" class="button" value="{$createButtonTranslation}" onclick="toggleDisplay('addform');" />
EOQ;
            $addformheader = get_form_header($createButtonTranslation, $formSave, false);
        }
        // END CREATE STUFF
        // search request inputs
        $searchInputs = array();
        foreach ($this->_popupMeta['searchInputs'] as $input) {
            $searchInputs[$input] = empty($_REQUEST[$input]) ? '' : $_REQUEST[$input];
        }
        $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
        $hide_clear_button = empty($_REQUEST['hide_clear_button']) && empty($this->_hide_clear_button) ? false : true;
        $button = '<script>eval("var request_data = " + window.document.forms[\'popup_query_form\'].request_data.value);</script>';
        if (isset($_REQUEST['mass'])) {
            foreach (array_unique($_REQUEST['mass']) as $record) {
                $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n";
            }
        }
        //START:FOR MULTI-SELECT
        $multi_select = false;
        if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
            $multi_select = true;
            $button .= "<input type='hidden' name='mode' value='MultiSelect'>";
            $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "  ' />\n";
        }
        //END:FOR MULTI-SELECT
        if (!$hide_clear_button) {
            $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  ' />\n";
        }
        $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
        if (isset($this->_popupMeta['templateForm'])) {
            $form = new XTemplate($this->_popupMeta['templateForm']);
        } else {
            $form = new XTemplate('modules/' . $currentModule . '/Popup_picker.html');
        }
        $form->assign('MOD', $mod_strings);
        $form->assign('APP', $app_strings);
        $form->assign('THEME', $theme);
        $form->assign('MODULE_NAME', $currentModule);
        $form->assign('request_data', $request_data);
        // CREATE STUFF
        if ($this->_create) {
            $form->assign('CREATEBUTTON', $createButton);
            $form->assign('ADDFORMHEADER', $addformheader);
            $form->assign('ADDFORM', $addform);
        }
        // CREATE STUFF
        if (isset($this->_popupMeta['className'])) {
            $seed_bean = new $this->_popupMeta['className']();
        } else {
            $seed_bean = new $this->_popupMeta['moduleMain']();
        }
        // assign search inputs to xtemplates
        foreach (array_keys($searchInputs) as $key) {
            if (!empty($_REQUEST[$key]) && (isset($seed_bean->field_name_map[$key]['type']) && $seed_bean->field_name_map[$key]['type'] == 'bool')) {
                $form->assign(strtoupper($key), ' checked ');
            } else {
                $form->assign(strtoupper($key), $searchInputs[$key]);
            }
        }
        if ($this->_create) {
            $form->assign('CREATE', 'true');
        } else {
            $form->assign('CREATE', 'false');
        }
        // fill any doms
        if (isset($this->_popupMeta['selectDoms'])) {
            foreach ($this->_popupMeta['selectDoms'] as $key => $value) {
                $form->assign($key, get_select_options_with_id($app_list_strings[$value['dom']], $value['searchInput']));
            }
        }
        $form->assign('MULTI_SELECT', !empty($_REQUEST['mode']) ? strtoupper($_REQUEST['mode']) : '');
        ob_start();
        insert_popup_header($theme);
        $output_html .= ob_get_contents();
        ob_end_clean();
        $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
        $form->parse('main.SearchHeader');
        $output_html .= $form->text('main.SearchHeader');
        // Reset the sections that are already in the page so that they do not print again later.
        $form->reset('main.SearchHeader');
        $ListView = new ListView();
        $ListView->show_select_menu = false;
        $ListView->show_delete_button = false;
        $ListView->show_export_button = false;
        $ListView->process_for_popups = true;
        $ListView->setXTemplate($form);
        $ListView->multi_select_popup = $multi_select;
        $ListView->xTemplate->assign('TAG_TYPE', 'A');
        if (isset($this->_popupMeta['listTitle'])) {
            $ListView->setHeaderTitle($this->_popupMeta['listTitle']);
        } else {
            $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
        }
        $ListView->setHeaderText($button);
        $ListView->setQuery($where, '', $this->_popupMeta['orderBy'], $this->_popupMeta['varName']);
        $ListView->setModStrings($mod_strings);
        ob_start();
        $ListView->processListView($seed_bean, 'main', $this->_popupMeta['varName']);
        $output_html .= ob_get_contents();
        ob_end_clean();
        $json = getJSONobj();
        // decode then encode to escape "'s
        $output_html .= "</form>\n\t\t<script type=\"text/javascript\">\n\t\tfunction save_checks(offset) {\n\t\t\tchecked_ids = Array();\n\t\t\tfor (i = 0; i < document.MassUpdate.elements.length; i++){\n\t\t\t\tif(document.MassUpdate.elements[i].name == 'mass[]' && document.MassUpdate.elements[i].checked) {\n\t\t\t\t\ttemp_string = '';\n\t\t\t\t\ttemp_string += '\"' + document.MassUpdate.elements[i].value + '\": {';\n\t\t\t\t\tfor(the_key in associated_javascript_data[document.MassUpdate.elements[i].value]) {\n\t\t\t\t\t\ttemp_string += '\"' + the_key + '\":\"' + associated_javascript_data[document.MassUpdate.elements[i].value][the_key] + '\",'; \n\t\t\t\t\t}\n\t\t\t\t\ttemp_string = temp_string.substring(0,temp_string.length - 1);\n\t\t\t\t\ttemp_string += '}';\n\t\t\t\t\tchecked_ids.push(temp_string);\n\t\t\t\t}\t\t\t\t \n\t\t\t}\n\t\t\tdocument.MassUpdate.saved_associated_data.value = escape('{' + checked_ids.join(',') + '}');\n\n\t\t\tdocument.MassUpdate.action.value = \"Popup\";\n\t\t\tdocument.MassUpdate.{$currentModule}" . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset.value = offset;
			document.MassUpdate.submit();
		}
		// reassigned the saved data from the saved checks
		if(typeof(document.MassUpdate) != \'undefined\' && document.MassUpdate.saved_associated_data.value != \'\') {
			temp_array = ' . (!empty($_REQUEST['saved_associated_data']) ? $json->encode($json->decode(urldecode($_REQUEST['saved_associated_data']))) : '\'\'') . ';
			for(the_key in temp_array) {
				associated_javascript_data[the_key] = temp_array[the_key];
			}
		}

		// save checks across pages for multiselects 
		if(typeof(document.MassUpdate) != "undefined") {		
			checked_items = Array();
			inputs_array = document.MassUpdate.elements;
	
			for(wp = 0 ; wp < inputs_array.length; wp++) {
				if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") {
					checked_items.push(inputs_array[wp].value);
				} 
			}
			for(i in checked_items) {
				for(wp = 0 ; wp < inputs_array.length; wp++) {
					if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) {
						inputs_array[wp].checked = true;
					}
				}
			}
		}
		</script>';
        $output_html .= insert_popup_footer();
        return $output_html;
    }
コード例 #14
0
 /**
  * Returns the URL for an image in the current theme. If not found in the current theme, will revert
  * to looking in the base theme.
  *
  * @param  string $jsFileName js file name
  * @param  bool   $returnURL if true, returns URL with unique image mark, otherwise returns path to the file
  * @return string path to js file
  */
 public function getJSURL($jsFileName, $returnURL = true)
 {
     if (isset($this->_jsCache[$jsFileName]) && sugar_is_file(sugar_cached($this->_jsCache[$jsFileName]))) {
         if ($returnURL) {
             return getJSPath("cache/" . $this->_jsCache[$jsFileName]);
         } else {
             return sugar_cached($this->_jsCache[$jsFileName]);
         }
     }
     $jsFileContents = '';
     $fullFileName = $this->getJSPath() . '/' . $jsFileName;
     $defaultFileName = $this->getDefaultJSPath() . '/' . $jsFileName;
     if (isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceof SugarTheme && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName, false)) != '' && !in_array($jsFileName, $this->ignoreParentFiles)) {
         $jsFileContents .= file_get_contents($filename);
     } else {
         if (sugar_is_file($defaultFileName)) {
             $jsFileContents .= file_get_contents($defaultFileName);
         }
         if (sugar_is_file('custom/' . $defaultFileName)) {
             $jsFileContents .= file_get_contents('custom/' . $defaultFileName);
         }
     }
     if (sugar_is_file($fullFileName)) {
         $jsFileContents .= file_get_contents($fullFileName);
     }
     if (sugar_is_file('custom/' . $fullFileName)) {
         $jsFileContents .= file_get_contents('custom/' . $fullFileName);
     }
     if (empty($jsFileContents)) {
         $GLOBALS['log']->warn("Javascript File {$jsFileName} not found");
         return false;
     }
     // create the cached file location
     $jsFilePath = create_cache_directory($fullFileName);
     // minify the js
     if (!inDeveloperMode() && !sugar_is_file(str_replace('.js', '-min.js', $jsFilePath))) {
         $jsFileContents = SugarMin::minify($jsFileContents);
         $jsFilePath = str_replace('.js', '-min.js', $jsFilePath);
         $fullFileName = str_replace('.js', '-min.js', $fullFileName);
     }
     // now write the js to cache
     sugar_file_put_contents($jsFilePath, $jsFileContents);
     $this->_jsCache[$jsFileName] = $fullFileName;
     if ($returnURL) {
         return getJSPath("cache/" . $fullFileName);
     }
     return sugar_cached($fullFileName);
 }
コード例 #15
0
/**
 * Create a header for a popup.
 *
 * @todo refactor this into the base Popup_Picker class
 *
 * @param  $theme string the name of the current theme, ignorred to use SugarThemeRegistry::current() instead.
 * @return string HTML
 */
function insert_popup_header($theme = null)
{
    global $app_strings, $sugar_config;
    $charset = isset($app_strings['LBL_CHARSET']) ? $app_strings['LBL_CHARSET'] : $sugar_config['default_charset'];
    $themeCSS = SugarThemeRegistry::current()->getCSS();
    echo <<<EOHTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="{$charset}">
<title>{$app_strings['LBL_BROWSER_TITLE']}</title>
{$themeCSS}
EOHTML;
    echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1_yui.js') . '"></script>';
    echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1.js') . '"></script>';
    echo <<<EOHTML
</head>
<body class="popupBody">
EOHTML;
}
コード例 #16
0
ファイル: view.wizard.php プロジェクト: MexinaD/SuiteCRM
    /**
     * @see SugarView::display()
     */
    public function display()
    {
        global $mod_strings, $current_user, $locale, $sugar_config, $app_list_strings, $sugar_version;
        $themeObject = SugarThemeRegistry::current();
        $css = $themeObject->getCSS();
        $this->ss->assign('SUGAR_CSS', $css);
        $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
        $this->ss->assign('FAVICON_URL', getJSPath($favicon));
        $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
        $this->ss->assign('JAVASCRIPT', user_get_validate_record_js() . user_get_chooser_js() . user_get_confsettings_js());
        $this->ss->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']);
        $this->ss->assign('SKIP_WELCOME', isset($_REQUEST['skipwelcome']) && $_REQUEST['skipwelcome'] == 1);
        $this->ss->assign('ID', $current_user->id);
        $this->ss->assign('USER_NAME', $current_user->user_name);
        $this->ss->assign('FIRST_NAME', $current_user->first_name);
        $this->ss->assign('SUGAR_VERSION', $sugar_version);
        $this->ss->assign('LAST_NAME', $current_user->last_name);
        $this->ss->assign('TITLE', $current_user->title);
        $this->ss->assign('DEPARTMENT', $current_user->department);
        $this->ss->assign('REPORTS_TO_ID', $current_user->reports_to_id);
        $this->ss->assign('REPORTS_TO_NAME', $current_user->reports_to_name);
        $this->ss->assign('PHONE_HOME', $current_user->phone_home);
        $this->ss->assign('PHONE_MOBILE', $current_user->phone_mobile);
        $this->ss->assign('PHONE_WORK', $current_user->phone_work);
        $this->ss->assign('PHONE_OTHER', $current_user->phone_other);
        $this->ss->assign('PHONE_FAX', $current_user->phone_fax);
        $this->ss->assign('EMAIL1', $current_user->email1);
        $this->ss->assign('EMAIL2', $current_user->email2);
        $this->ss->assign('ADDRESS_STREET', $current_user->address_street);
        $this->ss->assign('ADDRESS_CITY', $current_user->address_city);
        $this->ss->assign('ADDRESS_STATE', $current_user->address_state);
        $this->ss->assign('ADDRESS_POSTALCODE', $current_user->address_postalcode);
        $this->ss->assign('ADDRESS_COUNTRY', $current_user->address_country);
        $configurator = new Configurator();
        if ($configurator->config['passwordsetting']['SystemGeneratedPasswordON'] || $configurator->config['passwordsetting']['forgotpasswordON']) {
            $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '1');
        } else {
            $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '0');
        }
        // get javascript
        ob_start();
        $this->options['show_javascript'] = true;
        $this->renderJavascript();
        $this->options['show_javascript'] = false;
        $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
        ob_end_clean();
        $messenger_type = '<select tabindex="5" name="messenger_type">';
        $messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $current_user->messenger_type);
        $messenger_type .= '</select>';
        $this->ss->assign('MESSENGER_TYPE_OPTIONS', $messenger_type);
        $this->ss->assign('MESSENGER_ID', $current_user->messenger_id);
        // set default settings
        $use_real_names = $current_user->getPreference('use_real_names');
        if (empty($use_real_names)) {
            $current_user->setPreference('use_real_names', 'on');
        }
        $current_user->setPreference('reminder_time', 1800);
        $current_user->setPreference('email_reminder_time', 3600);
        $current_user->setPreference('mailmerge_on', 'on');
        //// Timezone
        if (empty($current_user->id)) {
            // remove default timezone for new users(set later)
            $current_user->user_preferences['timezone'] = '';
        }
        $userTZ = $current_user->getPreference('timezone');
        if (empty($userTZ) && !$current_user->is_group && !$current_user->portal_only) {
            $userTZ = TimeDate::guessTimezone();
            $current_user->setPreference('timezone', $userTZ);
        }
        if (!$current_user->getPreference('ut')) {
            $this->ss->assign('PROMPTTZ', ' checked');
        }
        $this->ss->assign('TIMEZONE_CURRENT', $userTZ);
        $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
        //// Numbers and Currency display
        require_once 'modules/Currencies/ListCurrency.php';
        $currency = new ListCurrency();
        // 10/13/2006 Collin - Changed to use Localization.getConfigPreference
        // This was the problem- Previously, the "-99" currency id always assumed
        // to be defaulted to US Dollars.  However, if someone set their install to use
        // Euro or other type of currency then this setting would not apply as the
        // default because it was being overridden by US Dollars.
        $cur_id = $locale->getPrecedentPreference('currency', $current_user);
        if ($cur_id) {
            $selectCurrency = $currency->getSelectOptions($cur_id);
            $this->ss->assign("CURRENCY", $selectCurrency);
        } else {
            $selectCurrency = $currency->getSelectOptions();
            $this->ss->assign("CURRENCY", $selectCurrency);
        }
        $currenciesArray = $locale->currencies;
        $currenciesVars = $this->correctCurrenciesSymbolsSort($currenciesArray);
        $currencySymbolsJs = <<<eoq
var currencies = new Object;
{$currenciesVars}
function setSymbolValue(id) {
\tdocument.getElementById('symbol').value = currencies[id];
}
eoq;
        $this->ss->assign('currencySymbolJs', $currencySymbolsJs);
        // fill significant digits dropdown
        $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
        $sigDigits = '';
        for ($i = 0; $i <= 6; $i++) {
            if ($significantDigits == $i) {
                $sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>";
            } else {
                $sigDigits .= "<option value=\"{$i}\">{$i}</option>";
            }
        }
        $this->ss->assign('sigDigits', $sigDigits);
        $num_grp_sep = $current_user->getPreference('num_grp_sep');
        $dec_sep = $current_user->getPreference('dec_sep');
        $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep);
        $this->ss->assign("DEC_SEP", empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep);
        $this->ss->assign('getNumberJs', $locale->getNumberJs());
        //// Name display format
        $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($current_user));
        $this->ss->assign('getNameJs', $locale->getNameJs());
        $this->ss->assign('TIMEOPTIONS', get_select_options_with_id($sugar_config['time_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_time_format')));
        $this->ss->assign('DATEOPTIONS', get_select_options_with_id($sugar_config['date_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_date_format')));
        $this->ss->assign("MAIL_SENDTYPE", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $current_user->getPreference('mail_sendtype')));
        $this->ss->assign("NEW_EMAIL", $current_user->emailAddress->getEmailAddressWidgetEditView($current_user->id, $current_user->module_dir));
        $this->ss->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $current_user->getPreference('email_link_type')));
        $selectedLocaleNameFormat = $current_user->_userPreferenceFocus->getDefaultPreference('default_locale_name_format');
        if (array_key_exists($selectedLocaleNameFormat, $sugar_config['name_formats'])) {
            $selectedLocaleNameFormat = $sugar_config['default_locale_name_format'];
        }
        $this->ss->assign('NAMEOPTIONS', get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $selectedLocaleNameFormat));
        // email smtp
        $systemOutboundEmail = new OutboundEmail();
        $systemOutboundEmail = $systemOutboundEmail->getSystemMailerSettings();
        $mail_smtpserver = $systemOutboundEmail->mail_smtpserver;
        $mail_smtptype = $systemOutboundEmail->mail_smtptype;
        $mail_smtpport = $systemOutboundEmail->mail_smtpport;
        $mail_smtpssl = $systemOutboundEmail->mail_smtpssl;
        $mail_smtpdisplay = $systemOutboundEmail->mail_smtpdisplay;
        $mail_smtpuser = "";
        $mail_smtppass = "";
        $hide_if_can_use_default = true;
        $mail_smtpauth_req = true;
        if (!empty($mail_smtpserver) && !empty($mail_smtptype)) {
            if (!$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound()) {
                $mail_smtpauth_req = $systemOutboundEmail->mail_smtpauth_req;
                $userOverrideOE = $systemOutboundEmail->getUsersMailerForSystemOverride($current_user->id);
                if ($userOverrideOE != null) {
                    $mail_smtpuser = $userOverrideOE->mail_smtpuser;
                    $mail_smtppass = $userOverrideOE->mail_smtppass;
                }
                if (!$mail_smtpauth_req && (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser) || empty($systemOutboundEmail->mail_smtppass))) {
                    $hide_if_can_use_default = true;
                } else {
                    $hide_if_can_use_default = false;
                }
            }
        }
        $isAdmin = is_admin($current_user);
        $this->ss->assign('IS_ADMIN', $isAdmin);
        $this->ss->assign("mail_smtpdisplay", $mail_smtpdisplay);
        $this->ss->assign("mail_smtpuser", $mail_smtpuser);
        $this->ss->assign("mail_smtppass", $mail_smtppass);
        $this->ss->assign('mail_smtpserver', $mail_smtpserver);
        $this->ss->assign("mail_smtpauth_req", $mail_smtpauth_req);
        $this->ss->assign('MAIL_SMTPPORT', $mail_smtpport);
        $this->ss->assign('MAIL_SMTPSSL', $mail_smtpssl);
        $this->ss->assign('HIDE_IF_CAN_USE_DEFAULT_OUTBOUND', $hide_if_can_use_default);
        $this->ss->assign('langHeader', get_language_header());
        $this->ss->display($this->getCustomFilePathIfExists('modules/Users/tpls/wizard.tpl'));
    }
コード例 #17
0
 function getQSScriptsJSONAlreadyDefined()
 {
     global $sugar_version, $sugar_config, $theme;
     $qsScriptsJSONAlreadyDefined = '<script type="text/javascript">sqsWaitGif = "' . SugarThemeRegistry::current()->getImageURL('sqsWait.gif') . '";</script><script type="text/javascript" src="' . getJSPath('include/javascript/quicksearch.js') . '"></script>';
     return $qsScriptsJSONAlreadyDefined;
 }
コード例 #18
0
ファイル: SugarView.php プロジェクト: omusico/sugar_work
 /**
  * Retrieves favicon corresponding to currently requested module
  *
  * @return array
  */
 protected function getFavicon()
 {
     // get favicon
     if (isset($GLOBALS['sugar_config']['default_module_favicon'])) {
         $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
     } else {
         $module_favicon = false;
     }
     $themeObject = SugarThemeRegistry::current();
     $favicon = '';
     if ($module_favicon) {
         $favicon = $themeObject->getImageURL($this->module . '.gif', false);
     }
     if (!sugar_is_file($favicon) || !$module_favicon) {
         $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     }
     $extension = pathinfo($favicon, PATHINFO_EXTENSION);
     switch ($extension) {
         case 'png':
             $type = 'image/png';
             break;
         case 'ico':
             // fall through
         // fall through
         default:
             $type = 'image/x-icon';
             break;
     }
     return array('url' => getJSPath($favicon), 'type' => $type);
 }
コード例 #19
0
/**
 * Create a header for a popup.
 *
 * @todo refactor this into the base Popup_Picker class
 *
 * @param  $theme string the name of the current theme, ignorred to use SugarThemeRegistry::current() instead.
 * @return string HTML
 */
function insert_popup_header($theme = null, $includeJS = true)
{
    global $app_strings, $sugar_config;
    $themeCSS = SugarThemeRegistry::current()->getCSS();
    $langHeader = get_language_header();
    //The SugarView will insert the header now, this function should no longer do the actual head element.
    if ($includeJS) {
        echo <<<EOHTML
<!DOCTYPE HTML>
<html {$langHeader}>
<head>
EOHTML;
    }
    if (isset($sugar_config['meta_tags']) && isset($sugar_config['meta_tags']['IE_COMPAT_MODE'])) {
        echo $sugar_config['meta_tags']['IE_COMPAT_MODE'];
    }
    echo "<title>{$app_strings['LBL_BROWSER_TITLE']}</title>" . $themeCSS;
    if ($includeJS) {
        $charset = isset($app_strings['LBL_CHARSET']) ? $app_strings['LBL_CHARSET'] : $sugar_config['default_charset'];
        echo '<meta http-equiv="Content-Type" content="text/html; charset="{$charset}">';
        echo '<script type="text/javascript" src="' . getJSPath('cache/include/javascript/sugar_grp1_yui.js') . '"></script>';
        echo '<script type="text/javascript" src="' . getJSPath('cache/include/javascript/sugar_grp1.js') . '"></script>';
    }
    /* Fix to include files required to make pop-ups responsive */
    echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
    echo '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />';
    echo '<link href="themes/SuiteR/css/bootstrap.min.css" rel="stylesheet">';
    echo '<link href="themes/SuiteR/css/colourSelector.php" rel="stylesheet">';
    echo '</head>';
    echo '<body class="popupBody">';
}
コード例 #20
0
ファイル: Login.php プロジェクト: delkyd/sugarcrm_dev
}
if (empty($GLOBALS['sugar_config']['passwordsetting']['forgotpasswordON'])) {
    $sugar_smarty->assign('DISPLAY_FORGOT_PASSWORD_FEATURE', 'none');
}
$the_languages = get_languages();
if (count($the_languages) > 1) {
    $sugar_smarty->assign('SELECT_LANGUAGE', get_select_options_with_id($the_languages, $display_language));
}
$the_themes = SugarThemeRegistry::availableThemes();
if (!empty($logindisplay)) {
    $sugar_smarty->assign('LOGIN_DISPLAY', $logindisplay);
}
// RECAPTCHA
$admin = new Administration();
$admin->retrieveSettings('captcha');
$captcha_privatekey = "";
$captcha_publickey = "";
$captcha_js = "";
$Captcha = '';
// if the admin set the captcha stuff, assign javascript and div
if (isset($admin->settings['captcha_on']) && $admin->settings['captcha_on'] == '1' && !empty($admin->settings['captcha_private_key']) && !empty($admin->settings['captcha_public_key'])) {
    $captcha_privatekey = $admin->settings['captcha_private_key'];
    $captcha_publickey = $admin->settings['captcha_public_key'];
    $captcha_js .= "<script type='text/javascript' src='" . getJSPath('cache/include/javascript/sugar_grp1_yui.js') . "'></script><script type='text/javascript' src='" . getJSPath('cache/include/javascript/sugar_grp_yui2.js') . "'></script>\n\t\t\t<script type='text/javascript' src='http://api.recaptcha.net/js/recaptcha_ajax.js'></script>\n\t\t\t<script>\n\t\t\tfunction initCaptcha(){\n\t\t\tRecaptcha.create('{$captcha_publickey}' ,'captchaImage',{theme:'custom'});\n\t\t\t}\n\t\t\twindow.onload=initCaptcha;\n\n\t\t\tvar handleFailure=handleSuccess;\n\t\t\tvar handleSuccess = function(o){\n\t\t\t\tif(o.responseText!==undefined && o.responseText =='Success'){\n\t\t\t\t\tgeneratepwd();\n\t\t\t\t\tRecaptcha.reload();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(o.responseText!='')\n\t\t\t\t\t\tdocument.getElementById('generate_success').innerHTML =o.responseText;\n\t\t\t\t\tRecaptcha.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar callback2 ={ success:handleSuccess, failure: handleFailure };\n\n\t\t\tfunction validateAndSubmit(){\n\t\t\t\t\tvar form = document.getElementById('form');\n\t\t\t\t\tvar url = '&to_pdf=1&module=Home&action=index&entryPoint=Changenewpassword&recaptcha_challenge_field='+Recaptcha.get_challenge()+'&recaptcha_response_field='+ Recaptcha.get_response();\n\t\t\t\t\tYAHOO.util.Connect.asyncRequest('POST','index.php',callback2,url);\n\t\t\t}</script>";
    $Captcha .= "<tr>\n\t\t\t<td scope='row' width='20%'>" . $mod_strings['LBL_RECAPTCHA_INSTRUCTION'] . ":</td>\n\t\t    <td width='70%'><input type='text' size='26' id='recaptcha_response_field' value=''></td>\n\n\t\t</tr>\n\t\t<tr>\n\n\t\t \t<td colspan='2'><div style='margin-left:2px'class='x-sqs-list' id='recaptcha_image'></div></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2' align='right'><a href='javascript:Recaptcha.reload()'>" . $mod_strings['LBL_RECAPTCHA_NEW_CAPTCHA'] . "</a>&nbsp;&nbsp;\n\t\t\t \t\t<a class='recaptcha_only_if_image' href='javascript:Recaptcha.switch_type(\"audio\")'>" . $mod_strings['LBL_RECAPTCHA_SOUND'] . "</a>\n\t\t\t \t\t<a class='recaptcha_only_if_audio' href='javascript:Recaptcha.switch_type(\"image\")'> " . $mod_strings['LBL_RECAPTCHA_IMAGE'] . "</a>\n\t\t \t</td>\n\t\t</tr>";
    $sugar_smarty->assign('CAPTCHA', $Captcha);
    echo $captcha_js;
} else {
    echo "<script>\n\t\tfunction validateAndSubmit(){generatepwd();}\n\t\t</script>";
}
$sugar_smarty->display('modules/Users/login.tpl');
コード例 #21
0
}
if (!empty($_REQUEST['campaign_id'])) {
    $web_form_campaign = $_REQUEST['campaign_id'];
}
if (!empty($_REQUEST['assigned_user_id'])) {
    $web_assigned_user = $_REQUEST['assigned_user_id'];
}
$lead = new Lead();
$fieldsMetaData = new FieldsMetaData();
$xtpl = new XTemplate('modules/Campaigns/WebToLeadForm.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$Web_To_Lead_Form_html = '';
$Web_To_Lead_Form_html .= '<link rel="stylesheet" type="text/css" media="all" href="' . getJSPath(SugarThemeRegistry::current()->getCSSURL('calendar-win2k-cold-1.css')) . '">';
$Web_To_Lead_Form_html .= "<script type=\"text/javascript\" src='" . getJSPath($site_url . '/cache/include/javascript/sugar_grp1.js') . "'></script>";
$Web_To_Lead_Form_html .= '<script type="text/javascript" src="' . getJSPath($site_url . '/cache/include/javascript/calendar.js') . '"></script>';
$Web_To_Lead_Form_html .= "<form action='{$web_post_url}' name='WebToLeadForm' method='POST' id='WebToLeadForm'>";
$Web_To_Lead_Form_html .= "<table width='100%' style='border-top: 1px solid;\nborder-bottom: 1px solid;\npadding: 10px 6px 12px 10px;\nbackground-color: rgb(233, 243, 255);\nfont-size: 12px;\nbackground-repeat: repeat-x;\nbackground-position: center top;'>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'><b><h2>{$web_form_header}</h2></b></TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='left' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>{$web_form_description}</TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
//$Web_To_Lead_Form_html .= "\n<p>\n";
if (!empty($_REQUEST['colsFirst']) && !empty($_REQUEST['colsSecond'])) {
    if (count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])) {
        $columns = count($_REQUEST['colsSecond']);
    }
    if (count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])) {
        $columns = count($_REQUEST['colsFirst']);
    }
} else {
コード例 #22
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
// $Id: MyPipelineBySalesStageDashlet.meta.php 54045 2010-01-26 20:25:05Z roger $
global $app_strings, $current_language;
$dashletMeta['MyPipelineBySalesStageDashlet'] = array('title' => 'LBL_TITLE', 'description' => 'LBL_TITLE', 'icon' => getJSPath('icon_Charts_Funnel_32.gif'), 'module' => 'Opportunities', 'category' => 'Charts');
コード例 #23
0
ファイル: Charts.php プロジェクト: aldridged/gtg-sugar
 function campaign_response_roi($datay = array(), $targets = array(), $campaign_id, $cache_file_name = 'a_file', $refresh = false, $marketing_id = '', $is_dashlet = false, $dashlet_id = '')
 {
     global $app_strings, $mod_strings, $current_module_strings, $charset, $lang, $app_list_strings, $current_language, $sugar_config;
     $not_empty = false;
     if ($is_dashlet) {
         $mod_strings = return_module_language($current_language, 'Campaigns');
     }
     if (!file_exists($cache_file_name) || $refresh == true) {
         $GLOBALS['log']->debug("datay is:");
         $GLOBALS['log']->debug($datay);
         $GLOBALS['log']->debug("user_id is: ");
         $GLOBALS['log']->debug("cache_file_name is: {$cache_file_name}");
         $focus = new Campaign();
         $focus->retrieve($campaign_id);
         $opp_count = 0;
         $opp_query = "select count(*) opp_count,sum(" . db_convert("amount_usdollar", "IFNULL", array(0)) . ")  total_value";
         $opp_query .= " from opportunities";
         $opp_query .= " where campaign_id='{$campaign_id}'";
         $opp_query .= " and sales_stage='Prospecting'";
         $opp_query .= " and deleted=0";
         $opp_result = $focus->db->query($opp_query);
         $opp_data = $focus->db->fetchByAssoc($opp_result);
         //            if (empty($opp_data['opp_count'])) $opp_data['opp_count']=0;
         if (empty($opp_data['total_value'])) {
             $opp_data['total_value'] = 0;
         }
         //report query
         $opp_query1 = "select SUM(opp.amount) as revenue";
         $opp_query1 .= " from opportunities opp";
         $opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
         $opp_query1 .= " where opp.sales_stage = 'Closed Won'and camp.id='{$campaign_id}' and opp.deleted=0";
         $opp_query1 .= " group by camp.name";
         $opp_result1 = $focus->db->query($opp_query1);
         $opp_data1 = $focus->db->fetchByAssoc($opp_result1);
         //if (empty($opp_data1[]))
         if (empty($opp_data1['revenue'])) {
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
             unset($opp_data1['revenue']);
         } else {
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
             unset($opp_data1['revenue']);
             $not_empty = true;
         }
         $camp_query1 = "select camp.name, SUM(camp.actual_cost) as investment,SUM(camp.budget) as budget,SUM(camp.expected_revenue) as expected_revenue";
         $camp_query1 .= " from campaigns camp";
         $camp_query1 .= " where camp.id='{$campaign_id}'";
         $camp_query1 .= " group by camp.name";
         $camp_result1 = $focus->db->query($camp_query1);
         $camp_data1 = $focus->db->fetchByAssoc($camp_result1);
         //query needs to be lowercase, but array keys need to be propercased, as these are used in
         //chart to display legend
         if (empty($camp_data1['investment'])) {
             $camp_data1['investment'] = 0;
         } else {
             $not_empty = true;
         }
         if (empty($camp_data1['budget'])) {
             $camp_data1['budget'] = 0;
         } else {
             $not_empty = true;
         }
         if (empty($camp_data1['expected_revenue'])) {
             $camp_data1['expected_revenue'] = 0;
         } else {
             $not_empty = true;
         }
         $opp_data1[$mod_strings['LBL_ROI_CHART_INVESTMENT']] = $camp_data1['investment'];
         $opp_data1[$mod_strings['LBL_ROI_CHART_BUDGET']] = $camp_data1['budget'];
         $opp_data1[$mod_strings['LBL_ROI_CHART_EXPECTED_REVENUE']] = $camp_data1['expected_revenue'];
         $query = "SELECT activity_type,target_type, count(*) hits ";
         $query .= " FROM campaign_log ";
         $query .= " WHERE campaign_id = '{$campaign_id}' AND archived=0 AND deleted=0";
         //if $marketing id is specified, then lets filter the chart by the value
         if (!empty($marketing_id)) {
             $query .= " AND marketing_id ='{$marketing_id}'";
         }
         $query .= " GROUP BY  activity_type, target_type";
         $query .= " ORDER BY  activity_type, target_type";
         $result = $focus->db->query($query);
         $leadSourceArr = array();
         $total = 0;
         $total_targeted = 0;
     }
     global $current_user;
     $user_id = $current_user->id;
     require_once 'include/SugarCharts/SugarChart.php';
     $width = $is_dashlet ? '100%' : '720px';
     $return = '<script type="text/javascript" src="' . getJSPath('include/javascript/swfobject.js') . '"></script>';
     if (!$is_dashlet) {
         $return .= '<br />';
     }
     $currency_id = $focus->currency_id;
     $currency_symbol = $sugar_config['default_currency_symbol'];
     if (!empty($currency_id)) {
         $cur = new Currency();
         $cur->retrieve($currency_id);
         $currency_symbol = $cur->symbol;
     }
     $sugarChart = new SugarChart();
     $sugarChart->is_currency = true;
     $sugarChart->currency_symbol = $currency_symbol;
     if ($not_empty) {
         $sugarChart->setData($opp_data1);
     } else {
         $sugarChart->setData(array());
     }
     $sugarChart->setProperties($mod_strings['LBL_CAMPAIGN_RETURN_ON_INVESTMENT'], $mod_strings['LBL_AMOUNT_IN'] . $currency_symbol, 'bar chart');
     if (!$is_dashlet) {
         $xmlFile = $sugarChart->getXMLFileName('roi_details_chart');
         $sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
         $return .= $sugarChart->display('roi_details_chart', $xmlFile, $width, '480');
     } else {
         $xmlFile = $sugarChart->getXMLFileName($dashlet_id);
         $sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
         $return .= $sugarChart->display($dashlet_id, $xmlFile, $width, '480');
     }
     return $return;
 }
コード例 #24
0
 protected function post_save()
 {
     if (!$this->bean->deleted) {
         // do not load bean here since password is already encoded
         if ($this->api->authMethod != 'oauth') {
             // OAuth beans have to be handled specially.
             $reply = $this->api->checkLogin();
             if (!$reply['success']) {
                 return $this->failed(translate('LBL_AUTH_ERROR', $this->bean->module_dir));
             } else {
                 $this->bean->validated();
             }
         }
     }
     if ($this->return_module == 'Users') {
         $this->return_action = 'EditView';
     }
     parent::post_save();
     if ($this->return_module == 'Import') {
         $this->set_redirect("index.php?module=Import&action=Step1&import_module=" . $this->return_action . "&application=" . $this->bean->application);
     }
     if ($this->module == 'EAPM') {
         $this->set_redirect('index.php?module=Users&action=EditView&record=' . $_POST['assigned_user_id']);
     }
     // Override the redirect location to add the hash
     $this->redirect_url = $this->redirect_url . '#tab5';
     if ($this->api->authMethod == 'oauth' && !$this->bean->deleted) {
         // It's OAuth, we have to handle this specially.
         // We need to create a new window to handle the OAuth, and redirect this window back to the edit view
         // So we will handle that in javascript.
         $popup_warning_msg = string_format($GLOBALS['mod_strings']['LBL_ERR_POPUPS_DISABLED'], array($_SERVER['HTTP_HOST']));
         echo '<script src="modules/EAPM/EAPMEdit.js" type="text/javascript"></script><script type="text/javascript">EAPMPopupAndRedirect("index.php?module=EAPM&action=oauth&record=' . $this->bean->id . '", "' . $this->redirect_url . '", \'' . $popup_warning_msg . '\'); </script>';
         // To prevent the normal handler from issuing a header call and destroying our neat little javascript we'll
         // end right here.
         sugar_die('');
     } elseif ($this->api->authMethod == 'oauth2' && !$this->bean->deleted) {
         $client = $this->api->getClient();
         $loginUrl = $client->createAuthUrl();
         echo '<script src="' . getJSPath('modules/EAPM/EAMPOauth.js') . '" type="text/javascript"></script><script type="text/javascript">EAMPOauth.startOauthAuthentication("' . $loginUrl . '","index.php?module=EAPM&action=oauth&record=' . $this->bean->id . '");</script>';
         // To prevent the normal handler from issuing a header call and destroying our neat little javascript we'll
         // end right here.
         sugar_cleanup(true);
     }
 }
コード例 #25
0
    function display($showContainer = true, $forceTabless = false)
    {
        global $layout_edit_mode, $sugar_version, $sugar_config, $current_user, $app_strings;
        if (isset($layout_edit_mode) && $layout_edit_mode) {
            return;
        }
        global $modListHeader;
        ob_start();
        echo '<script type="text/javascript" src="' . getJSPath('include/SubPanel/SubPanelTiles.js') . '"></script>';
        ?>
<script>
if(document.DetailView != null &&
   document.DetailView.elements != null &&
   document.DetailView.elements.layout_def_key != null &&
   typeof document.DetailView.elements['layout_def_key'] != 'undefined'){
    document.DetailView.elements['layout_def_key'].value = '<?php 
        echo $this->layout_def_key;
        ?>
';
}
</script>
<?php 
        $tabs = array();
        $default_div_display = 'inline';
        if (!empty($sugar_config['hide_subpanels_on_login'])) {
            if (!isset($_SESSION['visited_details'][$this->focus->module_dir])) {
                setcookie($this->focus->module_dir . '_divs', '');
                unset($_COOKIE[$this->focus->module_dir . '_divs']);
                $_SESSION['visited_details'][$this->focus->module_dir] = true;
            }
            $default_div_display = 'none';
        }
        $div_cookies = get_sub_cookies($this->focus->module_dir . '_divs');
        //Display the group header. this section is executed only if the tabbed interface is being used.
        $current_key = '';
        if (!empty($this->show_tabs)) {
            require_once 'include/tabs.php';
            $tab_panel = new SugarWidgetTabs($tabs, $current_key, 'showSubPanel');
            echo get_form_header('Related', '', false);
            echo "<br />" . $tab_panel->display();
        }
        if (empty($_REQUEST['subpanels'])) {
            $selected_group = $forceTabless ? '' : $this->getSelectedGroup();
            $usersLayout = $current_user->getPreference('subpanelLayout', $this->focus->module_dir);
            // we need to use some intelligence here when restoring the user's layout, as new modules with new subpanels might have been installed since the user's layout was recorded
            // this means that we can't just restore the old layout verbatim as the new subpanels would then go walkabout
            // so we need to do a merge while attempting as best we can to preserve the sense of the specified order
            // this is complicated by the different ordering schemes used in the two sources for the panels: the user's layout uses an ordinal layout, the panels from getTabs have an explicit ordering driven by the 'order' parameter
            // it's not clear how to best reconcile these two schemes; so we punt on it, and add all new panels to the end of the user's layout. At least this will give them a clue that something has changed...
            // we also now check for tabs that have been removed since the user saved his or her preferences.
            $tabs = $this->getTabs($showContainer, $selected_group);
            if (!empty($usersLayout)) {
                $availableTabs = $tabs;
                $tabs = array_intersect($usersLayout, $availableTabs);
                // remove any tabs that have been removed since the user's layout was saved
                foreach (array_diff($availableTabs, $usersLayout) as $tab) {
                    $tabs[] = $tab;
                }
            }
        } else {
            $tabs = explode(',', $_REQUEST['subpanels']);
        }
        $tab_names = array();
        if ($showContainer) {
            echo '<ul class="noBullet" id="subpanel_list">';
        }
        //echo "<li id='hidden_0' style='height: 5px' class='noBullet'>&nbsp;&nbsp;&nbsp;</li>";
        if (empty($GLOBALS['relationships'])) {
            if (!class_exists('Relationship')) {
                require 'modules/Relationships/Relationship.php';
            }
            $rel = new Relationship();
            $rel->load_relationship_meta();
        }
        // this array will store names of sub-panels that can contain items
        // of each module
        $module_sub_panels = array();
        foreach ($tabs as $tab) {
            //load meta definition of the sub-panel.
            $thisPanel = $this->subpanel_definitions->load_subpanel($tab);
            if ($thisPanel === false) {
                continue;
            }
            //this if-block will try to skip over ophaned subpanels. Studio/MB are being delete unloaded modules completely.
            //this check will ignore subpanels that are collections (activities, history, etc)
            if (!isset($thisPanel->_instance_properties['collection_list']) and isset($thisPanel->_instance_properties['get_subpanel_data'])) {
                //ignore when data source is a function
                if (!isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']])) {
                    if (stripos($thisPanel->_instance_properties['get_subpanel_data'], 'function:') === false) {
                        Log::fatal("Bad subpanel definition, it has incorrect value for get_subpanel_data property " . $tab);
                        continue;
                    }
                } else {
                    $rel_name = '';
                    if (isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'])) {
                        $rel_name = $this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'];
                    }
                    if (empty($rel_name) or !isset($GLOBALS['relationships'][$rel_name])) {
                        Log::fatal("Missing relationship definition " . $rel_name . ". skipping " . $tab . " subpanel");
                        continue;
                    }
                }
            }
            if ($thisPanel->isCollection()) {
                // collect names of sub-panels that may contain items of each module
                $collection_list = $thisPanel->get_inst_prop_value('collection_list');
                if (is_array($collection_list)) {
                    foreach ($collection_list as $data) {
                        if (!empty($data['module'])) {
                            $module_sub_panels[$data['module']][$tab] = true;
                        }
                    }
                }
            } else {
                $module = $thisPanel->get_module_name();
                if (!empty($module)) {
                    $module_sub_panels[$module][$tab] = true;
                }
            }
            echo '<li class="noBullet" id="whole_subpanel_' . $tab . '">';
            $display = 'none';
            $div_display = $default_div_display;
            $cookie_name = $tab . '_v';
            if (isset($thisPanel->_instance_properties['collapsed']) && $thisPanel->_instance_properties['collapsed']) {
                $div_display = 'none';
            }
            if (isset($div_cookies[$cookie_name])) {
                //If defaultSubPanelExpandCollapse is set, ignore the cookie that remembers whether the panel is expanded or collapsed.
                //To be used with the above 'collapsed' metadata setting so they will always be set the same when the page is loaded.
                if (!isset($sugar_config['defaultSubPanelExpandCollapse']) || $sugar_config['defaultSubPanelExpandCollapse'] == false) {
                    $div_display = $div_cookies[$cookie_name];
                }
            }
            if (!empty($sugar_config['hide_subpanels'])) {
                $div_display = 'none';
            }
            if ($thisPanel->isDefaultHidden()) {
                $div_display = 'none';
            }
            if ($div_display == 'none') {
                $opp_display = 'inline';
            } else {
                $opp_display = 'none';
            }
            if (!empty($this->layout_def_key)) {
                $layout_def_key = $this->layout_def_key;
            } else {
                $layout_def_key = '';
            }
            if (empty($this->show_tabs)) {
                $show_icon_html = SugarThemeRegistry::current()->getImage('advanced_search', 'border="0" align="absmiddle"', null, null, '.gif', translate('LBL_SHOW'));
                $hide_icon_html = SugarThemeRegistry::current()->getImage('basic_search', 'border="0" align="absmiddle"', null, null, '.gif', translate('LBL_HIDE'));
                $max_min = "<a name=\"{$tab}\"> </a><span id=\"show_link_" . $tab . "\" style=\"display: {$opp_display}\"><a href='#' class='utilsLink' onclick=\"current_child_field = '" . $tab . "';showSubPanel('" . $tab . "',null,null,'" . $layout_def_key . "');document.getElementById('show_link_" . $tab . "').style.display='none';document.getElementById('hide_link_" . $tab . "').style.display='';return false;\">" . "" . $show_icon_html . "</a></span>";
                $max_min .= "<span id=\"hide_link_" . $tab . "\" style=\"display: {$div_display}\"><a href='#' class='utilsLink' onclick=\"hideSubPanel('" . $tab . "');document.getElementById('hide_link_" . $tab . "').style.display='none';document.getElementById('show_link_" . $tab . "').style.display='';return false;\">" . "" . $hide_icon_html . "</a></span>";
                echo '<div id="subpanel_title_' . $tab . '"';
                if (empty($sugar_config['lock_subpanels']) || $sugar_config['lock_subpanels'] == false) {
                    echo ' onmouseover="this.style.cursor = \'move\';"';
                }
                echo '>' . get_form_header($thisPanel->get_title(), $max_min, false) . '</div>';
            }
            echo <<<EOQ
<div cookie_name="{$cookie_name}" id="subpanel_{$tab}" style="display:{$div_display}">
    <script>document.getElementById("subpanel_{$tab}" ).cookie_name="{$cookie_name}";</script>
EOQ;
            $display_spd = '';
            if ($div_display != 'none') {
                echo "<script>SUGAR.util.doWhen(\"typeof(markSubPanelLoaded) != 'undefined'\", function() {markSubPanelLoaded('{$tab}');});</script>";
                $old_contents = ob_get_contents();
                @ob_end_clean();
                ob_start();
                include_once 'include/SubPanel/SubPanel.php';
                $subpanel_object = new SubPanel($this->module, $_REQUEST['record'], $tab, $thisPanel, $layout_def_key);
                $subpanel_object->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
                $subpanel_object->display();
                $subpanel_data = ob_get_contents();
                @ob_end_clean();
                ob_start();
                echo $this->get_buttons($thisPanel, $subpanel_object->subpanel_query);
                $buttons = ob_get_contents();
                @ob_end_clean();
                ob_start();
                echo $old_contents;
                //echo $buttons;
                $display_spd = $subpanel_data;
            }
            echo <<<EOQ
    <div id="list_subpanel_{$tab}">{$display_spd}</div>
</div>
EOQ;
            array_push($tab_names, $tab);
            echo '</li>';
        }
        // end $tabs foreach
        if ($showContainer) {
            echo '</ul>';
            if (!empty($selected_group)) {
                // closing table from tpls/singletabmenu.tpl
                echo '</td></tr></table>';
            }
        }
        // drag/drop code
        $tab_names = '["' . join($tab_names, '","') . '"]';
        global $sugar_config;
        if (empty($sugar_config['lock_subpanels']) || $sugar_config['lock_subpanels'] == false) {
            echo <<<EOQ
    <script>
    \tvar SubpanelInit = function() {
    \t\tSubpanelInitTabNames({$tab_names});
    \t}
        var SubpanelInitTabNames = function(tabNames) {
    \t\tsubpanel_dd = new Array();
    \t\tj = 0;
    \t\tfor(i in tabNames) {
    \t\t\tsubpanel_dd[j] = new ygDDList('whole_subpanel_' + tabNames[i]);
    \t\t\tsubpanel_dd[j].setHandleElId('subpanel_title_' + tabNames[i]);
    \t\t\tsubpanel_dd[j].onMouseDown = SUGAR.subpanelUtils.onDrag;
    \t\t\tsubpanel_dd[j].afterEndDrag = SUGAR.subpanelUtils.onDrop;
    \t\t\tj++;
    \t\t}

    \t\tYAHOO.util.DDM.mode = 1;
    \t}
    \tcurrentModule = '{$this->module}';
    \tSUGAR.util.doWhen(
    \t    "typeof(SUGAR.subpanelUtils) == 'object' && typeof(SUGAR.subpanelUtils.onDrag) == 'function'" +
    \t        " && document.getElementById('subpanel_list')",
    \t    SubpanelInit
    \t);
    </script>
EOQ;
        }
        $module_sub_panels = array_map('array_keys', $module_sub_panels);
        $module_sub_panels = json_encode($module_sub_panels);
        echo <<<EOQ
<script>
var ModuleSubPanels = {$module_sub_panels};
</script>
EOQ;
        $ob_contents = ob_get_contents();
        ob_end_clean();
        return $ob_contents;
    }
コード例 #26
0
$view = new SugarView();
$view->init();
$view->displayHeader();
$sugar_smarty = new Sugar_Smarty();
$admin = new Administration();
$admin->retrieveSettings('captcha');
$add_captcha = 0;
$captcha_privatekey = "";
$captcha_publickey = "";
$captcha_js = "";
$Captcha = "";
if (isset($admin->settings['captcha_on']) && $admin->settings['captcha_on'] == '1' && !empty($admin->settings['captcha_private_key']) && !empty($admin->settings['captcha_public_key'])) {
    $add_captcha = 1;
    $captcha_privatekey = $admin->settings['captcha_private_key'];
    $captcha_publickey = $admin->settings['captcha_public_key'];
    $captcha_js .= "<script type='text/javascript' src='" . getJSPath('include/javascript/sugar_grp1_yui.js') . "'></script><script type='text/javascript' src='" . getJSPath('include/javascript/sugar_grp_yui2.js') . "'></script>\n\t\t<script type='text/javascript' src='http://api.recaptcha.net/js/recaptcha_ajax.js'></script>\n\t\t<script> //var oldFormAction = document.getElementById('form').action; //save old action\n\t\tfunction initCaptcha(){\n\t\t\t\tRecaptcha.create('{$captcha_publickey}' ,'captchaImage',{theme:'custom',callback:Recaptcha.focus_response_field});\n\t\t\t\t}\n\n\t\twindow.onload=initCaptcha;\n\n\t\tvar handleFailure=handleSuccess;\n\t\tvar handleSuccess = function(o){\n\t\t\tif(o.responseText!==undefined && o.responseText =='Success'){\n\t\t\t\t\n\t\t\t\tdocument.getElementById('user_password').value=document.getElementById('new_password').value;\n\t\t\t\tdocument.getElementById('ChangePasswordForm').submit();\n\t\t\t}\n\t\t\telse{\n\t\t\t\talert(o.responseText);\n\t\t\t\tRecaptcha.reload();\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tvar callback2 =\n\t\t{\n\t\t  success:handleSuccess,\n\t\t  failure: handleFailure\n\t\t};\n\t\tfunction validateCaptchaAndSubmit(){\n\t\t\t\tvar form = document.getElementById('form');\n\t\t\t\tvar url = '&to_pdf=1&module=Home&action=index&entryPoint=Changenewpassword&recaptcha_challenge_field='+Recaptcha.get_challenge()+'&recaptcha_response_field='+ Recaptcha.get_response();\n\t\t\t\tYAHOO.util.Connect.asyncRequest('POST','index.php',callback2,url);\n\t\t\t\t\n\t\t}\n\t\t\n\t</script>";
    $Captcha .= $captcha_js;
    $Captcha .= "<tr>\n\t\t\t\t\t<td scope='row' width='20%'>" . $mod_strings['LBL_RECAPTCHA_INSTRUCTION_OPPOSITE'] . ":</td>\n\t\t            <td width='70%'><input type='text' size='26' id='recaptcha_response_field' value=''></td>\n\t\t        \t<th rowsapn='2' class='x-sqs-list' ><div  id='recaptcha_image'></div></th>\n\t\t\t    </tr>\n\t\t\t    \n\t\t\t    <tr>\n\t\t         \t<td colspan='2'>\n\t\t         \t\t<a href='javascript:Recaptcha.reload()'> " . $mod_strings['LBL_RECAPTCHA_NEW_CAPTCHA'] . "</a>&nbsp;&nbsp;\n\t\t         \t\t<a class='recaptcha_only_if_image' href='javascript:Recaptcha.switch_type('audio')'>" . $mod_strings['LBL_RECAPTCHA_SOUND'] . "</a>\n\t\t         \t\t<a class='recaptcha_only_if_audio' href='javascript:Recaptcha.switch_type('image')'>" . $mod_strings['LBL_RECAPTCHA_IMAGE'] . "</a>\n\t\t         \t</td>\n\t\t        </tr>";
} else {
    echo "<script>function validateCaptchaAndSubmit(){document.getElementById('user_password').value=document.getElementById('new_password').value;document.getElementById('ChangePasswordForm').submit();}</script>";
}
$pwd_settings = $GLOBALS['sugar_config']['passwordsetting'];
$sugar_smarty->assign('sugar_md', getWebPath('include/images/sugar_md_open.png'));
$sugar_smarty->assign("MOD", $mod_strings);
$sugar_smarty->assign("CAPTCHA", $Captcha);
$sugar_smarty->assign("IS_ADMIN", '1');
$sugar_smarty->assign("ENTRY_POINT", 'Changenewpassword');
$sugar_smarty->assign('return_action', 'login');
$sugar_smarty->assign("APP", $app_strings);
$sugar_smarty->assign("INSTRUCTION", $app_strings['NTC_LOGIN_MESSAGE']);
$sugar_smarty->assign("USERNAME_FIELD", '<td scope="row" width="30%">' . $mod_strings['LBL_USER_NAME'] . ':</td><td width="70%"><input type="text" size="20" tabindex="1" id="user_name" name="user_name"  value=""</td>');
コード例 #27
0
ファイル: ListViewXTPL.php プロジェクト: delkyd/sugarcrm_dev
 /**
  * Assigns the sort arrows in the tpl
  *    
  * @param ordering array data that contains the ordering info
  *
  */
 function processArrows($ordering)
 {
     $pathParts = pathinfo(SugarThemeRegistry::current()->getImageURL('arrow.gif', false));
     list($width, $height) = getimagesize($pathParts['dirname'] . '/' . $pathParts['basename']);
     $this->xtpl->assign('arrow_start', "&nbsp;<!--not_in_theme!--><img border='0' src='" . getJSPath($pathParts['dirname'] . '/' . $pathParts['filename']));
     $this->xtpl->assign('arrow_end', "' width='{$width}' height='{$height}' align='absmiddle' alt=" . translate('LBL_SORT') . ">");
     $arrow_order = strcmp($ordering['sortOrder'], 'ASC') ? '_up' : '_down';
     $this->xtpl->assign($ordering['orderBy'] . '_arrow', $arrow_order);
 }
コード例 #28
0
ファイル: editviewdefs.php プロジェクト: delkyd/sugarcrm_dev
 * 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 Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero 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".
 ********************************************************************************/
$viewdefs['Campaigns']['EditView'] = array('templateMeta' => array('maxColumns' => '2', 'widths' => array(array('label' => '10', 'field' => '30'), array('label' => '10', 'field' => '30')), 'javascript' => '<script type="text/javascript" src="' . getJSPath('include/javascript/popup_parent_helper.js') . '"></script>
<script type="text/javascript">
function type_change() {ldelim}
	type = document.getElementsByName(\'campaign_type\');
	if(type[0].value==\'NewsLetter\') {ldelim}
		document.getElementById(\'freq_label\').style.display = \'\';
		document.getElementById(\'freq_field\').style.display = \'\';
	 {rdelim} else {ldelim}
		document.getElementById(\'freq_label\').style.display = \'none\';
		document.getElementById(\'freq_field\').style.display = \'none\';
	 {rdelim}
 {rdelim}
type_change();

function ConvertItems(id)  {ldelim}
	var items = new Array();
コード例 #29
0
ファイル: SugarTheme.php プロジェクト: klr2003/sourceread
 /**
  * Returns the URL for an image in the current theme. If not found in the current theme, will revert
  * to looking in the base theme.
  * 
  * @param  string $jsFileName js file name
  * @param  bool   $addJSPath call getJSPath() with the results to add some unique image tracking support
  * @return string path to js file
  */
 public function getJSURL($jsFileName, $addJSPath = true)
 {
     if (isset($this->_jsCache[$jsFileName])) {
         if ($addJSPath) {
             return getJSPath($this->_jsCache[$jsFileName]);
         } else {
             return $this->_jsCache[$jsFileName];
         }
     }
     $jsFileContents = '';
     if (isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceof SugarTheme && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName, false)) != '') {
         $jsFileContents .= file_get_contents($filename);
     } else {
         if (sugar_is_file($this->getDefaultJSPath() . '/' . $jsFileName)) {
             $jsFileContents .= file_get_contents($this->getDefaultJSPath() . '/' . $jsFileName);
         }
         if (sugar_is_file('custom/' . $this->getDefaultJSPath() . '/' . $jsFileName)) {
             $jsFileContents .= file_get_contents('custom/' . $this->getDefaultJSPath() . '/' . $jsFileName);
         }
     }
     if (sugar_is_file($this->getJSPath() . '/' . $jsFileName)) {
         $jsFileContents .= file_get_contents($this->getJSPath() . '/' . $jsFileName);
     }
     if (sugar_is_file('custom/' . $this->getJSPath() . '/' . $jsFileName)) {
         $jsFileContents .= file_get_contents('custom/' . $this->getJSPath() . '/' . $jsFileName);
     }
     if (empty($jsFileContents)) {
         $GLOBALS['log']->warn("Javascript File {$jsFileName} not found");
         return false;
     }
     // create the cached file location
     $jsFilePath = create_cache_directory($this->getJSPath() . "/{$jsFileName}");
     // now write the js to cache
     sugar_file_put_contents($jsFilePath, $jsFileContents);
     // minify the js
     $jsFilePathMin = str_replace('.js', '-min.js', $jsFilePath);
     if (!inDeveloperMode() && !sugar_is_file($jsFilePathMin)) {
         $jMin = new JSMin($jsFilePath, $jsFilePathMin);
         $jMin->minify();
         $jsFilePath = $jsFilePathMin;
     }
     $this->_jsCache[$jsFileName] = $jsFilePath;
     if ($addJSPath) {
         return getJSPath($jsFilePath);
     }
     return $jsFilePath;
 }
コード例 #30
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
global $app_strings, $current_language;
$dashletMeta['MyModulesUsedChartDashlet'] = array('title' => 'LBL_TITLE', 'description' => 'LBL_TITLE', 'icon' => getJSPath('icon_Charts_Horizontal_32.gif'), 'module' => 'Trackers', 'category' => 'Charts');