Skip to content

Commit

Permalink
[ADD] Redirect after save configuration #91.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seiger committed May 22, 2023
1 parent 36a2bbb commit 2ccccc4
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 84 deletions.
1 change: 1 addition & 0 deletions core/src/Controllers/SystemSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ private function callEvent(string $name)
protected function parameterActionButtons(): array
{
return [
'select' => 1,
'save' => 1,
'cancel' => 1
];
Expand Down
8 changes: 7 additions & 1 deletion manager/processors/save_settings.processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,11 @@
// empty cache
$modx->clearCache('full');
}
$header = "Location: index.php?a=7&r=10";

// redirect/stay options
if ($data['stay'] != '') {
$header = "Location: index.php?a=17&stay=" . $data['stay'];
} else {
$header = "Location: index.php?a=7&r=10";
}
header($header);
151 changes: 72 additions & 79 deletions manager/views/page/system_settings.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
@section('content')
@push('scripts.top')
<script>
var displayStyle = '{{ $displayStyle }}';
var lang_chg = '{{ ManagerTheme::getLexicon('confirm_setting_language_change') }}';
var actions = {
save: function() {
documentDirty = false;
document.settings.submit();
},
cancel: function() {
documentDirty = false;
document.location.href = 'index.php?a=2';
}
};
var displayStyle = '{{ $displayStyle }}';
var lang_chg = '{{ ManagerTheme::getLexicon('confirm_setting_language_change') }}';
var actions = {
save: function() {
documentDirty = false;
document.settings.submit();
},
cancel: function() {
documentDirty = false;
document.location.href = 'index.php?a=2';
}
};
</script>
<script src="media/script/mutate_settings.js"></script>
@endpush
Expand All @@ -22,20 +22,16 @@
<!-- this field is used to check site settings have been entered/ updated after install or upgrade -->
<input type="hidden" name="site_id" value="{{ get_by_key(EvolutionCMS()->config, 'site_id') }}" />
<input type="hidden" name="settings_version" value="{{ EvolutionCMS()->getVersionData('version') }}" />
<h1>
<i class="{{ $_style['icon_sliders'] }}"></i>{{ ManagerTheme::getLexicon('settings_title') }}
</h1>

<h1><i class="{{ $_style['icon_sliders'] }}"></i>{{ ManagerTheme::getLexicon('settings_title') }}</h1>
@include('manager::partials.actionButtons', $actionButtons)

@if(!get_by_key(EvolutionCMS()->config, 'settings_version') || get_by_key(EvolutionCMS()->config, 'settings_version') !== EvolutionCMS()->getVersionData('version'))
<div class="container">
<p class="alert alert-warning">{!! ManagerTheme::getLexicon('settings_after_install') !!}</p>
</div>
@endif
<div class="tab-pane" id="settingsPane">
<script>
tpSettings = new WebFXTabPane(document.getElementById('settingsPane'), {{ get_by_key(EvolutionCMS()->config, 'remember_last_tab') ? 1 : 0 }});
tpSettings = new WebFXTabPane(document.getElementById('settingsPane'), {{ get_by_key(EvolutionCMS()->config, 'remember_last_tab') ? 1 : 0 }});
</script>
@include('manager::page.system_settings.general')
@include('manager::page.system_settings.friendly_urls')
Expand All @@ -48,70 +44,67 @@
</form>
@push('scripts.bot')
<script>
(function($) {
$('input:radio').change(function() {
documentDirty = true;
});
$('#furlRowOn').change(function() {
$('.furlRow').fadeIn();
});
$('#furlRowOff').change(function() {
$('.furlRow').fadeOut();
});
$('#udPermsOn').change(function() {
$('.udPerms').slideDown();
});
$('#udPermsOff').change(function() {
$('.udPerms').slideUp();
});
$('#editorRowOn').change(function() {
$('.editorRow').slideDown();
});
$('#editorRowOff').change(function() {
$('.editorRow').slideUp();
});
$('#rbRowOn').change(function() {
$('.rbRow').fadeIn();
});
$('#rbRowOff').change(function() {
$('.rbRow').fadeOut();
});
$('#useSmtp').change(function() {
$('.smtpRow').fadeIn();
});
$('#useMail').change(function() {
$('.smtpRow').fadeOut();
});
$('#captchaOn').change(function() {
$('.captchaRow').fadeIn();
});
$('#captchaOff').change(function() {
$('.captchaRow').fadeOut();
});
})(jQuery);
</script>
(function($) {
$('input:radio').change(function() {
documentDirty = true;
});
$('#furlRowOn').change(function() {
$('.furlRow').fadeIn();
});
$('#furlRowOff').change(function() {
$('.furlRow').fadeOut();
});
$('#udPermsOn').change(function() {
$('.udPerms').slideDown();
});
$('#udPermsOff').change(function() {
$('.udPerms').slideUp();
});
$('#editorRowOn').change(function() {
$('.editorRow').slideDown();
});
$('#editorRowOff').change(function() {
$('.editorRow').slideUp();
});
$('#rbRowOn').change(function() {
$('.rbRow').fadeIn();
});
$('#rbRowOff').change(function() {
$('.rbRow').fadeOut();
});
$('#useSmtp').change(function() {
$('.smtpRow').fadeIn();
});
$('#useMail').change(function() {
$('.smtpRow').fadeOut();
});
$('#captchaOn').change(function() {
$('.captchaRow').fadeIn();
});
$('#captchaOff').change(function() {
$('.captchaRow').fadeOut();
});
})(jQuery);
<script>
function setChangesChunkProcessor(item)
{
item = item || document.querySelector('[name="chunk_processor"]:checked');
document.querySelectorAll('[name="enable_at_syntax"], [name="enable_filter"]').forEach(function(el) {
if (item.checked && item.value === 'DLTemplate') {
el.checked = !!el.value;
el.disabled = true;
} else {
el.disabled = false;
}
});
}
function setChangesChunkProcessor(item) {
item = item || document.querySelector('[name="chunk_processor"]:checked');
document.querySelectorAll('[name="enable_at_syntax"], [name="enable_filter"]').forEach(function(el) {
if (item.checked && item.value === 'DLTemplate') {
el.checked = !!el.value;
el.disabled = true;
} else {
el.disabled = false;
}
});
}
setChangesChunkProcessor();
setChangesChunkProcessor();
document.querySelectorAll('[name="chunk_processor"]').forEach(function(item) {
item.addEventListener('change', function() {
setChangesChunkProcessor(item);
}, false);
});
document.querySelectorAll('[name="chunk_processor"]').forEach(function(item) {
item.addEventListener('change', function() {
setChangesChunkProcessor(item);
}, false);
});
</script>
@if(is_numeric(get_by_key($_GET, 'tab')))
<script>tpSettings.setSelectedIndex({{ $_GET['tab'] }});</script>
Expand Down
6 changes: 2 additions & 4 deletions manager/views/partials/actionButtons.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
// actions buttons templates
<?php // actions buttons templates
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
if (EvolutionCMS()->getConfig('global_tabs') && !isset($_SESSION['stay'])) {
$_REQUEST['stay'] = 2;
Expand All @@ -9,8 +8,7 @@
} elseif (isset($_SESSION['stay'])) {
$_REQUEST['stay'] = $_SESSION['stay'];
}
$stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : '';
?>
$stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; ?>
<div id="actions">
<div class="btn-group">
@if(!empty($select) && !empty($save))
Expand Down

0 comments on commit 2ccccc4

Please sign in to comment.