Browse Source

Merge branch '1.10.x' into advsub

Daniel Barreto 10 years ago
parent
commit
829fba26ac

+ 14 - 14
main/coursecopy/classes/CourseRestorer.class.php

@@ -1131,7 +1131,7 @@ class CourseRestorer
 			$table = Database :: get_course_table(TABLE_AGENDA);
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_EVENT] as $id => $event) {
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $event->content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $event->content,
                     $this->course->code,
@@ -1208,7 +1208,7 @@ class CourseRestorer
 					$course_destination=$this->course->destination_path;
 				}
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $description_content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $cd->content,
                     $this->course->code,
@@ -1240,7 +1240,7 @@ class CourseRestorer
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement) {
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $announcement->content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $announcement->content,
                     $this->course->code,
@@ -1342,7 +1342,7 @@ class CourseRestorer
 				}
 
 				if ($id != -1) {
-					// check resources inside html from fckeditor tool and copy correct urls into recipient course
+					// check resources inside html from ckeditor tool and copy correct urls into recipient course
                     $quiz->description = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                         $quiz->description,
                         $this->course->code,
@@ -1438,7 +1438,7 @@ class CourseRestorer
 			$table_ans 		= Database::get_course_table(TABLE_QUIZ_ANSWER);
             $table_options	= Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
 
-			// check resources inside html from fckeditor tool and copy correct urls into recipient course
+			// check resources inside html from ckeditor tool and copy correct urls into recipient course
             $question->description = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                 $question->description,
                 $this->course->code,
@@ -1513,7 +1513,7 @@ class CourseRestorer
                 $correct_answers = array();
 				foreach ($question->answers as $index => $answer) {
 
-					// check resources inside html from fckeditor tool and copy correct urls into recipient course
+					// check resources inside html from ckeditor tool and copy correct urls into recipient course
                     $answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                         $answer['answer'],
                         $this->course->code,
@@ -1717,7 +1717,7 @@ class CourseRestorer
 
 				$result_check = Database::query($sql_check);
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $survey->title = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $survey->title,
                     $this->course->code,
@@ -1902,7 +1902,7 @@ class CourseRestorer
 			$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION);
 			$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
 
-			// check resources inside html from fckeditor tool and copy correct urls into recipient course
+			// check resources inside html from ckeditor tool and copy correct urls into recipient course
             $question->survey_question = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                 $question->survey_question,
                 $this->course->code,
@@ -1927,7 +1927,7 @@ class CourseRestorer
 			$new_id = Database::insert_id();
 			foreach ($question->answers as $index => $answer) {
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $answer['option_text'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $answer['option_text'],
                     $this->course->code,
@@ -2376,7 +2376,7 @@ class CourseRestorer
     				$condition_session = " , session_id = '$session_id' ";
     			}
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $glossary->description = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $glossary->description,
                     $this->course->code,
@@ -2429,7 +2429,7 @@ class CourseRestorer
 			foreach ($resources[RESOURCE_WIKI] as $id => $wiki) {
 				// the sql statement to insert the groups from the old course to the new course
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $wiki->content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $wiki->content,
                     $this->course->code,
@@ -2478,7 +2478,7 @@ class CourseRestorer
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_THEMATIC] as $id => $thematic) {
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $thematic->content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $thematic->content,
                     $this->course->code,
@@ -2533,7 +2533,7 @@ class CourseRestorer
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_ATTENDANCE] as $id => $obj) {
 
-				// check resources inside html from fckeditor tool and copy correct urls into recipient course
+				// check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $obj->params['description'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $obj->params['description'],
                     $this->course->code,
@@ -2576,7 +2576,7 @@ class CourseRestorer
             $resources = $this->course->resources;
             foreach ($resources[RESOURCE_WORK] as $obj) {
 
-                // check resources inside html from fckeditor tool and copy correct urls into recipient course
+                // check resources inside html from ckeditor tool and copy correct urls into recipient course
                 $obj->params['description'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
                     $obj->params['description'],
                     $this->course->code,

+ 93 - 23
main/document/edit_document.php

@@ -79,7 +79,7 @@ if (api_is_in_group()) {
 $dir = '/';
 
 $currentDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
-
+$readonly = false;
 if (isset($_GET['id'])) {
     $document_data = DocumentManager::get_document_data_by_id(
         $_GET['id'],
@@ -87,14 +87,13 @@ if (isset($_GET['id'])) {
         true
     );
 
-    $document_id    = $document_data['id'];
-    $file           = $document_data['path'];
-    $parent_id      = DocumentManager::get_document_id($course_info, dirname($file));
-    $dir            = dirname($document_data['path']);
-    $dir_original   =  $dir;
-
-    $doc            = basename($file);
-    $readonly       = $document_data['readonly'];
+	$document_id = $document_data['id'];
+	$file = $document_data['path'];
+	$parent_id = DocumentManager::get_document_id($course_info, dirname($file));
+	$dir = dirname($document_data['path']);
+	$dir_original = $dir;
+	$doc = basename($file);
+	$readonly = $document_data['readonly'];
 }
 
 if (empty($document_data)) {
@@ -193,8 +192,8 @@ if (!is_allowed_to_edit()) {
 
 if (isset($_POST['comment'])) {
 	// Fixing the path if it is wrong
-	$comment 	     = Database::escape_string(trim($_POST['comment']));
-	$title 		     = Database::escape_string(trim($_POST['title']));
+	$comment = Database::escape_string(trim($_POST['comment']));
+	$title = Database::escape_string(trim($_POST['title']));
     //Just in case see BT#3525
     if (empty($title)) {
 		$title = $documen_data['title'];
@@ -205,7 +204,7 @@ if (isset($_POST['comment'])) {
     if (!empty($document_id)) {
         $query = "UPDATE $dbTable SET comment='".$comment."', title='".$title."' WHERE c_id = $course_id AND id = ".$document_id;
         Database::query($query);
-        $info_message     = get_lang('fileModified');
+        $info_message = get_lang('fileModified');
     }
 }
 
@@ -249,17 +248,67 @@ if ($is_allowed_to_edit) {
 						if (!is_dir($filepath.'css')) {
 							mkdir($filepath.'css', api_get_permissions_for_new_directories());
 							$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
-							api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(), null, null, null, null, $sessionId);
-							api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(), null, null, null, null, $sessionId);
+							api_item_property_update(
+								$_course,
+								TOOL_DOCUMENT,
+								$doc_id,
+								'FolderCreated',
+								api_get_user_id(),
+								null,
+								null,
+								null,
+								null,
+								$sessionId
+							);
+							api_item_property_update(
+								$_course,
+								TOOL_DOCUMENT,
+								$doc_id,
+								'invisible',
+								api_get_user_id(),
+								null,
+								null,
+								null,
+								null,
+								$sessionId
+							);
 						}
 
 						if (!is_file($filepath.'css/frames.css')) {
 							$platform_theme = api_get_setting('stylesheets');
 							if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) {
 								copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css');
-								$doc_id = add_document($_course, $dir.'css/frames.css', 'file', filesize($filepath.'css/frames.css'), 'frames.css');
-								api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), null, null, null, null, $sessionId);
-								api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(), null, null, null, null, $sessionId);
+								$doc_id = add_document(
+									$_course,
+									$dir . 'css/frames.css',
+									'file',
+									filesize($filepath . 'css/frames.css'),
+									'frames.css'
+								);
+								api_item_property_update(
+									$_course,
+									TOOL_DOCUMENT,
+									$doc_id,
+									'DocumentAdded',
+									api_get_user_id(),
+									null,
+									null,
+									null,
+									null,
+									$sessionId
+								);
+								api_item_property_update(
+									$_course,
+									TOOL_DOCUMENT,
+									$doc_id,
+									'invisible',
+									api_get_user_id(),
+									null,
+									null,
+									null,
+									null,
+									$sessionId
+								);
 							}
 						}
 
@@ -267,12 +316,32 @@ if ($is_allowed_to_edit) {
 						$document_id = DocumentManager::get_document_id($_course, $file);
 
 						if ($document_id) {
-							update_existing_document($_course, $document_id, $file_size, $read_only_flag);
-							api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', api_get_user_id(), null, null, null, null, $sessionId);
+							update_existing_document(
+								$_course,
+								$document_id,
+								$file_size,
+								$read_only_flag
+							);
+							api_item_property_update(
+								$_course,
+								TOOL_DOCUMENT,
+								$document_id,
+								'DocumentUpdated',
+								api_get_user_id(),
+								null,
+								null,
+								null,
+								null,
+								$sessionId
+							);
 							// Update parent folders
-							item_property_update_on_folder($_course, $dir, api_get_user_id());
-							header('Location: document.php?id='.$document_data['parent_id'].'&'.api_get_cidreq());
-                            exit;
+							item_property_update_on_folder(
+								$_course,
+								$dir,
+								api_get_user_id()
+							);
+							header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq());
+							exit;
 						} else {
 							$msgError = get_lang('Impossible');
 						}
@@ -337,6 +406,7 @@ $document_info = api_get_item_property_info(
     $document_id,
     0
 );
+
 // Try to find this document in the session
 if (!empty($sessionId)) {
     $document_info = api_get_item_property_info(
@@ -390,9 +460,9 @@ if ($owner_id == api_get_user_id() ||
     if ($showSystemFolders == 1) {
         $condition = true;
     }
+
 	if (($extension == 'htm' || $extension == 'html') && $condition) {
 		if (empty($readonly) && $readonly == 0) {
-			$_SESSION['showedit'] = 1;
             $form->add_html_editor('content', '', false, false, $html_editor_config);
 		}
 	}

+ 25 - 29
main/document/showinframes.php

@@ -164,36 +164,32 @@ if ($is_courseAdmin) {
 $js_glossary_in_documents = '';
 
 if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
-    $js_glossary_in_documents = '	//	    $(document).ready(function() {
-                                    $.frameReady(function() {
-                                       //  $("<div>I am a div courses</div>").prependTo("body");
-                                      }, "top.mainFrame",
-                                      { load: [
-                                                {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
-                                                {type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
-                                                {type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
-                                                {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
-                                                {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
-                                           ]
-                                      }
-                                      );
-                                    //});';
+    $js_glossary_in_documents = '
+    $.frameReady(function() {
+       //  $("<div>I am a div courses</div>").prependTo("body");
+      }, "top.mainFrame",
+      { load: [
+            {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
+            {type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
+            {type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
+            {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
+            {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
+           ]
+    });';
 } elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
-    $js_glossary_in_documents =	'//    $(document).ready(function() {
-                                      $.frameReady(function(){
-                                       //  $("<div>I am a div courses</div>").prependTo("body");
-
-                                      }, "top.mainFrame",
-                                      { load: [
-                                                {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
-                                                {type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
-                                                {type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
-                                                {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
-                                                {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
-                                           ]
-                                      }
-                                      );
-                                //   });';
+    $js_glossary_in_documents =	'
+      $.frameReady(function(){
+       //  $("<div>I am a div courses</div>").prependTo("body");
+      }, "top.mainFrame",
+      {
+        load: [
+            { type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
+            { type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
+            { type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
+            { type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
+            { type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js"}
+        ]
+      });';
 }
 
 $web_odf_supported_files = DocumentManager::get_web_odf_extension_list();

+ 25 - 32
main/document/showinframesmin.php

@@ -65,8 +65,7 @@ if ($is_allowed_in_course == false) {
     api_not_allowed(true);
 }
 
-//Check user visibility
-//$is_visible = DocumentManager::is_visible_by_id($document_id, $course_info, api_get_session_id(), api_get_user_id());
+// Check user visibility
 $is_visible = DocumentManager::check_visibility_tree(
     $document_id,
     api_get_course_id(),
@@ -91,32 +90,31 @@ $browser_display_title = 'Documents - '.Security::remove_XSS($_GET['cidReq']).'
 
 $js_glossary_in_documents = '';
 if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
-    $js_glossary_in_documents = '	//	    $(document).ready(function() {
-                                    $.frameReady(function() {
-                                       //  $("<div>I am a div courses</div>").prependTo("body");
-                                      }, "mainFrame",
-                                      { load: [
-                                              {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
-                                            {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
-                                            {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
-                                           ]
-                                      }
-                                      );
-                                    //});';
+    $js_glossary_in_documents = '
+    $.frameReady(function() {
+       //  $("<div>I am a div courses</div>").prependTo("body");
+      }, "mainFrame",
+      { load: [
+              {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
+            {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
+            {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
+           ]
+      }
+      );
+    ';
 } elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
-    $js_glossary_in_documents =	'//    $(document).ready(function() {
-                                      $.frameReady(function(){
-                                       //  $("<div>I am a div courses</div>").prependTo("body");
-
-                                      }, "mainFrame",
-                                      { load: [
-                                              {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
-                                            {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
-                                            {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
-                                           ]
-                                      }
-                                      );
-                                //   });';
+    $js_glossary_in_documents =	'
+      $.frameReady(function(){
+       //  $("<div>I am a div courses</div>").prependTo("body");
+
+      }, "mainFrame",
+      { load: [
+              {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
+            {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
+            {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js"}
+           ]
+      });
+    ';
 }
 
 $htmlHeadXtra[] = '<script type="text/javascript">
@@ -127,11 +125,7 @@ $htmlHeadXtra[] = '<script type="text/javascript">
 $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
 $htmlHeadXtra[] = '
 <script type="text/javascript">
-<!--
     var updateContentHeight = function() {
-        //HeaderHeight = document.getElementById("header").offsetHeight;
-        //FooterHeight = document.getElementById("footer").offsetHeight;
-        //document.getElementById("mainFrame").style.height = ((docHeight-(parseInt(HeaderHeight)+parseInt(FooterHeight)))+60)+"px";
         my_iframe           = document.getElementById("mainFrame");
         new_height          = my_iframe.contentWindow.document.body.scrollHeight;
         my_iframe.height    = my_iframe.contentWindow.document.body.scrollHeight + "px";
@@ -142,7 +136,6 @@ $htmlHeadXtra[] = '
          updateContentHeight();
         '.$js_glossary_in_documents.'
     }
--->
 </script>';
 
 Display::display_reduced_header();

+ 2 - 2
main/inc/lib/hook/HookManagement.php

@@ -88,8 +88,8 @@ class HookManagement implements HookManagementInterface
     public function deleteHook($eventName, $observerClassName, $type)
     {
         if ($type === HOOK_EVENT_TYPE_ALL) {
-            $this->insertHook($eventName, $observerClassName, HOOK_EVENT_TYPE_PRE);
-            $this->insertHook($eventName, $observerClassName, HOOK_EVENT_TYPE_POST);
+            $this->deleteHook($eventName, $observerClassName, HOOK_EVENT_TYPE_PRE);
+            $this->deleteHook($eventName, $observerClassName, HOOK_EVENT_TYPE_POST);
         } else {
             $this->insertHookIfNotExist($eventName, $observerClassName);
 

+ 83 - 115
main/inc/lib/javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js

@@ -1,135 +1,103 @@
 /**
-* Makes posible to load glossary items from the Glossary Tool
+* Makes possible to load glossary items from the Glossary Tool
 *   This library will be loaded in:
 *
 *    document/showinframes.php
 *    newscorm/lp_view.php
 *    newscorm/scorm_api.php
-*    
+*
 */
 
-/*$(document).ready(function() {
-    $(window).load(function() {
-	*/	
-    my_protocol = location.protocol;
-    my_pathname=location.pathname;
-    work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
+my_protocol = location.protocol;
+my_pathname=location.pathname;
+work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
 
-    $.ajax({
-        contentType: "application/x-www-form-urlencoded",
-        beforeSend: function(content_object) {},
-        type: "POST",
-        url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
-        data: "glossary_data=true",
-        success: function(datas) {
-            if (datas.length==0) {
-                return false;
-            }
-            // glossary terms 
-            data_terms=datas.split("[|.|_|.|-|.|]");
-            var complex_array = new Array();
-            var cp_complex_array = new Array();
-            for(i=0;i<data_terms.length;i++) {
-                specific_terms=data_terms[i].split("__|__|");
-                var real_term = specific_terms[1]; // glossary term 
-                var real_code = specific_terms[0]; // glossary id
-                complex_array[real_code] = real_term;
-                cp_complex_array[real_code] = real_term;
-            }
+var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
+var imageSource = my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif";
+var indicatorImage ='<img src="' + imageSource + '" />';
+
+$.ajax({
+    contentType: "application/x-www-form-urlencoded",
+    beforeSend: function(content_object) {},
+    type: "POST",
+    url: ajaxRequestUrl,
+    data: "glossary_data=true",
+    success: function(datas) {
+        if (datas.length==0) {
+            return false;
+        }
+        // glossary terms
+        data_terms=datas.split("[|.|_|.|-|.|]");
+        var complex_array = new Array();
+        var cp_complex_array = new Array();
+        for(i=0;i<data_terms.length;i++) {
+            specific_terms=data_terms[i].split("__|__|");
+            var real_term = specific_terms[1]; // glossary term
+            var real_code = specific_terms[0]; // glossary id
+            complex_array[real_code] = real_term;
+            cp_complex_array[real_code] = real_term;
+        }
 
-            complex_array.reverse();
+        complex_array.reverse();
 
-            for (var my_index in complex_array) {
-                n = complex_array[my_index];
-                if (n == null) {
-                    n = '';
-                } else {
-                    for (var cp_my_index in cp_complex_array) {
-                        cp_data = cp_complex_array[cp_my_index];
-                        if (cp_data == null) {
-                            cp_data = '';
-                        } else {
-                            if (cp_data == n) {
-                                my_index = cp_my_index;
-                            }
+        for (var my_index in complex_array) {
+            n = complex_array[my_index];
+            if (n == null) {
+                n = '';
+            } else {
+                for (var cp_my_index in cp_complex_array) {
+                    cp_data = cp_complex_array[cp_my_index];
+                    if (cp_data == null) {
+                        cp_data = '';
+                    } else {
+                        if (cp_data == n) {
+                            my_index = cp_my_index;
                         }
                     }
-                    //alert(n + ' ' + my_index);
-                    $('body').removeHighlight().highlight(n,my_index) 
-                }                   
+                }
+                $('body').removeHighlight().highlight(n, my_index)
             }
+        }
 
-            var complex_array = new Array();
+        var complex_array = new Array();
+        //mouse on click
+        $("body").on("click", ".glossary-ajax", function(e) {
+            random_id = Math.round(Math.random()*100);
+            div_show_id = "div_show_id";
+            div_content_id = "div_content_id";
 
-            //mouse over event
-            //$("body .glossary-ajax").mouseover(function(){
-            //
-            //mouse on click
-            $("body").on("click", ".glossary-ajax", function(e) {
-                random_id = Math.round(Math.random()*100);
-                
-                //div_show_id = "div_show_id"+random_id;
-                //div_content_id = "div_content_id"+random_id;
-                div_show_id = "div_show_id";
-                div_content_id = "div_content_id";
-                
-                $(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>");
-                
-                //$("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
-                //$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");
-                
-                var $target = $(this);                
-                
-                $("#"+div_show_id).dialog("destroy");
-                $("#"+div_show_id).dialog({
-                    autoOpen: false,
-                    width: 600,
-                    height: 200,
-                    position:  { my: 'left top', at: 'right top', of: $target },
-                    close: function(){
-                         $("div#"+div_show_id).remove();
-                         $("div#"+div_content_id).remove();
-                    }
-                });
-                
-                notebook_id = $(this).attr("name");
-                data_notebook = notebook_id.split("link");
-                my_glossary_id = data_notebook[1];
-                
-                $.ajax({
-                    contentType: "application/x-www-form-urlencoded",
-                    beforeSend: function(content_object) {
-                        $("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />");
-                    },
-                    type: "POST",
-                    url: "../../../../../../../main/glossary/glossary_ajax_request.php",
-                    data: "glossary_id="+my_glossary_id,
-                    success: function(datas) {
-                        $("div#"+div_content_id).html(datas);
-                        $("#"+div_show_id).dialog("open");
-                    }
-                });
-                
+            $(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>");
+            var $target = $(this);
+
+            $("#"+div_show_id).dialog("destroy");
+            $("#"+div_show_id).dialog({
+                autoOpen: false,
+                width: 600,
+                height: 200,
+                position:  { my: 'left top', at: 'right top', of: $target },
+                close: function(){
+                     $("div#"+div_show_id).remove();
+                     $("div#"+div_content_id).remove();
+                }
             });
 
-            //mouse out event
-            /*$("body .glossary-ajax").mouseout(function(){
-                var current_element = $(this);
-                div_show_id=current_element.find("div").attr("id");
-                $("div#"+div_show_id).remove();
-            });*/
-            
-            //mouse click
-            
-            /*$("body").on("click", ".glossary-ajax", function(){
-                var current_element = $(this);
-                div_show_id=current_element.find("div").attr("id");
-                $("div#"+div_show_id).remove();
-            });*/
-            
-        }
+            notebook_id = $(this).attr("name");
+            data_notebook = notebook_id.split("link");
+            my_glossary_id = data_notebook[1];
 
-    });
-/*			
+            $.ajax({
+                contentType: "application/x-www-form-urlencoded",
+                beforeSend: function(content_object) {
+                    $("div#"+div_content_id).html(indicatorImage);
+                },
+                type: "POST",
+                url: ajaxRequestUrl,
+                data: "glossary_id="+my_glossary_id,
+                success: function(datas) {
+                    $("div#"+div_content_id).html(datas);
+                    $("#"+div_show_id).dialog("open");
+                }
+            });
         });
-});*/
+    }
+});

+ 45 - 65
main/inc/lib/javascript/ckeditor/plugins/glossary/fck_glossary_manual.js

@@ -1,73 +1,53 @@
 /**
-
-Makes posible to load glossary items from the Glossary Tool
+Makes possible to load glossary items from the Glossary Tool
 This library will be loaded in:
 
 document/showinframes.php
 newscorm/lp_view.php
 newscorm/scorm_api.php
 
- */
-//$(document).ready(function() {
-//    $(window).load(function () {
-    my_protocol = location.protocol;
-    my_pathname=location.pathname;
-    work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));      
-
-    //$("body .glossary").mouseover(function(){
-    $("body").on("click", ".glossary", function() {
-        is_glossary_name = $(this).html();	        
-        random_id = Math.round(Math.random()*100);
-
-        /*div_show_id="div_show_id"+random_id;
-                div_content_id="div_content_id"+random_id;*/
-
-        div_show_id="div_show_id";
-        div_content_id="div_content_id";
-        
-        $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
-
-        var $target = $(this);             
-
-        $("#"+div_show_id).dialog("destroy");
-        $("#"+div_show_id).dialog({
-            autoOpen: false,
-            width: 600,
-            height: 200,
-            position:  { my: 'left top', at: 'right top', of: $target },
-            close: function(){
-                $("div#"+div_show_id).remove();
-                $("div#"+div_content_id).remove();
-            }
-        });
-
-
-        
-        /* $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
-                 $("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");*/
-
-        $.ajax({
-            contentType: "application/x-www-form-urlencoded",
-            beforeSend: function(result) {
-                $("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />"); 
-            },        
-            type: "POST",
-            url: "../../../../../../../main/glossary/glossary_ajax_request.php",
-            data: "glossary_name="+is_glossary_name,
-            success: function(data) {
-                $("div#"+div_content_id).html(data);
-                $("#"+div_show_id).dialog("open");
-            }
-        });
-    });
-        
-/*
-	    $("body .glossary").mouseout(function(){
-	        current_element=$(this);
-	        div_show_id=current_element.find("div").attr("id");
-	        $("div#"+div_show_id).remove();
-	    });
 */
-		
-//    });
-//});
+my_protocol = location.protocol;
+my_pathname = location.pathname;
+work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
+var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
+
+var imageSource = my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif";
+var indicatorImage ='<img src="' + imageSource + '" />';
+
+$("body").on("click", ".glossary", function() {
+    is_glossary_name = $(this).html();
+    random_id = Math.round(Math.random()*100);
+    div_show_id = "div_show_id";
+    div_content_id = "div_content_id";
+
+    $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
+
+    var $target = $(this);
+
+    $("#"+div_show_id).dialog("destroy");
+    $("#"+div_show_id).dialog({
+        autoOpen: false,
+        width: 600,
+        height: 200,
+        position:  { my: 'left top', at: 'right top', of: $target },
+        close: function(){
+            $("div#"+div_show_id).remove();
+            $("div#"+div_content_id).remove();
+        }
+    });
+    var indicator =
+    $.ajax({
+        contentType: "application/x-www-form-urlencoded",
+        beforeSend: function(result) {
+            $("div#"+div_content_id).html(indicatorImage);
+        },
+        type: "POST",
+        url: ajaxRequestUrl,
+        data: "glossary_name="+is_glossary_name,
+        success: function(data) {
+            $("div#"+div_content_id).html(data);
+            $("#"+div_show_id).dialog("open");
+        }
+    });
+});

+ 16 - 14
main/inc/lib/javascript/glossary.js

@@ -1,33 +1,35 @@
 $(document).ready(function() {
-    $(window).load(function () {    	
-        var my_text=$(".glossary-content").html();
+    $(window).load(function () {
+        var my_text = $(".glossary-content").html();
         my_protocol = location.protocol;
         my_pathname=location.pathname;
         work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
+        var ajaxRequestUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
+
         $.ajax({
             contentType: "application/x-www-form-urlencoded",
             beforeSend: function(content_object) {
             },
             type: "POST",
-            url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
+            url: ajaxRequestUrl,
             data: "glossary_data=true",
             success: function(datas) {
                 if (datas.length==0) {
                     return false;
                 }
-                data_terms=datas.split("[|.|_|.|-|.|]");
+                data_terms = datas.split("[|.|_|.|-|.|]");
                 var complex_array = new Array();
                 var cp_complex_array = new Array();
-                for(i=0;i<data_terms.length;i++) {
+                for (i=0;i<data_terms.length;i++) {
                     specific_terms=data_terms[i].split("__|__|");
                     var real_term = specific_terms[1];
                     var real_code = specific_terms[0];
                     complex_array[real_code] = real_term;
                     cp_complex_array[real_code] = real_term;
                 }
-				
+
                 complex_array.reverse();
-				
+
                 for (var my_index in complex_array) {
                     n = complex_array[my_index];
                     if (n == null) {
@@ -43,10 +45,10 @@ $(document).ready(function() {
                                 }
                             }
                         }
-                        $('#highlight-plugin').removeHighlight().highlight(n,my_index) 
-                    }					
+                        $('#highlight-plugin').removeHighlight().highlight(n,my_index)
+                    }
                 }
-              
+
                 var complex_array = new Array();
                 $("#highlight-plugin .glossary-ajax").mouseover(function(){
                     random_id = Math.round(Math.random()*100);
@@ -54,7 +56,7 @@ $(document).ready(function() {
                     div_content_id="div_content_id"+random_id;
                     $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
                     $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
-                    $("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");	         
+                    $("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");
                     notebook_id = $(this).attr("name");
                     data_notebook = notebook_id.split("link");
                     my_glossary_id = data_notebook[1];
@@ -64,20 +66,20 @@ $(document).ready(function() {
                             $("div#"+div_content_id).html("<img src='../../../../main/inc/lib/javascript/indicator.gif' />");
                         },
                         type: "POST",
-                        url: "../../../../main/glossary/glossary_ajax_request.php",
+                        url: ajaxRequestUrl,
                         data: "glossary_id="+my_glossary_id,
                         success: function(datas) {
                             $("div#"+div_content_id).html(datas);
                         }
                     });
                 });
+
                 $("#highlight-plugin .glossary-ajax").mouseout(function(){
                     var current_element = $(this);
                     div_show_id=current_element.find("div").attr("id");
                     $("div#"+div_show_id).remove();
                 });
-                //helpers		
             }
         });
     });
-});
+});

+ 15 - 7
main/inc/lib/sessionmanager.lib.php

@@ -5272,20 +5272,29 @@ class SessionManager
     }
 
     /**
-     * Get the session coached by a user
+     * Get the session coached by a user (general coach and course-session coach)
      * @param int $coachId The coach id
-     * @param boolean $checkSessionRelUserVisibility Optional. Check the session visibility
+     * @param boolean $checkSessionRelUserVisibility Check the session visibility
      * @return array The session list
      */
     public static function getSessionsCoachedByUser($coachId, $checkSessionRelUserVisibility = false)
     {
+        // Get all sessions where $coachId is the general coach
         $sessions = self::get_sessions_by_general_coach($coachId);
-        $sessionsByCoach = self::get_sessions_by_coach($coachId);
+        // Get all sessions where $coachId is the course - session coach
+        $courseSessionList = self::getCoursesListByCourseCoach($coachId);
+        $sessionsByCoach = array();
+        if (!empty($courseSessionList)) {
+            foreach ($courseSessionList as $courseSession) {
+                $sessionsByCoach[$courseSession['id_session']] = api_get_session_info($courseSession['id_session']);
+            }
+        }
 
         if (!empty($sessionsByCoach)) {
             $sessions = array_merge($sessions, $sessionsByCoach);
         }
-        //Remove  repeated sessions
+
+        // Remove repeated sessions
         if (!empty($sessions)) {
             $cleanSessions = array();
             foreach ($sessions as $session) {
@@ -5427,9 +5436,8 @@ class SessionManager
      */
     public static function getCoursesListByCourseCoach($coachId)
     {
-        $srcruTable = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-
-        return  Database::select('*', $srcruTable, array(
+        $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+        return  Database::select('*', $table, array(
             'where' => array(
                 'id_user = ? AND ' => $coachId,
                 'status = ?' => 2

+ 36 - 41
main/newscorm/lp_view.php

@@ -332,7 +332,8 @@ $mediaplayer    = $_SESSION['oLP']->get_mediaplayer($autostart);
 $tbl_lp_item    = Database::get_course_table(TABLE_LP_ITEM);
 $show_audioplayer = false;
 // Getting all the information about the item.
-$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id."'";
+$sql = "SELECT audio FROM " . $tbl_lp_item . "
+        WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id."'";
 $res_media= Database::query($sql);
 
 if (Database::num_rows($res_media) > 0) {
@@ -360,31 +361,29 @@ if ($is_allowed_to_edit) {
     echo '<div id="header">';
     //echo '<a href="lp_controller.php?action=return_to_course_homepage&'.api_get_cidreq().'" target="_self" onclick="javascript: window.parent.API.save_asset();"></a>';
 
-                    // Return to course home.
-                    if ($is_allowed_to_edit) {
-                        $url = 'lp_controller.php?isStudentView=false&action=return_to_course_homepage&' . api_get_cidreq();
-                    } else {
-                        $url = 'lp_controller.php?action=return_to_course_homepage&' . api_get_cidreq();
-                    }
-
-                    $name = get_lang('CourseHomepageLink');
-                    // Return to lp list
-                    if (api_get_course_setting('lp_return_link') == 1) {
-                        $url .= '&redirectTo=lp_list';
-                        $name = get_lang('LearningPathList');
-                    }
-
-                    echo Display::url(
-                        $name,
-                        $url,
-                        array(
-                            'class' => 'home btn btn-small btn-info',
-                            'target' => '_self',
-                            'onclick' => 'javascript: window.parent.API.save_asset();'
-                        )
-                    );
+    // Return to course home.
+    if ($is_allowed_to_edit) {
+        $url = 'lp_controller.php?isStudentView=false&action=return_to_course_homepage&' . api_get_cidreq();
+    } else {
+        $url = 'lp_controller.php?action=return_to_course_homepage&' . api_get_cidreq();
+    }
 
+    $name = get_lang('CourseHomepageLink');
+    // Return to lp list
+    if (api_get_course_setting('lp_return_link') == 1) {
+        $url .= '&redirectTo=lp_list';
+        $name = get_lang('LearningPathList');
+    }
 
+    echo Display::url(
+        $name,
+        $url,
+        array(
+            'class' => 'home btn btn-small btn-info',
+            'target' => '_self',
+            'onclick' => 'javascript: window.parent.API.save_asset();'
+        )
+    );
     echo '</div>';
 ?>
         <!-- end header -->
@@ -485,38 +484,34 @@ if ($is_allowed_to_edit) {
     // Loads the glossary library.
     <?php
       if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
-           if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
-                ?>
+           if (api_get_setting('show_glossary_in_documents') == 'ismanual') { ?>
             $.frameReady(function(){
                    //  $("<div>I am a div courses</div>").prependTo("body");
          }, "top.content_name",
           { load: [
-                  {type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
-                  {type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
-                  {type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
-                  {type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
-
+              { type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
+              { type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
+              { type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
+              { type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
           ] }
           );
-    <?php
-        } elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
-      ?>
+    <?php } elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') { ?>
     $.frameReady(function(){
         //  $("<div>I am a div courses</div>").prependTo("body");
       },
         "top.content_name",
       {
       load: [
-          {type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
-          {type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
-          {type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
-          {type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
+          { type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
+          { type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
+          { type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
+          { type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
       ]}
       );
-  <?php
-       }
+    <?php }
+    }
+  ?>
   }
-  ?>}
     $(document).ready(function() {
         updateContentHeight();
         $('#hide_bar').children().click(function(){

+ 4 - 3
main/newscorm/scorm_api.php

@@ -1972,6 +1972,7 @@ function attach_glossary_into_scorm(type) {
     my_protocol = location.protocol;
     my_pathname=location.pathname;
     work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
+    var ajaxRequestUrl = '<?php echo api_get_path(WEB_CODE_PATH).'glossary/glossary_ajax_request.php'; ?>';
 
     if (type == 'automatic') {
         $.ajax({
@@ -1979,7 +1980,7 @@ function attach_glossary_into_scorm(type) {
             beforeSend: function(object) {
             },
             type: "POST",
-            url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
+            url: ajaxRequestUrl,
             data: "glossary_data=true",
             success: function(datas) {
                 if (datas.length==0) {
@@ -2059,7 +2060,7 @@ function attach_glossary_into_scorm(type) {
                     $.ajax({
                         contentType: "application/x-www-form-urlencoded",
                         type: "POST",
-                        url: "<?php echo api_get_path(WEB_PATH); ?>main/glossary/glossary_ajax_request.php",
+                        url: ajaxRequestUrl,
                         data: "glossary_id="+my_glossary_id,
                         success: function(data) {
                             show_description.html(data);
@@ -2106,7 +2107,7 @@ function attach_glossary_into_scorm(type) {
                 $.ajax({
                     contentType: "application/x-www-form-urlencoded",
                     type: "POST",
-                    url: "<?php echo api_get_path(WEB_PATH); ?>main/glossary/glossary_ajax_request.php",
+                    url: ajaxRequestUrl,
                     data: "glossary_name="+is_glossary_name,
                     success: function(data) {
                          show_description.html(data);

+ 5 - 0
main/template/default/javascript/editor/ckeditor/config_js.tpl

@@ -1,3 +1,5 @@
+/* Ckeditor global configuration file */
+
 CKEDITOR.editorConfig = function( config ) {
     // Define changes to default configuration here.
     // For complete reference see:
@@ -17,5 +19,8 @@ CKEDITOR.editorConfig = function( config ) {
         '{{ _p.web_main ~ 'inc/lib/elfinder/templates.php'}}'
     ];
 
+    // Allows to use "class" attribute inside divs and spans.
+    config.allowedContent = true;
+
     config.customConfig = '{{ _p.web_main ~ 'inc/lib/javascript/ckeditor/config_js.php'}}';
 };

+ 2 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php

@@ -20,7 +20,8 @@ class Basic extends Toolbar
         'video',
         'wordcount',
         'templates',
-        'justify'
+        'justify',
+        'colorbutton'
     );
 
     /**

+ 58 - 0
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php

@@ -0,0 +1,58 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
+
+/**
+ * Class Documents
+ *
+ * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
+ */
+class DocumentsStudent extends Basic
+{
+    public $plugins = array(
+        'toolbarswitch',
+        'audio',
+        'video',
+        'youtube',
+        'leaflet',
+        'widget',
+        'lineutils',
+        'mathjax',
+        'asciimath',
+        'glossary',
+        'asciisvg',
+        'mapping'
+    );
+
+    /**
+     * @return mixed
+     */
+    public function getConfig()
+    {
+        $config['toolbarGroups'] = array(
+            array('name' => 'document',  'groups' => array('document', 'doctools')),
+            array('name' => 'clipboard', 'groups' => array('clipboard', 'undo')),
+            array('name' => 'editing',   'groups' => array( 'find', 'selection', 'spellchecker')),
+            //array('name' => 'forms'),
+            '/',
+            array('name' => 'basicstyles', 'groups' => array('basicstyles', 'cleanup')),
+            array('name' => 'paragraph',   'groups' => array('list', 'indent', 'blocks', 'align', 'bidi')),
+            array('name' => 'links'),
+            array('name' => 'insert'),
+            '/',
+            array('name' => 'styles'),
+            array('name' => 'colors'),
+            //array('name' => 'tools'),
+            array('name' => 'others'),
+            array('name' => 'mode')
+        );
+        $config['extraPlugins'] = $this->getPluginsToString();
+        //$config['mathJaxLib'] = $this->urlGenerator->generate('javascript').'/math_jax/MathJax.js?config=default';
+        //$config['mathJaxLib'] = api_get_path(WEB_LIBRARY_JS_PATH).'/math_jax/MathJax.js?config=default';
+        $config['fullPage'] = true;
+
+        return $config;
+    }
+
+}