2012-11-19 Dario Rodriguez <dario.rodriguez@artica.es>
* operation/integria_incidents/incident.list.php, operation/integria_incidents/incident.incident.php, operation/integria_incidents/incident.php, operation/integria_incidents/incident.files.php, operation/integria_incidents/incident.workunits.php: Fixed several errors in behavior, added messages about operation result and added style to buttons. MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7160 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
34867c52ad
commit
9e485707e4
|
@ -1,3 +1,14 @@
|
||||||
|
2012-11-19 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||||
|
|
||||||
|
* operation/integria_incidents/incident.list.php,
|
||||||
|
operation/integria_incidents/incident.incident.php,
|
||||||
|
operation/integria_incidents/incident.php,
|
||||||
|
operation/integria_incidents/incident.files.php,
|
||||||
|
operation/integria_incidents/incident.workunits.php: Fixed several errors
|
||||||
|
in behavior, added messages about operation result and added style to buttons.
|
||||||
|
|
||||||
|
MERGED FROM 4.0.2
|
||||||
|
|
||||||
2012-11-19 Junichi Satoh <junichi@rworks.jp>
|
2012-11-19 Junichi Satoh <junichi@rworks.jp>
|
||||||
|
|
||||||
* godmode/agentes/planned_downtime.editor.php: Allowed to change
|
* godmode/agentes/planned_downtime.editor.php: Allowed to change
|
||||||
|
|
|
@ -26,7 +26,7 @@ $table->data[1][0] = "<b>".__('Description')."</b><br/>".html_print_textarea('de
|
||||||
|
|
||||||
$form = "<form method='post' action='' enctype='multipart/form-data'>";
|
$form = "<form method='post' action='' enctype='multipart/form-data'>";
|
||||||
$form .= html_print_table($table, true);
|
$form .= html_print_table($table, true);
|
||||||
$form .= html_print_submit_button(__('Add'), 'submit_button', false, '', true);
|
$form .= html_print_submit_button(__('Add'), 'submit_button', false, 'class="sub next"', true);
|
||||||
$form .= html_print_input_hidden('tab', 'files', true);
|
$form .= html_print_input_hidden('tab', 'files', true);
|
||||||
$form .= html_print_input_hidden('attach_file', '1', true);
|
$form .= html_print_input_hidden('attach_file', '1', true);
|
||||||
$form .= html_print_input_hidden('id_incident', $id_incident, true);
|
$form .= html_print_input_hidden('id_incident', $id_incident, true);
|
||||||
|
|
|
@ -121,7 +121,7 @@ $table->data[4][0] = "<b>".__('Resolution epilog')."</b><br/>".html_print_textar
|
||||||
if(isset($result['id_incidencia'])) {
|
if(isset($result['id_incidencia'])) {
|
||||||
echo "<form method='post' action=''>";
|
echo "<form method='post' action=''>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
html_print_submit_button(__('Update'), 'submit_button');
|
html_print_submit_button(__('Update'), 'submit_button', false, "class='sub upd'");
|
||||||
html_print_input_hidden('tab', 'incident');
|
html_print_input_hidden('tab', 'incident');
|
||||||
html_print_input_hidden('update_incident', '1');
|
html_print_input_hidden('update_incident', '1');
|
||||||
html_print_input_hidden('id_incident', $result['id_incidencia']);
|
html_print_input_hidden('id_incident', $result['id_incidencia']);
|
||||||
|
@ -130,8 +130,8 @@ if(isset($result['id_incidencia'])) {
|
||||||
else {
|
else {
|
||||||
echo "<form method='post' action='index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident'>";
|
echo "<form method='post' action='index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident'>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
html_print_submit_button(__('Create'), 'submit_button');
|
html_print_submit_button(__('Create'), 'submit_button', false, "class='sub next'");
|
||||||
html_print_input_hidden('tab', 'incident');
|
html_print_input_hidden('tab', 'list');
|
||||||
html_print_input_hidden('create_incident', '1');
|
html_print_input_hidden('create_incident', '1');
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ html_print_select ($groups, 'search_group', $search_group, '', '', 0, false, fal
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
html_print_submit_button (__('Search'));
|
html_print_submit_button (__('Search'), '', false, "class='sub search'");
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,23 @@ if($update_incident == 1) {
|
||||||
$params = implode($token, $values);
|
$params = implode($token, $values);
|
||||||
|
|
||||||
$url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params;
|
$url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params;
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_call_api($url);
|
$result = incidents_call_api($url);
|
||||||
|
|
||||||
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data']) {
|
||||||
|
ui_print_success_message (__("Incident updated"));
|
||||||
|
} else {
|
||||||
|
ui_print_error_message (__("There was a problem updating the incident, please check if any field was modified and the values are correct."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$create_incident = get_parameter('create_incident', 0);
|
$create_incident = get_parameter('create_incident', 0);
|
||||||
|
|
||||||
if($create_incident == 1) {
|
if($create_incident == 1) {
|
||||||
|
|
||||||
$values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
$values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
||||||
$values[1] = get_parameter('group');
|
$values[1] = get_parameter('group');
|
||||||
$values[2] = get_parameter('priority');
|
$values[2] = get_parameter('priority');
|
||||||
|
@ -67,9 +77,15 @@ if($create_incident == 1) {
|
||||||
$url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params;
|
$url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params;
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_xml_to_array(incidents_call_api($url));
|
$result = incidents_call_api($url);
|
||||||
|
|
||||||
$id_incident = $result['data'];
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data']) {
|
||||||
|
ui_print_success_message (__("Incident created"));
|
||||||
|
} else {
|
||||||
|
ui_print_error_message (__("There was a problem creating incident"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
@ -121,7 +137,7 @@ if($attach_file == 1) {
|
||||||
$values[0] = $id_incident;
|
$values[0] = $id_incident;
|
||||||
$values[1] = $_FILES['new_file']['name'];
|
$values[1] = $_FILES['new_file']['name'];
|
||||||
$values[2] = $_FILES['new_file']['size'];
|
$values[2] = $_FILES['new_file']['size'];
|
||||||
$values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description'), __('No description available')));
|
$values[3] = io_safe_output(get_parameter('description'), __('No description available'));
|
||||||
$values[4] = base64_encode($file_content);
|
$values[4] = base64_encode($file_content);
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,31 +147,49 @@ if($attach_file == 1) {
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_call_api($url, array('params' => $params));
|
$result = incidents_call_api($url, array('params' => $params));
|
||||||
|
|
||||||
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data'] == 0) {
|
||||||
|
ui_print_success_message (__("File uploaded"));
|
||||||
|
} else {
|
||||||
|
ui_print_error_message (__("There was a problem uploading file"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch ($_FILES['new_file']['error']) {
|
switch ($_FILES['new_file']['error']) {
|
||||||
case 1:
|
case 1:
|
||||||
echo '<h3 class="error">'.__('File is too big').'</h3>';
|
ui_print_error_message (__('File is too big'));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
echo '<h3 class="error">'.__('File was partially uploaded. Please try again').'</h3>';
|
ui_print_error_message (__('File was partially uploaded. Please try again'));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
echo '<h3 class="error">'.__('No file was uploaded').'</h3>';
|
ui_print_error_message (__('No file was uploaded'));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo '<h3 class="error">'.__('Generic upload error').'(Code: '.$_FILES['new_file']['error'].')</h3>';
|
ui_print_error_message (__('Generic upload error').'(Code: '.$_FILES['new_file']['error'].')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$delete_file = get_parameter('delete_file', 0);
|
$delete_file = get_parameter('delete_file', 0);
|
||||||
|
|
||||||
if($delete_file != 0) {
|
if($delete_file != 0 && !$attach_file) {
|
||||||
$url = $integria_api."&op=delete_file¶ms=".$delete_file;
|
$url = $integria_api."&op=delete_file¶ms=".$delete_file;
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_call_api($url);
|
$result = incidents_call_api($url);
|
||||||
|
|
||||||
|
$result = incidents_call_api($url, array('params' => $params));
|
||||||
|
|
||||||
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data'] == 0 || $result_array['data'] == -2) {
|
||||||
|
ui_print_success_message (__("File deleted"));
|
||||||
|
} else if ($result_array['data'] == -1) {
|
||||||
|
ui_print_error_message (__("You user doesn't have enough rights to delete this file"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$delete_incident = get_parameter('delete_incident', 0);
|
$delete_incident = get_parameter('delete_incident', 0);
|
||||||
|
@ -165,6 +199,14 @@ if($delete_incident != 0) {
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_call_api($url);
|
$result = incidents_call_api($url);
|
||||||
|
|
||||||
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data']) {
|
||||||
|
ui_print_success_message (__("Incident deleted"));
|
||||||
|
} else {
|
||||||
|
ui_print_error_message (__("There was a problem deteling incident"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$create_workunit = get_parameter('create_workunit', 0);
|
$create_workunit = get_parameter('create_workunit', 0);
|
||||||
|
@ -183,11 +225,22 @@ if($create_workunit == 1) {
|
||||||
|
|
||||||
// Call the integria API
|
// Call the integria API
|
||||||
$result = incidents_call_api($url);
|
$result = incidents_call_api($url);
|
||||||
|
|
||||||
|
$result_array = incidents_xml_to_array($result);
|
||||||
|
|
||||||
|
if ($result_array['data']) {
|
||||||
|
ui_print_success_message (__("Workunit added"));
|
||||||
|
} else {
|
||||||
|
ui_print_error_message (__("There was a problem adding workunit"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
|
||||||
// Set the url with parameters to call the api
|
// Set the url with parameters to call the api
|
||||||
switch($tab) {
|
switch($tab) {
|
||||||
case 'list':
|
case 'list':
|
||||||
|
|
||||||
$search_string = get_parameter('search_string', "");
|
$search_string = get_parameter('search_string', "");
|
||||||
$params[0] = $search_string;
|
$params[0] = $search_string;
|
||||||
|
|
||||||
|
@ -196,7 +249,7 @@ switch($tab) {
|
||||||
|
|
||||||
$search_group = get_parameter('search_group', 1);
|
$search_group = get_parameter('search_group', 1);
|
||||||
$params[2] = $search_group;
|
$params[2] = $search_group;
|
||||||
|
|
||||||
$params = implode($token,$params);
|
$params = implode($token,$params);
|
||||||
|
|
||||||
$url = $integria_api."&op=get_incidents&token=".$token."¶ms=".$params;
|
$url = $integria_api."&op=get_incidents&token=".$token."¶ms=".$params;
|
||||||
|
@ -205,8 +258,13 @@ switch($tab) {
|
||||||
$url_groups = $integria_api."&op=get_groups¶ms=1";
|
$url_groups = $integria_api."&op=get_groups¶ms=1";
|
||||||
break;
|
break;
|
||||||
case 'incident':
|
case 'incident':
|
||||||
$url = $integria_api."&op=get_incident_details¶ms=".$id_incident;
|
|
||||||
case 'editor':
|
case 'editor':
|
||||||
|
//Request incident information if any
|
||||||
|
if ($id_incident) {
|
||||||
|
$url = $integria_api."&op=get_incident_details¶ms=".$id_incident;
|
||||||
|
} else {
|
||||||
|
$url = $integria_api."&op=get_incident_details";
|
||||||
|
}
|
||||||
$url_resolutions = $integria_api."&op=get_incidents_resolutions";
|
$url_resolutions = $integria_api."&op=get_incidents_resolutions";
|
||||||
$url_status = $integria_api."&op=get_incidents_status";
|
$url_status = $integria_api."&op=get_incidents_status";
|
||||||
$url_sources = $integria_api."&op=get_incidents_sources";
|
$url_sources = $integria_api."&op=get_incidents_sources";
|
||||||
|
|
|
@ -32,7 +32,7 @@ $table->data[1][0] = "<b>".__('Description')."</b><br/>".html_print_textarea('de
|
||||||
|
|
||||||
$form = "<form method='post' action=''>";
|
$form = "<form method='post' action=''>";
|
||||||
$form .= html_print_table($table, true);
|
$form .= html_print_table($table, true);
|
||||||
$form .= html_print_submit_button(__('Add'), 'submit_button', false, '', true);
|
$form .= html_print_submit_button(__('Add'), 'submit_button', false, 'class="sub next"', true);
|
||||||
$form .= html_print_input_hidden('tab', 'workunits', true);
|
$form .= html_print_input_hidden('tab', 'workunits', true);
|
||||||
$form .= html_print_input_hidden('create_workunit', '1', true);
|
$form .= html_print_input_hidden('create_workunit', '1', true);
|
||||||
$form .= html_print_input_hidden('id_incident', $id_incident, true);
|
$form .= html_print_input_hidden('id_incident', $id_incident, true);
|
||||||
|
|
Loading…
Reference in New Issue