Skip to content

Commit

Permalink
Fixed issue #15715: Adjust message theme editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Höck committed Jan 15, 2020
1 parent 7f01cb9 commit 1fe863e
Showing 1 changed file with 5 additions and 37 deletions.
42 changes: 5 additions & 37 deletions application/controllers/admin/themes.php
Expand Up @@ -1246,16 +1246,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
$aData['relativePathEditfile'] = $editfile;
$aViewUrls['templateeditorbar_view'][] = $aData;

$usedVersion = App()->getConfig('versionnumber');
$delimiter = '.';
$version = explode($delimiter, $usedVersion);
$versionAsInteger = (int) $version[0];

if ($versionAsInteger >= 4) {
$this->showIntroNotificationForLS4();
} elseif ($versionAsInteger <= 3) {
$this->showIntroNotification();
}
$this->showIntroNotification();

if ($showsummary) {
Yii::app()->clientScript->registerPackage($oEditedTemplate->sPackageName);
Expand All @@ -1267,7 +1258,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
}

/**
* First time user visits template editor on 3.0, show
* First time user visits template editor, show
* a notification about manual and forum.
* @return void
*/
Expand All @@ -1276,41 +1267,18 @@ protected function showIntroNotification()
$user = User::model()->findByPk(Yii::app()->session['loginID']);
$not = new UniqueNotification(array(
'user_id' => $user->uid,
'title' => gT('LimeSurvey 3.0 theme editor'),
'title' => gT('LimeSurvey theme editor'),
'markAsNew' => false,
'importance' => Notification::HIGH_IMPORTANCE,
'message' => sprintf(
gT('Welcome to the new theme editor of LimeSurvey 3.0. To get an overview of new functionality and possibilities, please visit the %s LimeSurvey manual %s. For further questions and information, feel free to post your questions on the %s LimeSurvey forums %s.', 'unescaped'),
'<a target="_blank" href="https://manual.limesurvey.org/New_Template_System_in_LS3.x">', '</a>',
gT('Welcome to the new theme editor of LimeSurvey To get an overview of new functionality and possibilities, please visit the %s LimeSurvey manual %s. For further questions and information, feel free to post your questions on the %s LimeSurvey forums %s.', 'unescaped'),
'<a target="_blank" href="https://manualv4.limesurvey.org/LimeSurvey_Manual">', '</a>',
'<a target="_blank" href="https://www.limesurvey.org/community/forums">', '</a>'
)
));
$not->save();
}

/**
* First time user visits theme editor on 4.0.
* Show a notificiation about manual and forum.
*
* @return void
*/
private function showIntroNotificationForLS4(): void {
$user = User::model()->findByPk(App()->session['loginID']);
$notificationData = [
'user_id' => $user->uid,
'title' => gT('LimeSurvey 4.0 theme editor'),
'markAsNew' => false,
'importance' => Notification::HIGH_IMPORTANCE,
'message' => sprintf(
gT('Welcome to the theme editor of LimeSurvey 4.0. To get an overview of all functionality and possibilities, please visit the %s LimeSurvey manual %s. For further questions and information, feel free to post your questions on the %s LimeSurvey forums %s.', 'unescaped'),
'<a target="_blank" href="https://manualv4.limesurvey.org/LimeSurvey_Manual">', '</a>',
'<a target="_blank" href="https://www.limesurvey.org/community/forums">', '</a>'
)
];
$notification = new UniqueNotification($notificationData);
$notification->save();
}

/**
* Renders template(s) wrapped in header and footer
*
Expand Down

0 comments on commit 1fe863e

Please sign in to comment.