mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
edit frontend
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -9,7 +9,14 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Identifier</th>
|
||||
<td><?php echo $cron->id; ?></td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" disabled style="font-family: Courier New;" name="edit_cron_id" id="edit_cron_id" value="<?php echo $cron->id; ?>">
|
||||
<span class="input-group-text" data-bs-toggle="tooltip" data-bs-placement="right" title="ID's can't be changed">
|
||||
<i class="fas fa-info"></i>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Enabled</th>
|
||||
@@ -48,7 +55,9 @@
|
||||
|
||||
<select class="form-select mb-4" id="edit_cron_expression_dropdown" name="edit_cron_expression_dropdown">
|
||||
<?php foreach ($presets as $cron_preset => $label) : ?>
|
||||
<option value="<?php echo $cron_preset; ?>" <?php if ($cron->expression == $cron_preset) { echo " selected=\"selected\""; } ?>><?php echo $label; ?></option>
|
||||
<option value="<?php echo $cron_preset; ?>" <?php if ($cron->expression == $cron_preset) {
|
||||
echo " selected=\"selected\"";
|
||||
} ?>><?php echo $label; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user