Skip to content

Commit

Permalink
Fixed issue #16935: Directly show Editor mode from my profile not wor…
Browse files Browse the repository at this point in the history
…king (#1728)

Rebasing for master
  • Loading branch information
gabrieljenik committed Jan 28, 2021
1 parent 8dccfb3 commit a3f78f2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
9 changes: 7 additions & 2 deletions application/controllers/QuestionAdministrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public function actionCreate($surveyid)
[
'surveyid' => $oQuestion->sid,
'gid' => $oQuestion->gid,
'landOnSideMenuTab' => 'structure'
'landOnSideMenuTab' => 'structure',
'mode' => 'overview',
]
);

Expand Down Expand Up @@ -129,6 +130,9 @@ public function actionEdit($questionId, $tabOverviewEditor = 'overview')
$this->redirect(Yii::app()->request->urlReferrer);
}

// "Directly show edit mode" personal setting
$tabOverviewEditor = SettingsUser::getUserSettingValue('noViewMode', App()->user->id) ? 'editor' : $tabOverviewEditor;

$this->aData['closeUrl'] = Yii::app()->createUrl(
'questionAdministration/view/',
[
Expand Down Expand Up @@ -492,7 +496,8 @@ public function actionSaveQuestionData()
[
'surveyid' => $iSurveyId,
'gid' => $question->gid,
'landOnSideMenuTab' => $landOnSideMenuTab
'landOnSideMenuTab' => $landOnSideMenuTab,
'mode' => 'overview',
]
);
break;
Expand Down
22 changes: 19 additions & 3 deletions application/controllers/QuestionGroupsAdministrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,25 @@ protected function beforeRender($view)
* @param int $surveyid survey id is important here for new questiongroups without groupid
* @param int $gid
* @param string $landOnSideMenuTab
* @param string $mode either 'overview' or 'auto'. The 'overview' mode ignores the 'noViewMode' user setting
*
* * @return void
*/
public function actionView($surveyid, $gid, $landOnSideMenuTab = 'structure')
public function actionView($surveyid, $gid, $landOnSideMenuTab = 'structure', $mode = 'auto')
{
if ($mode != 'overview' && SettingsUser::getUserSettingValue('noViewMode', App()->user->id)) {
$this->redirect(
Yii::app()->createUrl(
'questionGroupsAdministration/edit/',
[
'surveyid' => $surveyid,
'gid' => $gid,
'landOnSideMenuTab' => 'structure'
]
)
);
}

//check permissions for view and create groups ...
if ($gid === null) { //this is the case when new questiongroup should be created
if (!Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'create')) {
Expand Down Expand Up @@ -213,7 +227,8 @@ public function actionEdit($surveyid, $gid, $landOnSideMenuTab = 'structure')
[
'surveyid' => $surveyid,
'gid' => $oQuestionGroup->gid,
'landOnSideMenuTab' => $landOnSideMenuTab
'landOnSideMenuTab' => $landOnSideMenuTab,
'mode' => 'overview',
]
);

Expand Down Expand Up @@ -753,7 +768,8 @@ public function actionSaveQuestionGroupData($sid)
[
'surveyid' => $iSurveyId,
'gid' => $oQuestionGroup->gid,
'landOnSideMenuTab' => $landOnSideMenuTab
'landOnSideMenuTab' => $landOnSideMenuTab,
'mode' => 'overview',
]
);
break;
Expand Down

0 comments on commit a3f78f2

Please sign in to comment.