Index: install.php =================================================================== --- install.php (revision 13756) +++ install.php (working copy) @@ -72,7 +72,7 @@ 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'), 'already_installed' => Array ('check_paths', 'install_setup'), - 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'security', 'finish'), + 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'skin_upgrade', 'security', 'finish'), 'update_license' => Array ('check_paths', 'install_setup', 'select_license', /*'download_license',*/ 'select_domain', 'security', 'finish'), 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'), 'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'security', 'finish'), @@ -128,6 +128,20 @@ var $LastQueryNum = 0; /** + * Dependencies, that should be used in upgrade process + * + * @var Array + */ + var $upgradeDepencies = Array (); + + /** + * Log of upgrade - list of upgraded modules and their versions + * + * @var Array + */ + var $upgradeLog = Array (); + + /** * Common tools required for installation process * * @var kInstallToolkit @@ -312,6 +326,13 @@ } break; + case 'skin_upgrade': + if ($this->Application->RecallVar('SkinUpgradeLog') === false) { + // no errors during skin upgrade -> skip this step + $this->currentStep = $this->GetNextStep(); + } + break; + case 'install_setup': $next_preset = $this->Application->GetVar('next_preset'); if ($next_preset !== false) { @@ -838,51 +859,71 @@ case 'upgrade_modules': // get installed modules from db and compare their versions to upgrade script $modules = $this->Application->GetVar('modules'); + if ($modules) { $upgrade_data = $this->GetUpgradableModules(); + $start_from_query = $this->Application->GetVar('start_from_query'); + $this->upgradeDepencies = $this->getUpgradeDependencies($modules, $upgrade_data); - $start_from_module = $this->GetVar('continue_from_module'); - $start_from_query = $this->GetVar('continue_from_query'); - if (!$start_from_query) $start_from_query = 0; - foreach ($modules as $module_name) { - if ($start_from_module && $module_name != $start_from_module) { - continue; + if ($start_from_query !== false) { + $this->upgradeLog = unserialize( $this->Application->RecallVar('UpgradeLog') ); + } + else { + $start_from_query = 0; + $this->upgradeLog = Array ('ModuleVersions' => Array ()); + + // remember each module version, before upgrade scripts are executed + foreach ($modules as $module_name) { + $module_info = $upgrade_data[$module_name]; + $this->upgradeLog['ModuleVersions'][$module_name] = $module_info['FromVersion']; } - else { - $start_from_module = false; //otherwise it will skip all modules after the one we start with! - } - $module_info = $upgrade_data[$module_name]; - $upgrades_file = sprintf(UPGRADES_FILE, $module_info['Path'], 'sql'); - $sqls = file_get_contents($upgrades_file); - $version_mark = preg_replace('/(\(.*?\))/', $module_info['FromVersion'], VERSION_MARK); + $this->Application->RemoveVar('UpgradeLog'); + } - // get only sqls from next (relative to current) version to end of file - $start_pos = strpos($sqls, $version_mark); - $sqls = substr($sqls, $start_pos); + // 1. perform "php before", "sql", "php after" upgrades + foreach ($modules as $module_name) { + $module_info = $upgrade_data[$module_name]; - preg_match_all('/'.VERSION_MARK.'/s', $sqls, $regs); + /*echo '

Upgrading "' . $module_info['Name'] . '" to "' . $module_info['ToVersion'] . '"

