From 3cb5cbf5ec24bdbaf1ae53573d3754269b800346 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Thu, 20 Feb 2020 14:39:51 +0900 Subject: [PATCH 1/4] feat: don't make CDN cache in questionnaire pages --- Controller/QuestionnaireAnswersController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Controller/QuestionnaireAnswersController.php b/Controller/QuestionnaireAnswersController.php index 3f969d6..d6c13e5 100644 --- a/Controller/QuestionnaireAnswersController.php +++ b/Controller/QuestionnaireAnswersController.php @@ -93,6 +93,9 @@ public function beforeFilter() { // 親クラスのbeforeFilterを済ませる parent::beforeFilter(); + // CDNキャッシュを作成しない + $this->response->header('Pragma', 'no-cache'); + // 現在の表示形態を調べておく list($this->__displayType) = $this->QuestionnaireFrameSetting->getQuestionnaireFrameSetting( Current::read('Frame.key') From 364a74f7ca07391bcc592dcb81e0253d88a2d60c Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 8 Aug 2020 16:41:33 +0900 Subject: [PATCH 2/4] =?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 482fd7a..16cf142 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: "cb32rUp2l+Zd991n/6fY18wudLW0EjqqqlvxpKMWZOUaJ6dS5+R+IcoV5Oo94TNUEgzOQ/7Ldp5PW+qGg0S5EDyQOHtLp7kmmGy9ST7EL0QNyWyfSGXl9FUCqKd/fP3WZVx8ci6MgfUtj5DfamqjRctpJy4uQapbZwtUDQWweGY=" - GIT_COMMITTER_NAME=RikaFujiwara From a5d42918db9bf4cd689f1cedc99ea05d1125a148 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 10 Sep 2021 21:49:10 +0900 Subject: [PATCH 3/4] =?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/QuestionnaireAnswersController.php | 14 +++++++++----- View/QuestionnaireAnswers/key_auth.ctp | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Controller/QuestionnaireAnswersController.php b/Controller/QuestionnaireAnswersController.php index d6c13e5..2fff2f4 100644 --- a/Controller/QuestionnaireAnswersController.php +++ b/Controller/QuestionnaireAnswersController.php @@ -181,11 +181,6 @@ protected function _viewGuard() { !isset($this->request->data['QuestionnairePage']['page_sequence'])) { // 認証キーコンポーネントお約束: if ($quest['is_key_pass_use'] == QuestionnairesComponent::USES_USE) { - $this->AuthorizationKey->contentId = $quest['id']; - $this->AuthorizationKey->guard( - AuthorizationKeyComponent::OPERATION_EMBEDDING, - 'Questionnaire', - $this->__questionnaire); $this->setAction('key_auth'); return; } @@ -208,6 +203,15 @@ protected function _viewGuard() { * @return void */ public function key_auth() { + $this->AuthorizationKey->contentId = $this->__questionnaire['Questionnaire']['id']; + $this->AuthorizationKey->guard( + AuthorizationKeyComponent::OPERATION_EMBEDDING, + 'Questionnaire', + $this->__questionnaire); + if ($this->request->is('ajax')) { + return; + } + $isKeyPassUse = $this->__questionnaire['Questionnaire']['is_key_pass_use']; if ($isKeyPassUse != QuestionnairesComponent::USES_USE) { $this->_redirectAnswerPage(); diff --git a/View/QuestionnaireAnswers/key_auth.ctp b/View/QuestionnaireAnswers/key_auth.ctp index 73687ba..4cb7d4e 100644 --- a/View/QuestionnaireAnswers/key_auth.ctp +++ b/View/QuestionnaireAnswers/key_auth.ctp @@ -8,8 +8,11 @@ * @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('Questionnaires.Answers/answer_header'); ?> element('Questionnaires.Answers/answer_test_mode_header'); ?> From 8de4f9204056a190e2412a7d34df7c7f9f679121 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 18 Mar 2024 16:19:59 +0900 Subject: [PATCH 4/4] =?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/QuestionnaireAnswersController.php | 14 +++++++++----- Model/QuestionnaireAnswer.php | 7 +++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Controller/QuestionnaireAnswersController.php b/Controller/QuestionnaireAnswersController.php index 2fff2f4..46ddc54 100644 --- a/Controller/QuestionnaireAnswersController.php +++ b/Controller/QuestionnaireAnswersController.php @@ -349,11 +349,15 @@ public function view() { } } if (! ($this->request->is('post') && $nextPageSeq == $postPageSeq)) { - $summary = $this->QuestionnairesOwnAnswer->getProgressiveSummaryOfThisUser( - $questionnaireKey); - $setAnswers = $this->QuestionnaireAnswer->getProgressiveAnswerOfThisSummary( - $questionnaire, - $summary); + if (empty($this->request->params['requested'])) { + $summary = $this->QuestionnairesOwnAnswer->getProgressiveSummaryOfThisUser( + $questionnaireKey); + $setAnswers = $this->QuestionnaireAnswer->getProgressiveAnswerOfThisSummary( + $questionnaire, + $summary); + } else { + $setAnswers = []; + } $this->set('answers', $setAnswers); $this->request->data['QuestionnaireAnswer'] = $setAnswers; diff --git a/Model/QuestionnaireAnswer.php b/Model/QuestionnaireAnswer.php index c088642..6be4158 100644 --- a/Model/QuestionnaireAnswer.php +++ b/Model/QuestionnaireAnswer.php @@ -259,6 +259,13 @@ public function saveAnswer($data, $questionnaire, $summary) { if (! $targetQuestion) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } + + //HACK: 作りが悪いため、DELETE->INSERTで既存データを初期化してから登録する + $this->deleteAll([ + $this->alias . '.questionnaire_answer_summary_id' => $summaryId, + $this->alias . '.questionnaire_question_key' => $targetQuestionKey, + ], false); + // データ保存 // Matrixタイプの場合はanswerが配列になっているがsaveでかまわない // saveMany中で1回しかValidateしなくてよい関数のためのフラグ