2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_commands.php: fixed the ajax of "get_alert_command". Fixes: #2214 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8133 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
361e63c218
commit
8cbf72e246
|
@ -1,3 +1,10 @@
|
||||||
|
2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* godmode/alerts/alert_commands.php: fixed the ajax of
|
||||||
|
"get_alert_command".
|
||||||
|
|
||||||
|
Fixes: #2214
|
||||||
|
|
||||||
2013-05-14 Ramon Novoa <rnovoa@artica.es>
|
2013-05-14 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* include/config_process.php,
|
* include/config_process.php,
|
||||||
|
|
|
@ -42,7 +42,7 @@ if (is_ajax ()) {
|
||||||
$id = (int) get_parameter ('id', 0);
|
$id = (int) get_parameter ('id', 0);
|
||||||
|
|
||||||
// If command ID is not provided, check for action id
|
// If command ID is not provided, check for action id
|
||||||
if($id == 0) {
|
if ($id == 0) {
|
||||||
$id_action = (int) get_parameter ('id_action');
|
$id_action = (int) get_parameter ('id_action');
|
||||||
$id = alerts_get_alert_action_alert_command_id($id_action);
|
$id = alerts_get_alert_action_alert_command_id($id_action);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ if (is_ajax ()) {
|
||||||
$command = alerts_get_alert_command ($id);
|
$command = alerts_get_alert_command ($id);
|
||||||
|
|
||||||
// If is setted a description, we change the carriage return by <br> tags
|
// If is setted a description, we change the carriage return by <br> tags
|
||||||
if(isset($command['description'])) {
|
if (isset($command['description'])) {
|
||||||
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
|
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,13 +63,14 @@ if (is_ajax ()) {
|
||||||
$fields_values = empty($command['fields_values']) ? '' : json_decode(io_safe_output($command['fields_values']), true);
|
$fields_values = empty($command['fields_values']) ? '' : json_decode(io_safe_output($command['fields_values']), true);
|
||||||
|
|
||||||
$fields_rows = array();
|
$fields_rows = array();
|
||||||
for($i=1;$i<=10;$i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
if(!empty($fields_descriptions[$i-1])) {
|
if (!empty($fields_descriptions[$i - 1])) {
|
||||||
$fdesc = $fields_descriptions[$i-1].' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>';
|
$fdesc = $fields_descriptions[$i - 1] .
|
||||||
|
' <br><span style="font-size:xx-small; font-weight:normal;">' . sprintf(__('Field %s'), $i) . '</span>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
|
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
|
||||||
if(substr_count($command['command'], "_field$i_") > 0) {
|
if (substr_count($command['command'], "_field" . $i . "_") > 0) {
|
||||||
$fdesc = sprintf(__('Field %s'), $i);
|
$fdesc = sprintf(__('Field %s'), $i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -77,16 +78,16 @@ if (is_ajax ()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($fields_values[$i-1])) {
|
if (!empty($fields_values[$i-1])) {
|
||||||
$fields_value_select = array();
|
$fields_value_select = array();
|
||||||
$fv = $fields_values[$i-1];
|
$fv = $fields_values[$i-1];
|
||||||
$fv = explode(';', $fv);
|
$fv = explode(';', $fv);
|
||||||
|
|
||||||
if(empty($fv)) {
|
if (empty($fv)) {
|
||||||
$fv = array();
|
$fv = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($fv as $fv_option) {
|
foreach ($fv as $fv_option) {
|
||||||
$fv_option = explode(',', $fv_option);
|
$fv_option = explode(',', $fv_option);
|
||||||
$fields_value_select[$fv_option[0]] = $fv_option[1];
|
$fields_value_select[$fv_option[0]] = $fv_option[1];
|
||||||
}
|
}
|
||||||
|
@ -98,16 +99,17 @@ if (is_ajax ()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The empty descriptions will be ignored
|
// The empty descriptions will be ignored
|
||||||
if($fdesc == '') {
|
if ($fdesc == '') {
|
||||||
$fields_rows[$i] = '';
|
$fields_rows[$i] = '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$fields_rows[$i] = '<tr id="table1-field'.$i.'" class="datos">
|
$fields_rows[$i] =
|
||||||
|
'<tr id="table1-field' . $i . '" class="datos">
|
||||||
<td style="font-weight:bold;width:20%" class="datos">
|
<td style="font-weight:bold;width:20%" class="datos">
|
||||||
'.$fdesc.'
|
' . $fdesc . '
|
||||||
</td>
|
</td>
|
||||||
<td class="datos">
|
<td class="datos">
|
||||||
'.$ffield.'
|
' . $ffield . '
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
@ -139,7 +141,7 @@ if ($create_command) {
|
||||||
$fields_values = array();
|
$fields_values = array();
|
||||||
$info_fields = '';
|
$info_fields = '';
|
||||||
$values = array();
|
$values = array();
|
||||||
for($i=1;$i<=10;$i++) {
|
for ($i=1;$i<=10;$i++) {
|
||||||
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
|
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
|
||||||
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
|
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
|
||||||
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];
|
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];
|
||||||
|
@ -190,7 +192,7 @@ if ($update_command) {
|
||||||
$fields_values = array();
|
$fields_values = array();
|
||||||
$info_fields = '';
|
$info_fields = '';
|
||||||
$values = array();
|
$values = array();
|
||||||
for($i=1;$i<=10;$i++) {
|
for ($i=1;$i<=10;$i++) {
|
||||||
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
|
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
|
||||||
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
|
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
|
||||||
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];
|
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];
|
||||||
|
@ -279,12 +281,14 @@ foreach ($commands as $command) {
|
||||||
$data[0] .= $command['name'];
|
$data[0] .= $command['name'];
|
||||||
$data[0] .= '</span>';
|
$data[0] .= '</span>';
|
||||||
$data[1] = $command['id'];
|
$data[1] = $command['id'];
|
||||||
$data[2] = str_replace("\r\n","<br>",io_safe_output($command['description']));
|
$data[2] = str_replace("\r\n","<br>",
|
||||||
|
io_safe_output($command['description']));
|
||||||
$data[3] = '';
|
$data[3] = '';
|
||||||
if (! $command['internal'])
|
if (! $command['internal']) {
|
||||||
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
|
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
|
||||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
|
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
|
||||||
html_print_image("images/cross.png", true) . '</a>';
|
html_print_image("images/cross.png", true) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -293,11 +297,13 @@ if (isset($data)) {
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<div class='nf'>".__('No alert commands configured')."</div>";
|
echo "<div class='nf'>" .
|
||||||
|
__('No alert commands configured') .
|
||||||
|
"</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
|
||||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
echo '<form method="post" action="index.php?sec=' . $sec . '&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||||
html_print_submit_button (__('Create'), 'create', false, 'class="sub next"');
|
html_print_submit_button (__('Create'), 'create', false, 'class="sub next"');
|
||||||
html_print_input_hidden ('create_alert', 1);
|
html_print_input_hidden ('create_alert', 1);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
Loading…
Reference in New Issue