From c625c153ea2ac25fa697999ea788329d3f7e87ce Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 11 Aug 2019 11:52:39 +0900 Subject: [PATCH 01/23] =?UTF-8?q?add:=20blog=5Fentries.calendar=5Fevent=5F?= =?UTF-8?q?key=E3=82=AB=E3=83=A9=E3=83=A0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...add_calendar_event_key_by_blog_entries.php | 50 +++++++++++++++++++ Config/Schema/schema.php | 1 + 2 files changed, 51 insertions(+) create mode 100644 Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php diff --git a/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php b/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php new file mode 100644 index 0000000..135b59f --- /dev/null +++ b/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php @@ -0,0 +1,50 @@ + array( + 'create_field' => array( + 'blog_entries' => array( + 'calendar_event_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'body2'), + ), + ), + ), + 'down' => array( + 'drop_field' => array( + 'blog_entries' => array('calendar_event_key'), + ), + ), + ); + +/** + * 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 ba76c70..4b8373f 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -52,6 +52,7 @@ public function after($event = array()) { 'title_icon' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'body1' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '本文1', 'charset' => 'utf8'), 'body2' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '本文2', 'charset' => 'utf8'), + 'calendar_event_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'public_type' => array('type' => 'integer', 'null' => false, 'default' => '2', 'length' => 4, 'unsigned' => false), 'publish_start' => array('type' => 'datetime', 'null' => true, 'default' => null), 'publish_end' => array('type' => 'datetime', 'null' => true, 'default' => null), From f1d3d91cce9ed0c1e62e9381a81ec34f252fbd78 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 11 Aug 2019 11:57:20 +0900 Subject: [PATCH 02/23] =?UTF-8?q?add:=20event=5Fkey=E3=81=8C=E3=81=82?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=82=89calendar=5Fevent=5Fkey=E3=81=AB?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 2 ++ View/BlogEntriesEdit/form.ctp | 1 + 2 files changed, 3 insertions(+) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 7413d34..0e10ecd 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -99,8 +99,10 @@ public function add() { $this->NetCommons->handleValidationError($this->BlogEntry->validationErrors); } else { + $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query['event_key'] ?? null; $this->request->data = $blogEntry; $this->request->data['Tag'] = array(); + } $this->view = 'form'; diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 17121b8..16207a3 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -34,6 +34,7 @@ $dataJson = json_encode( NetCommonsForm->hidden('Block.id', array( 'value' => Current::read('Block.id'), )); ?> + NetCommonsForm->hidden('BlogEntry.calendar_event_key');?>
From 1f9d86f91dbd157c0e64c686d21def8a6e401cad Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 11 Aug 2019 12:03:40 +0900 Subject: [PATCH 03/23] =?UTF-8?q?add:=20calendar=5Fevent=5Fkey=E3=81=8C?= =?UTF-8?q?=E7=99=BB=E9=8C=B2=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=82=89=E3=82=AB=E3=83=AC=E3=83=B3=E3=83=80=E3=81=AE=E8=A9=B2?= =?UTF-8?q?=E5=BD=93=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=B8=E3=81=AE?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E3=82=92=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/BlogEntries/view.ctp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 91c0010..5bbae0d 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -40,6 +40,19 @@ echo $this->BlogOgp->ogpMetaByBlogEntry($blogEntry);
+ +
+ NetCommonsHtml->link('この記事のイベント', [ + 'plugin' => 'calendars', + 'controller' => 'calendar_plans', + 'action' => 'view', + 'key' => $blogEntry['BlogEntry']['calendar_event_key'] + ],[ + 'class' => ['btn', 'btn-default'] + ]);?> +
+ + element('Blogs.entry_footer'); ?> From 3816e65f55f81b8763d3cd404f699c38f4db6a1c Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 11 Aug 2019 14:28:18 +0900 Subject: [PATCH 04/23] =?UTF-8?q?change:=20=E5=85=83=E3=82=A4=E3=83=99?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF?= =?UTF-8?q?=E3=81=AB=E5=85=83=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E5=90=8D?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_calendar.php | 4 ++++ Model/BlogEntry.php | 7 +++++++ View/BlogEntries/view.ctp | 40 +++++++++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 Config/related_calendar.php diff --git a/Config/related_calendar.php b/Config/related_calendar.php new file mode 100644 index 0000000..7665de7 --- /dev/null +++ b/Config/related_calendar.php @@ -0,0 +1,4 @@ + 32 +]; \ No newline at end of file diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 2b57a95..8456fdb 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -457,4 +457,11 @@ public function yetPublish($blogEntry) { return ($count == 0); } + public function getByCalendarEventKey(string $calendarEventKey) { + $conditions = [ + 'BlogEntry.calendar_event_key' => $calendarEventKey + ]; + $conditions = $this->getWorkflowConditions($conditions); + return $this->find('first', ['conditions' => $conditions]); + } } diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 5bbae0d..863a386 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -40,17 +40,35 @@ echo $this->BlogOgp->ogpMetaByBlogEntry($blogEntry); - -
- NetCommonsHtml->link('この記事のイベント', [ - 'plugin' => 'calendars', - 'controller' => 'calendar_plans', - 'action' => 'view', - 'key' => $blogEntry['BlogEntry']['calendar_event_key'] - ],[ - 'class' => ['btn', 'btn-default'] - ]);?> -
+ prepareCalRoleAndPerm(); + CalendarPermissiveRooms::setRoomPermRoles($roomPermRoles); + + $event = $calendarEventModel->getEventByKey($blogEntry['BlogEntry']['calendar_event_key']); + Configure::load('Blogs.related_calendar'); + $calendarFrameId = Configure::read('Blogs.relatedCalendar.frame_id'); + } + ?> + + +
+ '; ?> + NetCommonsHtml->link(h($event['CalendarEvent']['title']), [ + 'plugin' => 'calendars', + 'controller' => 'calendar_plans', + 'action' => 'view', + 'key' => $blogEntry['BlogEntry']['calendar_event_key'], + 'frame_id' => $calendarFrameId, + 'block_id' => false, + ],[ + 'class' => ['btn', 'btn-default', 'btn-lg'], + 'escape' => false, + ]);?> +
element('Blogs.entry_footer'); ?> From a41c36883eb4443e0f21dd775b5b142d4ceabe5c Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 10:08:52 +0900 Subject: [PATCH 05/23] =?UTF-8?q?add:=20=E5=89=8A=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E3=81=AE=E3=83=96=E3=83=AD=E3=82=B0=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/do_not_delete_blogs.php | 5 +++++ Controller/BlogBlocksController.php | 2 ++ View/BlogBlocks/edit.ctp | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Config/do_not_delete_blogs.php diff --git a/Config/do_not_delete_blogs.php b/Config/do_not_delete_blogs.php new file mode 100644 index 0000000..f633694 --- /dev/null +++ b/Config/do_not_delete_blogs.php @@ -0,0 +1,5 @@ + 'school_announce', + 'school_blog' => 'school_blog' +]; \ No newline at end of file diff --git a/Controller/BlogBlocksController.php b/Controller/BlogBlocksController.php index e3d08c2..73f500b 100644 --- a/Controller/BlogBlocksController.php +++ b/Controller/BlogBlocksController.php @@ -90,6 +90,8 @@ public function beforeFilter() { if ($this->params['action'] === 'index') { $this->Components->unload('Categories.CategoryEdit'); } + + Configure::load('Blogs.do_not_delete_blogs'); } /** diff --git a/View/BlogBlocks/edit.ctp b/View/BlogBlocks/edit.ctp index 481c33f..f638721 100644 --- a/View/BlogBlocks/edit.ctp +++ b/View/BlogBlocks/edit.ctp @@ -22,7 +22,12 @@ 'cancelUrl' => NetCommonsUrl::backToIndexUrl('default_setting_action'), )); ?> - request->params['action'] === 'edit') : ?> + request->params['action'] === 'edit' && + !in_array( + $this->request->data['Blog']['key'], + Configure::read('Blogs.doNotDeleteBlogs'), + true + )) : ?> element('Blocks.delete_form', array( 'model' => 'BlogBlock', 'action' => NetCommonsUrl::actionUrl(array( From d7fadac7f0fc5d5a19b75e98986bc69378e9d6e7 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 10:20:14 +0900 Subject: [PATCH 06/23] =?UTF-8?q?add:=20=E5=89=8A=E9=99=A4=E3=82=AC?= =?UTF-8?q?=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/BlogBlocksController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Controller/BlogBlocksController.php b/Controller/BlogBlocksController.php index 73f500b..ac4eaa8 100644 --- a/Controller/BlogBlocksController.php +++ b/Controller/BlogBlocksController.php @@ -167,6 +167,9 @@ public function edit() { */ public function delete() { if ($this->request->is('delete')) { + if (in_array($this->data['Blog']['key'], Configure::read('Blogs.doNotDeleteBlogs'), true)) { + return $this->throwBadRequest('削除不可のブログです'); + } if ($this->Blog->deleteBlog($this->data)) { return $this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action')); } From 5c7da89da901c0afd2619641bd2613687961daf9 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 10:23:54 +0900 Subject: [PATCH 07/23] =?UTF-8?q?disable:=20=E3=82=AB=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=80=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92=E3=81=A8=E3=82=8A=E3=82=84=E3=82=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_calendar.php | 6 ++-- View/BlogEntries/view.ctp | 56 ++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Config/related_calendar.php b/Config/related_calendar.php index 7665de7..b666f7b 100644 --- a/Config/related_calendar.php +++ b/Config/related_calendar.php @@ -1,4 +1,4 @@ 32 -]; \ No newline at end of file +//$config['Blogs']['relatedCalendar'] = [ +// 'frame_id' => 32 +//]; \ No newline at end of file diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 863a386..8925d64 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -41,35 +41,35 @@ echo $this->BlogOgp->ogpMetaByBlogEntry($blogEntry); prepareCalRoleAndPerm(); - CalendarPermissiveRooms::setRoomPermRoles($roomPermRoles); + //$event = null; + //if ($blogEntry['BlogEntry']['calendar_event_key']) { + // /** @var CalendarEvent $calendarEventModel */ + // $calendarEventModel = ClassRegistry::init('Calendars.CalendarEvent'); + // $roomPermRoles = $calendarEventModel->prepareCalRoleAndPerm(); + // CalendarPermissiveRooms::setRoomPermRoles($roomPermRoles); + // + // $event = $calendarEventModel->getEventByKey($blogEntry['BlogEntry']['calendar_event_key']); + // Configure::load('Blogs.related_calendar'); + // $calendarFrameId = Configure::read('Blogs.relatedCalendar.frame_id'); + //} + //?> - $event = $calendarEventModel->getEventByKey($blogEntry['BlogEntry']['calendar_event_key']); - Configure::load('Blogs.related_calendar'); - $calendarFrameId = Configure::read('Blogs.relatedCalendar.frame_id'); - } - ?> - - -
- '; ?> - NetCommonsHtml->link(h($event['CalendarEvent']['title']), [ - 'plugin' => 'calendars', - 'controller' => 'calendar_plans', - 'action' => 'view', - 'key' => $blogEntry['BlogEntry']['calendar_event_key'], - 'frame_id' => $calendarFrameId, - 'block_id' => false, - ],[ - 'class' => ['btn', 'btn-default', 'btn-lg'], - 'escape' => false, - ]);?> -
- + + + '; ?> + NetCommonsHtml->link(h($event['CalendarEvent']['title']), [ + // 'plugin' => 'calendars', + // 'controller' => 'calendar_plans', + // 'action' => 'view', + // 'key' => $blogEntry['BlogEntry']['calendar_event_key'], + // 'frame_id' => $calendarFrameId, + // 'block_id' => false, + // ],[ + // 'class' => ['btn', 'btn-default', 'btn-lg'], + // 'escape' => false, + // ]);?> + + element('Blogs.entry_footer'); ?> From 107692abaee1d7d8659cc61d37e000f4f7e1d70f Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 11:05:04 +0900 Subject: [PATCH 08/23] =?UTF-8?q?add:=20=E3=82=AB=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=80=E3=81=8B=E3=82=89=E3=80=8C=E5=AE=9F=E7=B8=BE=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=8D=E3=81=A7=E6=96=B0=E8=A6=8F=E8=A8=98?= =?UTF-8?q?=E4=BA=8B=E3=82=92=E4=BD=9C=E6=88=90=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AF=E3=80=81=E3=82=AB=E3=83=AC=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=AE=E9=96=8B=E5=A7=8B?= =?UTF-8?q?=E6=97=A5=E3=80=81=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=82=92?= =?UTF-8?q?=E3=83=96=E3=83=AD=E3=82=B0=E8=A8=98=E4=BA=8B=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=88=E3=83=AB=E3=81=AB=E3=81=AA=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 0e10ecd..d244b96 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -100,6 +100,10 @@ public function add() { } else { $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query['event_key'] ?? null; + if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { + $title = $this->__getTitleByCalendaerEvent($blogEntry['BlogEntry']['calendar_event_key']); + $blogEntry['BlogEntry']['title'] = $title; + } $this->request->data = $blogEntry; $this->request->data['Tag'] = array(); @@ -108,6 +112,28 @@ public function add() { $this->view = 'form'; } +/** + * 指定されたカレンダイベントの開始日とイベント名を組み合わせたタイトルを返す + * + * @param string $calendarEventKey CalendarEvent.key + * @return string n月j日イベント名 + */ + private function __getTitleByCalendaerEvent(string $calendarEventKey) : string { + /** @var CalendarEvent $calendarEventModel */ + $calendarEventModel = ClassRegistry::init('Calendars.CalendarEvent'); + $roomPermRoles = $calendarEventModel->prepareCalRoleAndPerm(); + CalendarPermissiveRooms::setRoomPermRoles($roomPermRoles); + + $event = $calendarEventModel->getEventByKey($calendarEventKey); + + $time = strtotime($event['CalendarEvent']['dtstart']) + $event['CalendarEvent']['timezone_offset'] * HOUR; + $title = date('n月j日', $time); + + $title .= $event['CalendarEvent']['title']; + + return $title; + } + /** * edit method * From 01657499fa9f08b2ab7a41b80122f076401d382d Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Fri, 23 Aug 2019 19:45:16 +0900 Subject: [PATCH 09/23] =?UTF-8?q?fix:=20CalendarEvent=E3=81=8C=E8=A6=8B?= =?UTF-8?q?=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA=E3=81=84=E3=81=A8=E3=81=8D?= =?UTF-8?q?=E3=81=ABNotice=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82CalendarEvent?= =?UTF-8?q?=E3=81=8C=E8=A6=8B=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA=E3=81=91?= =?UTF-8?q?=E3=82=8C=E3=81=B0=E4=B8=8D=E6=AD=A3=E3=81=AA=E3=83=AA=E3=82=AF?= =?UTF-8?q?=E3=82=A8=E3=82=B9=E3=83=88=E3=81=A8=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index d244b96..66ac53a 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -125,7 +125,10 @@ private function __getTitleByCalendaerEvent(string $calendarEventKey) : string { CalendarPermissiveRooms::setRoomPermRoles($roomPermRoles); $event = $calendarEventModel->getEventByKey($calendarEventKey); - + if (!$event) { + $this->throwBadRequest('CalendarEvent Not Found'); + return ''; + } $time = strtotime($event['CalendarEvent']['dtstart']) + $event['CalendarEvent']['timezone_offset'] * HOUR; $title = date('n月j日', $time); From 045b5cd6facc66c68456bbcf1d64696534f654f4 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Mon, 26 Aug 2019 10:30:29 +0900 Subject: [PATCH 10/23] =?UTF-8?q?fix:=20WYSIWYG=E3=81=A7=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=82=92=E5=B7=A6=E5=AF=84=E3=81=9B=E3=82=84=E5=8F=B3=E3=82=88?= =?UTF-8?q?=E3=81=9B=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB=E3=83=AC?= =?UTF-8?q?=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E5=B4=A9=E3=82=8C=E3=81=8C?= =?UTF-8?q?=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B=E3=81=AE=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 --- View/BlogEntries/view.ctp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/View/BlogEntries/view.ctp b/View/BlogEntries/view.ctp index 91c0010..c8c28c2 100644 --- a/View/BlogEntries/view.ctp +++ b/View/BlogEntries/view.ctp @@ -33,10 +33,11 @@ echo $this->BlogOgp->ogpMetaByBlogEntry($blogEntry); -
+
-
+ +
From f0b7986db86dc5c7d86c3f7557a7539bb63fb99e Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 11:42:29 +0900 Subject: [PATCH 11/23] =?UTF-8?q?add:=20Blog.key=E3=81=8B=E3=82=89Blog.blo?= =?UTF-8?q?ck=5Fid=E3=82=92=E8=BF=94=E3=81=99=E3=83=A1=E3=82=BD=E3=83=83?= =?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 --- Model/Blog.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Model/Blog.php b/Model/Blog.php index aed5a2f..5d9ed70 100644 --- a/Model/Blog.php +++ b/Model/Blog.php @@ -292,4 +292,25 @@ public function deleteBlog($data) { return true; } +/** + * findBlockIdByKey + * + * @param string $blogKey Blog.key + * @return int|null + */ + public function findBlockIdByKey($blogKey) { + $options = [ + 'conditions' => [ + 'Blog.key' => $blogKey + ], + 'fields' => ['Blog.block_id'], + 'recursive' => -1 + ]; + $result = $this->find('first', $options); + if ($result) { + return $result['Blog']['block_id']; + } + return null; + } + } From 449befb9ab0763da929ecb7f143514e8ce868c41 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 11:44:46 +0900 Subject: [PATCH 12/23] =?UTF-8?q?change:=20=E5=89=8A=E9=99=A4=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E3=81=AF=20Blog.key=3D=3D=3Dschool=5Fblog=E3=81=AE?= =?UTF-8?q?=E3=81=BF=E3=81=A8=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/do_not_delete_blogs.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Config/do_not_delete_blogs.php b/Config/do_not_delete_blogs.php index f633694..f3c1110 100644 --- a/Config/do_not_delete_blogs.php +++ b/Config/do_not_delete_blogs.php @@ -1,5 +1,4 @@ 'school_announce', 'school_blog' => 'school_blog' ]; \ No newline at end of file From 08930a5cc61f7fe786bdf39429f839adc0fb4776 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 12:00:01 +0900 Subject: [PATCH 13/23] =?UTF-8?q?change:=20PHP7=E5=90=91=E3=81=91=E3=81=AE?= =?UTF-8?q?=E8=A8=98=E8=BF=B0=E3=82=92PHP5=E7=B3=BB=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=95=E3=81=9B=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 4 ++-- Model/BlogEntry.php | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 66ac53a..88a3dce 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -99,7 +99,7 @@ public function add() { $this->NetCommons->handleValidationError($this->BlogEntry->validationErrors); } else { - $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query['event_key'] ?? null; + $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query('event_key'); if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { $title = $this->__getTitleByCalendaerEvent($blogEntry['BlogEntry']['calendar_event_key']); $blogEntry['BlogEntry']['title'] = $title; @@ -118,7 +118,7 @@ public function add() { * @param string $calendarEventKey CalendarEvent.key * @return string n月j日イベント名 */ - private function __getTitleByCalendaerEvent(string $calendarEventKey) : string { + private function __getTitleByCalendaerEvent($calendarEventKey) { /** @var CalendarEvent $calendarEventModel */ $calendarEventModel = ClassRegistry::init('Calendars.CalendarEvent'); $roomPermRoles = $calendarEventModel->prepareCalRoleAndPerm(); diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 8456fdb..076b194 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -457,7 +457,13 @@ public function yetPublish($blogEntry) { return ($count == 0); } - public function getByCalendarEventKey(string $calendarEventKey) { +/** + * getByCalendarEventKey + * + * @param string $calendarEventKey + * @return array|int|null + */ + public function getByCalendarEventKey($calendarEventKey) { $conditions = [ 'BlogEntry.calendar_event_key' => $calendarEventKey ]; From 2c701d9196ab581f14121b2ca220a4e9a06dc4b2 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 12:07:36 +0900 Subject: [PATCH 14/23] =?UTF-8?q?change:=20=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AE=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogBlocksController.php | 2 +- Locale/jpn/LC_MESSAGES/blogs.po | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/BlogBlocksController.php b/Controller/BlogBlocksController.php index ac4eaa8..226700f 100644 --- a/Controller/BlogBlocksController.php +++ b/Controller/BlogBlocksController.php @@ -168,7 +168,7 @@ public function edit() { public function delete() { if ($this->request->is('delete')) { if (in_array($this->data['Blog']['key'], Configure::read('Blogs.doNotDeleteBlogs'), true)) { - return $this->throwBadRequest('削除不可のブログです'); + return $this->throwBadRequest(__d('blogs', 'This blog cannot be deleted.')); } if ($this->Blog->deleteBlog($this->data)) { return $this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action')); diff --git a/Locale/jpn/LC_MESSAGES/blogs.po b/Locale/jpn/LC_MESSAGES/blogs.po index 05af961..15199fe 100644 --- a/Locale/jpn/LC_MESSAGES/blogs.po +++ b/Locale/jpn/LC_MESSAGES/blogs.po @@ -134,3 +134,6 @@ msgstr "%s 件" #: Blogs/View/Elements/BlogFrameSettings/edit_form.ctp:23 msgid "%s articles" msgstr "%s 件" + +msgid "This blog cannot be deleted." +msgstr "削除不可のブログです。" \ No newline at end of file From 7ead7b54c4c2931b3ec873d47825a240eea101b2 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 12:00:01 +0900 Subject: [PATCH 15/23] =?UTF-8?q?change:=20PHP7=E5=90=91=E3=81=91=E3=81=AE?= =?UTF-8?q?=E8=A8=98=E8=BF=B0=E3=82=92PHP5=E7=B3=BB=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=95=E3=81=9B=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 4 ++-- Model/BlogEntry.php | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 66ac53a..88a3dce 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -99,7 +99,7 @@ public function add() { $this->NetCommons->handleValidationError($this->BlogEntry->validationErrors); } else { - $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query['event_key'] ?? null; + $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query('event_key'); if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { $title = $this->__getTitleByCalendaerEvent($blogEntry['BlogEntry']['calendar_event_key']); $blogEntry['BlogEntry']['title'] = $title; @@ -118,7 +118,7 @@ public function add() { * @param string $calendarEventKey CalendarEvent.key * @return string n月j日イベント名 */ - private function __getTitleByCalendaerEvent(string $calendarEventKey) : string { + private function __getTitleByCalendaerEvent($calendarEventKey) { /** @var CalendarEvent $calendarEventModel */ $calendarEventModel = ClassRegistry::init('Calendars.CalendarEvent'); $roomPermRoles = $calendarEventModel->prepareCalRoleAndPerm(); diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 8456fdb..076b194 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -457,7 +457,13 @@ public function yetPublish($blogEntry) { return ($count == 0); } - public function getByCalendarEventKey(string $calendarEventKey) { +/** + * getByCalendarEventKey + * + * @param string $calendarEventKey + * @return array|int|null + */ + public function getByCalendarEventKey($calendarEventKey) { $conditions = [ 'BlogEntry.calendar_event_key' => $calendarEventKey ]; From 334b74d4d346d138c16f06f856c725ae4d8a19a6 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 12:07:36 +0900 Subject: [PATCH 16/23] =?UTF-8?q?change:=20=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AE=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogBlocksController.php | 2 +- Locale/jpn/LC_MESSAGES/blogs.po | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/BlogBlocksController.php b/Controller/BlogBlocksController.php index ac4eaa8..226700f 100644 --- a/Controller/BlogBlocksController.php +++ b/Controller/BlogBlocksController.php @@ -168,7 +168,7 @@ public function edit() { public function delete() { if ($this->request->is('delete')) { if (in_array($this->data['Blog']['key'], Configure::read('Blogs.doNotDeleteBlogs'), true)) { - return $this->throwBadRequest('削除不可のブログです'); + return $this->throwBadRequest(__d('blogs', 'This blog cannot be deleted.')); } if ($this->Blog->deleteBlog($this->data)) { return $this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action')); diff --git a/Locale/jpn/LC_MESSAGES/blogs.po b/Locale/jpn/LC_MESSAGES/blogs.po index 05af961..15199fe 100644 --- a/Locale/jpn/LC_MESSAGES/blogs.po +++ b/Locale/jpn/LC_MESSAGES/blogs.po @@ -134,3 +134,6 @@ msgstr "%s 件" #: Blogs/View/Elements/BlogFrameSettings/edit_form.ctp:23 msgid "%s articles" msgstr "%s 件" + +msgid "This blog cannot be deleted." +msgstr "削除不可のブログです。" \ No newline at end of file From 21bb82ff7a33148b72d3f6714fa1bffeb199d0c3 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 12:19:18 +0900 Subject: [PATCH 17/23] =?UTF-8?q?change:=20=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AE=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 2 +- Locale/eng/LC_MESSAGES/blogs.po | 2 ++ Locale/jpn/LC_MESSAGES/blogs.po | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 88a3dce..0279f92 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -130,7 +130,7 @@ private function __getTitleByCalendaerEvent($calendarEventKey) { return ''; } $time = strtotime($event['CalendarEvent']['dtstart']) + $event['CalendarEvent']['timezone_offset'] * HOUR; - $title = date('n月j日', $time); + $title = date(__d('blogs', 'EventDateFormat'), $time); $title .= $event['CalendarEvent']['title']; diff --git a/Locale/eng/LC_MESSAGES/blogs.po b/Locale/eng/LC_MESSAGES/blogs.po index d712b7e..d7ae737 100644 --- a/Locale/eng/LC_MESSAGES/blogs.po +++ b/Locale/eng/LC_MESSAGES/blogs.po @@ -135,3 +135,5 @@ msgstr "" msgid "%s articles" msgstr "" +msgid "EventDateFormat" +msgstr "M/j" \ No newline at end of file diff --git a/Locale/jpn/LC_MESSAGES/blogs.po b/Locale/jpn/LC_MESSAGES/blogs.po index 15199fe..789e0fe 100644 --- a/Locale/jpn/LC_MESSAGES/blogs.po +++ b/Locale/jpn/LC_MESSAGES/blogs.po @@ -136,4 +136,7 @@ msgid "%s articles" msgstr "%s 件" msgid "This blog cannot be deleted." -msgstr "削除不可のブログです。" \ No newline at end of file +msgstr "削除不可のブログです。" + +msgid "EventDateFormat" +msgstr "n月j日" \ No newline at end of file From dd3ed046749af83f530c196f4ac6107345e5abe7 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 10:41:49 +0900 Subject: [PATCH 18/23] =?UTF-8?q?fix:=20test:=20calendar=5Fevent=5Fkey?= =?UTF-8?q?=E3=82=AB=E3=83=A9=E3=83=A0=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=81=A7=E5=90=88=E3=82=8F=E3=81=9B=E3=81=A6?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/BlogEntryFixture.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Test/Fixture/BlogEntryFixture.php b/Test/Fixture/BlogEntryFixture.php index df7d9e2..a58cb51 100644 --- a/Test/Fixture/BlogEntryFixture.php +++ b/Test/Fixture/BlogEntryFixture.php @@ -44,6 +44,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '1', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), array( 'id' => '2', @@ -67,6 +68,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '2', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), // * 一般が書いたコンテンツ&一度も公開していない(承認待ち) array( @@ -91,6 +93,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '3', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), // * 一般が書いたコンテンツ&公開して、一時保存 // (id=4とid=5で区別できるものをセットする) @@ -116,6 +119,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '4', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), array( 'id' => '5', @@ -139,6 +143,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '5', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), // * 編集者が書いたコンテンツ&一度公開して、差し戻し // (id=6とid=7で区別できるものをセットする) @@ -164,6 +169,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '6', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), array( 'id' => '7', @@ -187,6 +193,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '7', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), array( 'id' => '8', @@ -210,6 +217,7 @@ class BlogEntryFixture extends CakeTestFixture { 'modified_user' => '8', 'modified' => '2016-03-17 07:10:12', 'title_icon' => '', + 'calendar_event_key' => null, ), ); From 4a4e997d14e8eca4596be8e799e180b33c22e1ef Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 11:06:05 +0900 Subject: [PATCH 19/23] =?UTF-8?q?remove:=20=E4=BD=BF=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_calendar.php | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 Config/related_calendar.php diff --git a/Config/related_calendar.php b/Config/related_calendar.php deleted file mode 100644 index b666f7b..0000000 --- a/Config/related_calendar.php +++ /dev/null @@ -1,4 +0,0 @@ - 32 -//]; \ No newline at end of file From f25c87bad6f961546676945ee58b405553a7fd6d Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 11:06:19 +0900 Subject: [PATCH 20/23] =?UTF-8?q?comment:=20=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1565491879_add_calendar_event_key_by_blog_entries.php | 7 +++++++ Config/do_not_delete_blogs.php | 4 ++++ Model/BlogEntry.php | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php b/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php index 135b59f..6167e61 100644 --- a/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php +++ b/Config/Migration/1565491879_add_calendar_event_key_by_blog_entries.php @@ -1,4 +1,11 @@ 'school_blog' ]; \ No newline at end of file diff --git a/Model/BlogEntry.php b/Model/BlogEntry.php index 076b194..57ab8d9 100644 --- a/Model/BlogEntry.php +++ b/Model/BlogEntry.php @@ -460,7 +460,7 @@ public function yetPublish($blogEntry) { /** * getByCalendarEventKey * - * @param string $calendarEventKey + * @param string $calendarEventKey calendar event.key * @return array|int|null */ public function getByCalendarEventKey($calendarEventKey) { From b4d53bc9ff83cc9e186df1b0a3782218716a49ea Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 11:43:35 +0900 Subject: [PATCH 21/23] style: fix phpcs problem --- Controller/BlogEntriesEditController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 0279f92..f9c5b46 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -101,7 +101,7 @@ public function add() { } else { $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query('event_key'); if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { - $title = $this->__getTitleByCalendaerEvent($blogEntry['BlogEntry']['calendar_event_key']); + $title = $this->__getTitleByCalendarEvent($blogEntry['BlogEntry']['calendar_event_key']); $blogEntry['BlogEntry']['title'] = $title; } $this->request->data = $blogEntry; @@ -118,7 +118,7 @@ public function add() { * @param string $calendarEventKey CalendarEvent.key * @return string n月j日イベント名 */ - private function __getTitleByCalendaerEvent($calendarEventKey) { + private function __getTitleByCalendarEvent($calendarEventKey) { /** @var CalendarEvent $calendarEventModel */ $calendarEventModel = ClassRegistry::init('Calendars.CalendarEvent'); $roomPermRoles = $calendarEventModel->prepareCalRoleAndPerm(); @@ -129,7 +129,8 @@ private function __getTitleByCalendaerEvent($calendarEventKey) { $this->throwBadRequest('CalendarEvent Not Found'); return ''; } - $time = strtotime($event['CalendarEvent']['dtstart']) + $event['CalendarEvent']['timezone_offset'] * HOUR; + $time = strtotime($event['CalendarEvent']['dtstart']) + + $event['CalendarEvent']['timezone_offset'] * HOUR; $title = date(__d('blogs', 'EventDateFormat'), $time); $title .= $event['CalendarEvent']['title']; From 7b79323f61e70fef0242c3dd697cfc5d9422a080 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 16 Nov 2019 10:49:26 +0900 Subject: [PATCH 22/23] =?UTF-8?q?fix:=20=E3=82=AB=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=80=E3=81=8B=E3=82=89=E3=81=AE=E5=AE=9F=E7=B8=BE=E7=99=BB?= =?UTF-8?q?=E9=8C=B2=E6=99=82=E3=81=AB=E3=82=AD=E3=83=A3=E3=83=B3=E3=82=BB?= =?UTF-8?q?=E3=83=AB=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E3=81=A8=E7=9C=9F=E3=81=A3?= =?UTF-8?q?=E7=99=BD=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 10 ++++++++++ View/BlogEntriesEdit/form.ctp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index f9c5b46..4a0be98 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -99,10 +99,20 @@ public function add() { $this->NetCommons->handleValidationError($this->BlogEntry->validationErrors); } else { + $this->set('cancelUrl', null); $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query('event_key'); if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { + // カレンダからの実績登録時 $title = $this->__getTitleByCalendarEvent($blogEntry['BlogEntry']['calendar_event_key']); $blogEntry['BlogEntry']['title'] = $title; + $cancelUrl = NetCommonsUrl::actionUrl([ + 'plugin' => 'calendars', + 'controller' => 'calendar_plans', + 'action' => 'view', + 'key' => $blogEntry['BlogEntry']['calendar_event_key'], + 'page_id' => $this->request->query('page_id') + ]); + $this->set('cancelUrl', $cancelUrl); } $this->request->data = $blogEntry; $this->request->data['Tag'] = array(); diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 16207a3..6fc1887 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -96,7 +96,7 @@ $dataJson = json_encode(
- Workflow->buttons('BlogEntry.status'); ?> + Workflow->buttons('BlogEntry.status', $cancelUrl); ?> NetCommonsForm->end() ?> From 704cb3262be6fccb7ca9b2351efe28e9dc0bcb46 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 17 Nov 2019 17:53:31 +0900 Subject: [PATCH 23/23] =?UTF-8?q?fix:=20Notice=E5=AF=BE=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/BlogEntriesEditController.php | 2 +- View/BlogEntriesEdit/form.ctp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Controller/BlogEntriesEditController.php b/Controller/BlogEntriesEditController.php index 4a0be98..9b92754 100644 --- a/Controller/BlogEntriesEditController.php +++ b/Controller/BlogEntriesEditController.php @@ -99,7 +99,7 @@ public function add() { $this->NetCommons->handleValidationError($this->BlogEntry->validationErrors); } else { - $this->set('cancelUrl', null); + //$this->set('cancelUrl', null); $blogEntry['BlogEntry']['calendar_event_key'] = $this->request->query('event_key'); if ($blogEntry['BlogEntry']['calendar_event_key'] !== null) { // カレンダからの実績登録時 diff --git a/View/BlogEntriesEdit/form.ctp b/View/BlogEntriesEdit/form.ctp index 6fc1887..6aa004e 100644 --- a/View/BlogEntriesEdit/form.ctp +++ b/View/BlogEntriesEdit/form.ctp @@ -96,7 +96,10 @@ $dataJson = json_encode(
- Workflow->buttons('BlogEntry.status', $cancelUrl); ?> + Workflow->buttons('BlogEntry.status', $cancelUrl); + ?> NetCommonsForm->end() ?>