Skip to content

Commit

Permalink
Fixed issue #15901: Regression: Buttons to uninstall or reset a theme…
Browse files Browse the repository at this point in the history
… missing at LS 4
  • Loading branch information
Trischi80 committed Apr 24, 2020
1 parent 69c8914 commit 0d1a3dc
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -719,6 +719,10 @@ public function getButtons()
array("id" => $this->id)
);

$sUninstallUrl = Yii::app()->getController()->createUrl('admin/themeoptions/sa/uninstall/');
$sResetUrl = Yii::app()->getController()->createUrl('admin/themeoptions/sa/reset/', array("gsid"=>$gsid));


$sEditorLink = "<a
id='template_editor_link_" . $this->template_name . "'
href='" . $sEditorUrl . "'
Expand Down Expand Up @@ -759,13 +763,52 @@ class="btn btn-primary btn-block selector--ConfirmModal">
' . gT('Extend') . '
</a>';

$sUninstallLink = '<a
id="remove_fromdb_link_'.$this->template_name.'"
href="'.$sUninstallUrl.'"
data-post=\'{ "templatename": "'.$this->template_name.'" }\'
data-text="'.gT('This will reset all the specific configurations of this theme.').'<br>'.gT('Do you want to continue?').'"
title="'.gT('Uninstall this theme').'"
class="btn btn-danger btn-block selector--ConfirmModal">
<span class="icon-trash"></span>
'.gT('Uninstall').'
</a>';

$sResetLink = '<a
id="remove_fromdb_link_'.$this->template_name.'"
href="'.$sResetUrl.'"
data-post=\'{ "templatename": "'.$this->template_name.'" }\'
data-text="'.gT('This will reload the configuration file of this theme.').'<br>'.gT('Do you want to continue?').'"
title="'.gT('Reset this theme').'"
class="btn btn-warning btn-block selector--ConfirmModal">
<span class="icon-trash"></span>
'.gT('Reset').'
</a>';

if (App()->getController()->action->id == "surveysgroups") {
$sButtons = $OptionLink;
} else {
$sButtons = $sEditorLink . $OptionLink . $sExtendLink;

if ($this->template_name != getGlobalSetting('defaulttheme')) {
$sButtons .= $sUninstallLink;
} else {
$sButtons .= '
<a
class="btn btn-danger btn-block"
disabled
data-toggle="tooltip"
title="' . gT('You cannot uninstall the default template.').'"
>
<span class="icon-trash"></span>
'.gT('Uninstall').'
</a>
';
}
}

$sButtons .= $sResetLink;

return $sButtons;
}

Expand Down

0 comments on commit 0d1a3dc

Please sign in to comment.