Fix messages

ofaj
jmontoyaa 10 years ago
parent f3982ca0ac
commit a1ee00eb21
  1. 2
      main/work/add_document.php
  2. 2
      main/work/add_user.php
  3. 13
      main/work/edit.php
  4. 12
      main/work/upload.php
  5. 6
      main/work/upload_corrections.php
  6. 13
      main/work/upload_from_template.php
  7. 10
      main/work/work_list.php
  8. 40
      main/work/work_list_all.php

@ -41,8 +41,6 @@ $interbreadcrumb[] = array(
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddDocument'));
$error_message = null;
switch ($action) {
case 'delete':
if (!empty($workId) && !empty($docId)) {

@ -40,8 +40,6 @@ $interbreadcrumb[] = array(
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddUsers'));
$error_message = null;
switch ($action) {
case 'add':
$data = getUserToWork($userId, $workId, api_get_course_int_id());

@ -218,7 +218,6 @@ $class = 'save';
$form->addButtonUpdate($text);
$form->setDefaults($defaults);
$error_message = null;
$_course = api_get_course_info();
$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '/';
@ -262,10 +261,10 @@ if ($form->validate()) {
}
if ($_POST['qualification'] > $_POST['qualification_over']) {
$error_message .= Display::return_message(
Display::addFlash(Display::return_message(
get_lang('QualificationMustNotBeMoreThanQualificationOver'),
'error'
);
));
} else {
$sql = "UPDATE " . $work_table . "
SET title = '".Database::escape_string($title)."',
@ -284,16 +283,12 @@ if ($form->validate()) {
);
$succeed = true;
$error_message .= Display::return_message(get_lang('ItemUpdated'));
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
}
Security::clear_token();
} else {
// 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);
Display::addFlash(Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error'));
}
$script = 'work_list.php';

@ -27,9 +27,7 @@ if (empty($work_id)) {
}
protectWork($course_info, $work_id);
$workInfo = get_work_data_by_id($work_id);
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course(
$user_id,
$course_id,
@ -88,8 +86,6 @@ setWorkUploadForm($form, $workInfo['allow_text_assignment']);
$form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'sec_token', $token);
$error_message = null;
$succeed = false;
if ($form->validate()) {
@ -112,7 +108,9 @@ if ($form->validate()) {
exit;
} else {
// Bad token or can't add works
$error_message = Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
Display::addFlash(
Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error')
);
}
}
@ -143,10 +141,10 @@ if (!empty($work_id)) {
} elseif ($student_can_edit_in_session && $validationStatus['has_ended'] == false) {
echo $tabs;
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
Display::addFlash(Display::return_message(get_lang('ActionNotAllowed'), 'error'));
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
Display::addFlash(Display::return_message(get_lang('ActionNotAllowed'), 'error'));
}
Display :: display_footer();

@ -62,8 +62,6 @@ $form->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'id', $workId);
$form->addButtonUpload(get_lang('Upload'));
$error_message = null;
$succeed = false;
if ($form->validate()) {
@ -199,10 +197,10 @@ if (!empty($workId)) {
if ($is_allowed_to_edit) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
api_not_allowed();
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
api_not_allowed();
}
Display :: display_footer();

@ -85,8 +85,6 @@ if (!empty($documentTemplateData)) {
$form->setDefaults($defaults);
$error_message = null;
$succeed = false;
if ($form->validate()) {
if ($student_can_edit_in_session && $check) {
@ -105,15 +103,12 @@ if ($form->validate()) {
$script = 'work_list_all.php';
}
if (!empty($error_message)) {
Session::write('error_message', $error_message);
}
Display::addFlash($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
$error_message = Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
Display::addFlash(Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error'));
}
}
@ -131,10 +126,10 @@ if (!empty($work_id)) {
} elseif ($student_can_edit_in_session && $validationStatus['has_ended'] == false) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
api_not_allowed();
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
api_not_allowed();
}
Display :: display_footer();

@ -71,12 +71,6 @@ if (!empty($my_folder_data['title'])) {
echo Display::page_subheader($my_folder_data['title']);
}
$error_message = Session::read('error_message');
if (!empty($error_message)) {
echo $error_message;
Session::erase('error_message');
}
if (!empty($my_folder_data['description'])) {
$contentWork = Security::remove_XSS($my_folder_data['description']);
$html = '';
@ -92,9 +86,9 @@ switch ($action) {
$fileDeleted = deleteWorkItem($item_id, $courseInfo);
if (!$fileDeleted) {
Display::display_error_message(get_lang('YouAreNotAllowedToDeleteThisDocument'));
Display::addFlash(Display::return_message(get_lang('YouAreNotAllowedToDeleteThisDocument')));
} else {
Display::display_confirmation_message(get_lang('TheDocumentHasBeenDeleted'));
Display::addFlash(Display::return_message(get_lang('TheDocumentHasBeenDeleted')));
}
break;
}

@ -82,11 +82,8 @@ $interbreadcrumb[] = array(
'name' => $my_folder_data['title']
);
$error_message = null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$itemId = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$message = null;
switch ($action) {
case 'export_to_doc':
@ -104,9 +101,13 @@ switch ($action) {
if ($itemId) {
$fileDeleted = deleteWorkItem($itemId, $courseInfo);
if (!$fileDeleted) {
$message = Display::return_message(get_lang('YouAreNotAllowedToDeleteThisDocument'), 'error');
Display::addFlash(
Display::return_message(get_lang('YouAreNotAllowedToDeleteThisDocument'), 'error')
);
} else {
$message = Display::return_message(get_lang('TheDocumentHasBeenDeleted'), 'confirmation');
Display::addFlash(
Display::return_message(get_lang('TheDocumentHasBeenDeleted'), 'confirmation')
);
}
}
break;
@ -117,7 +118,9 @@ switch ($action) {
if (isset($itemId) && $itemId == 'all') {
} else {
makeVisible($itemId, $courseInfo);
$message = Display::return_message(get_lang('FileVisible'), 'confirmation');
Display::addFlash(
Display::return_message(get_lang('FileVisible'), 'confirmation')
);
}
}
}
@ -128,7 +131,9 @@ switch ($action) {
if (isset($itemId) && $itemId == 'all') {
} else {
makeInvisible($itemId, $courseInfo);
$message = Display::return_message(get_lang('FileInvisible'), 'confirmation');
Display::addFlash(
Display::return_message(get_lang('FileInvisible'), 'confirmation')
);
}
}
break;
@ -146,18 +151,13 @@ $htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-upload'));
Display :: display_header(null);
echo $message;
$documentsAddedInWork = getAllDocumentsFromWorkToString($workId, $courseInfo);
$actionsLeft = '';
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'">'.
$actionsLeft = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfCourse) {
/*echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';*/
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
$actionsLeft .= Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
@ -178,23 +178,17 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfC
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/edit_work.php?'.api_get_cidreq().'&id='.$workId.'">';
$actionsLeft .= Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
$url = api_get_path(WEB_CODE_PATH).'work/upload_corrections.php?'.api_get_cidreq().'&id='.$workId;
$actionsLeft .= Display::toolbarButton(get_lang('UploadCorrections'), $url, 'upload', 'success');
}
echo Display::toolbarAction('toolbar-worklist', array( 0 => $actionsLeft), 1);
echo Display::toolbarAction('toolbar-worklist', array($actionsLeft), 1);
if (!empty($my_folder_data['title'])) {
echo Display::page_subheader($my_folder_data['title']);
}
$error_message = Session::read('error_message');
if (!empty($error_message)) {
echo $error_message;
Session::erase('error_message');
}
if (!empty($my_folder_data['description'])) {
$contentWork = Security::remove_XSS($my_folder_data['description']);
$html = '';
@ -378,7 +372,7 @@ $extra_params = array(
'sortable' => 'false'
);
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_all&work_id='.$workId.'&type='.$type;
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_all&work_id='.$workId.'&type='.$type.'&'.api_get_cidreq();
?>
<script>
$(function() {

Loading…
Cancel
Save