diff --git a/application/controllers/Cron.php b/application/controllers/Cron.php
index 5a945d4bf..74b99f0e1 100644
--- a/application/controllers/Cron.php
+++ b/application/controllers/Cron.php
@@ -130,6 +130,22 @@ class cron extends CI_Controller {
$this->load->view('cron/edit', $data);
}
+ public function edit() {
+ $this->load->model('user_model');
+ if (!$this->user_model->authorize(99)) {
+ $this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
+ redirect('dashboard');
+ }
+
+ $id = xss_clean($this->input->post('id',true));
+ $description = xss_clean($this->input->post('description',true));
+ $expression = xss_clean($this->input->post('expression',true));
+ $enabled = xss_clean($this->input->post('enabled',true));
+
+ $this->cron_model->update_cron($id, $description, $expression, $enabled);
+
+ }
+
public function toogleEnableCronSwitch() {
$id = xss_clean($this->input->post('id',true));
diff --git a/application/views/cron/edit.php b/application/views/cron/edit.php
index cb7c44e39..5f7c10f10 100644
--- a/application/views/cron/edit.php
+++ b/application/views/cron/edit.php
@@ -9,7 +9,14 @@
| Identifier |
- id; ?> |
+
+
+
+
+
+
+
+ |
| Enabled |
@@ -48,7 +55,9 @@
diff --git a/assets/js/sections/cron.js b/assets/js/sections/cron.js
index 59b5ecc46..a48466634 100644
--- a/assets/js/sections/cron.js
+++ b/assets/js/sections/cron.js
@@ -83,6 +83,7 @@ function editCronDialog(e) {
var editCronModal = new bootstrap.Modal(document.getElementById('editCronModal'));
editCronModal.show();
modalEventListener();
+ $('[data-bs-toggle="tooltip"]').tooltip();
},
error: function (data) {
@@ -91,6 +92,23 @@ function editCronDialog(e) {
return false;
}
+function editCron() {
+ var $cron_id = '';
+ var $cron_description = '';
+ var $cron_expression = '';
+ var $cron_enabled = '';
+ $.ajax({
+ url: base_url + 'index.php/cron/edit',
+ method: 'POST',
+ data: {
+ cron_id: $cron_id,
+ cron_description: $cron_description,
+ cron_expression: $cron_expression,
+ cron_enabled: $cron_enabled
+ }
+ });
+}
+
function humanReadableInEditDialog() {
var exp_inputID = $('#edit_cron_expression_custom');
var exp_dropdownID = $('#edit_cron_expression_dropdown');
@@ -191,52 +209,3 @@ function loadCronTable(rows) {
init_expression_tooltips();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// const SPECIAL_EXPRESSIONS = {
-// '@yearly': '0 0 1 1 *',
-// '@annualy': '0 0 1 1 *',
-// '@monthly': '0 0 1 * *',
-// '@weekly': '0 0 * * 0',
-// '@daily': '0 0 * * *',
-// '@midnight': '0 0 * * *',
-// '@hourly': '0 * * * *'
-// };
-
-// function convSpecialExpression(expression) {
-// if (expression.startsWith('@')) {
-// const specialExpression = SPECIAL_EXPRESSIONS[expression];
-// if (specialExpression) {
-// return specialExpression;
-// } else {
-// throw new Error('Unknown special expression');
-// }
-// } else {
-// return expression;
-// }
-// }
\ No newline at end of file