Пример #1
0
 /**
  * This function loads portal config vars from db and sets them for the view
  * @see SugarView::display() for more info
  */
 function display()
 {
     global $current_user, $app_strings;
     $smarty = new Sugar_Smarty();
     $smarty->assign('mod', $GLOBALS['mod_strings']);
     $smarty->assign("token", session_id());
     $smarty->assign("siteURL", $GLOBALS['sugar_config']['site_url']);
     //Loading label
     $smarty->assign('LBL_LOADING', $app_strings['LBL_ALERT_TITLE_LOADING']);
     $theme = new SidecarTheme();
     $smarty->assign("css_url", $theme->getCSSURL());
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
     $ajax->addCrumb(ucwords(translate('LBL_PORTAL_THEME')), '');
     $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portaltheme.tpl'));
     echo $ajax->getJavascript();
 }
Пример #2
0
 /**
  * This method checks to see if the configuration file exists and, if not, creates one by default
  *
  */
 public function preDisplay()
 {
     global $app_strings;
     //Rebuild config file if it doesn't exist
     if (!file_exists($this->configFile)) {
         ModuleInstaller::handleBaseConfig();
     }
     $this->ss->assign("configFile", $this->configFile);
     $config = ModuleInstaller::getBaseConfig();
     $this->ss->assign('configHash', md5(serialize($config)));
     $sugarSidecarPath = ensureJSCacheFilesExist();
     $this->ss->assign("sugarSidecarPath", $sugarSidecarPath);
     // TODO: come up with a better way to deal with the various JS files
     // littered in sidecar.tpl.
     $voodooFile = 'custom/include/javascript/voodoo.js';
     if (SugarAutoLoader::fileExists($voodooFile)) {
         $this->ss->assign('voodooFile', $voodooFile);
     }
     //Load sidecar theme css
     $theme = new SidecarTheme();
     $this->ss->assign("css_url", $theme->getCSSURL());
     $this->ss->assign("developerMode", inDeveloperMode());
     //Loading label
     $this->ss->assign('LBL_LOADING', $app_strings['LBL_ALERT_TITLE_LOADING']);
     $this->ss->assign('LBL_ENABLE_JAVASCRIPT', $app_strings['LBL_ENABLE_JAVASCRIPT']);
     $slFunctionsPath = inDeveloperMode() ? "cache/Expressions/functions_cache_debug.js" : "cache/Expressions/functions_cache.js";
     if (!is_file($slFunctionsPath)) {
         $GLOBALS['updateSilent'] = true;
         include "include/Expressions/updatecache.php";
     }
     $this->ss->assign("SLFunctionsPath", $slFunctionsPath);
     if (!empty($this->authorization)) {
         $this->ss->assign('appPrefix', $config['env'] . ":" . $config['appId'] . ":");
         $this->ss->assign('authorization', $this->authorization);
     }
 }
Пример #3
0
    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.
 */
/**
 * This file is here to provide a HTML template for the rest help api.
 */
$theme = new SidecarTheme();
$bootstrap_css = $theme->getCSSURL();
// Fixes pathing for help requests ending in '/'
$base_path = '../../../';
$link_path = '../';
if (substr($_SERVER['REQUEST_URI'], -1) == '/') {
    $base_path .= '../';
    $link_path .= '../';
}
?>

<!DOCTYPE HTML>
<html>

    <head>
        <title>SugarCRM Auto Generated API Exceptions Documentation</title>
Пример #4
0
 /**
  * Updates variables.less with the values given in the request.
  *
  * @param ServiceBase $api
  * @param array $args
  *
  * @return array Locations of CSS files
  * @throws SugarApiExceptionNotAuthorized
  * @throws SugarApiExceptionMissingParameter
  */
 public function updateCustomTheme(ServiceBase $api, array $args)
 {
     if (!$api->user->isAdmin()) {
         throw new SugarApiExceptionNotAuthorized();
     }
     if (empty($args)) {
         throw new SugarApiExceptionMissingParameter('Missing colors');
     }
     // Validating arguments
     $platform = isset($args['platform']) ? $args['platform'] : 'base';
     $themeName = isset($args['themeName']) ? $args['themeName'] : null;
     $theme = new SidecarTheme($platform, $themeName);
     // if reset=true is passed
     if (!empty($args['reset'])) {
         $theme->saveThemeVariables($args['reset']);
     } else {
         // else
         $theme->loadVariables();
         // Override the custom variables.less with the given vars
         $variables = array_diff_key($args, array('platform' => 0, 'themeName' => 0, 'reset' => 0));
         $theme->setVariables($variables);
         $theme->saveThemeVariables();
     }
     // saves the bootstrap.css URL in the portal settings
     $urls = $theme->getCSSURL();
     foreach ($urls as $key => $url) {
         $urls[$key] = $GLOBALS['sugar_config']['site_url'] . '/' . $url;
     }
     $GLOBALS['system_config']->saveSetting($platform, 'css', json_encode($urls));
     return $urls;
 }
Пример #5
0
 /**
  * Write the theme metadata file. This method actually does:
  * - Read contents of base/default theme metadata file
  * - Override variables (if $resetBaseDefaultTheme is false)
  * - Save the file as the theme metadata file.
  *
  * @param bool $reset True if you want to reset the theme to the base default theme
  */
 public function saveThemeVariables($reset = false)
 {
     // take the contents from /themes/clients/base/default/variables.php
     $baseDefaultTheme = new SidecarTheme('base', 'default');
     $baseDefaultThemePaths = $baseDefaultTheme->getPaths();
     include $baseDefaultThemePaths['base'] . 'variables.php';
     if (is_dir($this->paths['cache'])) {
         rmdir_recursive($this->paths['cache']);
     }
     if ($reset) {
         //In case of reset we just need to delete the theme files.
         if (is_dir($this->paths['custom'])) {
             rmdir_recursive($this->paths['custom']);
         }
     } else {
         //override the base variables with variables passed in arguments
         foreach ($this->variables as $lessVar => $lessValue) {
             foreach ($lessdefs as $type => $varset) {
                 if (isset($lessdefs[$type][$lessVar])) {
                     $lessdefs[$type][$lessVar] = $lessValue;
                 }
             }
         }
         // save the theme variables in /themes/clients/$client/$themeName/variables.php
         sugar_mkdir($this->paths['custom'], null, true);
         $write = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . '$lessdefs = ' . var_export_helper($lessdefs) . ';';
         sugar_file_put_contents($this->paths['custom'] . 'variables.php', $write);
     }
 }