From 747a13a888e6f295a274034cb98eaa691f891932 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 16 Jan 2017 16:05:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=8C=96?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=EF=BC=88is=5Foriginal=5Fcopy=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=AB=E3=83=89=E8=BF=BD=E5=8A=A0=EF=BC=89?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons3/issues/770?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1484544861_add_is_original_copy.php | 71 +++++++++++++++++++ Config/Schema/schema.php | 2 + 2 files changed, 73 insertions(+) create mode 100644 Config/Migration/1484544861_add_is_original_copy.php diff --git a/Config/Migration/1484544861_add_is_original_copy.php b/Config/Migration/1484544861_add_is_original_copy.php new file mode 100644 index 0000000..2683d26 --- /dev/null +++ b/Config/Migration/1484544861_add_is_original_copy.php @@ -0,0 +1,71 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +App::uses('NetCommonsMigration', 'NetCommons.Config/Migration'); + +/** + * 多言語化対応 + * + * @author Shohei Nakajima + * @package NetCommons\Bbses\Config\Migration + */ +class AddIsOriginalCopy extends NetCommonsMigration { + +/** + * Migration description + * + * @var string + */ + public $description = 'add_is_original_copy'; + +/** + * Actions to be performed + * + * @var array $migration + */ + public $migration = array( + 'up' => array( + 'create_field' => array( + 'bbs_articles' => array( + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'), + ), + 'bbses' => array( + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'), + ), + ), + ), + 'down' => array( + 'drop_field' => array( + 'bbs_articles' => array('is_original_copy'), + 'bbses' => array('is_original_copy'), + ), + ), + ); + +/** + * Before migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function before($direction) { + return true; + } + +/** + * After migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function after($direction) { + return true; + } +} diff --git a/Config/Schema/schema.php b/Config/Schema/schema.php index 66ae9c5..1f64974 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -86,6 +86,7 @@ public function after($event = array()) { 'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '最新コンテンツかどうか 0:最新でない 1:最新'), 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'), 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'), + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'), 'key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'comment' => 'キー', 'charset' => 'utf8'), 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル', 'charset' => 'utf8'), 'title_icon' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -134,6 +135,7 @@ public function after($event = array()) { 'language_id' => array('type' => 'integer', 'null' => false, 'default' => '2', 'length' => 6, 'unsigned' => false, 'comment' => '言語ID'), 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'), 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'), + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '掲示板名称', 'charset' => 'utf8'), 'bbs_article_modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '記事の最終更新日時'), 'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => '作成者'), From cbfcb1575f34798bf5d43a9d25cd3c33a3dd893e Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 16 Jan 2017 17:32:18 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Plugin=E3=83=87=E3=83=BC=E3=82=BF=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20https://github.com/NetCommons3/NetCommons3/issues/7?= =?UTF-8?q?70?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Migration/001_plugin_records.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Config/Migration/001_plugin_records.php b/Config/Migration/001_plugin_records.php index ca929e6..1ac1de1 100644 --- a/Config/Migration/001_plugin_records.php +++ b/Config/Migration/001_plugin_records.php @@ -45,6 +45,8 @@ class PluginRecords extends NetCommonsMigration { //日本語 array( 'language_id' => '2', + 'is_origin' => true, + 'is_translation' => true, 'key' => 'bbses', 'namespace' => 'netcommons/bbses', 'name' => '掲示板', @@ -58,6 +60,8 @@ class PluginRecords extends NetCommonsMigration { //英語 array( 'language_id' => '1', + 'is_origin' => false, + 'is_translation' => true, 'key' => 'bbses', 'namespace' => 'netcommons/bbses', 'name' => 'BBS',