Page MenuHomeIn-Portal Phabricator

in-news
No OneTemporary

File Metadata

Created
Mon, Jan 6, 3:17 AM
Index: branches/5.0.x/in-news/install/upgrades.php
===================================================================
--- branches/5.0.x/in-news/install/upgrades.php (revision 12179)
+++ branches/5.0.x/in-news/install/upgrades.php (revision 12180)
@@ -1,82 +1,94 @@
<?php
/**
* @version $Id$
* @package In-News
* @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 = 'InNewsUpgrades';
/**
* Class, that holds all upgrade scripts for "Core" module
*
*/
class InNewsUpgrades 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-News', 'RootCat');
$sql = 'UPDATE ' . $this->Application->getUnitOption('c', 'TableName') . '
SET UseMenuIconUrl = 1, MenuIconUrl = "in-news/img/menu_articles.gif"
WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $root_category;
$this->Conn->Query($sql);
$this->_updateDetailTemplate('n', 'innews/detail', 'in-news/designs/detail');
}
}
/**
* 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('n', 'in-news/designs/detail', 'in-news/articles/article_detail');
+ }
+ }
}
\ No newline at end of file
Index: branches/5.0.x/in-news/install/upgrades.sql
===================================================================
--- branches/5.0.x/in-news/install/upgrades.sql (revision 12179)
+++ branches/5.0.x/in-news/install/upgrades.sql (revision 12180)
@@ -1,20 +1,23 @@
# ===== v 4.3.9 =====
INSERT INTO ImportScripts VALUES (DEFAULT, 'Articles from CSV file [In-News]', '', 'n', 'In-News', '', 'CSV', '1');
# ===== v 5.0.0 =====
ALTER TABLE News ADD INDEX (StartDate), ADD INDEX (Archived);
UPDATE Category SET Template = '/in-news/designs/section' WHERE Template = 'innews/index';
UPDATE Category SET CachedTemplate = '/in-news/designs/section' WHERE CachedTemplate = 'innews/index';
UPDATE ConfigurationValues SET VariableValue = '/in-news/designs/section' WHERE VariableName = 'n_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-news/designs/detail' WHERE VariableName = 'n_ItemTemplate';
INSERT INTO Permissions VALUES (DEFAULT, 'in-news:articles.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-news:setting_folder.view', 11, 1, 1, 0);
DELETE FROM Permissions WHERE Permission LIKE 'in-news:innews_general.%';
UPDATE Phrase SET Module = 'In-News' WHERE ((Phrase LIKE '%Article%' OR Phrase LIKE '%News%') AND (Module = 'Core') AND Phrase NOT IN ('la_ToolTip_NewSearchConfig', 'la_tooltip_newstylesheet'));
-UPDATE Phrase SET Module = 'In-News' WHERE Phrase = 'la_title_In-News';
\ No newline at end of file
+UPDATE Phrase SET Module = 'In-News' WHERE Phrase = 'la_title_In-News';
+
+# ===== v 5.0.1 =====
+UPDATE ConfigurationValues SET VariableValue = 'in-news/articles/article_detail' WHERE VariableName = 'n_ItemTemplate';
Index: branches/5.0.x/in-news/install.php
===================================================================
--- branches/5.0.x/in-news/install.php (revision 12179)
+++ branches/5.0.x/in-news/install.php (revision 12180)
@@ -1,49 +1,49 @@
<?php
/**
* @version $Id$
* @package In-News
* @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-news';
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('News', 'News Articles', '/in-news/designs/section', 'in-news/img/menu_articles.gif');
$toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
$toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{NewsCatId}', $category->GetID());
$toolkit->ImportLanguage('/' . $module_folder . '/install/english');
$toolkit->SetModuleRootCategory($module_folder, $category->GetID());
$toolkit->linkCustomFields($module_folder, 'n', 2); // to create Custom Fields for News
$toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
- $toolkit->setModuleItemTemplate($category, 'n', 'in-news/designs/detail');
+ $toolkit->setModuleItemTemplate($category, 'n', 'in-news/articles/article_detail');
$toolkit->finalizeModuleInstall($module_folder, true);
\ No newline at end of file

Event Timeline