' . "\n"; + flush();*/ - if (!$start_from_module) { - $this->RunUpgrades($module_info['Path'], $regs[1], 'before'); - } - if (!$this->toolkit->RunSQLText($sqls, null, null, $start_from_query)) { - $this->errorMessage .= ''; - $this->errorMessage .= ''; - $this->errorMessage .= '
Click Continue button below to skip this query and go further
'; + if (!$this->RunUpgrade($module_info['Name'], $module_info['ToVersion'], $upgrade_data, $start_from_query)) { + $this->Application->StoreVar('UpgradeLog', serialize($this->upgradeLog)); $this->Done(); } - $start_from_query = 0; // so that next module start from the beggining + // restore upgradable module version (makes sense after sql error processing) + $upgrade_data[$module_name]['FromVersion'] = $this->upgradeLog['ModuleVersions'][$module_name]; + } + + // 2. import language pack, perform "languagepack" upgrade for all upgraded versions + foreach ($modules as $module_name) { + $module_info = $upgrade_data[$module_name]; + $sqls =& $this->getUpgradeQueriesFromVersion($module_info['Path'], $module_info['FromVersion']); + preg_match_all('/' . VERSION_MARK . '/s', $sqls, $regs); + + // import module language pack $this->toolkit->ImportLanguage('/' . $module_info['Path'] . 'install/english', true); - $this->RunUpgrades($module_info['Path'], $regs[1], 'after'); // upgrade script could operate resulting language pack - // after upgrade sqls are executed update version and upgrade language pack - $this->toolkit->SetModuleVersion($module_name, false, $module_info['ToVersion']); + // perform advanced language pack upgrade + foreach ($regs[1] as $version) { + $this->RunUpgradeScript($module_info['Path'], $version, 'languagepack'); + } } - // for now we set "In-Portal" module version to "Core" module version (during upgrade) + // 3. upgrade admin skin if (in_array('core', $modules)) { + $skin_upgrade_log = $this->toolkit->upgradeSkin($upgrade_data['core']); + + if ($skin_upgrade_log === true) { + $this->Application->RemoveVar('SkinUpgradeLog'); + } + else { + $this->Application->StoreVar('SkinUpgradeLog', serialize($skin_upgrade_log)); + } + + // for now we set "In-Portal" module version to "Core" module version (during upgrade) $this->toolkit->SetModuleVersion('In-Portal', false, $upgrade_data['core']['ToVersion']); } } @@ -934,40 +975,187 @@ } } + function getUpgradeDependencies($modules, &$upgrade_data) + { + $dependencies = Array (); + + foreach ($modules as $module_name) { + $module_info = $upgrade_data[$module_name]; + $upgrade_object =& $this->getUpgradeObject($module_info['Path']); + + if (!is_object($upgrade_object)) { + continue; + } + + foreach ($upgrade_object->dependencies as $dependent_version => $version_dependencies) { + if (!$version_dependencies) { + // module is independent -> skip + continue; + } + + list ($parent_name, $parent_version) = each($version_dependencies); + + if (!array_key_exists($parent_name, $dependencies)) { + // parent module + $dependencies[$parent_name] = Array (); + } + + if (!array_key_exists($parent_version, $dependencies[$parent_name])) { + // parent module versions, that are required by other module versions + $dependencies[$parent_name][$parent_version] = Array (); + } + + $dependencies[$parent_name][$parent_version][] = Array ($module_info['Name'] => $dependent_version); + } + } + + return $dependencies; + } + /** + * Returns database queries, that should be executed to perform upgrade from given to lastest version of given module path + * + * @param string $module_path + * @param string $from_version + * @return string + */ + function &getUpgradeQueriesFromVersion($module_path, $from_version) + { + $upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'sql'); + + $sqls = file_get_contents($upgrades_file); + $version_mark = preg_replace('/(\(.*?\))/', $from_version, VERSION_MARK); + + // get only sqls from next (relative to current) version to end of file + $start_pos = strpos($sqls, $version_mark); + $sqls = substr($sqls, $start_pos); + + return $sqls; + } + + function RunUpgrade($module_name, $to_version, &$upgrade_data, &$start_from_query = 0) + { + $module_info = $upgrade_data[ strtolower($module_name) ]; + + $sqls =& $this->getUpgradeQueriesFromVersion($module_info['Path'], $module_info['FromVersion']); + preg_match_all('/(' . VERSION_MARK . ')/s', $sqls, $matches, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); + + foreach ($matches as $index => $match) { + // upgrade version + $version = $match[2][0]; + + if ($this->toolkit->ConvertModuleVersion($version) > $this->toolkit->ConvertModuleVersion($to_version)) { + // only upgrade to $to_version, not further + break; + } + + if (!in_array($module_name . ':' . $version, $this->upgradeLog)) { + if ($this->Application->isDebugMode()) { + $this->Application->Debugger->appendHTML('Upgrading "' . $module_name . '" to "' . $version . '" version: BEGIN.'); + } + + /*echo 'Upgrading "' . $module_name . '" to "' . $version . '".
' . "\n"; + flush();*/ + + // don't upgrade same version twice + $start_pos = $match[0][1] + strlen($match[0][0]); + $end_pos = array_key_exists($index + 1, $matches) ? $matches[$index + 1][0][1] : mb_strlen($sqls); + $version_sqls = substr($sqls, $start_pos, $end_pos - $start_pos); + + if ($start_from_query == 0) { + $this->RunUpgradeScript($module_info['Path'], $version, 'before'); + } + + if (!$this->toolkit->RunSQLText($version_sqls, null, null, $start_from_query)) { + $this->errorMessage .= ''; + $this->errorMessage .= '
Module "' . $module_name . '" upgrade to "' . $version . '" failed.'; + $this->errorMessage .= '
Click Continue button below to skip this query and go further
'; + + return false; + } + else { + // reset query counter, when all queries were processed + $start_from_query = 0; + } + + $this->RunUpgradeScript($module_info['Path'], $version, 'after'); + + if ($this->Application->isDebugMode()) { + $this->Application->Debugger->appendHTML('Upgrading "' . $module_name . '" to "' . $version . '" version: END.'); + } + + // remember, that we've already upgraded given version + $this->upgradeLog[] = $module_name . ':' . $version; + } + + if (array_key_exists($module_name, $this->upgradeDepencies) && array_key_exists($version, $this->upgradeDepencies[$module_name])) { + foreach ($this->upgradeDepencies[$module_name][$version] as $dependency_info) { + list ($dependent_module, $dependent_version) = each($dependency_info); + + if (!$this->RunUpgrade($dependent_module, $dependent_version, $upgrade_data, $start_from_query)) { + return false; + } + } + } + + // only mark module as updated, when all it's dependent modules are upgraded + $this->toolkit->SetModuleVersion($module_name, false, $version); + } + + return true; + } + + /** * Run upgrade PHP scripts for module with specified path * * @param string $module_path - * @param Array $versions - * @param string $mode upgrade mode = {before,after} + * @param Array $version + * @param string $mode upgrade mode = {before,after,languagepack} */ - function RunUpgrades($module_path, $versions, $mode) + function RunUpgradeScript($module_path, $version, $mode) { - static $upgrade_classes = Array (); + $upgrade_object =& $this->getUpgradeObject($module_path); - $upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'php'); - if (!file_exists($upgrades_file) || !$versions) { + if (!is_object($upgrade_object)) { return ; } + $upgrade_method = 'Upgrade_' . str_replace(Array ('.', '-'), '_', $version); + + if (method_exists($upgrade_object, $upgrade_method)) { + $upgrade_object->$upgrade_method($mode); + } + } + + /** + * Returns upgrade class for given module path + * + * @param string $module_path + * @return kUpgradeHelper + */ + function &getUpgradeObject($module_path) + { + static $upgrade_classes = Array (); + $upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'php'); + + if (!file_exists($upgrades_file)) { + $false = false; + return $false; + } + if (!isset($upgrade_classes[$module_path])) { - // save class name, because 2nd time - // (in after call $upgrade_class variable will not be present) + require_once(FULL_PATH . REL_PATH . '/install/upgrade_helper.php'); + + // save class name, because 2nd time (in after call) + // $upgrade_class variable will not be present include_once $upgrades_file; $upgrade_classes[$module_path] = $upgrade_class; } $upgrade_object = new $upgrade_classes[$module_path](); - if (method_exists($upgrade_object, 'setToolkit')) { - $upgrade_object->setToolkit($this->toolkit); - } + $upgrade_object->setToolkit($this->toolkit); - foreach ($versions as $version) { - $upgrade_method = 'Upgrade_'.str_replace(Array ('.', '-'), '_', $version); - if (method_exists($upgrade_object, $upgrade_method)) { - $upgrade_object->$upgrade_method($mode); - } - } + return $upgrade_object; } /** Index: install/install_toolkit.php =================================================================== --- install/install_toolkit.php (revision 13756) +++ install/install_toolkit.php (working copy) @@ -304,7 +304,7 @@ * @param mixed $replace_from * @param mixed $replace_to */ - function RunSQLText(&$sqls, $replace_from = null, $replace_to = null, $start_from=0) + function RunSQLText(&$sqls, $replace_from = null, $replace_to = null, $start_from = 0) { $table_prefix = $this->getSystemConfig('Database', 'TablePrefix'); @@ -818,6 +818,8 @@ $this->Application->HandleEvent($event, 'adm:OnResetConfigsCache'); $this->Application->HandleEvent($event, 'c:OnResetCMSMenuCache'); + $this->Conn->Query('DELETE FROM ' . TABLE_PREFIX . 'CachedUrls'); + if ($refresh_permissions) { if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild')) { // refresh permission without progress bar @@ -906,4 +908,129 @@ $permissions = fileperms($file); return $permissions & 0x0010 || $permissions & 0x0002; } + + /** + * Upgrades primary skin to the latest version + * + * @param Array $module_info + * @return string + */ + function upgradeSkin($module_info) + { + $upgrades_file = sprintf(UPGRADES_FILE, $module_info['Path'], 'css'); + $data = file_get_contents($upgrades_file); + + // get all versions with their positions in file + $versions = Array (); + preg_match_all('/(' . VERSION_MARK . ')/s', $data, $matches, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); + $from_version_int = $this->ConvertModuleVersion($module_info['FromVersion']); + + foreach ($matches as $index => $match) { + $version_int = $this->ConvertModuleVersion($match[2][0]); + + if ($version_int < $from_version_int) { + // only process versions, that were released after currently used version + continue; + } + + $start_pos = $match[0][1] + strlen($match[0][0]); + $end_pos = array_key_exists($index + 1, $matches) ? $matches[$index + 1][0][1] : mb_strlen($data); + $patch_data = str_replace("\r\n", "\n", substr($data, $start_pos, $end_pos - $start_pos)); + + $versions[] = Array ( + 'Version' => $match[2][0], + // fixes trimmed leading spaces by modern text editor + 'Data' => ltrim( str_replace("\n\n", "\n \n", $patch_data) ), + ); + } + + if (!$versions) { + // not skin changes -> quit + return ; + } + + $primary_skin =& $this->Application->recallObject('skin.primary', null, Array ('skip_autoload' => true)); + /* @var $primary_skin kDBItem */ + + $primary_skin->Load(1, 'IsPrimary'); + + if (!$primary_skin->isLoaded()) { + // we always got primary skin, but just in case + return ; + } + + $temp_handler =& $this->Application->recallObject('skin_TempHandler', 'kTempTablesHandler'); + /* @var $temp_handler kTempTablesHandler */ + + // clone current skin + $cloned_ids = $temp_handler->CloneItems('skin', '', Array ($primary_skin->GetID())); + + if (!$cloned_ids) { + // can't clone + return ; + } + + $skin =& $this->Application->recallObject('skin.tmp', null, Array ('skip_autoload' => true)); + /* @var $skin kDBItem */ + + $skin->Load( $cloned_ids[0] ); + + // save css to temp file (for patching) + $skin_file = tempnam('/tmp', 'skin_css_'); + $fp = fopen($skin_file, 'w'); + fwrite($fp, str_replace("\r\n", "\n", $skin->GetDBField('CSS'))); + fclose($fp); + + $output = Array (); + $patch_file = tempnam('/tmp', 'skin_patch_'); + + foreach ($versions as $version_info) { + // for each left version get it's patch and apply to temp file + $fp = fopen($patch_file, 'w'); + fwrite($fp, $version_info['Data']); + fclose($fp); + + $output[ $version_info['Version'] ] = shell_exec('patch ' . $skin_file . ' ' . $patch_file . ' 2>&1') . "\n"; + } + + // place temp file content into cloned skin + $skin->SetDBField('Name', 'Upgraded to ' . $module_info['ToVersion']); + $skin->SetDBField('CSS', file_get_contents($skin_file)); + $skin->Update(); + + unlink($skin_file); + unlink($patch_file); + + $has_errors = false; + + foreach ($output as $version => $version_output) { + $version_errors = trim( preg_replace("/(^|\n)(patching file .*?|Hunk #.*?\.)(\n|$)/m", '', $version_output) ); + + if ($version_errors) { + $has_errors = true; + $output[$version] = trim( preg_replace("/(^|\n)(patching file .*?)(\n|$)/m", '', $output[$version]) ); + } + else { + unset($output[$version]); + } + } + + if (!$has_errors) { + // copy patched css back to primary skin + $primary_skin->SetDBField('CSS', $skin->GetDBField('CSS')); + $primary_skin->Update(); + + // delete temporary skin record + $temp_handler->DeleteItems('skin', '', Array ($skin->GetID())); + + return true; + } + + // put clean skin from new version + $skin->SetDBField('CSS', file_get_contents(FULL_PATH . '/core/admin_templates/incs/style_template.css')); + $skin->Update(); + + // return output in case of errors + return $output; + } } \ No newline at end of file Index: install/step_templates/skin_upgrade.tpl =================================================================== --- install/step_templates/skin_upgrade.tpl (revision 0) +++ install/step_templates/skin_upgrade.tpl (revision 0) @@ -0,0 +1,24 @@ + + + Automatic upgrade of Administrative Console Skin failed. You can verify patching log errors below. + + + + + + +

