From 429c4f647718b3ffabb1c469e7647be59405a63f Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sun, 3 Dec 2023 09:37:39 +0100 Subject: [PATCH] Version Dialog --- application/controllers/Options.php | 36 +++++++++++ application/views/interface_assets/footer.php | 11 ++++ application/views/options/sidebar.php | 1 + application/views/options/version_dialog.php | 62 +++++++++++++++++++ assets/js/sections/version_dialog.js | 22 +++++++ 5 files changed, 132 insertions(+) create mode 100644 application/views/options/version_dialog.php create mode 100644 assets/js/sections/version_dialog.js diff --git a/application/controllers/Options.php b/application/controllers/Options.php index a01e14ab..d703256d 100644 --- a/application/controllers/Options.php +++ b/application/controllers/Options.php @@ -390,4 +390,40 @@ class Options extends CI_Controller { redirect('/options/email'); } + // function used to display the /version_dialog url + function version_dialog() { + + $data['page_title'] = $this->lang->line('options_cloudlog_options'); + $data['sub_heading'] = $this->lang->line('options_version_dialog_settings'); + + $this->load->view('interface_assets/header', $data); + $this->load->view('options/version_dialog'); + $this->load->view('interface_assets/footer'); + } + + function version_dialog_save() { + + // Get Language Options + + $data['page_title'] = $this->lang->line('options_cloudlog_options'); + $data['sub_heading'] = $this->lang->line('options_version_dialog_settings'); + + $this->load->helper(array('form', 'url')); + + + $version_dialog_mode = $this->optionslib->update('version_dialog', $this->input->post('version_dialog_mode'), 'yes'); + if($version_dialog_mode == TRUE) { + $this->session->set_flashdata('success', $this->lang->line('options_version_dialog_mode_changed_to')." "."'".$this->input->post('version_dialog_mode')."'"); + } + if ($this->input->post('version_dialog_mode') == "both" || $this->input->post('version_dialog_mode') == "custom_text" ) { + $version_dialog_custom_text = $this->optionslib->update('version_dialog_text', $this->input->post('version_dialog_custom_text'), 'yes'); + if($version_dialog_custom_text == TRUE) { + $this->session->set_flashdata('success2', $this->lang->line('options_version_dialog_custom_text_saved')); + } + } + + redirect('/options/version_dialog'); + + } + } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 2496cc11..552176a2 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -45,6 +45,7 @@ + @@ -66,6 +67,16 @@ function load_was_map() { + +optionslib->get_option('version_dialog'); +if($versionDialog != "disabled") { + // Here will be the Version Dialog Part +} +?> + + + uri->segment(1) == "oqrs") { ?> diff --git a/application/views/options/sidebar.php b/application/views/options/sidebar.php index 7e21426d..902bd396 100644 --- a/application/views/options/sidebar.php +++ b/application/views/options/sidebar.php @@ -6,6 +6,7 @@
  • +
  • diff --git a/application/views/options/version_dialog.php b/application/views/options/version_dialog.php new file mode 100644 index 00000000..f535d5b8 --- /dev/null +++ b/application/views/options/version_dialog.php @@ -0,0 +1,62 @@ +
    + +
    + + load->view('options/sidebar') ?> + + + +
    +
    +

    -

    + +
    + session->flashdata('success')) { ?> + +
    + session->flashdata('success'); ?> +
    + + + session->flashdata('success2')) { ?> + +
    + session->flashdata('success2'); ?> +
    + + + session->flashdata('message')) { ?> + +
    + session->flashdata('message'); ?> +
    + + + + +
    + + + +
    + + + + + + +
    +
    +
    +
    + +
    \ No newline at end of file diff --git a/assets/js/sections/version_dialog.js b/assets/js/sections/version_dialog.js new file mode 100644 index 00000000..9e60bffb --- /dev/null +++ b/assets/js/sections/version_dialog.js @@ -0,0 +1,22 @@ + +// Admin Menu - Version Dialog Settings + +function showCustomTextarea() { + var selectedOptionValue = $("#version_dialog_mode option:selected").val(); + + if (selectedOptionValue === "custom_text" || selectedOptionValue === "both") { + $('#version_dialog_custom_textarea').show(); + } else { + $('#version_dialog_custom_textarea').hide(); + } +} + +$(document).ready(function () { + showCustomTextarea(); +}); + +$('#version_dialog_mode').on('change', function () { + showCustomTextarea(); +}); + +// \ No newline at end of file