From e69e706c95aa578be805d464df9984fab3a58405 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 08:26:02 +0900 Subject: [PATCH 01/27] =?UTF-8?q?change:=20event=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=AB=E3=81=AE=E3=82=AB=E3=83=A9=E3=83=A0=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=80=82=E5=AF=BE=E8=B1=A1=E8=80=85=EF=BC=88=E3=83=86?= =?UTF-8?q?=E3=82=AD=E3=82=B9=E3=83=88=EF=BC=89target=5Fperson,=20=20?= =?UTF-8?q?=E6=8C=81=E3=81=A1=E7=89=A9=20belongings=20=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...event_add_target_person_and_belongings.php | 51 +++++++++++++++++++ Config/Schema/schema.php | 2 + 2 files changed, 53 insertions(+) create mode 100644 Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php diff --git a/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php b/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php new file mode 100644 index 0000000..85438f0 --- /dev/null +++ b/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php @@ -0,0 +1,51 @@ + array( + 'create_field' => array( + 'calendar_events' => array( + 'target_person' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8', 'after' => 'location'), + 'belongings' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '持ち物', 'charset' => 'utf8', 'after' => 'target_person'), + ), + ), + ), + 'down' => array( + 'drop_field' => array( + 'calendar_events' => array('target_person', 'belongings'), + ), + ), + ); + +/** + * 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 5da139c..e74cf2f 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -101,6 +101,8 @@ public function after($event = array()) { 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル', 'charset' => 'utf8'), 'title_icon' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル アイコン', 'charset' => 'utf8'), 'location' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '場所', 'charset' => 'utf8'), + 'target_person' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8'), + 'belongings' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '持ち物', 'charset' => 'utf8'), 'contact' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '連絡先', 'charset' => 'utf8'), 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '詳細', 'charset' => 'utf8'), 'is_allday' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '終日かどうか | 0:終日ではない | 1:終日'), From b73b687743bc5e0bc5f000d984ebb06cd35109ea Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 10:44:05 +0900 Subject: [PATCH 02/27] =?UTF-8?q?change:=20=E5=AF=BE=E8=B1=A1=E8=80=85?= =?UTF-8?q?=E3=80=81=E6=8C=81=E3=81=A1=E7=89=A9=E3=81=AE=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E3=83=BB=E8=A1=A8=E7=A4=BA=E3=81=8C=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/jpn/LC_MESSAGES/calendars.po | 8 +++++++- Model/Behavior/CalendarAppBehavior.php | 6 ++++++ Model/Behavior/CalendarUpdatePlanBehavior.php | 3 +++ Model/CalendarActionPlan.php | 4 ++++ Utility/CalendarSupport.php | 5 +++++ View/CalendarPlans/detail_edit.ctp | 17 +++++++++++++++++ View/CalendarPlans/view.ctp | 16 ++++++++++++++++ 7 files changed, 58 insertions(+), 1 deletion(-) diff --git a/Locale/jpn/LC_MESSAGES/calendars.po b/Locale/jpn/LC_MESSAGES/calendars.po index c04e4c4..a4f0734 100644 --- a/Locale/jpn/LC_MESSAGES/calendars.po +++ b/Locale/jpn/LC_MESSAGES/calendars.po @@ -1215,4 +1215,10 @@ msgid "End date and time" msgstr "終了日時" msgid "You can not set sharers." -msgstr "予定の共有者を設定する権限がありません。" \ No newline at end of file +msgstr "予定の共有者を設定する権限がありません。" + +msgid "Target Person" +msgstr "対象者" + +msgid "Belongings" +msgstr "持ち物" \ No newline at end of file diff --git a/Model/Behavior/CalendarAppBehavior.php b/Model/Behavior/CalendarAppBehavior.php index e9f82a4..44b1feb 100644 --- a/Model/Behavior/CalendarAppBehavior.php +++ b/Model/Behavior/CalendarAppBehavior.php @@ -381,6 +381,8 @@ public function setPlanParams2Params(&$planParams, &$params) { $keys = array( 'title', 'title_icon', + 'target_person', + 'belongings', 'location', 'contact', 'description', @@ -421,6 +423,8 @@ public function setEventData($planParams, $rruleData, &$eventData) { 'target_user' => Current::read('User.id'), 'title' => '', 'title_icon' => '', + 'target_person' => '', + 'belongings' => '', 'location' => '', 'contact' => '', 'description' => '', @@ -454,6 +458,8 @@ public function setEventData($planParams, $rruleData, &$eventData) { $eventData['CalendarEvent']['target_user'] = $params['target_user']; $eventData['CalendarEvent']['title'] = $params['title']; $eventData['CalendarEvent']['title_icon'] = $params['title_icon']; + $eventData['CalendarEvent']['target_person'] = $params['target_person']; + $eventData['CalendarEvent']['belongings'] = $params['belongings']; $eventData['CalendarEvent']['is_allday'] = $params['is_allday']; $eventData['CalendarEvent']['start_date'] = $params['start_date']; $eventData['CalendarEvent']['start_time'] = $params['start_time']; diff --git a/Model/Behavior/CalendarUpdatePlanBehavior.php b/Model/Behavior/CalendarUpdatePlanBehavior.php index 2b74f0d..100ad37 100644 --- a/Model/Behavior/CalendarUpdatePlanBehavior.php +++ b/Model/Behavior/CalendarUpdatePlanBehavior.php @@ -719,6 +719,9 @@ private function __getEventDataForUpdateAllOrAfter($event, $eventData, $status) //タイトル、場所、連絡先、詳細は編集画面の値を使う $event['CalendarEvent']['title'] = $eventData['CalendarEvent']['title']; $event['CalendarEvent']['title_icon'] = $eventData['CalendarEvent']['title_icon']; + $event['CalendarEvent']['target_person'] = $eventData['CalendarEvent']['target_person']; + $event['CalendarEvent']['belongings'] = $eventData['CalendarEvent']['belongings']; + $event['CalendarEvent']['location'] = $eventData['CalendarEvent']['location']; $event['CalendarEvent']['contact'] = $eventData['CalendarEvent']['contact']; $event['CalendarEvent']['description'] = $eventData['CalendarEvent']['description']; diff --git a/Model/CalendarActionPlan.php b/Model/CalendarActionPlan.php index f6900e0..4463f9a 100644 --- a/Model/CalendarActionPlan.php +++ b/Model/CalendarActionPlan.php @@ -173,6 +173,9 @@ class CalendarActionPlan extends CalendarsAppModel { 'detail_end_datetime' => array( 'type' => 'string', 'default' => ''), //YYYY-MM-DD or YYYY-MM-DD hh:mm + 'target_person' => ['type' => 'string', 'default' => ''], + 'belongings' => ['type' => 'string', 'default' => ''], + //公開対象 'plan_room_id' => array( 'type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), @@ -649,6 +652,7 @@ public function convertToPlanParamFormat($data) { 'title', 'title_icon', //FIXME: insert/update側に追加実装しないといけない項目 'location', 'contact', 'description', 'enable_email', 'email_send_timing', 'status', + 'target_person', 'belongings' ); foreach ($fields as $field) { $planParam[$field] = $data[$this->alias][$field]; diff --git a/Utility/CalendarSupport.php b/Utility/CalendarSupport.php index 3956ef2..e8dedac 100644 --- a/Utility/CalendarSupport.php +++ b/Utility/CalendarSupport.php @@ -281,6 +281,8 @@ public function getInitialCalendarActionPlanForView($year, $month, $day, 'edit_rrule' => 0, 'title' => '', 'title_icon' => '', + 'target_person' => '', + 'belongings' => '', 'enable_time' => $enableTime, //YYYY-MM-DD hh:mm 'detail_start_datetime' => @@ -412,6 +414,9 @@ private function __makeCapForViewSubset($event, $userStartDatetime, $userEndDate 'edit_rrule' => 0, //tableにはない項目なのでinitと同じ値 'title' => $event['CalendarEvent']['title'], 'title_icon' => $event['CalendarEvent']['title_icon'], + 'target_person' => $event['CalendarEvent']['target_person'], + 'belongings' => $event['CalendarEvent']['belongings'], + 'enable_time' => ($event['CalendarEvent']['is_allday']) ? 0 : 1, 'easy_start_date' => substr($userStartDatetime, 0, 10), //YYYY-MM-DD 'easy_hour_minute_from' => substr($userStartDatetime, 11, 5), //hh:mm diff --git a/View/CalendarPlans/detail_edit.ctp b/View/CalendarPlans/detail_edit.ctp index 1fecd5a..1e50c47 100644 --- a/View/CalendarPlans/detail_edit.ctp +++ b/View/CalendarPlans/detail_edit.ctp @@ -130,6 +130,23 @@ $jsParameters = array( +
+ NetCommonsForm->input('CalendarActionPlan.target_person', [ + 'label' => __d('calendars', 'Target Person'), + 'div' => [ + 'class' => 'col-xs-12' + ] + ]);?> +
+
+ NetCommonsForm->input('CalendarActionPlan.belongings', [ + 'label' => __d('calendars', 'Belongings'), + 'div' => [ + 'class' => 'col-xs-12' + ] + ]);?> +
+
diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 44fb8b4..e894b51 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -79,6 +79,22 @@ echo $this->element('Calendars.scripts');
+ +
+

+

+ +

+
+ + +
+

+

+ +

+
+

From 54eeef43b421a5c99eb02f295efd1f9036fcf08e Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 10:49:02 +0900 Subject: [PATCH 03/27] =?UTF-8?q?change:=20=E8=A9=B3=E7=B4=B0=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=A7=E6=97=A5=E6=99=82=E3=81=AE=E6=AC=A1=E3=81=AB?= =?UTF-8?q?=E5=A0=B4=E6=89=80=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/CalendarPlans/view.ctp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index e894b51..5052814 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -79,6 +79,13 @@ echo $this->element('Calendars.scripts');
+ +
+

+

+
+ +

@@ -109,13 +116,6 @@ echo $this->element('Calendars.scripts');
- -
-

-

-
- -

From 552dcbffcb5e0634a08df2ab75ab32ff86f5248e Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 10:49:37 +0900 Subject: [PATCH 04/27] =?UTF-8?q?change:=20=E7=B7=A8=E9=9B=86=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=A7=E6=97=A5=E6=99=82=E3=81=AE=E6=AC=A1=E3=81=AB?= =?UTF-8?q?=E5=A0=B4=E6=89=80=E3=81=AE=E5=85=A5=E5=8A=9B=E6=AC=84=E3=81=8C?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/CalendarPlans/detail_edit.ctp | 13 +++++++++++++ .../CalendarPlans/detail_edit_etc_details.ctp | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/View/CalendarPlans/detail_edit.ctp b/View/CalendarPlans/detail_edit.ctp index 1e50c47..eaad918 100644 --- a/View/CalendarPlans/detail_edit.ctp +++ b/View/CalendarPlans/detail_edit.ctp @@ -130,6 +130,18 @@ $jsParameters = array(
+ +
+
+ NetCommonsForm->input('CalendarActionPlan.location', array( + 'type' => 'text', + 'label' => __d('calendars', 'Location'), + 'div' => false, + )); ?> +
+
+ +
NetCommonsForm->input('CalendarActionPlan.target_person', [ 'label' => __d('calendars', 'Target Person'), @@ -138,6 +150,7 @@ $jsParameters = array( ] ]);?>
+
NetCommonsForm->input('CalendarActionPlan.belongings', [ 'label' => __d('calendars', 'Belongings'), diff --git a/View/Elements/CalendarPlans/detail_edit_etc_details.ctp b/View/Elements/CalendarPlans/detail_edit_etc_details.ctp index 872fa8a..5cfb44d 100644 --- a/View/Elements/CalendarPlans/detail_edit_etc_details.ctp +++ b/View/Elements/CalendarPlans/detail_edit_etc_details.ctp @@ -17,16 +17,6 @@
- -
-
- NetCommonsForm->input('CalendarActionPlan.location', array( - 'type' => 'text', - 'label' => __d('calendars', 'Location'), - 'div' => false, - )); ?> -
-
From 01f18bd4f89dff28f32a81f11bb0a1e178cda904 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 11:13:51 +0900 Subject: [PATCH 05/27] =?UTF-8?q?change:=20=E5=A0=B4=E6=89=80=E3=81=A8?= =?UTF-8?q?=E5=AF=BE=E8=B1=A1=E8=80=85=E3=82=92=E5=85=A5=E5=8A=9B=E5=BF=85?= =?UTF-8?q?=E9=A0=88=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/jpn/LC_MESSAGES/calendars.po | 8 ++++++- Model/CalendarActionPlan.php | 34 +++++++++++++++++++++++++++++ View/CalendarPlans/detail_edit.ctp | 4 +++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Locale/jpn/LC_MESSAGES/calendars.po b/Locale/jpn/LC_MESSAGES/calendars.po index a4f0734..4c8a963 100644 --- a/Locale/jpn/LC_MESSAGES/calendars.po +++ b/Locale/jpn/LC_MESSAGES/calendars.po @@ -1221,4 +1221,10 @@ msgid "Target Person" msgstr "対象者" msgid "Belongings" -msgstr "持ち物" \ No newline at end of file +msgstr "持ち物" + +msgid "%d character limited. (target person)" +msgstr "対象者は最大 %d 文字です。" + +msgid "%d character limited. (belongings)" +msgstr "持ち物は最大 %d 文字です。" diff --git a/Model/CalendarActionPlan.php b/Model/CalendarActionPlan.php index 4463f9a..2ed1cb5 100644 --- a/Model/CalendarActionPlan.php +++ b/Model/CalendarActionPlan.php @@ -456,6 +456,40 @@ public function beforeValidate($options = array()) { 'message' => sprintf(__d('calendars', '%d character limited. (location)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), ), + 'notBlank' => [ + 'rule' => ['notBlank'], + 'required' => true, + 'message' => __d('net_commons', 'Please input %s.', + __d('calendars', 'Location')) + ] + ), + 'target_person' => array( + 'max_length' => array( + 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + 'required' => false, + 'message' => sprintf(__d('calendars', + '%d character limited. (target person)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + ), + 'notBlank' => [ + 'rule' => ['notBlank'], + 'required' => true, + 'message' => __d('net_commons', 'Please input %s.', + __d('calendars', 'Target Person')) + ] + ), + 'belongings' => array( + 'max_length' => array( + 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + 'required' => false, + 'message' => sprintf(__d('calendars', + '%d character limited. (belongings)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + ), + 'notBlank' => [ + 'rule' => ['notBlank'], + 'required' => true, + 'message' => __d('net_commons', 'Please input %s.', + __d('calendars', 'Target Person')) + ] ), 'contact' => array( 'rule1' => array( diff --git a/View/CalendarPlans/detail_edit.ctp b/View/CalendarPlans/detail_edit.ctp index eaad918..bd1cd8b 100644 --- a/View/CalendarPlans/detail_edit.ctp +++ b/View/CalendarPlans/detail_edit.ctp @@ -137,6 +137,7 @@ $jsParameters = array( 'type' => 'text', 'label' => __d('calendars', 'Location'), 'div' => false, + 'required' => true )); ?>
@@ -147,7 +148,8 @@ $jsParameters = array( 'label' => __d('calendars', 'Target Person'), 'div' => [ 'class' => 'col-xs-12' - ] + ], + 'required' => true ]);?> From e92aff0d70fca4d2edd7fe1a416bae901aa6af8e Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 14 Jul 2019 11:21:07 +0900 Subject: [PATCH 06/27] =?UTF-8?q?change:=20=E5=85=AC=E9=96=8B=E7=AF=84?= =?UTF-8?q?=E5=9B=B2=E3=81=AF=E9=81=B8=E6=8A=9E=E4=B8=8D=E5=8F=AF=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=A6=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/CalendarPlans/view.ctp | 2 ++ View/Helper/CalendarExposeTargetHelper.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 5052814..4b582d8 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -103,10 +103,12 @@ echo $this->element('Calendars.scripts'); +

CalendarCategory->getCategoryName($vars, $event); ?>

+ CalendarShareUsers->isShareEvent($event)): ?> diff --git a/View/Helper/CalendarExposeTargetHelper.php b/View/Helper/CalendarExposeTargetHelper.php index 4dbce24..c37a9e1 100644 --- a/View/Helper/CalendarExposeTargetHelper.php +++ b/View/Helper/CalendarExposeTargetHelper.php @@ -82,6 +82,9 @@ public function makeSelectExposeTargetHtml($event, $frameId, $vars, $options, $m $rooms = CalendarPermissiveRooms::getCreatableRoomIdList(); $targetRooms = array_intersect_key($options, $rooms); + $html = $this->NetCommonsForm->hidden('CalendarActionPlan.plan_room_id'); + return $html; + $html = $this->NetCommonsForm->label( 'CalendarActionPlan.plan_room_id' . Inflector::camelize('room_id'), __d('calendars', 'Category') . $this->_View->element('NetCommons.required')); From 6574d79bcfa6d961603cfd45453e396f99f973d3 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Mon, 15 Jul 2019 14:13:38 +0900 Subject: [PATCH 07/27] =?UTF-8?q?Revert=20"change:=20=E5=A0=B4=E6=89=80?= =?UTF-8?q?=E3=81=A8=E5=AF=BE=E8=B1=A1=E8=80=85=E3=82=92=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E5=BF=85=E9=A0=88=E3=81=AB=E5=A4=89=E6=9B=B4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 01f18bd4f89dff28f32a81f11bb0a1e178cda904. --- Locale/jpn/LC_MESSAGES/calendars.po | 8 +------ Model/CalendarActionPlan.php | 34 ----------------------------- View/CalendarPlans/detail_edit.ctp | 4 +--- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/Locale/jpn/LC_MESSAGES/calendars.po b/Locale/jpn/LC_MESSAGES/calendars.po index 4c8a963..a4f0734 100644 --- a/Locale/jpn/LC_MESSAGES/calendars.po +++ b/Locale/jpn/LC_MESSAGES/calendars.po @@ -1221,10 +1221,4 @@ msgid "Target Person" msgstr "対象者" msgid "Belongings" -msgstr "持ち物" - -msgid "%d character limited. (target person)" -msgstr "対象者は最大 %d 文字です。" - -msgid "%d character limited. (belongings)" -msgstr "持ち物は最大 %d 文字です。" +msgstr "持ち物" \ No newline at end of file diff --git a/Model/CalendarActionPlan.php b/Model/CalendarActionPlan.php index 2ed1cb5..4463f9a 100644 --- a/Model/CalendarActionPlan.php +++ b/Model/CalendarActionPlan.php @@ -456,40 +456,6 @@ public function beforeValidate($options = array()) { 'message' => sprintf(__d('calendars', '%d character limited. (location)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), ), - 'notBlank' => [ - 'rule' => ['notBlank'], - 'required' => true, - 'message' => __d('net_commons', 'Please input %s.', - __d('calendars', 'Location')) - ] - ), - 'target_person' => array( - 'max_length' => array( - 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), - 'required' => false, - 'message' => sprintf(__d('calendars', - '%d character limited. (target person)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), - ), - 'notBlank' => [ - 'rule' => ['notBlank'], - 'required' => true, - 'message' => __d('net_commons', 'Please input %s.', - __d('calendars', 'Target Person')) - ] - ), - 'belongings' => array( - 'max_length' => array( - 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), - 'required' => false, - 'message' => sprintf(__d('calendars', - '%d character limited. (belongings)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), - ), - 'notBlank' => [ - 'rule' => ['notBlank'], - 'required' => true, - 'message' => __d('net_commons', 'Please input %s.', - __d('calendars', 'Target Person')) - ] ), 'contact' => array( 'rule1' => array( diff --git a/View/CalendarPlans/detail_edit.ctp b/View/CalendarPlans/detail_edit.ctp index bd1cd8b..eaad918 100644 --- a/View/CalendarPlans/detail_edit.ctp +++ b/View/CalendarPlans/detail_edit.ctp @@ -137,7 +137,6 @@ $jsParameters = array( 'type' => 'text', 'label' => __d('calendars', 'Location'), 'div' => false, - 'required' => true )); ?> @@ -148,8 +147,7 @@ $jsParameters = array( 'label' => __d('calendars', 'Target Person'), 'div' => [ 'class' => 'col-xs-12' - ], - 'required' => true + ] ]);?> From 88a38239e75c0130e4b375a5bc5335f35804f7ba Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Mon, 15 Jul 2019 14:29:17 +0900 Subject: [PATCH 08/27] =?UTF-8?q?change:=20event=E3=82=AB=E3=83=A9?= =?UTF-8?q?=E3=83=A0=E5=A4=89=E6=9B=B4=E3=80=82target=5Fperson=E3=82=92tar?= =?UTF-8?q?get=5Fperson=5Fgrade=E3=81=AB=E3=80=82target=5Fperson=5Fclass?= =?UTF-8?q?=5Froom=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ter_event_change_target_person_columns.php | 59 +++++++++++++++++++ Config/Schema/schema.php | 3 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Config/Migration/1563168303_alter_event_change_target_person_columns.php diff --git a/Config/Migration/1563168303_alter_event_change_target_person_columns.php b/Config/Migration/1563168303_alter_event_change_target_person_columns.php new file mode 100644 index 0000000..1b09a03 --- /dev/null +++ b/Config/Migration/1563168303_alter_event_change_target_person_columns.php @@ -0,0 +1,59 @@ + array( + 'create_field' => array( + 'calendar_events' => array( + 'target_person_grade' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8', 'after' => 'location'), + 'target_person_class_room' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'target_person_grade'), + ), + ), + 'drop_field' => array( + 'calendar_events' => array('target_person'), + ), + ), + 'down' => array( + 'drop_field' => array( + 'calendar_events' => array('target_person_grade', 'target_person_class_room'), + ), + 'create_field' => array( + 'calendar_events' => array( + 'target_person' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8'), + ), + ), + ), + ); + +/** + * 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 e74cf2f..a5f5e6c 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -101,7 +101,8 @@ public function after($event = array()) { 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル', 'charset' => 'utf8'), 'title_icon' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル アイコン', 'charset' => 'utf8'), 'location' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '場所', 'charset' => 'utf8'), - 'target_person' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8'), + 'target_person_grade' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '対象者(テキスト)', 'charset' => 'utf8'), + 'target_person_class_room' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'belongings' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '持ち物', 'charset' => 'utf8'), 'contact' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '連絡先', 'charset' => 'utf8'), 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '詳細', 'charset' => 'utf8'), From 8d64d9a9b2614f0de0b3defe2143f27a3ce55956 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Mon, 15 Jul 2019 15:10:00 +0900 Subject: [PATCH 09/27] =?UTF-8?q?change:=20=E5=AF=BE=E8=B1=A1=E8=80=85?= =?UTF-8?q?=E3=82=92=E5=AD=A6=E5=B9=B4=E3=81=A8=E3=82=AF=E3=83=A9=E3=82=B9?= =?UTF-8?q?=E3=81=AB=E5=88=86=E5=89=B2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/jpn/LC_MESSAGES/calendars.po | 17 +++++++- Model/Behavior/CalendarAppBehavior.php | 9 +++-- Model/Behavior/CalendarUpdatePlanBehavior.php | 3 +- Model/CalendarActionPlan.php | 29 +++++++++++++- Utility/CalendarSupport.php | 6 ++- View/CalendarPlans/detail_edit.ctp | 25 +++++++++--- View/CalendarPlans/view.ctp | 40 ++++++++++--------- 7 files changed, 96 insertions(+), 33 deletions(-) diff --git a/Locale/jpn/LC_MESSAGES/calendars.po b/Locale/jpn/LC_MESSAGES/calendars.po index a4f0734..6f46255 100644 --- a/Locale/jpn/LC_MESSAGES/calendars.po +++ b/Locale/jpn/LC_MESSAGES/calendars.po @@ -1220,5 +1220,20 @@ msgstr "予定の共有者を設定する権限がありません。" msgid "Target Person" msgstr "対象者" +msgid "Grade" +msgstr "学年" + +msgid "Class room" +msgstr "クラス" + msgid "Belongings" -msgstr "持ち物" \ No newline at end of file +msgstr "持ち物" + +msgid "%d character limited. (grade)" +msgstr "学年は最大 %d 文字です。" + +msgid "%d character limited. (class room)" +msgstr "クラスは最大 %d 文字です。" + +msgid "%d character limited. (belongings)" +msgstr "持ち物は最大 %d 文字です。" diff --git a/Model/Behavior/CalendarAppBehavior.php b/Model/Behavior/CalendarAppBehavior.php index 44b1feb..4da9490 100644 --- a/Model/Behavior/CalendarAppBehavior.php +++ b/Model/Behavior/CalendarAppBehavior.php @@ -381,7 +381,8 @@ public function setPlanParams2Params(&$planParams, &$params) { $keys = array( 'title', 'title_icon', - 'target_person', + 'target_person_grade', + 'target_person_class_room', 'belongings', 'location', 'contact', @@ -423,7 +424,8 @@ public function setEventData($planParams, $rruleData, &$eventData) { 'target_user' => Current::read('User.id'), 'title' => '', 'title_icon' => '', - 'target_person' => '', + 'target_person_grade' => '', + 'target_person_class_room' => '', 'belongings' => '', 'location' => '', 'contact' => '', @@ -458,7 +460,8 @@ public function setEventData($planParams, $rruleData, &$eventData) { $eventData['CalendarEvent']['target_user'] = $params['target_user']; $eventData['CalendarEvent']['title'] = $params['title']; $eventData['CalendarEvent']['title_icon'] = $params['title_icon']; - $eventData['CalendarEvent']['target_person'] = $params['target_person']; + $eventData['CalendarEvent']['target_person_grade'] = $params['target_person_grade']; + $eventData['CalendarEvent']['target_person_class_room'] = $params['target_person_class_room']; $eventData['CalendarEvent']['belongings'] = $params['belongings']; $eventData['CalendarEvent']['is_allday'] = $params['is_allday']; $eventData['CalendarEvent']['start_date'] = $params['start_date']; diff --git a/Model/Behavior/CalendarUpdatePlanBehavior.php b/Model/Behavior/CalendarUpdatePlanBehavior.php index 100ad37..7d67c93 100644 --- a/Model/Behavior/CalendarUpdatePlanBehavior.php +++ b/Model/Behavior/CalendarUpdatePlanBehavior.php @@ -719,7 +719,8 @@ private function __getEventDataForUpdateAllOrAfter($event, $eventData, $status) //タイトル、場所、連絡先、詳細は編集画面の値を使う $event['CalendarEvent']['title'] = $eventData['CalendarEvent']['title']; $event['CalendarEvent']['title_icon'] = $eventData['CalendarEvent']['title_icon']; - $event['CalendarEvent']['target_person'] = $eventData['CalendarEvent']['target_person']; + $event['CalendarEvent']['target_person_grade'] = $eventData['CalendarEvent']['target_person_grade']; + $event['CalendarEvent']['target_person_class_room'] = $eventData['CalendarEvent']['target_person_class_room']; $event['CalendarEvent']['belongings'] = $eventData['CalendarEvent']['belongings']; $event['CalendarEvent']['location'] = $eventData['CalendarEvent']['location']; diff --git a/Model/CalendarActionPlan.php b/Model/CalendarActionPlan.php index 4463f9a..b7b4926 100644 --- a/Model/CalendarActionPlan.php +++ b/Model/CalendarActionPlan.php @@ -173,7 +173,8 @@ class CalendarActionPlan extends CalendarsAppModel { 'detail_end_datetime' => array( 'type' => 'string', 'default' => ''), //YYYY-MM-DD or YYYY-MM-DD hh:mm - 'target_person' => ['type' => 'string', 'default' => ''], + 'target_person_grade' => ['type' => 'string', 'default' => ''], + 'target_person_class_room' => ['type' => 'string', 'default' => ''], 'belongings' => ['type' => 'string', 'default' => ''], //公開対象 @@ -457,6 +458,30 @@ public function beforeValidate($options = array()) { '%d character limited. (location)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), ), ), + 'target_person_grade' => array( + 'max_length' => array( + 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + 'required' => false, + 'message' => sprintf(__d('calendars', + '%d character limited. (grade)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + ), + ), + 'target_person_class_room' => array( + 'max_length' => array( + 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + 'required' => false, + 'message' => sprintf(__d('calendars', + '%d character limited. (class room)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + ), + ), + 'belongings' => array( + 'max_length' => array( + 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + 'required' => false, + 'message' => sprintf(__d('calendars', + '%d character limited. (belongings)'), CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), + ), + ), 'contact' => array( 'rule1' => array( 'rule' => array('maxLength', CalendarsComponent::CALENDAR_VALIDATOR_TITLE_LEN), @@ -652,7 +677,7 @@ public function convertToPlanParamFormat($data) { 'title', 'title_icon', //FIXME: insert/update側に追加実装しないといけない項目 'location', 'contact', 'description', 'enable_email', 'email_send_timing', 'status', - 'target_person', 'belongings' + 'target_person_grade', 'target_person_class_room', 'belongings' ); foreach ($fields as $field) { $planParam[$field] = $data[$this->alias][$field]; diff --git a/Utility/CalendarSupport.php b/Utility/CalendarSupport.php index e8dedac..678a9fa 100644 --- a/Utility/CalendarSupport.php +++ b/Utility/CalendarSupport.php @@ -281,7 +281,8 @@ public function getInitialCalendarActionPlanForView($year, $month, $day, 'edit_rrule' => 0, 'title' => '', 'title_icon' => '', - 'target_person' => '', + 'target_person_grade' => '', + 'target_person_class_room' => '', 'belongings' => '', 'enable_time' => $enableTime, //YYYY-MM-DD hh:mm @@ -414,7 +415,8 @@ private function __makeCapForViewSubset($event, $userStartDatetime, $userEndDate 'edit_rrule' => 0, //tableにはない項目なのでinitと同じ値 'title' => $event['CalendarEvent']['title'], 'title_icon' => $event['CalendarEvent']['title_icon'], - 'target_person' => $event['CalendarEvent']['target_person'], + 'target_person_grade' => $event['CalendarEvent']['target_person_grade'], + 'target_person_class_room' => $event['CalendarEvent']['target_person_class_room'], 'belongings' => $event['CalendarEvent']['belongings'], 'enable_time' => ($event['CalendarEvent']['is_allday']) ? 0 : 1, diff --git a/View/CalendarPlans/detail_edit.ctp b/View/CalendarPlans/detail_edit.ctp index eaad918..84d4d7c 100644 --- a/View/CalendarPlans/detail_edit.ctp +++ b/View/CalendarPlans/detail_edit.ctp @@ -143,12 +143,25 @@ $jsParameters = array(
- NetCommonsForm->input('CalendarActionPlan.target_person', [ - 'label' => __d('calendars', 'Target Person'), - 'div' => [ - 'class' => 'col-xs-12' - ] - ]);?> +
+ NetCommonsForm->label(null, __d('calendars', 'Target Person'));?> +
+ NetCommonsForm->input('CalendarActionPlan.target_person_grade', [ + 'label' => false, + 'placeholder' => __d('calendars', 'Grade'), + 'div' => [ + 'class' => 'col-xs-6' + ] + ]);?> + NetCommonsForm->input('CalendarActionPlan.target_person_class_room', [ + 'label' => false, + 'placeholder' => __d('calendars', 'Class room'), + 'div' => [ + 'class' => 'col-xs-6' + ] + ]);?> +
+
diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 4b582d8..887c437 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -87,27 +87,31 @@ echo $this->element('Calendars.scripts'); -
-

-

- -

-
+ +
+

+

+ +

+
+ -
-

-

- -

-
- - + +
+

+

+ +

+
+ + + -
-

-

CalendarCategory->getCategoryName($vars, $event); ?>

-
+
+

+

CalendarCategory->getCategoryName($vars, $event); ?>

+
From d6afeaa681ae8e35884f598dfbafd26ce232e83a Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 10 Aug 2019 11:58:25 +0900 Subject: [PATCH 10/27] =?UTF-8?q?add:=20=E5=AE=9F=E7=B8=BE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=83=9C=E3=82=BF=E3=83=B3=E8=A8=AD=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_blog.php | 5 +++++ View/Helper/CalendarButtonHelper.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Config/related_blog.php diff --git a/Config/related_blog.php b/Config/related_blog.php new file mode 100644 index 0000000..896d81a --- /dev/null +++ b/Config/related_blog.php @@ -0,0 +1,5 @@ + 20 +]; \ No newline at end of file diff --git a/View/Helper/CalendarButtonHelper.php b/View/Helper/CalendarButtonHelper.php index 1dfa745..4832520 100644 --- a/View/Helper/CalendarButtonHelper.php +++ b/View/Helper/CalendarButtonHelper.php @@ -208,6 +208,20 @@ public function getEditButton($vars, $event) { 'day' => $vars['day'], ) )); + // 実績の追加ボタン + Configure::load('Calendars.related_blog'); + $blogFrameId = Configure::read('Calendars.relatedBlog.frame_id'); + $html .= ' '; + $html .= $this->LinkButton->add('実績の追加', array( + 'plugin' => 'blogs', + 'controller' => 'blog_entries_edit', + 'action' => 'add', + 'frame_id' => $blogFrameId, + '?' => [ + 'event_key' => $event['CalendarEvent']['key'] + ] + )); + return $html; } From e9ec38261508f0ff6b9f25b9843b3e8bb1393078 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 11 Aug 2019 14:27:38 +0900 Subject: [PATCH 11/27] =?UTF-8?q?change:=20=E3=83=96=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E8=A8=98=E4=BA=8B=E3=81=8C=E3=81=82=E3=82=8C=E3=81=B0=E5=AE=9F?= =?UTF-8?q?=E7=B8=BE=E8=BF=BD=E5=8A=A0=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92?= =?UTF-8?q?=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=81=AB=E3=81=97=E3=81=A6=E3=80=81?= =?UTF-8?q?=E8=A8=98=E4=BA=8B=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF?= =?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 --- View/CalendarPlans/view.ctp | 55 ++++++++++++++++++++++++++++ View/Helper/CalendarButtonHelper.php | 13 ------- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 887c437..fc4822c 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -8,6 +8,13 @@ * @license http://www.netcommons.org/license.txt NetCommons License * @copyright Copyright 2014, NetCommons Project */ + +/** @var BlogEntry $blogEntryModel */ +$blogEntryModel = ClassRegistry::init('Blogs.BlogEntry'); +$blogEntry = $blogEntryModel->getByCalendarEventKey($event['CalendarEvent']['key']); +Configure::load('Calendars.related_blog'); +$blogFrameId = Configure::read('Calendars.relatedBlog.frame_id'); + echo $this->element('Calendars.scripts'); ?> @@ -37,6 +44,32 @@ echo $this->element('Calendars.scripts');
CalendarButton->getEditButton($vars, $event);?> + + LinkButton->add('実績の追加', array( + 'plugin' => 'blogs', + 'controller' => 'blog_entries_edit', + 'action' => 'add', + 'frame_id' => $blogFrameId, + '?' => [ + 'event_key' => $event['CalendarEvent']['key'] + ] + )); + } + } + ?> + +
@@ -137,6 +170,7 @@ echo $this->element('Calendars.scripts');
+

DisplayUser->handleLink($event, array('avatar' => true)); ?>

@@ -153,6 +187,27 @@ echo $this->element('Calendars.scripts');

CalendarLink->getSourceLink($vars, $event); ?>

+ + +
+ NetCommonsHtml->link( + h($blogEntry['BlogEntry']['title']), + [ + 'plugin' => 'blogs', + 'controller' => 'blog_entries', + 'action' => 'view', + 'block_id' => $blogEntry['BlogEntry']['block_id'], + 'key' => $blogEntry['BlogEntry']['key'], + 'frame_id' => $blogFrameId + + ], + [ + 'class' => ['btn', 'btn-default', 'btn-lg'] + ] + ); ?> +
+ + diff --git a/View/Helper/CalendarButtonHelper.php b/View/Helper/CalendarButtonHelper.php index 4832520..991b97b 100644 --- a/View/Helper/CalendarButtonHelper.php +++ b/View/Helper/CalendarButtonHelper.php @@ -208,19 +208,6 @@ public function getEditButton($vars, $event) { 'day' => $vars['day'], ) )); - // 実績の追加ボタン - Configure::load('Calendars.related_blog'); - $blogFrameId = Configure::read('Calendars.relatedBlog.frame_id'); - $html .= ' '; - $html .= $this->LinkButton->add('実績の追加', array( - 'plugin' => 'blogs', - 'controller' => 'blog_entries_edit', - 'action' => 'add', - 'frame_id' => $blogFrameId, - '?' => [ - 'event_key' => $event['CalendarEvent']['key'] - ] - )); return $html; } From 38aff089cfaefedaa3b87f2dde790f918c7f917a Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 10:27:07 +0900 Subject: [PATCH 12/27] =?UTF-8?q?change:=20=E6=A8=A9=E9=99=90=E3=81=8C?= =?UTF-8?q?=E3=81=82=E3=82=8C=E3=81=B0=E3=80=81=E3=82=A4=E3=83=99=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=AB=E5=B8=B8=E3=81=AB=E3=80=8C=E5=AE=9F=E7=B8=BE?= =?UTF-8?q?=E3=81=AE=E8=BF=BD=E5=8A=A0=E3=80=8D=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=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/CalendarPlans/view.ctp | 38 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index fc4822c..89ec6f9 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -46,26 +46,24 @@ echo $this->element('Calendars.scripts'); CalendarButton->getEditButton($vars, $event);?> LinkButton->add('実績の追加', array( - 'plugin' => 'blogs', - 'controller' => 'blog_entries_edit', - 'action' => 'add', - 'frame_id' => $blogFrameId, - '?' => [ - 'event_key' => $event['CalendarEvent']['key'] - ] - )); - } + $roomId = $event['CalendarEvent']['room_id']; + // それ以外の時 + $canEdit = CalendarPermissiveRooms::isEditable($roomId); + $canCreate = CalendarPermissiveRooms::isCreatable($roomId); + // 表示ルームにおける自分の権限がeditable以上なら無条件に編集可能 + // creatbleのとき=自分が作ったデータならOK + if ($canEdit || + ($canCreate && $event['CalendarEvent']['created_user'] == Current::read('User.id'))) { + // 実績の追加ボタン + echo $this->LinkButton->add('実績の追加', array( + 'plugin' => 'blogs', + 'controller' => 'blog_entries_edit', + 'action' => 'add', + 'frame_id' => $blogFrameId, + '?' => [ + 'event_key' => $event['CalendarEvent']['key'] + ] + )); } ?> From 5d5d1e13f01b9b7997a0019354c8609280eae9ed Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 17 Aug 2019 10:30:56 +0900 Subject: [PATCH 13/27] =?UTF-8?q?change:=20=E3=83=96=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AE=E9=80=A3=E6=90=BA=E3=81=AFblock=5Fid=E3=82=92?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=80=82=E3=83=96=E3=83=AD=E3=82=B0=E8=A8=98?= =?UTF-8?q?=E4=BA=8B=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=AF?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_blog.php | 2 +- View/CalendarPlans/view.ctp | 47 +++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Config/related_blog.php b/Config/related_blog.php index 896d81a..9b0ba97 100644 --- a/Config/related_blog.php +++ b/Config/related_blog.php @@ -1,5 +1,5 @@ 20 + 'block_id' => 13 ]; \ No newline at end of file diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 89ec6f9..788fbf4 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -10,10 +10,10 @@ */ /** @var BlogEntry $blogEntryModel */ -$blogEntryModel = ClassRegistry::init('Blogs.BlogEntry'); -$blogEntry = $blogEntryModel->getByCalendarEventKey($event['CalendarEvent']['key']); +//$blogEntryModel = ClassRegistry::init('Blogs.BlogEntry'); +//$blogEntry = $blogEntryModel->getByCalendarEventKey($event['CalendarEvent']['key']); Configure::load('Calendars.related_blog'); -$blogFrameId = Configure::read('Calendars.relatedBlog.frame_id'); +$blogBlockId = Configure::read('Calendars.relatedBlog.block_id'); echo $this->element('Calendars.scripts'); ?> @@ -59,8 +59,9 @@ echo $this->element('Calendars.scripts'); 'plugin' => 'blogs', 'controller' => 'blog_entries_edit', 'action' => 'add', - 'frame_id' => $blogFrameId, + 'block_id' => $blogBlockId, '?' => [ + 'page_id' => Current::read('Page.id'), 'event_key' => $event['CalendarEvent']['key'] ] )); @@ -186,25 +187,25 @@ echo $this->element('Calendars.scripts'); - -
- NetCommonsHtml->link( - h($blogEntry['BlogEntry']['title']), - [ - 'plugin' => 'blogs', - 'controller' => 'blog_entries', - 'action' => 'view', - 'block_id' => $blogEntry['BlogEntry']['block_id'], - 'key' => $blogEntry['BlogEntry']['key'], - 'frame_id' => $blogFrameId - - ], - [ - 'class' => ['btn', 'btn-default', 'btn-lg'] - ] - ); ?> -
- + + + NetCommonsHtml->link( + // h($blogEntry['BlogEntry']['title']), + // [ + // 'plugin' => 'blogs', + // 'controller' => 'blog_entries', + // 'action' => 'view', + // 'block_id' => $blogEntry['BlogEntry']['block_id'], + // 'key' => $blogEntry['BlogEntry']['key'], + // 'frame_id' => $blogFrameId + // + // ], + // [ + // 'class' => ['btn', 'btn-default', 'btn-lg'] + // ] + // ); ?> + + From 55348719ba9d3437387f59419cb70c74434f9d15 Mon Sep 17 00:00:00 2001 From: Shohei Nakajima Date: Mon, 19 Aug 2019 14:48:55 +0900 Subject: [PATCH 14/27] =?UTF-8?q?fix:=20=E6=9C=80=E6=96=B0=E3=81=A0?= =?UTF-8?q?=E3=81=A8=E5=AD=A6=E6=A0=A1=E3=83=96=E3=83=AD=E3=82=B0=E3=81=AE?= =?UTF-8?q?block=5Fid=E3=81=AF11=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/related_blog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config/related_blog.php b/Config/related_blog.php index 9b0ba97..f5cbd1e 100644 --- a/Config/related_blog.php +++ b/Config/related_blog.php @@ -1,5 +1,5 @@ 13 -]; \ No newline at end of file + 'block_id' => 11 +]; From 615b0e8f126cc5a358ae94ef23df6fe0e030b383 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Fri, 18 Oct 2019 09:19:18 +0900 Subject: [PATCH 15/27] =?UTF-8?q?fix:=20test:=20=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=82=AB=E3=83=A9=E3=83=A0(target=5Fperson?= =?UTF-8?q?=5Fgrade,=20target=5Fperson=5Fclass=5Froom,=20belongings)?= =?UTF-8?q?=E3=82=92=E3=83=86=E3=82=B9=E3=83=88=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/Controller/CalendarPlans/AddTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Test/Case/Controller/CalendarPlans/AddTest.php b/Test/Case/Controller/CalendarPlans/AddTest.php index 9e364e7..fc23db1 100644 --- a/Test/Case/Controller/CalendarPlans/AddTest.php +++ b/Test/Case/Controller/CalendarPlans/AddTest.php @@ -151,6 +151,10 @@ private function __getData($originEventId = '0') { 'contact' => '', 'description' => '', 'timezone_offset' => 'Asia/Tokyo', + 'target_person_grade' => '学年', + 'target_person_class_room' => 'クラス', + 'belongings' => '持ち物', + ), 'WorkflowComment' => array( 'comment' => 'WorkflowComment save test' From f0222161a48791f9aee9d42631d910c3ea20c1eb Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Fri, 18 Oct 2019 09:20:51 +0900 Subject: [PATCH 16/27] =?UTF-8?q?fix:=20test:=20=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=82=AB=E3=83=A9=E3=83=A0(target=5Fperson?= =?UTF-8?q?=5Fgrade,=20target=5Fperson=5Fclass=5Froom,=20belongings)?= =?UTF-8?q?=E3=82=92=E3=83=86=E3=82=B9=E3=83=88=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/Model/CalendarActionPlan/SaveCalendarPlanTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Test/Case/Model/CalendarActionPlan/SaveCalendarPlanTest.php b/Test/Case/Model/CalendarActionPlan/SaveCalendarPlanTest.php index 84e47ab..fe92723 100644 --- a/Test/Case/Model/CalendarActionPlan/SaveCalendarPlanTest.php +++ b/Test/Case/Model/CalendarActionPlan/SaveCalendarPlanTest.php @@ -143,6 +143,10 @@ private function __getData($blockKey = 'block_1') { 'contact' => '', 'description' => '', 'timezone_offset' => 'Asia/Tokyo', + 'target_person_grade' => '学年', + 'target_person_class_room' => 'クラス', + 'belongings' => '持ち物', + ), 'CalendarActionPlanForDisp' => array( 'detail_start_datetime' => '2016-07-28 11:00', From 6e305ba988e39d682d9e1e02b9045095564f4fa9 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Fri, 18 Oct 2019 09:28:42 +0900 Subject: [PATCH 17/27] =?UTF-8?q?fix:=20test:=20=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=82=AB=E3=83=A9=E3=83=A0(target=5Fperson?= =?UTF-8?q?=5Fgrade,=20target=5Fperson=5Fclass=5Froom,=20belongings)?= =?UTF-8?q?=E3=82=92Fixture=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/CalendarEventFixture.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Test/Fixture/CalendarEventFixture.php b/Test/Fixture/CalendarEventFixture.php index afe558d..e1b5dff 100644 --- a/Test/Fixture/CalendarEventFixture.php +++ b/Test/Fixture/CalendarEventFixture.php @@ -31,6 +31,11 @@ class CalendarEventFixture extends CakeTestFixture { 'title' => 'calendarplan1', 'title_icon' => '/net_commons/img/title_icon/10_010_new.svg', 'location' => 'Lorem ipsum dolor sit amet', + + 'target_person_grade' => '学年', + 'target_person_class_room' => 'クラス', + 'belongings' => '持ち物', + 'contact' => 'Lorem ipsum dolor sit amet', 'description' => 'testdescription', 'is_allday' => true, From d093ff179b197e9d14ba253bb847d227932cadf1 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 11:36:24 +0900 Subject: [PATCH 18/27] =?UTF-8?q?change:=20=E5=AE=9F=E7=B8=BE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=AB=E4=BD=BF=E3=81=86=E3=83=96=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AE=E6=8C=87=E5=AE=9A=E3=81=AFBlog.key=E3=81=A7=E8=A1=8C?= =?UTF-8?q?=E3=81=86=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4=E3=80=82?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=81=95=E3=82=8C=E3=81=9F=E3=83=96=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=81=8C=E8=A6=8B=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=91=E3=82=8C=E3=81=B0=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=83=9C=E3=82=BF=E3=83=B3=E3=81=AF?= =?UTF-8?q?=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=81=A8=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_blog.php | 2 +- View/CalendarPlans/view.ctp | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Config/related_blog.php b/Config/related_blog.php index f5cbd1e..21b15b3 100644 --- a/Config/related_blog.php +++ b/Config/related_blog.php @@ -1,5 +1,5 @@ 11 + 'key' => 'school_blog' ]; diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 788fbf4..3f5e9e4 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -13,7 +13,14 @@ //$blogEntryModel = ClassRegistry::init('Blogs.BlogEntry'); //$blogEntry = $blogEntryModel->getByCalendarEventKey($event['CalendarEvent']['key']); Configure::load('Calendars.related_blog'); -$blogBlockId = Configure::read('Calendars.relatedBlog.block_id'); +$blogKey = Configure::read('Calendars.relatedBlog.key'); +/** @var Blog $blogModel */ +$blogModel = ClassRegistry::init('Blogs.Blog'); +$blogBlockId = null; +if ($blogKey) { + $blogBlockId = $blogModel->findBlockIdByKey($blogKey); +} +//$blogBlockId = Configure::read('Calendars.relatedBlog.block_id'); echo $this->element('Calendars.scripts'); ?> @@ -54,17 +61,19 @@ echo $this->element('Calendars.scripts'); // creatbleのとき=自分が作ったデータならOK if ($canEdit || ($canCreate && $event['CalendarEvent']['created_user'] == Current::read('User.id'))) { - // 実績の追加ボタン - echo $this->LinkButton->add('実績の追加', array( - 'plugin' => 'blogs', - 'controller' => 'blog_entries_edit', - 'action' => 'add', - 'block_id' => $blogBlockId, - '?' => [ - 'page_id' => Current::read('Page.id'), - 'event_key' => $event['CalendarEvent']['key'] - ] - )); + if ($blogBlockId !== null) { + // 実績の追加ボタン + echo $this->LinkButton->add('実績の追加', array( + 'plugin' => 'blogs', + 'controller' => 'blog_entries_edit', + 'action' => 'add', + 'block_id' => $blogBlockId, + '?' => [ + 'page_id' => Current::read('Page.id'), + 'event_key' => $event['CalendarEvent']['key'] + ] + )); + } } ?> From e914c9e51134b2feabb4f149a1f2c660c1107776 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 14:01:43 +0900 Subject: [PATCH 19/27] =?UTF-8?q?refactor:=20=E5=AE=9F=E7=B8=BE=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E3=83=98?= =?UTF-8?q?=E3=83=AB=E3=83=91=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/jpn/LC_MESSAGES/calendars.po | 3 + View/CalendarPlans/view.ctp | 36 +----------- View/Helper/CalendarRelatedBlogHelper.php | 69 +++++++++++++++++++++++ 3 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 View/Helper/CalendarRelatedBlogHelper.php diff --git a/Locale/jpn/LC_MESSAGES/calendars.po b/Locale/jpn/LC_MESSAGES/calendars.po index 6f46255..3c112a3 100644 --- a/Locale/jpn/LC_MESSAGES/calendars.po +++ b/Locale/jpn/LC_MESSAGES/calendars.po @@ -1237,3 +1237,6 @@ msgstr "クラスは最大 %d 文字です。" msgid "%d character limited. (belongings)" msgstr "持ち物は最大 %d 文字です。" + +msgid "Add Achievement" +msgstr "実績の追加" \ No newline at end of file diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 3f5e9e4..edc6394 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -9,19 +9,6 @@ * @copyright Copyright 2014, NetCommons Project */ -/** @var BlogEntry $blogEntryModel */ -//$blogEntryModel = ClassRegistry::init('Blogs.BlogEntry'); -//$blogEntry = $blogEntryModel->getByCalendarEventKey($event['CalendarEvent']['key']); -Configure::load('Calendars.related_blog'); -$blogKey = Configure::read('Calendars.relatedBlog.key'); -/** @var Blog $blogModel */ -$blogModel = ClassRegistry::init('Blogs.Blog'); -$blogBlockId = null; -if ($blogKey) { - $blogBlockId = $blogModel->findBlockIdByKey($blogKey); -} -//$blogBlockId = Configure::read('Calendars.relatedBlog.block_id'); - echo $this->element('Calendars.scripts'); ?> @@ -53,28 +40,7 @@ echo $this->element('Calendars.scripts'); CalendarButton->getEditButton($vars, $event);?> LinkButton->add('実績の追加', array( - 'plugin' => 'blogs', - 'controller' => 'blog_entries_edit', - 'action' => 'add', - 'block_id' => $blogBlockId, - '?' => [ - 'page_id' => Current::read('Page.id'), - 'event_key' => $event['CalendarEvent']['key'] - ] - )); - } - } + echo $this->CalendarRelatedBlog->addAchievementButton($event); ?> diff --git a/View/Helper/CalendarRelatedBlogHelper.php b/View/Helper/CalendarRelatedBlogHelper.php new file mode 100644 index 0000000..f38f4d1 --- /dev/null +++ b/View/Helper/CalendarRelatedBlogHelper.php @@ -0,0 +1,69 @@ +__findRelatedBlogBlockId(); + + $roomId = $event['CalendarEvent']['room_id']; + $canEdit = CalendarPermissiveRooms::isEditable($roomId); + $canCreate = CalendarPermissiveRooms::isCreatable($roomId); + // 表示ルームにおける自分の権限がeditable以上なら無条件に編集可能 + // creatable のとき=自分が作ったデータならOK + if ($canEdit || + ($canCreate && $event['CalendarEvent']['created_user'] == Current::read('User.id'))) { + if ($blogBlockId !== null) { + // 実績の追加ボタン + return $this->LinkButton->add(__d('calendars', 'Add Achievement'), array( + 'plugin' => 'blogs', + 'controller' => 'blog_entries_edit', + 'action' => 'add', + 'block_id' => $blogBlockId, + '?' => [ + 'page_id' => Current::read('Page.id'), + 'event_key' => $event['CalendarEvent']['key'] + ] + )); + } + } + } + +/** + * __findRelatedBlogBlockId + * + * @return int|null + */ + private function __findRelatedBlogBlockId() { + $blogModel = ClassRegistry::init('Blogs.Blog'); + + Configure::load('Calendars.related_blog'); + + $blogKey = Configure::read('Calendars.relatedBlog.key'); + /** @var Blog $blogModel */ + $blogBlockId = null; + if ($blogKey) { + $blogBlockId = $blogModel->findBlockIdByKey($blogKey); + } + return $blogBlockId; + } +} \ No newline at end of file From c33ca3429e5a57d0787a69fa9126ad4d02968ad2 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 16:16:58 +0900 Subject: [PATCH 20/27] =?UTF-8?q?add:=20test:=20blogs=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=ABFixture=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/Blog4testFixture.php | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Test/Fixture/Blog4testFixture.php diff --git a/Test/Fixture/Blog4testFixture.php b/Test/Fixture/Blog4testFixture.php new file mode 100644 index 0000000..2a7d629 --- /dev/null +++ b/Test/Fixture/Blog4testFixture.php @@ -0,0 +1,71 @@ + + * @author Ryuji AMANO + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +/** + * Summary for BlogFixture + */ +class Blog4testFixture extends CakeTestFixture { + +/** + * Model name + * + * @var string + */ + public $name = 'Blog'; + +/** + * Full Table Name + * + * @var string + */ + public $table = 'blogs'; + +/** + * Records + * + * @see https://github.com/s-nakajima/MyShell/blob/master/unitTest/AboutFixture.md#ブロックidの紐付くfixture + * @var array + */ + public $records = array( + array( + 'id' => 2, + 'block_id' => '2', + 'name' => 'BlockId2Blog', + 'key' => 'content_block_1', + 'created_user' => 1, + 'created' => '2016-03-17 07:09:43', + 'modified_user' => 1, + 'modified' => '2016-03-17 07:09:43' + ), + array( + 'id' => 4, + 'block_id' => 4, + 'name' => 'Lorem ipsum dolor sit amet', + 'key' => 'content_block_2', + 'created_user' => 2, + 'created' => '2016-03-17 07:09:43', + 'modified_user' => 2, + 'modified' => '2016-03-17 07:09:43' + ), + ); + +/** + * Initialize the fixture. + * + * @return void + */ + public function init() { + require_once App::pluginPath('Blogs') . 'Config' . DS . 'Schema' . DS . 'schema.php'; + $this->fields = (new BlogsSchema())->tables[Inflector::tableize($this->name)]; + parent::init(); + } + +} From c5a2ade7a983f831a1b30afdf1d2c2f5ef0e862d Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 16:17:13 +0900 Subject: [PATCH 21/27] =?UTF-8?q?add:=20test:=20blogs=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=ABFixture=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/Controller/CalendarPlans/ViewTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Test/Case/Controller/CalendarPlans/ViewTest.php b/Test/Case/Controller/CalendarPlans/ViewTest.php index 85d584c..6766630 100644 --- a/Test/Case/Controller/CalendarPlans/ViewTest.php +++ b/Test/Case/Controller/CalendarPlans/ViewTest.php @@ -47,6 +47,8 @@ class CalendarPlansControllerViewTest extends WorkflowControllerViewTest { 'plugin.rooms.room_role_permission4test', //test 'plugin.calendars.plugins_role4test', //add 'plugin.calendars.room4test', + + 'plugin.calendars.blog4test', ); /** From 5a1fd8391b8fe3e464269fc0012ba7b8462e3a37 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 20 Oct 2019 16:17:29 +0900 Subject: [PATCH 22/27] style: fix phpcs problem --- Model/Behavior/CalendarUpdatePlanBehavior.php | 6 +- View/CalendarPlans/view.ctp | 10 ++- View/Helper/CalendarExposeTargetHelper.php | 66 +++++++++---------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Model/Behavior/CalendarUpdatePlanBehavior.php b/Model/Behavior/CalendarUpdatePlanBehavior.php index 7d67c93..ab4f4b4 100644 --- a/Model/Behavior/CalendarUpdatePlanBehavior.php +++ b/Model/Behavior/CalendarUpdatePlanBehavior.php @@ -719,8 +719,10 @@ private function __getEventDataForUpdateAllOrAfter($event, $eventData, $status) //タイトル、場所、連絡先、詳細は編集画面の値を使う $event['CalendarEvent']['title'] = $eventData['CalendarEvent']['title']; $event['CalendarEvent']['title_icon'] = $eventData['CalendarEvent']['title_icon']; - $event['CalendarEvent']['target_person_grade'] = $eventData['CalendarEvent']['target_person_grade']; - $event['CalendarEvent']['target_person_class_room'] = $eventData['CalendarEvent']['target_person_class_room']; + $event['CalendarEvent']['target_person_grade'] = + $eventData['CalendarEvent']['target_person_grade']; + $event['CalendarEvent']['target_person_class_room'] = + $eventData['CalendarEvent']['target_person_class_room']; $event['CalendarEvent']['belongings'] = $eventData['CalendarEvent']['belongings']; $event['CalendarEvent']['location'] = $eventData['CalendarEvent']['location']; diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index edc6394..8bfa13e 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -114,12 +114,10 @@ echo $this->element('Calendars.scripts'); - -
-

-

CalendarCategory->getCategoryName($vars, $event); ?>

-
- + + +CalendarCategory->getCategoryName($vars, $event); ?> + CalendarShareUsers->isShareEvent($event)): ?> diff --git a/View/Helper/CalendarExposeTargetHelper.php b/View/Helper/CalendarExposeTargetHelper.php index c37a9e1..8085068 100644 --- a/View/Helper/CalendarExposeTargetHelper.php +++ b/View/Helper/CalendarExposeTargetHelper.php @@ -84,38 +84,38 @@ public function makeSelectExposeTargetHtml($event, $frameId, $vars, $options, $m $html = $this->NetCommonsForm->hidden('CalendarActionPlan.plan_room_id'); return $html; - - $html = $this->NetCommonsForm->label( - 'CalendarActionPlan.plan_room_id' . Inflector::camelize('room_id'), - __d('calendars', 'Category') . $this->_View->element('NetCommons.required')); - - // 発行権限がなくて、かつ、すでに発行済みデータの場合は空間変更を認めない - // 固定的な文字列と、hiddenを設定して返す - if (isset($event['CalendarEvent']['is_published']) && - $event['CalendarEvent']['is_published'] && - !$this->CalendarWorkflow->canDelete($event)) { - $html .= '
'; - $html .= $this->CalendarCategory->getCategoryName($vars, $event); - $html .= ''; - $html .= __d('calendars', 'You can not change the target space after published.'); - $html .= ''; - $html .= $this->NetCommonsForm->hidden('CalendarActionPlan.plan_room_id'); - $html .= '
'; - } else { - $html .= $this->NetCommonsForm->select('CalendarActionPlan.plan_room_id', $targetRooms, array( - //select-expose-targetクラスをもつ要素のchangeをjqで捕まえています - 'class' => 'form-control select-expose-target', - 'empty' => false, - 'required' => true, - //value値のoption要素がselectedになる。 - 'value' => $this->request->data['CalendarActionPlan']['plan_room_id'], - 'data-frame-id' => $frameId, - 'data-myself' => $myself, - 'escape' => false, - 'ng-model' => 'data.planRoomId' - )); - } - - return $html; + // + //$html = $this->NetCommonsForm->label( + // 'CalendarActionPlan.plan_room_id' . Inflector::camelize('room_id'), + // __d('calendars', 'Category') . $this->_View->element('NetCommons.required')); + // + //// 発行権限がなくて、かつ、すでに発行済みデータの場合は空間変更を認めない + //// 固定的な文字列と、hiddenを設定して返す + //if (isset($event['CalendarEvent']['is_published']) && + // $event['CalendarEvent']['is_published'] && + // !$this->CalendarWorkflow->canDelete($event)) { + // $html .= '
'; + // $html .= $this->CalendarCategory->getCategoryName($vars, $event); + // $html .= ''; + // $html .= __d('calendars', 'You can not change the target space after published.'); + // $html .= ''; + // $html .= $this->NetCommonsForm->hidden('CalendarActionPlan.plan_room_id'); + // $html .= '
'; + //} else { + // $html .= $this->NetCommonsForm->select('CalendarActionPlan.plan_room_id', $targetRooms, array( + // //select-expose-targetクラスをもつ要素のchangeをjqで捕まえています + // 'class' => 'form-control select-expose-target', + // 'empty' => false, + // 'required' => true, + // //value値のoption要素がselectedになる。 + // 'value' => $this->request->data['CalendarActionPlan']['plan_room_id'], + // 'data-frame-id' => $frameId, + // 'data-myself' => $myself, + // 'escape' => false, + // 'ng-model' => 'data.planRoomId' + // )); + //} + // + //return $html; } } From 1104853d2d244ee22147eb88bf2336cee6f3d18b Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 10:43:39 +0900 Subject: [PATCH 23/27] =?UTF-8?q?change:=20composer.json=E3=81=ABblogs?= =?UTF-8?q?=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e5ccdc9..2d75491 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,8 @@ "netcommons/topics": "@dev", "netcommons/users": "@dev", "netcommons/workflow": "@dev", - "netcommons/wysiwyg": "@dev" + "netcommons/wysiwyg": "@dev", + "netcommons/blogs": "dev-nc3forEducation" }, "type": "cakephp-plugin", "keywords": [ From 6d931e9b648975be151cd268742c27c507e4d510 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 11:20:37 +0900 Subject: [PATCH 24/27] =?UTF-8?q?disable:=20=E4=B8=8D=E8=A6=81=E3=81=AA?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/Helper/CalendarExposeTargetHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/View/Helper/CalendarExposeTargetHelper.php b/View/Helper/CalendarExposeTargetHelper.php index 8085068..818a0d6 100644 --- a/View/Helper/CalendarExposeTargetHelper.php +++ b/View/Helper/CalendarExposeTargetHelper.php @@ -79,8 +79,8 @@ public function makeSelectExposeTargetHtml($event, $frameId, $vars, $options, $m } } // 渡されたoptionから投稿権限のないものを外す - $rooms = CalendarPermissiveRooms::getCreatableRoomIdList(); - $targetRooms = array_intersect_key($options, $rooms); + //$rooms = CalendarPermissiveRooms::getCreatableRoomIdList(); + //$targetRooms = array_intersect_key($options, $rooms); $html = $this->NetCommonsForm->hidden('CalendarActionPlan.plan_room_id'); return $html; From 33c602990695d3e6f87ac54b6d72d538706f5f8f Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sun, 27 Oct 2019 12:07:04 +0900 Subject: [PATCH 25/27] =?UTF-8?q?comment:=20phpdoc=E3=82=B3=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...059535_alter_event_add_target_person_and_belongings.php | 7 +++++++ ...1563168303_alter_event_change_target_person_columns.php | 7 +++++++ Config/related_blog.php | 3 +++ 3 files changed, 17 insertions(+) diff --git a/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php b/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php index 85438f0..522a2a3 100644 --- a/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php +++ b/Config/Migration/1563059535_alter_event_add_target_person_and_belongings.php @@ -1,4 +1,11 @@ 'school_blog' From b1b96948225922726185900f070d1c5bb4b4d2e3 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 16 Nov 2019 10:44:53 +0900 Subject: [PATCH 26/27] =?UTF-8?q?remove:=20html=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=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/CalendarPlans/view.ctp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/View/CalendarPlans/view.ctp b/View/CalendarPlans/view.ctp index 8bfa13e..6f6026c 100644 --- a/View/CalendarPlans/view.ctp +++ b/View/CalendarPlans/view.ctp @@ -113,12 +113,6 @@ echo $this->element('Calendars.scripts'); - - - -CalendarCategory->getCategoryName($vars, $event); ?> - - CalendarShareUsers->isShareEvent($event)): ?>
@@ -160,26 +154,6 @@ echo $this->element('Calendars.scripts');
- - - NetCommonsHtml->link( - // h($blogEntry['BlogEntry']['title']), - // [ - // 'plugin' => 'blogs', - // 'controller' => 'blog_entries', - // 'action' => 'view', - // 'block_id' => $blogEntry['BlogEntry']['block_id'], - // 'key' => $blogEntry['BlogEntry']['key'], - // 'frame_id' => $blogFrameId - // - // ], - // [ - // 'class' => ['btn', 'btn-default', 'btn-lg'] - // ] - // ); ?> - - - From 5da7b25593afea0ca99cd9f000e93253f356ea3c Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Sat, 16 Nov 2019 10:48:23 +0900 Subject: [PATCH 27/27] =?UTF-8?q?change:=20=E5=AE=9F=E7=B8=BE=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=AF=E5=AF=BE=E8=B1=A1=E3=83=96=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E3=83=95=E3=83=AC=E3=83=BC=E3=83=A0=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=91=E3=82=8C=E3=81=B0=E9=9D=9E=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=A8=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/Helper/CalendarRelatedBlogHelper.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/View/Helper/CalendarRelatedBlogHelper.php b/View/Helper/CalendarRelatedBlogHelper.php index f38f4d1..d5e9b76 100644 --- a/View/Helper/CalendarRelatedBlogHelper.php +++ b/View/Helper/CalendarRelatedBlogHelper.php @@ -20,10 +20,14 @@ class CalendarRelatedBlogHelper extends AppHelper { * addAchievementButton * * @param array $event Event - * @return void + * @return string */ public function addAchievementButton(array $event) { $blogBlockId = $this->__findRelatedBlogBlockId(); + $blogFrameId = $this->__findRelatedBlogFrameIdByBlockId($blogBlockId); + if (!$blogFrameId) { + return ''; + } $roomId = $event['CalendarEvent']['room_id']; $canEdit = CalendarPermissiveRooms::isEditable($roomId); @@ -39,6 +43,7 @@ public function addAchievementButton(array $event) { 'controller' => 'blog_entries_edit', 'action' => 'add', 'block_id' => $blogBlockId, + //'frame_id' => $blogFrameId, '?' => [ 'page_id' => Current::read('Page.id'), 'event_key' => $event['CalendarEvent']['key'] @@ -46,6 +51,7 @@ public function addAchievementButton(array $event) { )); } } + return ''; } /** @@ -66,4 +72,19 @@ private function __findRelatedBlogBlockId() { } return $blogBlockId; } + + private function __findRelatedBlogFrameIdByBlockId($blockId) { + $frameModel = ClassRegistry::init('Frames.Frame'); + $result = $frameModel->find('first', [ + 'conditions' => [ + 'Frame.block_id' => $blockId + ], + 'fields' => ['Frame.id'], + 'recursive' => -1, + ]); + if ($result) { + return $result['Frame']['id']; + } + return false; + } } \ No newline at end of file