From 3814ecde06312d7f7dc0c4f7e2ac55653e1d5b00 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Sat, 24 Oct 2015 12:45:12 +0900 Subject: [PATCH 01/25] =?UTF-8?q?=E3=81=8A=E3=81=8B=E3=81=97=E3=81=AA?= =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Migration/1444876854_karuizawa.php | 33 ----------------------- 1 file changed, 33 deletions(-) diff --git a/Config/Migration/1444876854_karuizawa.php b/Config/Migration/1444876854_karuizawa.php index cc633b0..7e5843e 100644 --- a/Config/Migration/1444876854_karuizawa.php +++ b/Config/Migration/1444876854_karuizawa.php @@ -34,9 +34,6 @@ class Karuizawa extends CakeMigration { 'drop_field' => array( 'blog_frame_settings' => array('posts_per_page'), ), - 'drop_table' => array( - 'blog_entries' - ), ), 'down' => array( 'drop_field' => array( @@ -47,36 +44,6 @@ class Karuizawa extends CakeMigration { 'posts_per_page' => array('type' => 'integer', 'null' => false, 'default' => '10', 'unsigned' => false, 'comment' => 'display number | 表示件数 | | '), ), ), - 'create_table' => array( - 'blog_entries' => array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'comment' => 'ID | | | '), - 'blog_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'origin_id' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'entry key | エントリーキー | Hash値 | ', 'charset' => 'utf8'), - 'category_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => 'category id | カテゴリーID | blog_categories.id | '), - 'status' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'public status, 1: public, 2: public pending, 3: draft during 4: remand | 公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し | | '), - 'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '0'), - 'is_latest' => array('type' => 'boolean', 'null' => true, 'default' => null), - 'language_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'title | タイトル | | ', 'charset' => 'utf8'), - 'body1' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'entry body1 | 本文1 | | ', 'charset' => 'utf8'), - 'body2' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'entry body2 | 本文2 | | ', 'charset' => 'utf8'), - 'plus_vote_number' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'comment' => 'plus vote number | プラス投票数 | | '), - 'minus_vote_number' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'comment' => 'minus vote number | マイナス投票数 | | '), - 'publish_start' => array('type' => 'datetime', 'null' => false, 'default' => null), - 'is_auto_translated' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'translation type. 0:original , 1:auto translation | 翻訳タイプ 0:オリジナル、1:自動翻訳 | | '), - 'translation_engine' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'translation engine | 翻訳エンジン | | ', 'charset' => 'utf8'), - 'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'created user | 作成者 | users.id | '), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'created datetime | 作成日時 | | '), - 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => 'modified user | 更新者 | users.id | '), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => 'modified datetime | 更新日時 | | '), - 'block_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'key' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1), - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), - ), - ), ), ); From 92ed897de66e051d031660a8486a69953ba40a1b Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Tue, 27 Oct 2015 16:56:10 +0900 Subject: [PATCH 02/25] =?UTF-8?q?=E5=AE=9F=E9=A8=93=E7=9A=84=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 30 +++++++++++++++++++++++++++- Model/BlogEntry.php | 14 ++++++------- View/BlogEntriesEdit/form.ctp | 5 ++++- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index ea21c6e..028a9b8 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -283,7 +283,35 @@ public function view() { } } -/** + public function download() { + $this->_prepare(); + + //$originId = $this->request->params['named']['origin_id']; + $originId = $this->params['pass'][1]; + + $conditions = $this->BlogEntry->getConditions( + Current::read('Block.id'), + $this->Auth->user('id'), + $this->_getPermission(), + $this->_getCurrentDateTime() + ); + + $conditions['BlogEntry.origin_id'] = $originId; + $options = array( + 'conditions' => $conditions, + ); + $blogEntry = $this->BlogEntry->find('first', $options); + + if ($blogEntry) { + $this->FileDownload->do($blogEntry); + // TODO リクエストパラメータからファイルIDを取得するカラム名を確定する + } else { + // 表示できない記事へのアクセスなら404 + throw new NotFoundException(__('Invalid blog entry')); + } + } + + /** * 年月選択肢をViewへセット * * @return void diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index e74d13a..d6030c3 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -12,6 +12,7 @@ App::uses('BlogsAppModel', 'Blogs.Model'); App::uses('NetCommonsTime', 'NetCommons.Utility'); +//App::uses('AttachmentBehavior', 'Files.Model/Behavior'); /** * Summary for BlogEntry Model @@ -37,6 +38,7 @@ class BlogEntry extends BlogsAppModel { 'Likes.Like', 'Workflow.WorkflowComment', //'Categories.Category', + 'Files.Attachment', ); /** @@ -52,13 +54,11 @@ class BlogEntry extends BlogsAppModel { 'fields' => '', 'order' => '' ), - // 'CategoryOrder' => array( - // 'className' => 'Categories.CategoryOrder', - // 'foreignKey' => false, - // 'conditions' => 'CategoryOrder.category_key=Category.key', - // 'fields' => '', - // 'order' => '' - // ) + 'PhotoFile' => array( // コンテンツを更新してもファイル差し替えないこともあるのでコンテンツn:ファイル1の関係 + 'className' => 'Files.Attachment', + 'foreignKey' => 'photo_file_id', + 'conditions' => '', + ),// 関連づけておいて、afterSaveで関連モデルのsaveする? ); /** diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index e7f9df3..6f90ea4 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -41,7 +41,8 @@ $dataJson = json_encode( 'error' => false, ), 'div' => 'form-control', - 'novalidate' => true + 'novalidate' => true, + 'type' => 'file', ) ); $this->NetCommonsForm->unlockField('Tag'); @@ -79,6 +80,8 @@ $dataJson = json_encode( ));?> + NetCommonsForm->input('photo_file_id', ['type' => 'file']) ?> + NetCommonsForm->input('pdf_file_id', ['type' => 'file']) ?> NetCommonsForm->input('publish_start', From c1d2a5085b3fb246b2e7b1fbac21d6c12f0b651b Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 29 Oct 2015 17:45:27 +0900 Subject: [PATCH 03/25] =?UTF-8?q?FileUpload=E3=81=A7=E3=81=8D=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/BlogEntry.php | 15 +++++++++------ View/BlogEntriesEdit/form.ctp | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 72738d8..64f7870 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -38,7 +38,10 @@ class BlogEntry extends BlogsAppModel { 'Likes.Like', 'Workflow.WorkflowComment', //'Categories.Category', - 'Files.Attachment', + 'Files.Attachment' => [ + 'photo', + 'pdf', + ], ); /** @@ -54,11 +57,11 @@ class BlogEntry extends BlogsAppModel { 'fields' => '', 'order' => '' ), - 'PhotoFile' => array( // コンテンツを更新してもファイル差し替えないこともあるのでコンテンツn:ファイル1の関係 - 'className' => 'Files.Attachment', - 'foreignKey' => 'photo_file_id', - 'conditions' => '', - ),// 関連づけておいて、afterSaveで関連モデルのsaveする? + //'PhotoFile' => array( // コンテンツを更新してもファイル差し替えないこともあるのでコンテンツn:ファイル1の関係 + // 'className' => 'Files.Attachment', + // 'foreignKey' => 'photo_file_id', + // 'conditions' => '', + //),// 関連づけておいて、afterSaveで関連モデルのsaveする? ); /** diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 1320697..5874a91 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -80,8 +80,8 @@ $dataJson = json_encode( ));?> - NetCommonsForm->input('photo_file_id', ['type' => 'file']) ?> - NetCommonsForm->input('pdf_file_id', ['type' => 'file']) ?> + NetCommonsForm->input('photo', ['type' => 'file']) ?> + NetCommonsForm->input('pdf', ['type' => 'file']) ?> NetCommonsForm->input('publish_start', From a78f41eb1bc93315b9cd7814db56ee071f89ffef Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Fri, 6 Nov 2015 19:34:35 +0900 Subject: [PATCH 04/25] =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=89=E7=94=A8=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E5=8E=9F=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/BlogEntriesEdit/form.ctp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 5874a91..4a35b2d 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -80,8 +80,39 @@ $dataJson = json_encode( ));?> - NetCommonsForm->input('photo', ['type' => 'file']) ?> - NetCommonsForm->input('pdf', ['type' => 'file']) ?> + request->data['UploadFile'])){ + foreach($this->request->data['UploadFile'] as $key => $uploadFile){ + echo $this->NetCommonsForm->input('UploadFile.' . $key . '.id', ['type' => 'hidden']); + echo $this->NetCommonsForm->input('UploadFile.' . $key . '.field_name', ['type' => 'hidden']); + } + $originalNames = Hash::combine($this->request->data['UploadFile'], '{n}.field_name', '{n}.original_name'); + } + ?> + NetCommonsForm->Form->defaultModel; + $inputFieldName = $modelName . '.' . $fieldName; + echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); + if(isset($originalNames[$fieldName])){ + echo $originalNames[$fieldName]; + echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); + echo $this->Form->label($inputFieldName . '.remove', '削除'); + } + ?> + + NetCommonsForm->Form->defaultModel; + $inputFieldName = $modelName . '.' . $fieldName; + echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); + if(isset($originalNames[$fieldName])){ + echo $originalNames[$fieldName]; + echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); + echo $this->Form->label($inputFieldName . '.remove', '削除'); + } + ?> NetCommonsForm->input('publish_start', From e64989e15a051e1a3ed24e3c44cd740e9d598c10 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 12 Nov 2015 16:02:12 +0900 Subject: [PATCH 05/25] =?UTF-8?q?validate=E5=AE=9F=E9=A8=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/BlogEntry.php | 6 ++++++ View/BlogEntriesEdit/form.ctp | 1 + 2 files changed, 7 insertions(+) diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 64f7870..37afd68 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -71,6 +71,12 @@ class BlogEntry extends BlogsAppModel { */ protected function _getValidateSpecification() { $validate = array( + 'pdf' => [ + 'rule' => array('isValidExtension', array('pdf'), true), + 'message' => 'pdf only' + ], + + 'title' => array( 'notBlank' => [ 'rule' => array('notBlank'), diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 4a35b2d..4076354 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -112,6 +112,7 @@ $dataJson = json_encode( echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); echo $this->Form->label($inputFieldName . '.remove', '削除'); } + // TODO ここまで ?> Date: Fri, 13 Nov 2015 10:41:20 +0900 Subject: [PATCH 06/25] =?UTF-8?q?NetCommonsForm=E3=81=AB=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=89=E7=B3=BB=E3=82=92=E7=B5=B1=E5=90=88=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=BF=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/BlogEntry.php | 2 +- View/BlogEntriesEdit/form.ctp | 53 ++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 37afd68..841f94c 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -72,7 +72,7 @@ class BlogEntry extends BlogsAppModel { protected function _getValidateSpecification() { $validate = array( 'pdf' => [ - 'rule' => array('isValidExtension', array('pdf'), true), + 'rule' => array('isValidExtension', array('pdf'), false), 'message' => 'pdf only' ], diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 4076354..27be47f 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -82,36 +82,39 @@ $dataJson = json_encode( request->data['UploadFile'])){ - foreach($this->request->data['UploadFile'] as $key => $uploadFile){ - echo $this->NetCommonsForm->input('UploadFile.' . $key . '.id', ['type' => 'hidden']); - echo $this->NetCommonsForm->input('UploadFile.' . $key . '.field_name', ['type' => 'hidden']); - } - $originalNames = Hash::combine($this->request->data['UploadFile'], '{n}.field_name', '{n}.original_name'); - } + //if(isset($this->request->data['UploadFile'])){ + // foreach($this->request->data['UploadFile'] as $key => $uploadFile){ + // echo $this->NetCommonsForm->input('UploadFile.' . $key . '.id', ['type' => 'hidden']); + // echo $this->NetCommonsForm->input('UploadFile.' . $key . '.field_name', ['type' => 'hidden']); + // } + // $originalNames = Hash::combine($this->request->data['UploadFile'], '{n}.field_name', '{n}.original_name'); + //} ?> + NetCommonsForm->Form->defaultModel; - $inputFieldName = $modelName . '.' . $fieldName; - echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); - if(isset($originalNames[$fieldName])){ - echo $originalNames[$fieldName]; - echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); - echo $this->Form->label($inputFieldName . '.remove', '削除'); - } + echo $this->NetCommonsForm->uploadFile('photo'); + //$fieldName = 'photo'; + //$modelName = $this->NetCommonsForm->Form->defaultModel; + //$inputFieldName = $modelName . '.' . $fieldName; + //echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); + //if(isset($originalNames[$fieldName])){ + // echo $originalNames[$fieldName]; + // echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); + // echo $this->Form->label($inputFieldName . '.remove', '削除'); + //} ?> NetCommonsForm->Form->defaultModel; - $inputFieldName = $modelName . '.' . $fieldName; - echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); - if(isset($originalNames[$fieldName])){ - echo $originalNames[$fieldName]; - echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); - echo $this->Form->label($inputFieldName . '.remove', '削除'); - } + echo $this->NetCommonsForm->uploadFile('pdf'); + //$fieldName = 'pdf'; + //$modelName = $this->NetCommonsForm->Form->defaultModel; + //$inputFieldName = $modelName . '.' . $fieldName; + //echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); + //if(isset($originalNames[$fieldName])){ + // echo $originalNames[$fieldName]; + // echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); + // echo $this->Form->label($inputFieldName . '.remove', '削除'); + //} // TODO ここまで ?> From 45420f397caa8952e918120613f6b402f94c0710 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Fri, 13 Nov 2015 16:09:24 +0900 Subject: [PATCH 07/25] =?UTF-8?q?=E3=82=B5=E3=83=A0=E3=83=8D=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=B5=E3=82=A4=E3=82=BA=E6=8C=87=E5=AE=9A=E3=81=AE?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/BlogEntry.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 841f94c..6c52dfb 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -39,7 +39,16 @@ class BlogEntry extends BlogsAppModel { 'Workflow.WorkflowComment', //'Categories.Category', 'Files.Attachment' => [ - 'photo', + 'photo' => [ + 'thumbnailSizes' => array( + // NC2 800 , 640, 480だった + 'big' => '800ml', + 'medium' => '400ml', + 'small' => '200ml', + 'thumb' => '20x20', + ), + + ], 'pdf', ], ); From 5399ba47881667ca01c0c0add96d8a53c8653eb2 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Sat, 14 Nov 2015 12:40:54 +0900 Subject: [PATCH 08/25] =?UTF-8?q?=E5=AE=9F=E9=A8=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/BlogEntriesEdit/form.ctp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 27be47f..c4f231e 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -105,7 +105,7 @@ $dataJson = json_encode( ?> NetCommonsForm->uploadFile('pdf'); + echo $this->NetCommonsForm->uploadFile('BlogEntry.pdf'); //$fieldName = 'pdf'; //$modelName = $this->NetCommonsForm->Form->defaultModel; //$inputFieldName = $modelName . '.' . $fieldName; From 1dbf8da6885f8f654ab7ae8ac50aae5c74c5be20 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Wed, 18 Nov 2015 11:17:39 +0900 Subject: [PATCH 09/25] =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 1 + View/BlogEntries/index.ctp | 29 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 5f06f0f..96a3d1c 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -288,6 +288,7 @@ public function download() { //$originId = $this->request->params['named']['origin_id']; $originId = $this->params['pass'][1]; + $fieldName = $this->params['pass'][2]; $conditions = $this->BlogEntry->getConditions( Current::read('Block.id'), diff --git a/View/BlogEntries/index.ctp b/View/BlogEntries/index.ctp index 19dac45..fe35a4a 100644 --- a/View/BlogEntries/index.ctp +++ b/View/BlogEntries/index.ctp @@ -117,7 +117,8 @@ echo $this->Html->css( 'controller' => 'blog_entries', 'action' => 'view', //'frame_id' => Current::read('Frame.id'), - 'key' => $blogEntry['BlogEntry']['key'] + 'key' => $blogEntry['BlogEntry']['key'], + 'photo' ) ) ); @@ -125,6 +126,32 @@ echo $this->Html->css( element('entry_meta_info', array('blogEntry' => $blogEntry)); ?> + +
+ Image : + Html->image( + $this->NetCommonsHtml->url( + [ + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], + 'pdf' + ] + ) + ); ?> +
+
+ PDF : + Html->link('PDF', + $this->NetCommonsHtml->url( + [ + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'] + ] + ) + ); ?> +
+ +
From cae9cc8773c972171523093bb6032a68c07c137f Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Wed, 18 Nov 2015 12:47:33 +0900 Subject: [PATCH 10/25] =?UTF-8?q?=E5=AE=9F=E9=A8=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 9 ++++++--- View/BlogEntries/index.ctp | 19 ++++++++++--------- View/BlogEntries/view.ctp | 27 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 96a3d1c..b4ca717 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -29,6 +29,7 @@ class BlogEntriesController extends BlogsAppController { ); /** + * @var array helpers * @var array helpers */ public $helpers = array( @@ -38,6 +39,7 @@ class BlogEntriesController extends BlogsAppController { 'Likes.Like', ); + /** * beforeFilter * @@ -75,6 +77,7 @@ public function beforeFilter() { ), 'Categories.Categories', 'ContentComments.ContentComments', + 'Files.Download', ); /** @@ -287,7 +290,7 @@ public function download() { $this->_prepare(); //$originId = $this->request->params['named']['origin_id']; - $originId = $this->params['pass'][1]; + $key = $this->params['pass'][1]; $fieldName = $this->params['pass'][2]; $conditions = $this->BlogEntry->getConditions( @@ -297,14 +300,14 @@ public function download() { $this->_getCurrentDateTime() ); - $conditions['BlogEntry.origin_id'] = $originId; + $conditions['BlogEntry.key'] = $key; $options = array( 'conditions' => $conditions, ); $blogEntry = $this->BlogEntry->find('first', $options); if ($blogEntry) { - $this->FileDownload->do($blogEntry); + return $this->Download->doDownload($blogEntry['BlogEntry']['id'], $fieldName); // TODO リクエストパラメータからファイルIDを取得するカラム名を確定する } else { // 表示できない記事へのアクセスなら404 diff --git a/View/BlogEntries/index.ctp b/View/BlogEntries/index.ctp index fe35a4a..22b277d 100644 --- a/View/BlogEntries/index.ctp +++ b/View/BlogEntries/index.ctp @@ -130,14 +130,14 @@ echo $this->Html->css(
Image : Html->image( - $this->NetCommonsHtml->url( - [ - 'action' => 'download', - 'key' => $blogEntry['BlogEntry']['key'], - 'pdf' - ] - ) - ); ?> + $this->NetCommonsHtml->url( + [ + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], + 'photo' + ] + ) + ); ?>
PDF : @@ -145,7 +145,8 @@ echo $this->Html->css( $this->NetCommonsHtml->url( [ 'action' => 'download', - 'key' => $blogEntry['BlogEntry']['key'] + 'key' => $blogEntry['BlogEntry']['key'], + 'pdf', ] ) ); ?> diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 00226f8..7843d96 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -42,6 +42,33 @@ echo $this->Html->css( element('BlogEntries/edit_link', array('status' => $blogEntry['BlogEntry']['status'])); ?>
+ +
+ Image : + Html->image( + $this->NetCommonsHtml->url( + [ + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], + 'photo' + ] + ) + ); ?> +
+
+ PDF : + Html->link('PDF', + $this->NetCommonsHtml->url( + [ + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], + 'pdf', + ] + ) + ); ?> +
+ +
From 742f4d60a3662557fbd67ce943a8d86a28675064 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Wed, 18 Nov 2015 15:36:22 +0900 Subject: [PATCH 11/25] =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E9=81=95?= =?UTF-8?q?=E3=81=84=E3=81=AE=E4=BE=8B=E3=80=82index=E3=81=A7=E3=82=B5?= =?UTF-8?q?=E3=83=A0=E3=83=8D=E3=82=A4=E3=83=AB=E3=80=81View=E3=81=A7big?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=A6=E3=81=BF=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 3 ++- Model/BlogEntry.php | 5 +++-- View/BlogEntries/index.ctp | 3 ++- View/BlogEntries/view.ctp | 11 ++++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index b4ca717..add9b3c 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -292,6 +292,7 @@ public function download() { //$originId = $this->request->params['named']['origin_id']; $key = $this->params['pass'][1]; $fieldName = $this->params['pass'][2]; + $size = Hash::get($this->params['pass'], 3, null); $conditions = $this->BlogEntry->getConditions( Current::read('Block.id'), @@ -307,7 +308,7 @@ public function download() { $blogEntry = $this->BlogEntry->find('first', $options); if ($blogEntry) { - return $this->Download->doDownload($blogEntry['BlogEntry']['id'], $fieldName); + return $this->Download->doDownload($blogEntry['BlogEntry']['id'], $fieldName, $size); // TODO リクエストパラメータからファイルIDを取得するカラム名を確定する } else { // 表示できない記事へのアクセスなら404 diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 6c52dfb..f3254bd 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -41,11 +41,12 @@ class BlogEntry extends BlogsAppModel { 'Files.Attachment' => [ 'photo' => [ 'thumbnailSizes' => array( - // NC2 800 , 640, 480だった + // デフォルトはAttachmentビヘイビアできめてあるが、下記の様に設定も可能 + // NC2 800 > 640 > 480だった 'big' => '800ml', 'medium' => '400ml', 'small' => '200ml', - 'thumb' => '20x20', + 'thumb' => '80x80', ), ], diff --git a/View/BlogEntries/index.ctp b/View/BlogEntries/index.ctp index 22b277d..e5f9d59 100644 --- a/View/BlogEntries/index.ctp +++ b/View/BlogEntries/index.ctp @@ -134,7 +134,8 @@ echo $this->Html->css( [ 'action' => 'download', 'key' => $blogEntry['BlogEntry']['key'], - 'photo' + 'photo', + 'thumb', ] ) ); ?> diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 7843d96..3e29eff 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -48,9 +48,10 @@ echo $this->Html->css( Html->image( $this->NetCommonsHtml->url( [ - 'action' => 'download', - 'key' => $blogEntry['BlogEntry']['key'], - 'photo' + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], + 'photo', + 'big', ] ) ); ?> @@ -60,8 +61,8 @@ echo $this->Html->css( Html->link('PDF', $this->NetCommonsHtml->url( [ - 'action' => 'download', - 'key' => $blogEntry['BlogEntry']['key'], + 'action' => 'download', + 'key' => $blogEntry['BlogEntry']['key'], 'pdf', ] ) From c4e6c0ac0112ed2d844a3f1225dfc8368f240623 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Wed, 18 Nov 2015 16:14:39 +0900 Subject: [PATCH 12/25] =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=89=E5=90=8D=E3=80=81=E3=82=B5=E3=82=A4=E3=82=BA=E3=81=AE?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E3=82=92=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AB=E3=81=BE=E3=81=8B=E3=81=9B?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index add9b3c..7af56f4 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -287,13 +287,9 @@ public function view() { } public function download() { + // ここから元コンテンツを取得する処理 $this->_prepare(); - - //$originId = $this->request->params['named']['origin_id']; $key = $this->params['pass'][1]; - $fieldName = $this->params['pass'][2]; - $size = Hash::get($this->params['pass'], 3, null); - $conditions = $this->BlogEntry->getConditions( Current::read('Block.id'), $this->Auth->user('id'), @@ -306,10 +302,11 @@ public function download() { 'conditions' => $conditions, ); $blogEntry = $this->BlogEntry->find('first', $options); + // ここまで元コンテンツを取得する処理 + // ダウンロード実行 if ($blogEntry) { - return $this->Download->doDownload($blogEntry['BlogEntry']['id'], $fieldName, $size); - // TODO リクエストパラメータからファイルIDを取得するカラム名を確定する + return $this->Download->doDownload($blogEntry['BlogEntry']['id']); } else { // 表示できない記事へのアクセスなら404 throw new NotFoundException(__('Invalid blog entry')); From ba248ae33fd95669b40ee09d407608e0826c3d45 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 26 Nov 2015 11:27:48 +0900 Subject: [PATCH 13/25] =?UTF-8?q?=E4=B8=80=E6=99=82=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 2 +- Controller/BlogEntriesEditController.php | 11 +++++++++++ Model/BlogEntry.php | 2 +- View/BlogEntriesEdit/import.ctp | 10 ++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 View/BlogEntriesEdit/import.ctp diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 7af56f4..d5ba8a2 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -47,7 +47,7 @@ class BlogEntriesController extends BlogsAppController { */ public function beforeFilter() { // ゲストアクセスOKのアクションを設定 - $this->Auth->allow('index', 'view', 'category', 'tag', 'year_month'); + $this->Auth->allow('index', 'view', 'category', 'tag', 'year_month', 'download'); //$this->Categories->initCategories(); parent::beforeFilter(); } diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 2a1cb8c..598644e 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -45,6 +45,7 @@ class BlogEntriesEditController extends BlogsAppController { 'Categories.Categories', //'Blogs.BlogEntryPermission', 'NetCommons.NetCommonsTime', + 'Files.FileUpload', ); /** @@ -201,4 +202,14 @@ public function delete() { NetCommonsUrl::actionUrl( array('controller' => 'blog_entries', 'action' => 'index', 'frame_id' => Current::read('Frame.id'), 'block_id' => Current::read('Block.id')))); } + + + + public function import() { + if ($this->request->is(array('post', 'put'))) { + $file = $this->FileUpload->getTemporaryUploadFile('BlogEntry.import_csv'); + debug($file); + debug($this->request->data); + } + } } diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index f3254bd..754fa92 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -48,7 +48,7 @@ class BlogEntry extends BlogsAppModel { 'small' => '200ml', 'thumb' => '80x80', ), - + //'contentKeyFieldName' => 'id' ], 'pdf', ], diff --git a/View/BlogEntriesEdit/import.ctp b/View/BlogEntriesEdit/import.ctp new file mode 100644 index 0000000..4d0d643 --- /dev/null +++ b/View/BlogEntriesEdit/import.ctp @@ -0,0 +1,10 @@ +NetCommonsForm->create(false, ['type' => 'file']); +echo $this->NetCommonsForm->create(null, ['type' => 'file']); +echo $this->NetCommonsForm->input('import_csv', ['type' => 'file']); +echo $this->NetCommonsForm->input('import_photo', ['type' => 'file']); +?> + +NetCommonsForm->submit(); +echo $this->NetCommonsForm->end(); From 04343bb3728e62eb945205256b7623e970bec9ce Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 26 Nov 2015 15:58:03 +0900 Subject: [PATCH 14/25] CsvFileReader sample --- Controller/BlogEntriesEditController.php | 30 +++++++++++++++++++++--- View/BlogEntriesEdit/import.ctp | 6 ++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 598644e..5fcaba1 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -206,10 +206,34 @@ public function delete() { public function import() { + App::uses('CsvFileReader', 'Files.Utility'); if ($this->request->is(array('post', 'put'))) { - $file = $this->FileUpload->getTemporaryUploadFile('BlogEntry.import_csv'); - debug($file); - debug($this->request->data); + $file = $this->FileUpload->getTemporaryUploadFile('import_csv'); + $reader = new CsvFileReader($file); + foreach($reader as $row){ + debug($row); + } } } + + public function regist() { + $UploadFile = ClassRegistry::init('Files.UploadFile'); + $path = '/var/www/app/app/Plugin/Files/Test/Fixture/logo.gif'; + $path2 = TMP . 'logo.gif'; + copy($path, $path2); + $UploadFile->registByFilePath($path2, 'blogs', 'content_key..', 'photo'); + } + + public function attach_file() { + $UploadFile = ClassRegistry::init('Files.UploadFile'); + $path = '/var/www/app/app/Plugin/Files/Test/Fixture/logo.gif'; + $path2 = TMP . 'logo.gif'; + copy($path, $path2); + $data = $this->BlogEntry->find('first'); + //$file = new File($path2); + $this->BlogEntry->attachFile($data, 'pdf', $path2); + + $savedData = $this->BlogEntry->findById($data['BlogEntry']['id']); + debug($savedData); + } } diff --git a/View/BlogEntriesEdit/import.ctp b/View/BlogEntriesEdit/import.ctp index 4d0d643..e710583 100644 --- a/View/BlogEntriesEdit/import.ctp +++ b/View/BlogEntriesEdit/import.ctp @@ -1,10 +1,8 @@ NetCommonsForm->create(false, ['type' => 'file']); -echo $this->NetCommonsForm->create(null, ['type' => 'file']); +echo $this->NetCommonsForm->create(false, ['type' => 'file']); +//echo $this->NetCommonsForm->create(null, ['type' => 'file']); echo $this->NetCommonsForm->input('import_csv', ['type' => 'file']); -echo $this->NetCommonsForm->input('import_photo', ['type' => 'file']); ?> - NetCommonsForm->submit(); echo $this->NetCommonsForm->end(); From 9da44f09dea5a292bd9c0cd85a42903b83fac193 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 26 Nov 2015 17:40:09 +0900 Subject: [PATCH 15/25] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=82=B3=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/BlogEntriesEdit/form.ctp | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index c4f231e..05de967 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -49,9 +49,6 @@ $dataJson = json_encode( ?> NetCommonsForm->input('key', array('type' => 'hidden')); ?> NetCommonsForm->input('key', array('type' => 'hidden')); ?> - Form->hidden('Frame.id', array( - // 'value' => Current::read('Frame.id'), - // )); ?>
@@ -80,42 +77,12 @@ $dataJson = json_encode( ));?>
- request->data['UploadFile'])){ - // foreach($this->request->data['UploadFile'] as $key => $uploadFile){ - // echo $this->NetCommonsForm->input('UploadFile.' . $key . '.id', ['type' => 'hidden']); - // echo $this->NetCommonsForm->input('UploadFile.' . $key . '.field_name', ['type' => 'hidden']); - // } - // $originalNames = Hash::combine($this->request->data['UploadFile'], '{n}.field_name', '{n}.original_name'); - //} - ?> - NetCommonsForm->uploadFile('photo'); - //$fieldName = 'photo'; - //$modelName = $this->NetCommonsForm->Form->defaultModel; - //$inputFieldName = $modelName . '.' . $fieldName; - //echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); - //if(isset($originalNames[$fieldName])){ - // echo $originalNames[$fieldName]; - // echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); - // echo $this->Form->label($inputFieldName . '.remove', '削除'); - //} ?> NetCommonsForm->uploadFile('BlogEntry.pdf'); - //$fieldName = 'pdf'; - //$modelName = $this->NetCommonsForm->Form->defaultModel; - //$inputFieldName = $modelName . '.' . $fieldName; - //echo $this->NetCommonsForm->input($inputFieldName, ['type' => 'file']); - //if(isset($originalNames[$fieldName])){ - // echo $originalNames[$fieldName]; - // echo $this->NetCommonsForm->checkbox($inputFieldName . '.remove', ['type' => 'checkbox', 'div' => false, 'error' => false]); - // echo $this->Form->label($inputFieldName . '.remove', '削除'); - //} - // TODO ここまで ?> Date: Thu, 3 Dec 2015 11:08:10 +0900 Subject: [PATCH 16/25] =?UTF-8?q?Files=E9=96=A2=E4=BF=82=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E9=A8=93=E3=82=B3=E3=83=BC=E3=83=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 12 +++-- Test/Case/SandBoxTest.php | 60 ++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 Test/Case/SandBoxTest.php diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 5fcaba1..6fb394f 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -203,8 +203,6 @@ public function delete() { array('controller' => 'blog_entries', 'action' => 'index', 'frame_id' => Current::read('Frame.id'), 'block_id' => Current::read('Block.id')))); } - - public function import() { App::uses('CsvFileReader', 'Files.Utility'); if ($this->request->is(array('post', 'put'))) { @@ -229,11 +227,19 @@ public function attach_file() { $path = '/var/www/app/app/Plugin/Files/Test/Fixture/logo.gif'; $path2 = TMP . 'logo.gif'; copy($path, $path2); - $data = $this->BlogEntry->find('first'); + $data = $this->BlogEntry->findByIsLatest(true); //$file = new File($path2); $this->BlogEntry->attachFile($data, 'pdf', $path2); $savedData = $this->BlogEntry->findById($data['BlogEntry']['id']); debug($savedData); } + + public function begintest() { + $this->BlogEntry->begin(); + $this->BlogEntry->findById(1); + $this->BlogFrameSetting->begin(); + $this->BlogFrameSetting->findById(1); + //$this->BlogFrameSetting->setSlaveDataSource(); + } } diff --git a/Test/Case/SandBoxTest.php b/Test/Case/SandBoxTest.php new file mode 100644 index 0000000..a800ca0 --- /dev/null +++ b/Test/Case/SandBoxTest.php @@ -0,0 +1,60 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('Blog', 'Blogs.Model'); +App::uses('BlogsAppModelTestBase', 'Blogs.Test/Case/Model'); + +/** + * Summary for Blog Test Case + * + * @property Blog $Blog + */ +class SandBoxTest extends BlogsAppModelTestBase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + //'plugin.blogs.blog', + //'plugin.blogs.blog_entry', + //'plugin.blogs.blog_setting', + //'plugin.blocks.block', + //'plugin.blocks.block_role_permission', + //'plugin.rooms.room', + //'plugin.rooms.roles_room', + //'plugin.categories.category', + //'plugin.categories.categoryOrder', + //'plugin.frames.frame', + //'plugin.boxes.box', + //'plugin.blogs.plugin', + //'plugin.m17n.language', + //'plugin.users.user', + ); + + public function testIndex() { + $e1 = new extend1(); + $e2 = new extend2(); + $e1::$staticVal = 'foo'; + debug($e2::$staticVal); + } + +} + +class base +{ + static $staticVal; +} +class extend1 extends base{ + +} +class extend2 extends base{ + +} \ No newline at end of file From ab8e40932ed097974be5bcd1c43133522ec909ef Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 3 Dec 2015 12:17:59 +0900 Subject: [PATCH 17/25] =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=AE=E5=AE=9F=E9=A8=93=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 6fb394f..18f3902 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -46,6 +46,7 @@ class BlogEntriesEditController extends BlogsAppController { //'Blogs.BlogEntryPermission', 'NetCommons.NetCommonsTime', 'Files.FileUpload', + 'Files.Download', ); /** @@ -235,11 +236,15 @@ public function attach_file() { debug($savedData); } - public function begintest() { - $this->BlogEntry->begin(); - $this->BlogEntry->findById(1); - $this->BlogFrameSetting->begin(); - $this->BlogFrameSetting->findById(1); - //$this->BlogFrameSetting->setSlaveDataSource(); + public function csv_download() { + App::uses('TemporaryFile', 'Files.Utility'); + $file = new TemporaryFile(); + $file->append('test'); + + //$this->Download = $this->Components->load('Files.Download'); + //return $this->Download->downloadFile($file, ['name', 'test.txt']); + + $this->response->file($file->path, ['name' => 'test.txt']); + return $this->response; } } From 009e2621e06aac149571bd5c9979c6eb77d80d72 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 3 Dec 2015 16:18:32 +0900 Subject: [PATCH 18/25] =?UTF-8?q?CSV=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B?= =?UTF-8?q?=E4=BE=8B2=E3=81=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 52 +++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 18f3902..9baa41f 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -236,7 +236,7 @@ public function attach_file() { debug($savedData); } - public function csv_download() { + public function temporary_download() { App::uses('TemporaryFile', 'Files.Utility'); $file = new TemporaryFile(); $file->append('test'); @@ -247,4 +247,54 @@ public function csv_download() { $this->response->file($file->path, ['name' => 'test.txt']); return $this->response; } + + + /** + * 配列のCSV出力例 + * + * @return CakeResponse|null + */ + public function csv_download2() { + App::uses('CsvFileWriter', 'Files.Utility'); + + $data = [ + ['データID', 'タイトル', '本文', '作成日時'], + [1, '薪だなつくりました', '薪だなつくるの大変だったよ', '2015-10-01 10:00:00'], + [2, '薪ストーブ点火', '寒くなってきたので薪ストーブに火入れましたよ', '2015-12-01 13:00:00'], + ]; + $csvWriter = new CsvFileWriter(); + foreach($data as $line){ + $csvWriter->add($line); + } + $csvWriter->close(); + + return $csvWriter->download('export.csv'); + } + + /** + * Modelから取得したデータの指定カラムだけCSV出力する例 + * + * @return CakeResponse + */ + public function csv_download3() { + App::uses('CsvFileWriter', 'Files.Utility'); + + $header = [ + 'BlogEntry.id' => 'データID', + 'BlogEntry.title' => 'タイトル', + 'BlogEntry.body1' => '本文1', + 'BlogEntry.publish_start' => '公開日時' + ]; + $result = $this->BlogEntry->find('all'); + + $csvWriter = new CsvFileWriter(['header' => $header]); + foreach($result as $data){ + $csvWriter->addModelData($data); + } + $csvWriter->close(); + + return $csvWriter->download('export.csv'); + } + } + From 5d133f1d06883a453d1689aaad0853a3448acbad Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Fri, 11 Dec 2015 10:35:41 +0900 Subject: [PATCH 19/25] =?UTF-8?q?SampleCode=20=E3=82=B3=E3=83=9F=E3=83=83?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 74 +++++++++++++++++++----- Controller/BlogEntriesEditController.php | 38 ++++++++---- Model/BlogEntry.php | 1 + View/BlogEntries/index.ctp | 2 +- View/BlogEntries/view.ctp | 2 +- View/BlogEntriesEdit/csv_download2.ctp | 7 +++ 6 files changed, 96 insertions(+), 28 deletions(-) create mode 100644 View/BlogEntriesEdit/csv_download2.ctp diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index d5ba8a2..03a85f0 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -16,6 +16,8 @@ * @property BlogEntry $BlogEntry * @property BlogCategory $BlogCategory */ + + class BlogEntriesController extends BlogsAppController { /** @@ -39,19 +41,6 @@ class BlogEntriesController extends BlogsAppController { 'Likes.Like', ); - -/** - * beforeFilter - * - * @return void - */ - public function beforeFilter() { - // ゲストアクセスOKのアクションを設定 - $this->Auth->allow('index', 'view', 'category', 'tag', 'year_month', 'download'); - //$this->Categories->initCategories(); - parent::beforeFilter(); - } - /** * Components * @@ -77,7 +66,14 @@ public function beforeFilter() { ), 'Categories.Categories', 'ContentComments.ContentComments', - 'Files.Download', + 'Files.Download', + 'AuthorizationKeys.AuthorizationKey' => [ + //'operationType' => AuthorizationKeyComponent::OPERATION_REDIRECT, + //'operationType' => 'redirect', + 'operationType' => 'none', + 'targetAction' => 'download_pdf', + //'model' => 'BlogEntry', + ], ); /** @@ -89,6 +85,20 @@ public function beforeFilter() { 'yearMonth' => 0, ); +/** + * beforeFilter + * + * @return void + */ + public function beforeFilter() { + // ゲストアクセスOKのアクションを設定 + $this->Auth->allow('index', 'view', 'category', 'tag', 'year_month', 'download', 'download_pdf'); + //$this->Categories->initCategories(); + //$this->AuthorizationKey->contentId =23; // TODO hardcord + //$this->AuthorizationKey->model ='BlogEntry'; // TODO hardcord + parent::beforeFilter(); + } + /** * index * @@ -313,6 +323,42 @@ public function download() { } } + public function download_pdf() { + // ここから元コンテンツを取得する処理 + $this->_prepare(); + $key = $this->params['pass'][1]; + $conditions = $this->BlogEntry->getConditions( + Current::read('Block.id'), + $this->Auth->user('id'), + $this->_getPermission(), + $this->_getCurrentDateTime() + ); + + $conditions['BlogEntry.key'] = $key; + $options = array( + 'conditions' => $conditions, + ); + $blogEntry = $this->BlogEntry->find('first', $options); + // ここまで元コンテンツを取得する処理 + + if(Hash::get($blogEntry, 'AuthorizationKey', false)){ + $this->AuthorizationKey->operationType = 'redirect'; + $this->AuthorizationKey->model = 'BlogEntry'; + $this->AuthorizationKey->contentId = $blogEntry['BlogEntry']['id']; + $this->AuthorizationKey->startup($this); + } + + + // ダウンロード実行 + if ($blogEntry) { + return $this->Download->doDownload($blogEntry['BlogEntry']['id'], ['filed' => 'pdf']); + } else { + // 表示できない記事へのアクセスなら404 + throw new NotFoundException(__('Invalid blog entry')); + } + + } + /** * 年月選択肢をViewへセット * diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 9baa41f..1896d3c 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -255,20 +255,24 @@ public function temporary_download() { * @return CakeResponse|null */ public function csv_download2() { - App::uses('CsvFileWriter', 'Files.Utility'); - $data = [ - ['データID', 'タイトル', '本文', '作成日時'], - [1, '薪だなつくりました', '薪だなつくるの大変だったよ', '2015-10-01 10:00:00'], - [2, '薪ストーブ点火', '寒くなってきたので薪ストーブに火入れましたよ', '2015-12-01 13:00:00'], - ]; - $csvWriter = new CsvFileWriter(); - foreach($data as $line){ - $csvWriter->add($line); + if ($this->request->is(array('post', 'put'))) { + App::uses('CsvFileWriter', 'Files.Utility'); + + $data = [ + ['データID', 'タイトル', '本文', '作成日時'], + [1, '薪だなつくりました', '薪だなつくるの大変だったよ', '2015-10-01 10:00:00'], + [2, '薪ストーブ点火', '寒くなってきたので薪ストーブに火入れましたよ', '2015-12-01 13:00:00'], + ]; + $csvWriter = new CsvFileWriter(); + foreach($data as $line){ + $csvWriter->add($line); + } + $csvWriter->close(); + + return $csvWriter->download('export.csv'); } - $csvWriter->close(); - return $csvWriter->download('export.csv'); } /** @@ -293,7 +297,17 @@ public function csv_download3() { } $csvWriter->close(); - return $csvWriter->download('export.csv'); + $zip = new ZipArchive(); + $tmpFile = new TemporaryFile(); + $zip->open($tmpFile->path, ZipArchive::CREATE | ZipArchive::OVERWRITE); + $zip->addFile($csvWriter->path); + $zip->close(); + + // パスワード + + + //return $csvWriter->download('export.csv'); + return $csvWriter->zipDownload('test.zip', 'foo.csv', 'pass'); } } diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 754fa92..7a51e4b 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -52,6 +52,7 @@ class BlogEntry extends BlogsAppModel { ], 'pdf', ], + 'AuthorizationKeys.AuthorizationKey', ); /** diff --git a/View/BlogEntries/index.ctp b/View/BlogEntries/index.ctp index e5f9d59..ad41577 100644 --- a/View/BlogEntries/index.ctp +++ b/View/BlogEntries/index.ctp @@ -145,7 +145,7 @@ echo $this->Html->css( Html->link('PDF', $this->NetCommonsHtml->url( [ - 'action' => 'download', + 'action' => 'download_pdf', 'key' => $blogEntry['BlogEntry']['key'], 'pdf', ] diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 3e29eff..c69abf9 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -61,7 +61,7 @@ echo $this->Html->css( Html->link('PDF', $this->NetCommonsHtml->url( [ - 'action' => 'download', + 'action' => 'download_pdf', 'key' => $blogEntry['BlogEntry']['key'], 'pdf', ] diff --git a/View/BlogEntriesEdit/csv_download2.ctp b/View/BlogEntriesEdit/csv_download2.ctp new file mode 100644 index 0000000..4d58b7b --- /dev/null +++ b/View/BlogEntriesEdit/csv_download2.ctp @@ -0,0 +1,7 @@ + 'get' +]; +echo $this->NetCommonsForm->create(false, $options); +echo $this->NetCommonsForm->submit('ダウンロード'); +echo $this->NetCommonsForm->end(); \ No newline at end of file From 775d958cf2406887c5365603b75ba4105c194445 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Fri, 18 Dec 2015 16:28:44 +0900 Subject: [PATCH 20/25] =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 13 ++++------ Controller/BlogEntriesEditController.php | 11 +++++---- Model/BlogEntry.php | 2 +- View/BlogEntries/index.ctp | 30 +++++++++++++++++------- View/BlogEntriesEdit/form.ctp | 4 ++-- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 03a85f0..ce7a228 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -69,8 +69,8 @@ class BlogEntriesController extends BlogsAppController { 'Files.Download', 'AuthorizationKeys.AuthorizationKey' => [ //'operationType' => AuthorizationKeyComponent::OPERATION_REDIRECT, + 'operationType' => 'popup', //'operationType' => 'redirect', - 'operationType' => 'none', 'targetAction' => 'download_pdf', //'model' => 'BlogEntry', ], @@ -327,6 +327,7 @@ public function download_pdf() { // ここから元コンテンツを取得する処理 $this->_prepare(); $key = $this->params['pass'][1]; + $conditions = $this->BlogEntry->getConditions( Current::read('Block.id'), $this->Auth->user('id'), @@ -337,17 +338,12 @@ public function download_pdf() { $conditions['BlogEntry.key'] = $key; $options = array( 'conditions' => $conditions, + 'recursive' => 1, ); $blogEntry = $this->BlogEntry->find('first', $options); // ここまで元コンテンツを取得する処理 - if(Hash::get($blogEntry, 'AuthorizationKey', false)){ - $this->AuthorizationKey->operationType = 'redirect'; - $this->AuthorizationKey->model = 'BlogEntry'; - $this->AuthorizationKey->contentId = $blogEntry['BlogEntry']['id']; - $this->AuthorizationKey->startup($this); - } - + $this->AuthorizationKey->guard('redirect', 'BlogEntry', $blogEntry, 'pdf'); // ダウンロード実行 if ($blogEntry) { @@ -356,7 +352,6 @@ public function download_pdf() { // 表示できない記事へのアクセスなら404 throw new NotFoundException(__('Invalid blog entry')); } - } /** diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 1896d3c..8ebffb7 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -208,6 +208,7 @@ public function import() { App::uses('CsvFileReader', 'Files.Utility'); if ($this->request->is(array('post', 'put'))) { $file = $this->FileUpload->getTemporaryUploadFile('import_csv'); + debug($file); $reader = new CsvFileReader($file); foreach($reader as $row){ debug($row); @@ -297,11 +298,11 @@ public function csv_download3() { } $csvWriter->close(); - $zip = new ZipArchive(); - $tmpFile = new TemporaryFile(); - $zip->open($tmpFile->path, ZipArchive::CREATE | ZipArchive::OVERWRITE); - $zip->addFile($csvWriter->path); - $zip->close(); + //$zip = new ZipArchive(); + //$tmpFile = new TemporaryFile(); + //$zip->open($tmpFile->path, ZipArchive::CREATE | ZipArchive::OVERWRITE); + //$zip->addFile($csvWriter->path); + //$zip->close(); // パスワード diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 7a51e4b..3c87936 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -39,7 +39,7 @@ class BlogEntry extends BlogsAppModel { 'Workflow.WorkflowComment', //'Categories.Category', 'Files.Attachment' => [ - 'photo' => [ + 'foo_photo' => [ 'thumbnailSizes' => array( // デフォルトはAttachmentビヘイビアできめてあるが、下記の様に設定も可能 // NC2 800 > 640 > 480だった diff --git a/View/BlogEntries/index.ctp b/View/BlogEntries/index.ctp index ad41577..edc71d2 100644 --- a/View/BlogEntries/index.ctp +++ b/View/BlogEntries/index.ctp @@ -36,6 +36,15 @@ echo $this->Html->css( 'inline' => false ) ); +echo $this->Html->script( + '/AuthorizationKeys/js/authorization_keys.js', + array( + 'plugin' => false, + 'once' => true, + 'inline' => false + ) +); + ?>
@@ -140,19 +149,24 @@ echo $this->Html->css( ) ); ?>
+
PDF : Html->link('PDF', - $this->NetCommonsHtml->url( - [ - 'action' => 'download_pdf', - 'key' => $blogEntry['BlogEntry']['key'], - 'pdf', - ] - ) + '#', + ['authorization-keys-popup-link', + 'url' => $this->NetCommonsHtml->url( + [ + 'action' => 'download_pdf', + 'key' => $blogEntry['BlogEntry']['key'], + 'pdf', + ] + ), + 'frame-id' => Current::read('Frame.id') + ] ); ?>
- +
diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 05de967..35ae81b 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -78,11 +78,11 @@ $dataJson = json_encode(
NetCommonsForm->uploadFile('photo'); + echo $this->NetCommonsForm->uploadFile('foo_photo'); ?> NetCommonsForm->uploadFile('BlogEntry.pdf'); + echo $this->NetCommonsForm->uploadFile('BlogEntry.pdf', ['help' => 'PDFを選ぶぺん']); ?> Date: Thu, 24 Dec 2015 10:34:40 +0900 Subject: [PATCH 21/25] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E3=80=80?= =?UTF-8?q?=E3=83=AA=E3=83=80=E3=82=A4=E3=83=AC=E3=82=AF=E3=83=88=E5=9E=8B?= =?UTF-8?q?=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E7=B5=84=E3=81=BF=E8=BE=BC?= =?UTF-8?q?=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 4 ++-- Controller/BlogEntriesEditController.php | 2 +- Model/BlogEntry.php | 2 +- View/BlogEntriesEdit/form.ctp | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index ce7a228..6636d2b 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -69,10 +69,10 @@ class BlogEntriesController extends BlogsAppController { 'Files.Download', 'AuthorizationKeys.AuthorizationKey' => [ //'operationType' => AuthorizationKeyComponent::OPERATION_REDIRECT, - 'operationType' => 'popup', + 'operationType' => 'redirect', //'operationType' => 'redirect', 'targetAction' => 'download_pdf', - //'model' => 'BlogEntry', + 'model' => 'BlogEntry', ], ); diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 8ebffb7..83d8ff0 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -308,7 +308,7 @@ public function csv_download3() { //return $csvWriter->download('export.csv'); - return $csvWriter->zipDownload('test.zip', 'foo.csv', 'pass'); + return $csvWriter->zipDownload('test.zip', '日本語ファイル名.csv', 'pass'); } } diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 3c87936..ca92150 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -22,7 +22,7 @@ class BlogEntry extends BlogsAppModel { /** * @var int recursiveはデフォルトアソシエーションなしに */ - public $recursive = -1; + public $recursive = 0; /** * use behaviors diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 35ae81b..9f56163 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -21,6 +21,7 @@ echo $this->Html->script( 'inline' => false ) ); +//$this->request->data['BlogEntry']['flag'] = 0; ?> 'file', ) ); + echo $this->Form->input('flag', ['type' => 'hidden']); $this->NetCommonsForm->unlockField('Tag'); ?> NetCommonsForm->input('key', array('type' => 'hidden')); ?> From 5f508b3e96a9595e3cd2e7c5bb74d69827d6fa53 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 24 Dec 2015 11:09:43 +0900 Subject: [PATCH 22/25] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E7=B5=84=E3=81=BF=E8=BE=BC=E3=81=BF=E5=AE=9F=E9=A8=93=E5=AE=8C?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 6636d2b..7a163c9 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -69,7 +69,7 @@ class BlogEntriesController extends BlogsAppController { 'Files.Download', 'AuthorizationKeys.AuthorizationKey' => [ //'operationType' => AuthorizationKeyComponent::OPERATION_REDIRECT, - 'operationType' => 'redirect', + 'operationType' => 'popup', //'operationType' => 'redirect', 'targetAction' => 'download_pdf', 'model' => 'BlogEntry', @@ -343,7 +343,7 @@ public function download_pdf() { $blogEntry = $this->BlogEntry->find('first', $options); // ここまで元コンテンツを取得する処理 - $this->AuthorizationKey->guard('redirect', 'BlogEntry', $blogEntry, 'pdf'); + $this->AuthorizationKey->guard('popup', 'BlogEntry', $blogEntry, 'pdf'); // ダウンロード実行 if ($blogEntry) { From 9a50be7c864e73e60558fd3442d09efc81f237b4 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 24 Dec 2015 11:13:03 +0900 Subject: [PATCH 23/25] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E7=B5=84=E3=81=BF=E8=BE=BC=E3=81=BF=E5=AE=9F=E9=A8=93=E5=AE=8C?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index 7a163c9..d506168 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -343,7 +343,7 @@ public function download_pdf() { $blogEntry = $this->BlogEntry->find('first', $options); // ここまで元コンテンツを取得する処理 - $this->AuthorizationKey->guard('popup', 'BlogEntry', $blogEntry, 'pdf'); + $this->AuthorizationKey->guard('popup', 'BlogEntry', $blogEntry); // ダウンロード実行 if ($blogEntry) { From dfbea547d1e2f3cc9510c4cd2d4801ffa8e606b5 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Thu, 11 Feb 2016 12:42:52 +0900 Subject: [PATCH 24/25] =?UTF-8?q?=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6?= =?UTF-8?q?=E5=86=85=E3=81=A7=E9=96=8B=E3=81=8B=E3=81=9A=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E3=81=95=E3=81=9B=E3=82=8B?= =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/BlogEntriesController.php b/Controller/BlogEntriesController.php index d506168..b38c379 100644 --- a/Controller/BlogEntriesController.php +++ b/Controller/BlogEntriesController.php @@ -347,7 +347,7 @@ public function download_pdf() { // ダウンロード実行 if ($blogEntry) { - return $this->Download->doDownload($blogEntry['BlogEntry']['id'], ['filed' => 'pdf']); + return $this->Download->doDownload($blogEntry['BlogEntry']['id'], ['filed' => 'pdf', 'download' => true]); } else { // 表示できない記事へのアクセスなら404 throw new NotFoundException(__('Invalid blog entry')); From 83c6a9807042570b5637c48bc35e78d2778ead9d Mon Sep 17 00:00:00 2001 From: kteraguchi Date: Fri, 26 Jan 2018 16:59:56 +0900 Subject: [PATCH 25/25] Change license value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Packagistで以下エラーが発生したため Importing branch master (dev-master) Skipped branch master, Invalid package information: License "NetCommons License" is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license. If the software is closed-source, you may use "proprietary" as license. Conflicts: composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 73fc72b..14b0562 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "netcommons/tags": "dev-master", "satooshi/php-coveralls": "dev-master" }, - "license": "NetCommons License", + "license": "LicenseRef-NetCommons", + "license-ref-net-commons": "https://raw.githubusercontent.com/NetCommons3/NetCommons3/master/license.txt", "authors": [ { "name": "Ryuji AMANO (RYUS INC.)",