Browse Source

Minor glossary corrections

Julio Montoya 13 years ago
parent
commit
abf3e0a741

+ 2 - 1
main/glossary/glossary_ajax_request.php

@@ -12,7 +12,8 @@ require_once api_get_path(LIBRARY_PATH).'glossary.lib.php';
 /*
  * Search a term and return description from a glossary.
  */
-global $charset;
+$charset = api_get_system_encoding();
+
 //replace image path
 $path_image=api_get_path(WEB_COURSE_PATH).api_get_course_path();
 $path_image_search='../../courses/'.api_get_course_path();

+ 7 - 6
main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js

@@ -14,8 +14,8 @@ newscorm/scorm_api.php
 	  my_pathname=location.pathname;
 	  work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
 	    $("body .glossary").mouseover(function(){
-	        is_glossary_name=$(this).html();
-		    random_id=Math.round(Math.random()*100);
+	        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;
 	         $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
@@ -24,13 +24,14 @@ newscorm/scorm_api.php
 
 	       $.ajax({
 	            contentType: "application/x-www-form-urlencoded",
-	            beforeSend: function(objeto) {
-	            $("div#"+div_content_id).html("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); },
+	            beforeSend: function(result) {
+	            	$("div#"+div_content_id).html("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); 
+	            },
 	            type: "POST",
 	            url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
 	            data: "glossary_name="+is_glossary_name,
-	            success: function(datos) {
-	                $("div#"+div_content_id).html(datos);
+	            success: function(data) {
+	                $("div#"+div_content_id).html(data);
 	            }
 	        });
 	    });

+ 8 - 10
main/inc/lib/glossary.lib.php

@@ -19,8 +19,7 @@ class GlossaryManager {
 		$glossary_table = Database::get_course_table(TABLE_GLOSSARY);
         $session_id = intval($session_id);
         $sql_filter = api_get_session_condition($session_id);
-		$sql = 'SELECT glossary_id as id,name,description '.
-		          ' FROM '.$glossary_table.' WHERE 1=1 '.$sql_filter;
+		$sql = 'SELECT glossary_id as id, name, description FROM '.$glossary_table.' WHERE 1=1 '.$sql_filter;
 		$rs = Database::query($sql);
 		while ($row = Database::fetch_array($rs)) {
 			$glossary_data[] = $row;
@@ -39,13 +38,14 @@ class GlossaryManager {
 		$sql='SELECT description FROM '.$glossary_table.' WHERE glossary_id="'.Database::escape_string($glossary_id).'"';
 		$rs=Database::query($sql);
         if (Database::num_rows($rs) > 0) {
-          $row=Database::fetch_array($rs);
+            $row = Database::fetch_array($rs);
             return $row['description'];
         } else {
             return '';
         }
-			}
-	/**
+    }
+    
+    /**
 	 * Get glossary term by glossary id
 	 * @author Isaac Flores <florespaz_isaac@hotmail.com>
 	 * @param String The glossary term name
@@ -56,12 +56,10 @@ class GlossaryManager {
 		$glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
         $session_id = intval($session_id);
         $sql_filter = api_get_session_condition($session_id);
-		$sql='SELECT description FROM '.$glossary_table.' '.
-		 ' WHERE name like trim("'.Database::escape_string($glossary_name).'")'.
-		 $sql_filter;
-		$rs=Database::query($sql);
+		$sql = 'SELECT description FROM '.$glossary_table.' WHERE name like trim("'.Database::escape_string($glossary_name).'")'.$sql_filter;
+		$rs = Database::query($sql);
 		if (Database::num_rows($rs) > 0) {
-		  $row=Database::fetch_array($rs);
+		     $row = Database::fetch_array($rs);
             return $row['description'];
 		} else {
 			return '';

+ 7 - 7
main/inc/lib/javascript/glossary.js

@@ -1,6 +1,5 @@
 $(document).ready(function() {
-    $(window).load(function () {
-
+    $(window).load(function () {    	
      var my_text=$(".glossary-content").html();
      my_protocol = location.protocol;
      my_pathname=location.pathname;
@@ -50,19 +49,20 @@ $(document).ready(function() {
               
 			  var complex_array = new Array();
               $("#highlight-plugin .glossary-ajax").mouseover(function(){
-                random_id=Math.round(Math.random()*100);
+                random_id = Math.round(Math.random()*100);
                 div_show_id="div_show_id"+random_id;
                 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;");	         
-                    notebook_id=$(this).attr("name");
-                    data_notebook=notebook_id.split("link");
-                    my_glossary_id=data_notebook[1];
+                    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="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); },
+                        	$("div#"+div_content_id).html("<img src="+my_protocol+"//"+location.host+work_path+"/main/inc/lib/javascript/indicator.gif />"); 
+                        },
                         type: "POST",
                         url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
                         data: "glossary_id="+my_glossary_id,