Index: branches/5.0.x/in-link/install/upgrades.php =================================================================== --- branches/5.0.x/in-link/install/upgrades.php (revision 12178) +++ branches/5.0.x/in-link/install/upgrades.php (revision 12179) @@ -1,104 +1,116 @@ <?php /** * @version $Id$ * @package In-Link * @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved. * @license GNU/GPL * In-Portal is Open Source software. * This means that this software may have been modified pursuant * the GNU General Public License, and as distributed it includes * or is derivative of works licensed under the GNU General Public License * or other free or open source software licenses. * See http://www.in-portal.net/license/ for copyright notices and details. */ $upgrade_class = 'InLinkUpgrades'; /** * Class, that holds all upgrade scripts for "Core" module * */ class InLinkUpgrades extends kHelper { /** * 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) */ function Upgrade_5_0_0($mode) { if ($mode == 'after') { $root_category = $this->Application->findModule('Name', 'In-Link', 'RootCat'); $sql = 'UPDATE ' . $this->Application->getUnitOption('c', 'TableName') . ' SET UseMenuIconUrl = 1, MenuIconUrl = "in-link/img/menu_links.gif" WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $root_category; $this->Conn->Query($sql); $this->_updateDetailTemplate('l', 'inlink/detail', 'in-link/designs/detail'); // copy link name and description to their multilingual equivalents $this->_copyToMultilingual(); } } /** * Copy link values from normal fields to multilingual * */ function _copyToMultilingual() { $fields = Array ('Name', 'Description'); $primary_language = $this->Application->GetDefaultLanguageId(); $set_clause = Array (); foreach ($fields as $field) { $set_clause[] = 'l' . $primary_language . '_' . $field . ' = ' . $field; } $sql = 'UPDATE ' . TABLE_PREFIX . 'Link SET ' . implode(', ', $set_clause); $this->Conn->Query($sql); } /** * Replaces deprecated detail template design with new one * * @param string $prefix * @param string $from_template * @param string $to_template */ function _updateDetailTemplate($prefix, $from_template, $to_template) { $sql = 'SELECT CustomFieldId FROM ' . TABLE_PREFIX . 'CustomField WHERE FieldName = "' . $prefix . '_ItemTemplate"'; $custom_field_id = $this->Conn->GetOne($sql); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ $field = $ml_formatter->LangFieldName('cust_' . $custom_field_id, true); $sql = 'UPDATE ' . TABLE_PREFIX . 'CategoryCustomData SET ' . $field . ' = "' . $to_template . '" WHERE ' . $field . ' = "' . $from_template . '"'; $this->Conn->Query($sql); } + + /** + * Update to 5.0.1, update details template + * + * @param string $mode when called mode {before, after) + */ + function Upgrade_5_0_1($mode) + { + if ($mode == 'after') { + $this->_updateDetailTemplate('l', 'in-link/designs/detail', 'in-link/links/link_detail'); + } + } } \ No newline at end of file Index: branches/5.0.x/in-link/install/upgrades.sql =================================================================== --- branches/5.0.x/in-link/install/upgrades.sql (revision 12178) +++ branches/5.0.x/in-link/install/upgrades.sql (revision 12179) @@ -1,31 +1,34 @@ # ===== v 4.3.9 ===== INSERT INTO Events VALUES (DEFAULT, 'LINK.VALIDATION.RESULTS', NULL, 1, 0, 'In-Link', 'la_event_link.validation.results', 1); INSERT INTO ImportScripts VALUES (DEFAULT, 'Links from CSV file [In-Link]', '', 'l', 'In-Link', '', 'CSV', '1'); UPDATE CustomField SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC</SQL>' WHERE FieldName = 'LinkState'; UPDATE CustomField SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC</SQL>' WHERE FieldName = 'LinkCountry'; # ===== v 5.0.0 ===== INSERT INTO Counters VALUES (DEFAULT, 'linkhits_count', 'SELECT ROUND(SUM(Hits)) FROM <%PREFIX%>Link', NULL, NULL, '300', '0', '|Link|'); UPDATE Category SET Template = '/in-link/designs/section' WHERE Template = 'inlink/index'; UPDATE Category SET CachedTemplate = '/in-link/designs/section' WHERE CachedTemplate = 'inlink/index'; UPDATE ConfigurationValues SET VariableValue = '/in-link/designs/section' WHERE VariableName = 'l_CategoryTemplate'; UPDATE ConfigurationValues SET VariableValue = 'in-link/designs/detail' WHERE VariableName = 'l_ItemTemplate'; INSERT INTO Permissions VALUES (DEFAULT, 'in-link:links.view', 11, 1, 1, 0); INSERT INTO Permissions VALUES (DEFAULT, 'in-link:setting_folder.view', 11, 1, 1, 0); DELETE FROM Permissions WHERE Permission LIKE 'in-link:inlink_general.%'; UPDATE Events SET Description = 'la_event_link.owner.modify' WHERE Description = 'la_event_link.modify.modify'; UPDATE Events SET Description = 'la_event_link.owner.modify.pending' WHERE Description = 'la_event_link.modify.modify.pending'; UPDATE Phrase SET Module = 'In-Link' WHERE ((Phrase LIKE '%Links%' OR Phrase LIKE '%Listing%') AND (Module = 'Core') AND Phrase NOT IN ('la_section_QuickLinks')); UPDATE Phrase SET Module = 'In-Link', PhraseType = 1 WHERE ( (Phrase LIKE '%Validation%' OR Phrase LIKE 'la_title_In-Link') AND (Module = 'Core') AND Phrase NOT IN ('la_ValidationEmail', 'la_prompt_validation')); + +# ===== v 5.0.1 ===== +UPDATE ConfigurationValues SET VariableValue = 'in-link/links/link_detail' WHERE VariableName = 'l_ItemTemplate'; \ No newline at end of file Index: branches/5.0.x/in-link/install.php =================================================================== --- branches/5.0.x/in-link/install.php (revision 12178) +++ branches/5.0.x/in-link/install.php (revision 12179) @@ -1,49 +1,49 @@ <?php /** * @version $Id$ * @package In-Link * @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved. * @license GNU/GPL * In-Portal is Open Source software. * This means that this software may have been modified pursuant * the GNU General Public License, and as distributed it includes * or is derivative of works licensed under the GNU General Public License * or other free or open source software licenses. * See http://www.in-portal.net/license/ for copyright notices and details. */ $module_folder = 'in-link'; if (!defined('IS_INSTALL')) { // separate module install define('IS_INSTALL', 1); define('ADMIN', 1); define('REL_PATH', $module_folder); define('FULL_PATH', realpath(dirname(__FILE__) . '/..') ); include_once(FULL_PATH . '/core/kernel/startup.php'); require_once FULL_PATH . '/core/install/install_toolkit.php'; $toolkit = new kInstallToolkit(); } else { // install, using installation wizard $toolkit =& $this->toolkit; /* @var $toolkit kInstallToolkit */ } $application =& kApplication::Instance(); $application->Init(); $category =& $toolkit->createModuleCategory('Directory', 'Link Directory', '/in-link/designs/section', 'in-link/img/menu_links.gif'); $toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql'); $toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{LinkCatId}', $category->GetID()); $toolkit->ImportLanguage('/' . $module_folder . '/install/english'); $toolkit->SetModuleRootCategory($module_folder, $category->GetID()); $toolkit->linkCustomFields($module_folder, 'l', 4); // to create Custom Fields for Links $toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field - $toolkit->setModuleItemTemplate($category, 'l', 'in-link/designs/detail'); + $toolkit->setModuleItemTemplate($category, 'l', 'in-link/links/link_detail'); $toolkit->finalizeModuleInstall($module_folder, true); \ No newline at end of file