From 87fe1e1597d723e50682bac2ff8b5ed3e0946935 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Thu, 20 Feb 2020 14:41:23 +0900 Subject: [PATCH 1/7] feat: don't make CDN cache in registration pages --- Controller/RegistrationAnswersController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Controller/RegistrationAnswersController.php b/Controller/RegistrationAnswersController.php index ea16a34..d9253e7 100644 --- a/Controller/RegistrationAnswersController.php +++ b/Controller/RegistrationAnswersController.php @@ -95,6 +95,9 @@ public function beforeFilter() { // 親クラスのbeforeFilterを済ませる parent::beforeFilter(); + // CDNキャッシュを作成しない + $this->response->header('Pragma', 'no-cache'); + // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている // まずは、そのキーを取り出す // 登録フォームキー From 2e07638fbaeb49a6c477f5a6cab653201c6ab0e6 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 7 May 2020 19:01:32 +0900 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E3=83=A1=E3=83=BC=E3=83=AB=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E3=81=AE=E6=9C=89=E7=84=A1=E3=83=81=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=8C=E6=8A=9C=E3=81=91=E3=81=A6=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=81=9F=E3=82=81=E9=80=81=E4=BF=A1=E3=81=95=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1577?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/RegistrationAnswerSummary.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Model/RegistrationAnswerSummary.php b/Model/RegistrationAnswerSummary.php index bbae00e..61305fe 100644 --- a/Model/RegistrationAnswerSummary.php +++ b/Model/RegistrationAnswerSummary.php @@ -35,7 +35,7 @@ class RegistrationAnswerSummary extends RegistrationsAppModel { ), 'keyField' => 'id', 'typeKey' => MailSettingFixedPhrase::ANSWER_TYPE, - ), + ), 'Mails.MailQueueDelete', ); @@ -464,6 +464,20 @@ protected function _sendMails($summary) { $condition = $this->Registration->getBaseCondition(); $registration = $this->Registration->find('first', ['conditions' => $condition]); + /** @see MailSetting::getMailSettingPlugin() */ + $this->loadModels([ + 'SiteSetting' => 'SiteManager.SiteSetting', + ]); + $mailSettingPlugin = $this->MailSetting->getMailSettingPlugin( + null, MailSettingFixedPhrase::ANSWER_TYPE + ); + $isMailSend = Hash::get($mailSettingPlugin, 'MailSetting.is_mail_send'); + + if (! $registration['Registration']['is_answer_mail_send'] || ! $isMailSend) { + $this->Behaviors->unload('Mails.MailQueue'); + return; + } + // X-SUBJECT設定 $this->setAddEmbedTagValue('X-SUBJECT', $registration['Registration']['title']); From d609c6fa09179a49ed995661f2baf9bfdca4dc7a Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 8 Aug 2020 16:32:43 +0900 Subject: [PATCH 3/7] =?UTF-8?q?change:=20test:=20Travis=E3=81=8B=E3=82=89P?= =?UTF-8?q?HP5.6=E3=82=92=E5=89=8A=E9=99=A4,php72=E4=BB=A5=E9=99=8D?= =?UTF-8?q?=E3=81=A7UnitTest=E3=81=A7Warning=E3=81=8C=E5=87=BA=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4bf7ccc..9c12fe7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ dist: trusty env: matrix: - - NETCOMMONS_VERSION=master DB=mysql + - NETCOMMONS_VERSION=availability DB=mysql global: - secure: "szHvmXAIkT3JaTfcPtHlTG7gpLnwR93Wd6l6IhkJZotPXVkNTWKYEGCGJtm/9uM3rnLFoTPS1XRrusm+J0Tt/DmjDVMTb/LU74e0+VlAO4Cu8Zw6nCUfXgdMBIq/4wjedgvfgL2Q8yLXMChRtImhVqvdtDM8shiJVBuUDWq0FftACItpYygB518sOj6i+/n9/awXAlzZZxWxJ/1GLshaQ+PXBZuDkG06rIcYZWSNKI1N78WzXDlqv/7mnVluPe0dsbAPC9qKpQr+0EpMI8ymXeVeUFFqb9i3Kujc72S4bpt+Y0Wv+i+U78/Yf/6qPKaJQXHD4GkZ08XknRBFDKXvq2cx8aIecbBOia0s5g2nCgfZFqqFE+Zguq8EPk0KgQZAVAJiZ4ZkXdSwTI1z36jkPWr2KKleULpp6JRD+9D6uANx6bVmMvgymxT+EuC8LfFgLBfo9crXoQ02KknSIJPPlj7rDdWp8ukcknM8zRr+mTCpa8KUSCejZZRBU9pU1QvBIdKeqAXmbJhU/3OvUeS+3AvZchhOsY18jrdoyCNipzQsSWzz1NNUxeLp0o6I/QYFbylWWXVZGz6s6Rk5UTCXr9q99QhmZCICiZlofJu3ldZ4UpgFeBMQY1OSTLjKS65nT1HpoMsqSqCvmllS7JM/0dmmjnkeCngUZepxWafohnE=" - GIT_COMMITTER_NAME=RyujiAMANO From 249d50140e9471626f2102653ac16e00e64bfbde Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 10 Sep 2021 21:50:58 +0900 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E7=99=BB=E9=8C=B2=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=BC=E3=83=A0=EF=BC=88=E3=82=A2=E3=83=B3=E3=82=B1=E3=83=BC?= =?UTF-8?q?=E3=83=88=EF=BC=89=E3=81=AE=E8=AA=8D=E8=A8=BC=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E3=82=A6=E3=82=A7=E3=83=96=E3=82=A2=E3=82=AF=E3=82=BB?= =?UTF-8?q?=E3=83=A9=E3=83=AC=E3=83=BC=E3=82=BF=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84=20https://github.?= =?UTF-8?q?com/edumap-jp/Edumap2/issues/139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/RegistrationAnswersController.php | 19 ++++++++++++------- View/RegistrationAnswers/key_auth.ctp | 7 +++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Controller/RegistrationAnswersController.php b/Controller/RegistrationAnswersController.php index d9253e7..a2fa2ac 100644 --- a/Controller/RegistrationAnswersController.php +++ b/Controller/RegistrationAnswersController.php @@ -196,11 +196,6 @@ protected function _viewGuard() { !isset($this->request->data['RegistrationPage']['page_sequence'])) { // 認証キーコンポーネントお約束: if ($quest['is_key_pass_use'] == RegistrationsComponent::USES_USE) { - $this->AuthorizationKey->contentId = $quest['id']; - $this->AuthorizationKey->guard( - AuthorizationKeyComponent::OPERATION_EMBEDDING, - 'Registration', - $this->__registration); $this->setAction('key_auth'); return; } @@ -223,6 +218,15 @@ protected function _viewGuard() { * @return void */ public function key_auth() { + $this->AuthorizationKey->contentId = $this->__registration['Registration']['id']; + $this->AuthorizationKey->guard( + AuthorizationKeyComponent::OPERATION_EMBEDDING, + 'Registration', + $this->__registration); + if ($this->request->is('ajax')) { + return; + } + $isKeyPassUse = $this->__registration['Registration']['is_key_pass_use']; if ($isKeyPassUse != RegistrationsComponent::USES_USE) { $this->_redirectAnswerPage(); @@ -377,15 +381,16 @@ public function view() { // 誠にCake流儀でなくて申し訳ないのですが、様々な種別のAnswerデータを // 特殊な文字列加工して統一化した形状でDBに入れている都合上、このような仕儀になっています } else { - $this->set('answers', $this->request->data['RegistrationAnswer']); + $this->set('answers', $this->request->data['RegistrationAnswer'] ?? null); } + $nextPageSeq = (int)$nextPageSeq; // 項目情報をView変数にセット $this->request->data['Frame'] = Current::read('Frame'); $this->request->data['Block'] = Current::read('Block'); $this->request->data['RegistrationPage'] = $registration['RegistrationPage'][$nextPageSeq]; $this->set('registration', $registration); - $this->set('questionPage', $registration['RegistrationPage'][$nextPageSeq]); + $this->set('questionPage', $registration['RegistrationPage'][$nextPageSeq] ?? null); $this->set('displayType', $this->__displayType); $this->NetCommons->handleValidationError($this->RegistrationAnswer->validationErrors); diff --git a/View/RegistrationAnswers/key_auth.ctp b/View/RegistrationAnswers/key_auth.ctp index 81b7c38..d8b9d8b 100644 --- a/View/RegistrationAnswers/key_auth.ctp +++ b/View/RegistrationAnswers/key_auth.ctp @@ -8,15 +8,18 @@ * @license http://www.netcommons.org/license.txt NetCommons License * @copyright Copyright 2014, NetCommons Project */ +echo $this->NetCommonsHtml->script(array( + '/authorization_keys/js/key_auth_init.js' +)); ?> -
+
element('Registrations.Answers/answer_header'); ?> element('Registrations.Answers/answer_test_mode_header'); ?> NetCommonsForm->create(null, array('type' => 'post', 'url' => $postUrl)); + echo $this->NetCommonsForm->create('AuthorizationKeys' . CurrentLib::read('Frame.id'), array('type' => 'post', 'url' => $postUrl)); echo $this->NetCommonsForm->hidden('Frame.id'); echo $this->NetCommonsForm->hidden('Block.id'); From 2bed6aae66259f19630c5698bc82d77309de6491 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 9 Jan 2024 12:17:11 +0900 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20=E7=99=BB=E9=8C=B2=E6=95=B0=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E9=9A=9B=E3=81=AE=E3=83=9E?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=A7Web=E3=82=A2=E3=82=AF=E3=82=BB?= =?UTF-8?q?=E3=83=A9=E3=83=AC=E3=83=BC=E3=82=BF=E5=AF=BE=E5=BF=9C=E3=81=8C?= =?UTF-8?q?=E3=82=AF=E3=83=AA=E3=82=A2=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://edumap.?= =?UTF-8?q?jp/bbses/bbs=5Farticles/view/49/91e8530ebc3c0a8785493355d0a135a?= =?UTF-8?q?4=3Fframe=5Fid=3D53?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- View/RegistrationAnswers/key_auth.ctp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/View/RegistrationAnswers/key_auth.ctp b/View/RegistrationAnswers/key_auth.ctp index d1a17dc..843ae6e 100644 --- a/View/RegistrationAnswers/key_auth.ctp +++ b/View/RegistrationAnswers/key_auth.ctp @@ -8,6 +8,9 @@ * @license http://www.netcommons.org/license.txt NetCommons License * @copyright Copyright 2014, NetCommons Project */ +echo $this->NetCommonsHtml->script(array( + '/authorization_keys/js/key_auth_init.js' +)); echo $this->NetCommonsHtml->css('/registrations/css/registration.css'); ?>
From 1f644f70f4979cde04adfd303ab68a97a2c08780 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 18 Mar 2024 16:19:34 +0900 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20CDN=E3=81=AB=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=81=95=E3=82=8C=E3=82=8B=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=81=8C=E3=81=82=E3=82=8B=E3=81=9F=E3=82=81?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20https://github.com/edumap-jp/Edumap2/issue?= =?UTF-8?q?s/168?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/RegistrationAnswersController.php | 16 ++++++++++------ Model/RegistrationAnswer.php | 7 +++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Controller/RegistrationAnswersController.php b/Controller/RegistrationAnswersController.php index eab1939..7bdb316 100644 --- a/Controller/RegistrationAnswersController.php +++ b/Controller/RegistrationAnswersController.php @@ -19,7 +19,7 @@ * @property RegistrationAnswer $RegistrationAnswer * @property RegistrationsOwnAnswerComponent $RegistrationOwnAnswer * @property RegistrationAnswerSummary $RegistrationAnswerSummary - * + * * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ class RegistrationAnswersController extends RegistrationsAppController { @@ -390,11 +390,15 @@ public function view() { } } if (! ($this->request->is('post') && $nextPageSeq == $postPageSeq)) { - $summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser( - $registrationKey); - $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary( - $registration, - $summary); + if (empty($this->request->params['requested'])) { + $summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser( + $registrationKey); + $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary( + $registration, + $summary); + } else { + $setAnswers = []; + } $this->set('answers', $setAnswers); $this->request->data['RegistrationAnswer'] = $setAnswers; diff --git a/Model/RegistrationAnswer.php b/Model/RegistrationAnswer.php index a7df869..cf415a3 100644 --- a/Model/RegistrationAnswer.php +++ b/Model/RegistrationAnswer.php @@ -284,6 +284,13 @@ public function saveAnswer($data, $registration, $summary) { if (! $targetQuestion) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } + + //HACK: 作りが悪いため、DELETE->INSERTで既存データを初期化してから登録する + $this->deleteAll([ + $this->alias . '.registration_answer_summary_id' => $summaryId, + $this->alias . '.registration_question_key' => $targetQuestionKey, + ], false); + // データ保存 // Matrixタイプの場合はanswerが配列になっているがsaveでかまわない // saveMany中で1回しかValidateしなくてよい関数のためのフラグ From 29207ec8432fc5b694a8875b2f6f8d35af04e52b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 18 Mar 2024 16:20:39 +0900 Subject: [PATCH 7/7] =?UTF-8?q?test:=20=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E7=84=A1=E5=8A=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eb2068b..6da4321 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,12 +3,10 @@ on: branches: - main - master - - availability pull_request: branches: - main - master - - availability name: tests