+ You must manually merge skin, created during upgrade with your current + primary skin to ensure, that Administrative Console interface isn't broken. +

+
+ + \ No newline at end of file Index: install/steps_db.xml =================================================================== --- install/steps_db.xml (revision 13756) +++ install/steps_db.xml (working copy) @@ -149,6 +149,9 @@ Select modules from the list, you need to update to the last downloaded version of In-Portal

]]>
+ + Review Administrative Console skin upgrade log.

]]> +
In-Portal needs to connect to your Database Server. Please provide the database server type*, host name (normally "localhost"), Database user name, and database Password. These fields are required Index: install/upgrade_helper.php =================================================================== --- install/upgrade_helper.php (revision 0) +++ install/upgrade_helper.php (revision 0) @@ -0,0 +1,42 @@ +_toolkit =& $instance; + } + + } \ No newline at end of file Index: install/upgrades.css =================================================================== --- install/upgrades.css (revision 0) +++ install/upgrades.css (revision 0) @@ -0,0 +1,578 @@ +# ===== v 5.0.0 ===== +Index: style_template.css +=================================================================== +--- style_template.css (revision 1.2.8.6) ++++ style_template.css (working copy) +@@ -14,13 +14,17 @@ + + body { + font-family: verdana,arial,helvetica,sans-serif; +- font-size: 9pt; + color: #000000; + overflow-x: auto; overflow-y: auto; + margin: 0px 0px 0px 0px; + text-decoration: none; + } + ++body, td { ++ /* fix for Firefox, when font-size was not inherited in table cells */ ++ font-size: 9pt; ++} ++ + a { + color: #006699; + text-decoration: none; +@@ -73,21 +77,36 @@ + } + + /* Head frame */ ++table.head-table { ++ background: url(@@base_url@@/core/admin_templates/img/top_frame/right_background.jpg) top right @@HeadBgColor@@ no-repeat; ++} ++ + .head-table tr td { +- background-color: @@HeadBgColor@@; + color: @@HeadColor@@ + } + ++div#extra_toolbar td.button-active { ++ background: url(@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif) bottom left repeat-x; ++ height: 22px; ++} ++ ++div#extra_toolbar td.button-active a { ++ color: black; ++ text-decoration: none; ++} ++ + td.kx-block-header, .head-table tr td.kx-block-header{ + color: @@HeadBarColor@@; +- background-color: @@HeadBarBgColor@@; ++ background: url(@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif) repeat-x top left; ++ /*background-color: @@HeadBarBgColor@@;*/ + padding-left: 7px; + padding-right: 7px; + } + + a.kx-header-link { + text-decoration: underline; +- color: #FFFFFF; ++ font-weight: bold; ++ color: #0080C8; + } + + a.kx-header-link:hover { +@@ -96,8 +115,8 @@ + } + + .kx-secondary-foreground { +- color: @@HeadBarColor@@; +- background-color: @@HeadBarBgColor@@; ++ color: #FFFFFF; ++ /*background-color: @@HeadBarBgColor@@;*/ + } + + .kx-login-button { +@@ -110,7 +129,7 @@ + font-size: 12px; + font-weight: normal; + color: #000000; +- background: url(@@base_url@@/proj-base/admin_templates/img/button_back.gif) #f9eeae repeat-x; ++ background: url(@@base_url@@/core/admin_templates/img/button_back.gif) #f9eeae repeat-x; + text-decoration: none; + } + +@@ -119,7 +138,7 @@ + font-size: 12px; + font-weight: normal; + color: #676767; +- background: url(@@base_url@@/proj-base/admin_templates/img/button_back_disabled.gif) #f9eeae repeat-x; ++ background: url(@@base_url@@/core/admin_templates/img/button_back_disabled.gif) #f9eeae repeat-x; + text-decoration: none; + } + +@@ -131,23 +150,48 @@ + border-top: 1px solid black; + border-left: 1px solid black; + border-right: 1px solid black; ++ margin-left: 3px !important; ++ white-space: nowrap; + } + + .tab-active { +- background-color: #2D79D6; +- border-bottom: 1px solid #2D79D6; ++ background-color: #4487D9; + } + + .tab a { +- color: #00659C; ++ color: #4487D9; + font-weight: bold; + } + + .tab-active a { +- color: #fff; ++ color: #FFFFFF; + font-weight: bold; + } + ++a.scroll-left, a.scroll-right { ++ cursor: pointer; ++ display: block; ++ float: left; ++ height: 18px; ++ margin: 0px 1px; ++ width: 18px; ++} ++ ++a.scroll-left { ++ background: transparent url(@@base_url@@/core/admin_templates/img/tabs/left.png) no-repeat scroll 0 0; ++} ++ ++a.scroll-right { ++ background: transparent url(@@base_url@@/core/admin_templates/img/tabs/right.png) no-repeat scroll 0 0; ++} ++ ++a.disabled { ++ visibility: hidden !important; ++} ++ ++a.scroll-left:hover, a.scroll-right:hover { ++ background-position: 0 -18px; ++} + + /* Toolbar */ + +@@ -255,7 +299,7 @@ + } + + /* Filters row */ +-tr.grid-header-row-0 td { ++tr.grid-header-row-1 td { + background-color: @@FiltersBgColor@@; + border-bottom: 1px solid black; + } +@@ -288,18 +332,19 @@ + } + + /* Column titles row */ +-tr.grid-header-row-1 td { ++tr.grid-header-row-0 td { + height: 25px; + font-weight: bold; + background-color: @@ColumnTitlesBgColor@@; + color: @@ColumnTitlesColor@@; ++ border-bottom: 1px solid black; + } + +-tr.grid-header-row-1 td a { ++tr.grid-header-row-0 td a { + color: @@ColumnTitlesColor@@; + } + +-tr.grid-header-row-1 td a:hover { ++tr.grid-header-row-0 td a:hover { + color: #FFCC00; + } + +@@ -307,7 +352,7 @@ + .grid-footer-row td { + background-color: #D7D7D7; + font-weight: bold; +- border-right: none; ++ border-right: 1px solid #C9C9C9; + padding: 3px 5px 3px 5px; + } + +@@ -320,12 +365,12 @@ + vertical-align: middle !important; + } + +-tr.grid-header-row-0 td.grid-header-col-0 { ++tr.grid-header-row-1 td.grid-header-col-1 { + text-align: center; + vertical-align: middle !important; + } + +-tr.grid-header-row-0 td.grid-header-col-0 div { ++tr.grid-header-row-1 td.grid-header-col-1 div { + display: table-cell; + vertical-align: middle; + } +@@ -374,11 +419,12 @@ + + .subsectiontitle td { + vertical-align: middle; +- padding: 3px 5px 3px 5px; ++ /*padding: 3px 5px 3px 5px;*/ ++ padding: 1px 5px; + } + + .label-cell { +- background: #DEE7F6 url(@@base_url@@/proj-base/admin_templates/img/bgr_input_name_line.gif) no-repeat right bottom; ++ background: #DEE7F6 url(@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif) no-repeat right bottom; + font: 12px arial, sans-serif; + padding: 4px 20px; + width: 150px; +@@ -387,13 +433,13 @@ + .control-mid { + width: 13px; + border-left: 1px solid #7A95C2; +- background: #fff url(@@base_url@@/proj-base/admin_templates/img/bgr_mid.gif) repeat-x left bottom; ++ background: #fff url(@@base_url@@/core/admin_templates/img/bgr_mid.gif) repeat-x left bottom; + } + + .control-cell { + font: 11px arial, sans-serif; + padding: 4px 10px 5px 5px; +- background: #fff url(@@base_url@@/proj-base/admin_templates/img/bgr_input_line.gif) no-repeat left bottom; ++ background: #fff url(@@base_url@@/core/admin_templates/img/bgr_input_line.gif) no-repeat left bottom; + width: auto; + vertical-align: middle; + } +@@ -420,8 +466,28 @@ + color: red; + } + ++.warning-table { ++ background-color: #F0F1EB; ++ border: 1px solid #000000; ++ border-collapse: collapse; ++ border-top-width: 0px; ++} ++ + .form-warning { + color: red; ++ font-size: 11px; ++} ++ ++.priority { ++ color: red; ++ padding-left: 1px; ++ padding-right: 1px; ++ font-size: 11px; ++} ++ ++.small-statistics { ++ font-size: 11px; ++ color: #707070; + } + + .req-note { +@@ -474,7 +540,13 @@ + + + /* To be sorted */ ++span#category_path, span#category_path a { ++ color: #FFFFFF; ++} + ++span#category_path a { ++ text-decoration: underline; ++} + + /* Section title, right to the big icon */ + .admintitle { +@@ -484,7 +556,7 @@ + text-decoration: none; + } + +-/* Left sid of bluebar */ ++/* Left side of bluebar */ + .header_left_bg { + background-color: @@TitleBarBgColor@@; + background-image: none; +@@ -560,7 +632,7 @@ + color: @@TreeColor@@; + font-family: Helvetica, Arial, Verdana; + text-decoration: none; +- padding: 2px 0px 2px 2px; ++ padding: 2px; + } + + .tree tr.highlighted td a { + + +# ===== v 5.0.1 ===== +Index: style_template.css +=================================================================== +--- style_template.css (revision 13764) ++++ style_template.css (working copy) +@@ -78,15 +78,15 @@ + + /* Head frame */ + table.head-table { +- background: url(@@base_url@@/core/admin_templates/img/top_frame/right_background.jpg) top right @@HeadBgColor@@ no-repeat; ++ background: url('@@base_url@@/core/admin_templates/img/top_frame/right_background.png') top right @@HeadBgColor@@ no-repeat; + } + +-.head-table tr td { ++.head-table tr td, .head-table tr td a { + color: @@HeadColor@@ + } + + div#extra_toolbar td.button-active { +- background: url(@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif) bottom left repeat-x; ++ background: url('@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif') bottom left repeat-x; + height: 22px; + } + +@@ -97,7 +97,7 @@ + + td.kx-block-header, .head-table tr td.kx-block-header{ + color: @@HeadBarColor@@; +- background: url(@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif) repeat-x top left; ++ background: url('@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif') repeat-x top left; + /*background-color: @@HeadBarBgColor@@;*/ + padding-left: 7px; + padding-right: 7px; +@@ -129,7 +129,7 @@ + font-size: 12px; + font-weight: normal; + color: #000000; +- background: url(@@base_url@@/core/admin_templates/img/button_back.gif) #f9eeae repeat-x; ++ background: url('@@base_url@@/core/admin_templates/img/button_back.gif') #f9eeae repeat-x; + text-decoration: none; + } + +@@ -138,7 +138,7 @@ + font-size: 12px; + font-weight: normal; + color: #676767; +- background: url(@@base_url@@/core/admin_templates/img/button_back_disabled.gif) #f9eeae repeat-x; ++ background: url('@@base_url@@/core/admin_templates/img/button_back_disabled.gif') #f9eeae repeat-x; + text-decoration: none; + } + +@@ -178,11 +178,11 @@ + } + + a.scroll-left { +- background: transparent url(@@base_url@@/core/admin_templates/img/tabs/left.png) no-repeat scroll 0 0; ++ background: transparent url('@@base_url@@/core/admin_templates/img/tabs/left.png') no-repeat scroll 0 0; + } + + a.scroll-right { +- background: transparent url(@@base_url@@/core/admin_templates/img/tabs/right.png) no-repeat scroll 0 0; ++ background: transparent url('@@base_url@@/core/admin_templates/img/tabs/right.png') no-repeat scroll 0 0; + } + + a.disabled { +@@ -193,6 +193,19 @@ + background-position: 0 -18px; + } + ++td.scroll-right-container { ++ width: 20px; ++} ++ ++td.scroll-right-container.disabled, td.scroll-right-container.disabled * { ++ width: 0px; ++ margin: 0px; ++} ++ ++td.scroll-right-container.disabled br { ++ display: none; ++} ++ + /* Toolbar */ + + .toolbar { +@@ -424,22 +437,22 @@ + } + + .label-cell { +- background: #DEE7F6 url(@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif) no-repeat right bottom; ++ background: #DEE7F6 url('@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif') no-repeat right bottom; + font: 12px arial, sans-serif; + padding: 4px 20px; +- width: 150px; ++ width: 160px; + } + + .control-mid { + width: 13px; + border-left: 1px solid #7A95C2; +- background: #fff url(@@base_url@@/core/admin_templates/img/bgr_mid.gif) repeat-x left bottom; ++ background: #fff url('@@base_url@@/core/admin_templates/img/bgr_mid.gif') repeat-x left bottom; + } + + .control-cell { + font: 11px arial, sans-serif; + padding: 4px 10px 5px 5px; +- background: #fff url(@@base_url@@/core/admin_templates/img/bgr_input_line.gif) no-repeat left bottom; ++ background: #fff url('@@base_url@@/core/admin_templates/img/bgr_input_line.gif') no-repeat left bottom; + width: auto; + vertical-align: middle; + } +@@ -528,14 +541,14 @@ + width: 100%; + border: 1px solid black; + height: 20px; +- background: #fff url(@@base_url@@/core/admin_templates/img/progress_left.gif); ++ background: #fff url('@@base_url@@/core/admin_templates/img/progress_left.gif'); + } + + .uploader-done { + width: 0%; + background-color: green; + height: 20px; +- background: #4A92CE url(@@base_url@@/core/admin_templates/img/progress_done.gif); ++ background: #4A92CE url('@@base_url@@/core/admin_templates/img/progress_done.gif'); + } + + +@@ -635,15 +648,15 @@ + padding: 2px; + } + ++.tree tr td a:hover { ++ color: @@TreeHoverColor@@; ++} ++ + .tree tr.highlighted td a { ++ color: @@TreeHighColor@@; + background-color: @@TreeHighBgColor@@; +- color: @@TreeHighColor@@; + } + + .tree tr.highlighted td a:hover { +- color: #fff; +-} +- +-.tree tr td a:hover { +- color: #000000; ++ color: @@TreeHighHoverColor@@; + } +\ No newline at end of file + +# ===== v 5.1.0-B1 ===== +Index: style_template.css +=================================================================== +--- style_template.css (revision 13764) ++++ style_template.css (working copy) +@@ -648,15 +648,36 @@ + padding: 2px; + } + +-.tree tr td a:hover { ++.tree tr td a:hover, .tree tr td a.debug-only-item:hover { + color: @@TreeHoverColor@@; + } + +-.tree tr.highlighted td a { ++.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item { + color: @@TreeHighColor@@; + background-color: @@TreeHighBgColor@@; + } + + .tree tr.highlighted td a:hover { + color: @@TreeHighHoverColor@@; ++} ++ ++.tree tr td a.debug-only-item { ++ color: grey; ++} ++ ++/* Ajax Dropdown */ ++.suggest-box { ++ border: 1px solid #999; ++ background-color: #fff; ++} ++ ++.suggest-item, .suggest-item-over { ++ padding: 1px 2px 0px 2px; ++ font-family: arial,verdana; ++ font-size: 12px; ++} ++ ++.suggest-item-over { ++ background-color: #3366CC; ++ color: #fff; + } +\ No newline at end of file + +# ===== v 5.1.0-B2 ===== +Index: style_template.css +=================================================================== +--- style_template.css (revision 13764) ++++ style_template.css (working copy) +@@ -512,45 +512,49 @@ + border-collapse: separate + } + +- + /* Uploader */ +- +-.uploader-main { +- position: absolute; +- display: none; +- z-index: 10; +- border: 1px solid #777; +- padding: 10px; +- width: 350px; +- height: 120px; +- overflow: hidden; +- background-color: #fff; ++.uploader-queue div.file { ++ font-size: 11px; ++ border: 1px solid #7F99C5; ++ padding: 3px; ++ background-color: #DEE7F6; ++ margin-bottom: 2px; + } + +-.uploader-percent { +- width: 100%; +- padding-top: 3px; +- text-align: center; +- position: relative; +- z-index: 20; ++.uploader-queue .left { + float: left; +- font-weight: bold; ++ vertical-align: top; + } + +-.uploader-left { +- width: 100%; ++.uploader-queue .file-label { ++ margin-left: 5px; ++} ++ ++.uploader-queue .preview .delete-checkbox { ++ margin-top: -3px; ++} ++ ++.uploader-queue .progress-container { ++ margin: 2px 5px 0px 5px; ++} ++ ++.uploader-queue .progress-empty { ++ width: 150px; ++ height: 9px; + border: 1px solid black; +- height: 20px; +- background: #fff url('@@base_url@@/core/admin_templates/img/progress_left.gif'); ++ background: url('@@base_url@@/core/admin_templates/img/progress_left.gif') repeat-x; + } + +-.uploader-done { +- width: 0%; +- background-color: green; +- height: 20px; +- background: #4A92CE url('@@base_url@@/core/admin_templates/img/progress_done.gif'); ++.uploader-queue .progress-full { ++ height: 9px; ++ background: url('@@base_url@@/core/admin_templates/img/progress_done.gif'); + } + ++.uploader-queue .thumbnail { ++ /*margin-bottom: 2px;*/ ++ border: 1px solid black; ++ background-color: grey; ++} + + /* To be sorted */ + span#category_path, span#category_path a { Index: install/upgrades.php =================================================================== --- install/upgrades.php (revision 13756) +++ install/upgrades.php (working copy) @@ -20,26 +20,9 @@ * Class, that holds all upgrade scripts for "Core" module * */ - class CoreUpgrades extends kHelper { + class CoreUpgrades extends kUpgradeHelper { /** - * Install toolkit instance - * - * @var kInstallToolkit - */ - var $_toolkit = null; - - /** - * Sets common instance of installator toolkit - * - * @param kInstallToolkit $instance - */ - function setToolkit(&$instance) - { - $this->_toolkit =& $instance; - } - - /** * Changes table structure, where multilingual fields of TEXT type are present * * @param string $mode when called mode {before, after) @@ -228,8 +211,8 @@ { // 1. find In-Portal old Conn->GetCol($sql)); // 2. replace In-Portal old $new_tag) { $sql = 'UPDATE '.TABLE_PREFIX.'EmailMessage - SET Template = REPLACE(Template, '.$this->Conn->qstr($old_tag).', '.$this->Conn->qstr($new_tag).') - WHERE EventId IN ('.$event_ids.')'; + SET Template = REPLACE(Template, '.$this->Conn->qstr($old_tag).', '.$this->Conn->qstr($new_tag).') + WHERE EventId IN ('.$event_ids.')'; $this->Conn->Query($sql); } if ($mode == 'after') { $this->_insertInPortalData(); - $this->_removeDuplicatePhrases(); $this->_moveDatabaseFolders(); // in case, when In-Portal module is enabled -> turn AdvancedUserManagement on too @@ -264,6 +246,10 @@ $this->Conn->Query($sql); } } + + if ($mode == 'languagepack') { + $this->_removeDuplicatePhrases(); + } } function _insertInPortalData() @@ -771,7 +757,7 @@ * @param string $module_name * @return int */ - function _getRootCategory($module_name) + function _getRootCategory($module_name, $module_prefix) { // don't cache anything here (like in static variables), because database value is changed on the fly !!! $sql = 'SELECT RootCat @@ -782,6 +768,7 @@ // put to cache too, because CategoriesEventHandler::_prepareAutoPage uses kApplication::findModule $this->Application->ModuleInfo[$module_name]['Name'] = $module_name; $this->Application->ModuleInfo[$module_name]['RootCat'] = $root_category; + $this->Application->ModuleInfo[$module_name]['Var'] = $module_prefix; return $root_category; } @@ -792,7 +779,7 @@ */ function _restructureCatalog() { - $root_category = $this->_getRootCategory('Core'); + $root_category = $this->_getRootCategory('Core', 'adm'); $sql = 'SELECT CategoryId FROM ' . TABLE_PREFIX . 'Category @@ -863,6 +850,13 @@ // option: from -> to 'HeadBgColor' => Array ('#1961B8', '#007BF4'), 'HeadBarColor' => Array ('#FFFFFF', '#000000'), + + 'HeadColor' => Array ('#CCFF00', '#FFFFFF'), + 'TreeColor' => Array ('#006F99', '#000000'), + 'TreeHoverColor' => Array ('', '#009FF0'), + 'TreeHighHoverColor' => Array ('', '#FFFFFF'), + 'TreeHighBgColor' => Array ('#4A92CE', '#4A92CE'), + 'TreeBgColor' => Array ('#FFFFFF', '#DCECF6'), ); $can_change = true; @@ -909,7 +903,7 @@ function _createProjCMSTables() { // 0. make sure, that Content category exists - $root_category = $this->_getRootCategory('Proj-CMS'); + $root_category = $this->_getRootCategory('Proj-CMS', 'st'); if ($root_category) { // proj-cms module found -> remove it $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Modules @@ -925,7 +919,7 @@ WHERE (Status = 4) AND (CategoryId <> ' . $root_category . ')'; $this->Conn->Query($sql); } else { - $root_category = $this->_getRootCategory('In-Edit'); + $root_category = $this->_getRootCategory('In-Edit', 'cms'); if ($root_category) { // in-edit module found -> remove it $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Modules @@ -1414,6 +1408,24 @@ function Upgrade_5_1_0_B1($mode) { if ($mode == 'before') { + // alter here, because kMultiLanguageHelper::createFields + // method, called after will expect that to be in database + $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'Events + ADD AllowChangingSender TINYINT NOT NULL DEFAULT "0" AFTER ReplacementTags , + ADD CustomSender TINYINT NOT NULL DEFAULT "0" AFTER AllowChangingSender , + ADD SenderName VARCHAR(255) NOT NULL DEFAULT "" AFTER CustomSender , + ADD SenderAddressType TINYINT NOT NULL DEFAULT "0" AFTER SenderName , + ADD SenderAddress VARCHAR(255) NOT NULL DEFAULT "" AFTER SenderAddressType , + ADD AllowChangingRecipient TINYINT NOT NULL DEFAULT "0" AFTER SenderAddress , + ADD CustomRecipient TINYINT NOT NULL DEFAULT "0" AFTER AllowChangingRecipient , + ADD Recipients TEXT AFTER CustomRecipient, + ADD INDEX (AllowChangingSender), + ADD INDEX (CustomSender), + ADD INDEX (SenderAddressType), + ADD INDEX (AllowChangingRecipient), + ADD INDEX (CustomRecipient)'; + $this->Conn->Query($sql); + // create multilingual fields for phrases and email events $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ @@ -1526,6 +1538,7 @@ if ($mode == 'after') { $this->_transformEmailRecipients(); + $this->_fixSkinColors(); } } Index: install/upgrades.sql =================================================================== --- install/upgrades.sql (revision 13758) +++ install/upgrades.sql (working copy) @@ -1623,7 +1623,7 @@ # ===== v 5.0.2 ===== # ===== v 5.0.3-B1 ===== -ALTER TABLE PermCache ADD INDEX (ACL); +ALTER TABLE PermCache ADD INDEX (ACL); INSERT INTO ConfigurationAdmin VALUES ('cms_DefaultTrackingCode', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.10, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced'); @@ -1708,7 +1708,7 @@ KEY DomainId (DomainId) ); -INSERT INTO ConfigurationAdmin VALUES ('CacheHandler', 'la_section_SettingsCaching', 'la_config_CacheHandler', 'select', NULL, 'Fake=la_None,Memcache=+Memcached,Apc=+Alternative PHP Cache,XCache=+XCache', 80.01, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('CacheHandler', 'la_section_SettingsCaching', 'la_config_CacheHandler', 'select', NULL, 'Fake=la_None||Memcache=+Memcached||Apc=+Alternative PHP Cache||XCache=+XCache', 80.01, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'CacheHandler', 'Fake', 'In-Portal', 'in-portal:configure_advanced'); ALTER TABLE ConfigurationValues @@ -1877,21 +1877,6 @@ UPDATE ConfigurationValues SET ValueList = NULL, DisplayOrder = 20.02 WHERE VariableName = 'Config_Site_Time'; UPDATE ConfigurationValues SET VariableValue = '' WHERE VariableName = 'Config_Site_Time' AND VariableValue = 14; -ALTER TABLE Events - ADD AllowChangingSender TINYINT NOT NULL DEFAULT '0' AFTER ReplacementTags , - ADD CustomSender TINYINT NOT NULL DEFAULT '0' AFTER AllowChangingSender , - ADD SenderName VARCHAR(255) NOT NULL DEFAULT '' AFTER CustomSender , - ADD SenderAddressType TINYINT NOT NULL DEFAULT '0' AFTER SenderName , - ADD SenderAddress VARCHAR(255) NOT NULL DEFAULT '' AFTER SenderAddressType , - ADD AllowChangingRecipient TINYINT NOT NULL DEFAULT '0' AFTER SenderAddress , - ADD CustomRecipient TINYINT NOT NULL DEFAULT '0' AFTER AllowChangingRecipient , - ADD Recipients TEXT AFTER CustomRecipient, - ADD INDEX (AllowChangingSender), - ADD INDEX (CustomSender), - ADD INDEX (SenderAddressType), - ADD INDEX (AllowChangingRecipient), - ADD INDEX (CustomRecipient); - UPDATE Events SET AllowChangingSender = 1, AllowChangingRecipient = 1; UPDATE Events SET Module = 'Core' WHERE Module LIKE 'Core:%'; Index: kernel/application.php =================================================================== --- kernel/application.php (revision 13756) +++ kernel/application.php (working copy) @@ -837,12 +837,14 @@ $this->setCache($serial_name, (int)$this->getCache($serial_name) + 1); } - // delete cached mod-rewrite urls related to given prefix and id - $delete_clause = isset($id) ? $prefix . ':' . $id : $prefix; + if (!defined('IS_INSTALL') || !IS_INSTALL) { + // delete cached mod-rewrite urls related to given prefix and id + $delete_clause = isset($id) ? $prefix . ':' . $id : $prefix; - $sql = 'DELETE FROM ' . TABLE_PREFIX . 'CachedUrls - WHERE Prefixes LIKE ' . $this->Conn->qstr('%|' . $delete_clause . '|%'); - $this->Conn->Query($sql); + $sql = 'DELETE FROM ' . TABLE_PREFIX . 'CachedUrls + WHERE Prefixes LIKE ' . $this->Conn->qstr('%|' . $delete_clause . '|%'); + $this->Conn->Query($sql); + } } return $serial_name; Index: units/skins/skin_eh.php =================================================================== --- units/skins/skin_eh.php (revision 13756) +++ units/skins/skin_eh.php (working copy) @@ -78,8 +78,42 @@ $this->Conn->Query($sql); } + /** + * Don't make cloned skin primary + * + * @param kEvent $event + */ + function OnBeforeClone(&$event) + { + parent::OnBeforeClone($event); + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $object->SetDBField('IsPrimary', 0); + } + /** + * Re-compile skin, after it's changed (live table only) + * + * @param kEvent $event + */ + function OnAfterItemUpdate(&$event) + { + parent::OnAfterItemUpdate($event); + + $object =& $event->getObject(); + /* @var $object kDBItem */ + + if (!$object->IsTempTable()) { + $skin_helper =& $this->Application->recallObject('SkinHelper'); + /* @var $skin_helper SkinHelper */ + + $skin_helper->compile($object); + } + } + + /** * [HOOK] Compile stylesheet file based on theme definitions * * @param kEvent $event