Fixing error messages see BT#6916

1.9.x
Julio Montoya 11 years ago
parent 7e69625f02
commit ed43b621a8
  1. 13
      main/work/edit.php
  2. 5
      main/work/upload.php
  3. 7
      main/work/upload_from_template.php
  4. 5
      main/work/work_list.php
  5. 5
      main/work/work_list_all.php
  6. 9
      main/work/work_missing.php

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
@ -192,7 +194,7 @@ if ($form->validate()) {
}
if ($_POST['qualification'] > $_POST['qualification_over']) {
Display::display_error_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'));
$error_message .= Display::return_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'), 'error');
} else {
$sql = "UPDATE " . $work_table . "
SET title = '".Database::escape_string($title)."',
@ -204,7 +206,7 @@ if ($form->validate()) {
api_item_property_update($_course, 'work', $item_to_edit_id, 'DocumentUpdated', $user_id);
$succeed = true;
$error_message .= Display::return_message(get_lang('ItemUpdated'), false);
$error_message .= Display::return_message(get_lang('ItemUpdated'), 'warning');
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
@ -216,11 +218,16 @@ if ($form->validate()) {
// Bad token or can't add works
$error_message = Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
if (!empty($error_message)) {
Session::write('error_message', $error_message);
}
$script = 'work_list.php';
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id.'&error_message='.$error_message);
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id);
exit;
}

@ -93,7 +93,10 @@ if ($form->validate()) {
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id.'&error_message='.$error_message);
if (!empty($error_message)) {
Session::write('error_message', $error_message);
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id);
exit;
} else {
// Bad token or can't add works

@ -88,7 +88,12 @@ if ($form->validate()) {
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id.'&error_message='.$error_message);
if (!empty($error_message)) {
Session::write('error_message', $error_message);
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id);
exit;
} else {
// Bad token or can't add works

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
@ -67,9 +69,10 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
}
echo '</div>';
$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
$error_message = Session::read('error_message');
if (!empty($error_message)) {
echo $error_message;
Session::erase('error_message');
}
if (!empty($my_folder_data['description'])) {

@ -124,11 +124,10 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
}
echo '</div>';
if (empty($error_message)) {
$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
}
$error_message = Session::read('error_message');
if (!empty($error_message)) {
echo $error_message;
Session::erase('error_message');
}
if (!empty($my_folder_data['description'])) {

@ -47,6 +47,10 @@ switch ($action) {
} else {
$error_message = Display::return_message(get_lang('MessageHasBeenSent').' '.implode(', ', $mails_sent_to), 'success');
}
if (!empty($error_message)) {
Session::write('error_message', $error_message);
}
Security::clear_token();
}
break;
@ -104,11 +108,10 @@ if (!empty($workId)) {
echo $display_output;
echo '</div>';
if (empty($error_message)) {
$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
}
$error_message = Session::read('error_message');
if (!empty($error_message)) {
echo $error_message;
Session::erase('error_message');
}
display_list_users_without_publication($workId);

Loading…
Cancel
Save