Browse Source

Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

Yannick Warnier 11 years ago
parent
commit
d8fb9cb359

+ 5 - 4
main/inc/lib/javascript/asciimath/ASCIIMathML.js

@@ -104,10 +104,11 @@ var checkForMathML = true;     // check if browser can display MathML
 var notifyIfNoMathML = false;   // display note at top if no MathML capability
 var alertIfNoMathML = false;   // show alert box if no MathML capability
 var translateOnLoad = true;    // set to false to do call translators from js
-//Modified by Ivan Tcholakov, 19-OCT-2010.
-//var translateLaTeX = false;     // false to preserve $..$, $$..$$
-var translateLaTeX = true;
-//
+// Originally modified by Ivan Tcholakov, 19-OCT-2010.
+//var translateLaTeX = true;
+// See #6355
+var translateLaTeX = false; // false to preserve $..$, $$..$$
+
 var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{}
 var translateASCIIMath = true; // false to preserve `..`
 var translateASCIIsvg = true;  // false to preserve agraph.., \begin{graph}..

+ 2 - 2
main/user/user_import.php

@@ -46,7 +46,7 @@ if ($form->validate()) {
     if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) {
 
         $unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false;
-
+        //@todo : csv_to_array deprecated
         $users  = Import::csv_to_array($_FILES['import_file']['tmp_name']);
 
         $invalid_users  = array();
@@ -84,7 +84,7 @@ if ($form->validate()) {
                     if (!empty($current_user_list)) {
                         $user_ids = array();
                         foreach ($current_user_list as $user) {
-                            if ($user['status'] <> 1) {
+                            if (!CourseManager::is_course_teacher($user['user_id'], $course_code)) {
                                 $user_ids[]= $user['user_id'];
                             }
                         }

+ 10 - 3
main/work/edit.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;
 }
 

+ 4 - 1
main/work/upload.php

@@ -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

+ 6 - 1
main/work/upload_from_template.php

@@ -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

+ 8 - 2
main/work/work.lib.php

@@ -1698,8 +1698,8 @@ function get_work_user_list_from_documents(
     if ($getCount) {
         $select = " SELECT count() as count  ";
     } else {
-        $select1 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, w.title, w.document_id document_id, w.id, qualification, qualificator_id";
-        $select2 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, d.title, d.id document_id, 0, 0, 0";
+        $select1 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, w.title, w.parent_id, w.document_id document_id, w.id, qualification, qualificator_id";
+        $select2 = " SELECT DISTINCT u.firstname, u.lastname, u.user_id, d.title, w.parent_id, d.id document_id, 0, 0, 0";
     }
 
     $documentTable = Database::get_course_table(TABLE_DOCUMENT);
@@ -1716,8 +1716,11 @@ function get_work_user_list_from_documents(
         $studentId = api_get_user_id();
     }
     $studentId = intval($studentId);
+    $workId = intval($workId);
+
     $userCondition = " AND u.user_id = $studentId ";
     $sessionCondition = " AND w.session_id = $sessionId ";
+    $workCondition = " AND w.parent_id = $workId";
 
     $sql = "    (
                     $select1 FROM $userTable u
@@ -1727,6 +1730,7 @@ function get_work_user_list_from_documents(
                         $userCondition
                         $sessionCondition
                         $whereCondition
+                        $workCondition
 
                 ) UNION (
                     $select2 FROM $workTable w
@@ -1744,6 +1748,7 @@ function get_work_user_list_from_documents(
                                 filetype = 'file' AND
                                 active = 1
                                 $sessionCondition
+                                $workCondition
                             )
                 )
             ";
@@ -1825,6 +1830,7 @@ function get_work_user_list_from_documents(
             }
 
             $viewLink = null;
+
             if (!empty($itemId)) {
                 $viewLink = Display::url($viewIcon, $urlView.'&id='.$itemId);
             }

+ 4 - 1
main/work/work_list.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';
@@ -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'])) {

+ 2 - 3
main/work/work_list_all.php

@@ -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'])) {

+ 6 - 3
main/work/work_missing.php

@@ -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);