public function initTheme() { $result = false; if (strlen($this->mTheme)) { global $gEnv; import('com.solarix.ampoliros.core.Ampoliros'); $amp = Ampoliros::instance('Ampoliros'); if ($this->mTheme == 'default') { $this->mTheme = $gEnv['hui']['theme']['default']; } if ($this->mTheme != 'userdefined') { if (file_exists(CONFIG_PATH . $this->mTheme . '.huitheme')) { $this->mThemeFile = CONFIG_PATH . $this->mTheme . '.huitheme'; } else { $this->mTheme = $gEnv['hui']['theme']['default']; $this->mThemeFile = CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme'; } OpenLibrary('configman.library'); $cfg_file = new ConfigFile($this->mThemeFile); if ($cfg_file->opened()) { $this->mIconsSetName = $cfg_file->Value('THEME.ICONSSET'); $this->mColorsSetName = $cfg_file->Value('THEME.COLORSSET'); $this->mStyleName = $cfg_file->Value('THEME.STYLE'); } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.huithemes_library.huitheme_class.inittheme', 'Unable to open theme configuration file ' . $this->mThemeFile, LOGGER_ERROR); } } else { $this->mIconsSetName = $this->mUserSettings['iconsset']; $this->mColorsSetName = $this->mUserSettings['colorsset']; $this->mStyleName = $this->mUserSettings['stylename']; } $this->mIconsSetBase = CGI_URL . 'icons/' . $this->mIconsSetName . '/'; $this->mIconsBase = CGI_URL . 'icons/'; $this->mIconsSetDir = CGI_PATH . 'icons/' . $this->mIconsSetName . '/'; $this->mStyleBase = CGI_URL . 'styles/'; $this->mStyleDir = CGI_PATH . 'styles/' . $this->mStyleName . '/'; $hui_colors = new HuiColorsSet($this->mrAmpDb, $this->mColorsSetName); $hui_icons = new HuiIconsSet($this->mrAmpDb, $this->mIconsSetName); $hui_style = new HuiStyle($this->mrAmpDb, $this->mStyleName); if ($amp->getState() != Ampoliros::STATE_SETUP) { $cached_iconsset = new CachedItem($this->mrAmpDb, 'ampoliros', 'huiiconsset-' . $this->mIconsSetName); $cached_colorsset = new CachedItem($this->mrAmpDb, 'ampoliros', 'huicolorsset-' . $this->mColorsSetName); $cached_style = new CachedItem($this->mrAmpDb, 'ampoliros', 'huistyle-' . $this->mStyleName); $this->mIconsSet = unserialize($cached_iconsset->Retrieve()); $this->mColorsSet = unserialize($cached_colorsset->Retrieve()); $this->mStyle = unserialize($cached_style->Retrieve()); } if (!$this->mIconsSet or !$this->mColorsSet or !$this->mStyle) { if ($gEnv['hui']['theme']['default'] == $this->mTheme) { $this->mColorsSet = $hui_colors->GetColorsSet(); $this->mIconsSet = $hui_icons->GetIconsSet(); $this->mStyle = $hui_style->GetStyle(); } else { OpenLibrary('configman.library'); $def_cfg_file = new ConfigFile(CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme'); if ($def_cfg_file->Opened()) { $def_icons_set_name = $def_cfg_file->Value('THEME.ICONSSET'); $def_colors_set_name = $def_cfg_file->Value('THEME.COLORSSET'); $def_style_name = $def_cfg_file->Value('THEME.STYLE'); } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.huithemes_library.huitheme_class.inittheme', 'Unable to open default theme configuration file ' . CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme', LOGGER_ERROR); } $hui_def_colors = new HuiColorsSet($this->mrAmpDb, $def_colors_set_name); $hui_def_icons = new HuiIconsSet($this->mrAmpDb, $def_icons_set_name); $hui_def_style = new HuiStyle($this->mrAmpDb, $def_style_name); $this->mColorsSet = $this->DefOpts($hui_def_colors->GetColorsSet(), $hui_colors->GetColorsSet()); $this->mIconsSet = $this->DefOpts($hui_def_icons->GetIconsSet(), $hui_icons->GetIconsSet()); $this->mStyle = $this->DefOpts($hui_def_style->GetStyle(), $hui_style->GetStyle()); } while (list($style_name, $style_item) = each($this->mStyle)) { $this->mStyle[$style_name] = $this->mStyleBase . $style_item['base'] . '/' . $style_item['value']; } if ($amp->getState() != Ampoliros::STATE_SETUP) { $cached_iconsset->Store(serialize($this->mIconsSet)); $cached_colorsset->Store(serialize($this->mColorsSet)); $cached_style->Store(serialize($this->mStyle)); } } } return $result; }
public function getIconsSet() { $result = array(); $cfg_file = new ConfigFile(CONFIG_PATH . $this->mSetName . '.huiiconsset'); if ($cfg_file->Opened()) { $values = $cfg_file->ValuesArray(); while (list($key, $val) = each($values)) { $key = trim($key); $val = trim($val); if (substr_count($key, '.') == 2) { $tmpkey = strtolower(substr($key, strpos($key, '.') + 1)); $type = substr($tmpkey, 0, strpos($tmpkey, '.')); $realkey = substr($tmpkey, strpos($tmpkey, '.') + 1); $result[$type][$realkey]['file'] = $val; $result[$type][$realkey]['base'] = $this->mSetName; } } } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.huithemes_library.huistyle_class.getstyle', 'Unable to open icons set file ' . CONFIG_PATH . $this->mSetName . '.huiiconsset', LOGGER_ERROR); } return $result; }
public function open() { $result = false; import('carthag.core.Registry'); $reg = Registry::instance(); OpenLibrary('configman.library'); $country_file = new ConfigFile($reg->getEntry('amp.config')->getKey('PRIVATE_TREE') . 'var/locale/' . $this->mCountry . '.country'); if ($country_file->Opened()) { $this->mCountryShort = $country_file->Value('COUNTRYSHORT'); $this->mLanguage = $country_file->Value('LANGUAGE'); $this->mDecimalSeparator = $country_file->Value('DECIMALSEPARATOR'); $this->mThousandsSeparator = $country_file->Value('THOUSANDSSEPARATOR'); $this->mPositiveSign = $country_file->Value('POSITIVESIGN'); $this->mNegativeSign = $country_file->Value('NEGATIVESIGN'); $this->mCurrencySymbol = $country_file->Value('CURRENCYSYMBOL'); $this->mMoneyDecimalSeparator = $country_file->Value('MONEYDECIMALSEPARATOR'); $this->mMoneyThousandsSeparator = $country_file->Value('MONEYTHOUSANDSSEPARATOR'); $this->mFractDigits = $country_file->Value('FRACTDIGITS'); $this->mPositivePrefixCurrency = $country_file->Value('POSITIVEPREFIXCURRENCY'); $this->mPositiveSignPosition = $country_file->Value('POSITIVESIGNPOSITION'); $this->mNegativePrefixCurrency = $country_file->Value('NEGATIVEPREFIXCURRENCY'); $this->mNegativeSignPosition = $country_file->Value('NEGATIVESIGNPOSITION'); $this->mTimeFormat = $country_file->Value('TIMEFORMAT'); $this->mDateFormat = $country_file->Value('DATEFORMAT'); $this->mShortDateFormat = $country_file->Value('SHORTDATEFORMAT'); $this->mStartWeekOnMonday = $country_file->Value('STARTWEEKONMONDAY'); $this->mDateSeparator = $country_file->Value('DATESEPARATOR'); $this->mDateOrder = $country_file->Value('DATEORDER'); $this->mCharSet = $country_file->Value('CHARSET'); $result = true; } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.locale_library.country_class.open', 'Unable to open country file ' . $reg->getEntry('amp.config')->getKey('PRIVATE_TREE') . 'var/locale/' . $this->mCountry . '.country', LOGGER_ERROR); } return $result; }
public function getColorsSet() { $result = array(); OpenLibrary('configman.library'); $cfg_file = new ConfigFile(CONFIG_PATH . $this->mSetName . '.huicolorsset'); if ($cfg_file->Opened()) { $result['pages']['bgcolor'] = $cfg_file->Value('COLORSET.PAGES.BGCOLOR'); $result['pages']['border'] = $cfg_file->Value('COLORSET.PAGES.BORDER'); $result['buttons']['text'] = $cfg_file->Value('COLORSET.BUTTONS.TEXT'); $result['buttons']['disabledtext'] = $cfg_file->Value('COLORSET.BUTTONS.DISABLEDTEXT'); $result['buttons']['selected'] = $cfg_file->Value('COLORSET.BUTTONS.SELECTED'); $result['buttons']['notselected'] = $cfg_file->Value('COLORSET.BUTTONS.NOTSELECTED'); $result['bars']['color'] = $cfg_file->Value('COLORSET.BARS.COLOR'); $result['bars']['shadow'] = $cfg_file->Value('COLORSET.BARS.SHADOW'); $result['frames']['border'] = $cfg_file->Value('COLORSET.FRAMES.BORDER'); $result['statusbars']['bgcolor'] = $cfg_file->Value('COLORSET.STATUSBARS.BGCOLOR'); $result['titlebars']['bgcolor'] = $cfg_file->Value('COLORSET.TITLEBARS.BGCOLOR'); $result['titlebars']['textcolor'] = $cfg_file->Value('COLORSET.TITLEBARS.TEXTCOLOR'); $result['toolbars']['separator'] = $cfg_file->Value('COLORSET.TOOLBARS.SEPARATOR'); $result['tables']['bgcolor'] = $cfg_file->Value('COLORSET.TABLES.BGCOLOR'); $result['tables']['headerbgcolor'] = $cfg_file->Value('COLORSET.TABLES.HEADERBGCOLOR'); $result['tables']['gridcolor'] = $cfg_file->Value('COLORSET.TABLES.GRIDCOLOR'); } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.huithemes_library.huicolorsset_class.getcolorsset', 'Unable to open colors set file ' . CONFIG_PATH . $this->mSetName . '.huicolorsset', LOGGER_ERROR); } return $result; }
public function getStyle() { $result = array(); OpenLibrary('configman.library'); $cfg_file = new ConfigFile(CONFIG_PATH . $this->mStyleName . '.huistyle'); if ($cfg_file->Opened()) { $values = $cfg_file->ValuesArray(); while (list($key, $val) = each($values)) { $key = trim($key); $val = trim($val); $realkey = strtolower(substr($key, strpos($key, '.') + 1)); if ($realkey != 'name') { $result[$realkey]['value'] = $val; $result[$realkey]['base'] = $this->mStyleName; } } } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.huithemes_library.huistyle_class.getstyle', 'Unable to open style file ' . CONFIG_PATH . $this->mStyleName . '.huistyle', LOGGER_ERROR); } return $result; }