public function registerThemeColorCss() { $cs = Yii::app()->getClientScript(); $themeName = Yii::app()->theme->name; $themeBaseUrl = $this->baseUrl . '/' . $themeName; if ($this->activeThemeColor != static::CUSTOM_NAME) { $cs->registerCssFile($themeBaseUrl . '/css/zurmo-' . $this->activeThemeColor . '.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/" . '/css/zurmo-' . $this->activeThemeColor . '.css')); $cs->registerCssFile($themeBaseUrl . '/css/imports-' . $this->activeThemeColor . '.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/" . '/css/imports-' . $this->activeThemeColor . '.css')); } else { $this->registerCustomThemeColorCss(); } }
public function registerScript() { $removeScript = null; foreach (Yii::app()->themeManager->getThemeColorNamesAndLabels() as $value => $notUsed) { $removeScript .= '$(document.body).removeClass("' . $value . '");' . "\n"; } $themeName = Yii::app()->theme->name; $themeBaseUrl = Yii::app()->themeManager->baseUrl . '/default/css'; $primaryFileName = 'zurmo-custom.css'; $secondaryFileName = 'imports-custom.css'; if (Yii::app()->themeManager->activeThemeColor != ThemeManager::CUSTOM_NAME) { Yii::app()->themeManager->registerThemeColorCss(); } $primaryCustomCssUrl = Yii::app()->assetManager->getPublishedUrl(Yii::app()->lessCompiler->compiledCustomCssPath) . DIRECTORY_SEPARATOR . $primaryFileName; $secondaryCustomCssUrl = Yii::app()->assetManager->getPublishedUrl(Yii::app()->lessCompiler->compiledCustomCssPath) . DIRECTORY_SEPARATOR . $secondaryFileName; // Begin Not Coding Standard $script = "\$('input[name=\"" . $this->getEditableInputName($this->getAttributeForRadioButtonList()) . "\"]').live('change', function(){\n {$removeScript}\n \$(document.body).addClass(this.value);\n var themeBaseUrl = '{$themeBaseUrl}';\n var primaryCustomCssUrl = '{$primaryCustomCssUrl}';\n var secondaryCustomCssUrl = '{$secondaryCustomCssUrl}';\n //use zurmo-blue since it is likely that all colors would change at same time. best we can do here for now\n var baseHashQueryString = '" . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/" . '/css/zurmo-blue.css') . "';\n if(this.value === 'custom')\n {\n \$('head').append('<link rel=\"stylesheet\" href=\"'+primaryCustomCssUrl+'\" type=\"text/css\" />');\n \$('head').append('<link rel=\"stylesheet\" href=\"'+secondaryCustomCssUrl+'\" type=\"text/css\" />');\n }\n else\n {\n \$('head').append('<link rel=\"stylesheet\" href=\"'+themeBaseUrl+'/zurmo-'+this.value+'.css' + baseHashQueryString + '\" type=\"text/css\" />');\n }\n });\n "; // End Not Coding Standard Yii::app()->clientScript->registerScript('changeThemeColor', $script); }
protected function renderBuilderCssTools() { $cs = Yii::app()->getClientScript(); $themeName = Yii::app()->theme->name; $baseUrl = Yii::app()->themeManager->baseUrl . '/default'; $cs->registerCssFile($baseUrl . '/css/builder-iframe-tools.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/builder-iframe-tools.css")); }
protected function renderXHtmlHead() { $themeName = Yii::app()->theme->name; $themeBaseUrl = Yii::app()->getRequest()->getHostInfo() . Yii::app()->themeManager->baseUrl . '/' . $themeName; $cs = Yii::app()->getClientScript(); $specialCssContent = null; $publishedAssetsPath = Yii::app()->getRequest()->getHostInfo() . Yii::app()->assetManager->publish(Yii::getPathOfAlias("application.core.views.assets.fonts")); $specialCssContent .= "<style>" . "@font-face" . "{" . "font-family: 'zurmo_gamification_symbly_rRg';" . "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot');" . "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot?#iefix') format('embedded-opentype'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.woff') format('woff'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.ttf') format('truetype'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.svg#zurmo_gamification_symbly_rRg') format('svg');" . "font-weight: normal;" . "font-style: normal;" . "unicode-range: U+00-FFFF;" . "}" . "</style>"; if (!MINIFY_SCRIPTS && Yii::app()->isApplicationInstalled()) { $specialCssContent .= '<link rel="stylesheet/less" type="text/css" id="default-theme" href="' . $themeBaseUrl . '/less/default-theme.less"/>'; if (Yii::app()->userInterface->isMobile()) { $specialCssContent .= '<link rel="stylesheet/less" type="text/css" id="mobile" href="' . $themeBaseUrl . '/less/mobile.less"/>'; } $specialCssContent .= '<!--[if lt IE 9]><link rel="stylesheet/less" type="text/css" href="' . $themeBaseUrl . '/less/ie.less"/><![endif]-->'; } else { Yii::app()->themeManager->registerThemeColorCss(); if (file_exists("themes/{$themeName}/css/commercial.css")) { $cs->registerCssFile($themeBaseUrl . '/css/commercial.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/commercial.css")); } if (file_exists("themes/{$themeName}/css/custom.css")) { $cs->registerCssFile($themeBaseUrl . '/css/custom.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/custom.css")); } // https://www.pivotaltracker.com/story/show/82070424 /*if (Yii::app()->userInterface->isMobile()) { $cs->registerCssFile($themeBaseUrl . '/css/mobile.css'); } */ if (Yii::app()->getRequest()->isContextiveExternalRequest()) { $cs->registerCssFile($themeBaseUrl . '/css/gmail.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/gmail.css")); } if (Yii::app()->getClientScript()->isIsolationMode()) { $cs->registerCssFile($themeBaseUrl . '/css/webforms-external.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/webforms-external.css")); } } if (MINIFY_SCRIPTS) { Yii::app()->minScript->generateScriptMap('css'); Yii::app()->minScript->generateScriptMap('css-color'); } if (Yii::app()->browser->getName() == 'msie' && Yii::app()->browser->getVersion() < 9) { $cs->registerCssFile($themeBaseUrl . '/css/ie.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/ie.css"), 'screen, projection'); } foreach ($this->getStyles() as $style) { if ($style != 'ie') { if (file_exists("themes/{$themeName}/css/{$style}.css")) { // Begin Not Coding Standard $cs->registerCssFile($themeBaseUrl . '/css/' . $style . '.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/{$style}.css")); // Not Coding Standard // End Not Coding Standard } } } return '<head>' . $specialCssContent . '</head>'; }
/** * Renders the XHtml header element containing the title * and the default stylesheets screen, print, and ie. Additional * stylesheets can be specified by overriding getStyles() in * the extending class. */ protected function renderXHtmlHead() { $title = Yii::app()->format->text(trim($this->getTitleAs())); $subtitle = Yii::app()->format->text(trim($this->getSubtitle())); if ($subtitle != '') { $title = "{$title} - {$subtitle}"; } $defaultThemeName = 'default'; $defaultThemeBaseUrl = Yii::app()->themeManager->baseUrl . '/' . $defaultThemeName; $themeName = Yii::app()->theme->name; $themeBaseUrl = Yii::app()->themeManager->baseUrl . '/' . $themeName; $cs = Yii::app()->getClientScript(); $specialCssContent = null; $publishedAssetsPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias("application.core.views.assets.fonts")); $specialCssContent .= "<style>" . "@font-face" . "{" . "font-family: 'zurmo_gamification_symbly_rRg';" . "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot');" . "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot?#iefix') format('embedded-opentype'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.woff') format('woff'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.ttf') format('truetype'), " . "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.svg#zurmo_gamification_symbly_rRg') format('svg');" . "font-weight: normal;" . "font-style: normal;" . "unicode-range: U+00-FFFF;" . "}" . "</style>"; if (!MINIFY_SCRIPTS && Yii::app()->isApplicationInstalled()) { $specialCssContent .= '<link rel="stylesheet/less" type="text/css" id="default-theme" href="' . $themeBaseUrl . '/less/default-theme.less"/>'; $specialCssContent .= '<!--[if lt IE 9]><link rel="stylesheet/less" type="text/css" href="' . $themeBaseUrl . '/less/ie.less"/><![endif]-->'; } else { Yii::app()->themeManager->registerThemeColorCss(); if (file_exists("themes/{$themeName}/css/commercial.css")) { $cs->registerCssFile($themeBaseUrl . '/css/commercial.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/commercial.css")); } if (file_exists("themes/{$themeName}/css/custom.css")) { $cs->registerCssFile($themeBaseUrl . '/css/custom.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/custom.css")); } } if (MINIFY_SCRIPTS) { Yii::app()->minScript->generateScriptMap('css'); Yii::app()->minScript->generateScriptMap('css-color'); if (!YII_DEBUG && !defined('IS_TEST')) { Yii::app()->minScript->generateScriptMap('js'); } } if (Yii::app()->browser->getName() == 'msie' && Yii::app()->browser->getVersion() < 9) { $cs->registerCssFile($themeBaseUrl . '/css/ie.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/ie.css"), 'screen, projection'); } foreach ($this->getStyles() as $style) { if ($style != 'ie') { if (file_exists("themes/{$themeName}/css/{$style}.css")) { // Begin Not Coding Standard $cs->registerCssFile($themeBaseUrl . '/css/' . $style . '.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/{$themeName}/css/{$style}.css")); // End Not Coding Standard } } } // Add common css file written by Ideas2it $cs->registerCssFile($themeBaseUrl . '/custom-css/I2it-Custom.css' . ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/default/custom-css/I2it-Custom.css")); if (file_exists("themes/{$themeName}/ico/favic.png")) { $cs->registerLinkTag('shortcut icon', null, $themeBaseUrl . '/ico/favic.png'); } else { $cs->registerLinkTag('shortcut icon', null, $defaultThemeBaseUrl . '/ico/favic.png'); } return '<head>' . '<meta charset="utf-8">' . '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' . '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">' . '<meta name="apple-mobile-web-app-capable" content="yes" />' . '<link rel="apple-touch-icon" sizes="144x144" href="' . $defaultThemeBaseUrl . '/images/touch-icon-iphone4.png" />' . $specialCssContent . '<title>' . $title . '</title>' . '</head>'; }