Ver código fonte

Fixing bug that breaks the LP when using pdfs see BT#2819

Julio Montoya 13 anos atrás
pai
commit
6eda07a1a4

+ 39 - 33
main/inc/lib/javascript/jquery.lp_minipanel.js

@@ -5,54 +5,57 @@
  Alberto Torreblanca @albert1t0
  *******************************************/
 
+// Copy little progress bar in <tr></tr>
+function minipb() {
+    $('#learning_path_main #control tr').after('<tr></tr>');
+	$('#learning_path_main #control tr:eq(1)').append($('#progress_bar').html());
+	$('#learning_path_main #control tr:eq(1) #progress_img_limit_left').attr('height','5');
+	$('#learning_path_main #control tr:eq(1) #progress_img_full').attr('height','5');
+	$('#learning_path_main #control tr:eq(1) #progress_img_limit_middle').attr('height','5');
+	$('#learning_path_main #control tr:eq(1) #progress_img_empty').attr('height','5');
+	$('#learning_path_main #control tr:eq(1) #progress_bar_img_limit_right').attr('height','5');
+	$('#learning_path_main #control tr:eq(1) #progress_text').remove();
+	$('#learning_path_main #control tr:eq(1) div').css('width','');
+}
+  
 (function($){
   $(document).ready(function() {
 
    //Adding div to hide panel
-    $('#learning_path_right_zone').
-         before('<div id="hide_bar" style="float: left; width: 10px; height: 100%;">' +
+    $('#learning_path_right_zone').before('<div id="hide_bar" style="float: left; width: 10px; height: 100%;">' +
         '<table style="border: 0 none; width: 100%; height: 100%; cursor: pointer; background-color: #EEEEEE">' +
-        '<tr> <td> </td></tr></table></div>');
-    $('#hide_bar table').css({backgroundImage: "url(../img/hide0.png)", backgroundRepeat: "no-repeat", backgroundPosition: "center center"})
+        '<tr><td></td></tr></table></div>');
+    $('#hide_bar table').css({backgroundImage: "url(../img/hide0.png)", backgroundRepeat: "no-repeat", backgroundPosition: "center center"});
 
     //Adding effects to hide bar
-    $('#hide_bar table').hover(function (){
-            if($('#hide_bar').position().left == 280)
-              $(this).css('backgroundImage','url(../img/hide1.png)').css('backgroundColor','#888888');
-            else if($('#hide_bar').position().left == 0)
-              $(this).css('backgroundImage','url(../img/hide3.png)').css('backgroundColor','#888888');
+    $('#hide_bar table').hover(function () {
+    	if($('#hide_bar').position().left == 280)
+    		$(this).css('backgroundImage','url(../img/hide1.png)').css('backgroundColor','#888888');
+    	else if($('#hide_bar').position().left == 0)
+    		$(this).css('backgroundImage','url(../img/hide3.png)').css('backgroundColor','#888888');
+    	
         },function (){
             if($('#hide_bar').position().left == 280)
               $(this).css('backgroundImage','url(../img/hide0.png)').css('backgroundColor','#EEEEEE');
             else if($('#hide_bar').position().left == 0)
               $(this).css('backgroundImage','url(../img/hide2.png)').css('backgroundColor','#EEEEEE');
         }
-      );
+    );
 
     // Adding funcionality
     $('#hide_bar table').toggle(function(){
 
-      // Copy little progress bar in <tr></tr>
-      function minipb(){
-        $('#learning_path_main #control tr').after('<tr></tr>');
-        $('#learning_path_main #control tr:eq(1)').append($('#progress_bar').html());
-        $('#learning_path_main #control tr:eq(1) #progress_img_limit_left').attr('height','5');
-        $('#learning_path_main #control tr:eq(1) #progress_img_full').attr('height','5');
-        $('#learning_path_main #control tr:eq(1) #progress_img_limit_middle').attr('height','5');
-        $('#learning_path_main #control tr:eq(1) #progress_img_empty').attr('height','5');
-        $('#learning_path_main #control tr:eq(1) #progress_bar_img_limit_right').attr('height','5');
-        $('#learning_path_main #control tr:eq(1) #progress_text').remove();
-        $('#learning_path_main #control tr:eq(1) div').css('width','');
-      }
+
 
       // Construct mini panel
       var panel = $('#lp_navigation_elem div:first').clone();
       $(panel).attr('id','control');
       $('#learning_path_main').append(panel);
-      minipb();
+      minipb();      
       $('#learning_path_main #control .buttons').attr('align','center');
-      $('#learning_path_main  #control').css(
-        { margin: "auto",
+      
+      $('#learning_path_main  #control').css({
+    	  margin: "auto",
           width: "132px",
           height: "34px",
           position: "absolute",
@@ -65,17 +68,20 @@
           borderRadius: "4px 4px 4px 4px",
           opacity: "0.8",
           cursor: "move"
-        });
+      });
+      
       $('#learning_path_main  #control table').attr('align','center');
-      $('#learning_path_main  #control').draggable(
-      { iframeFix: true,
-        stack: "#learning_path_right_zone",
-        cursor: "move"
+      $('#learning_path_main  #control').draggable({ 
+    	  iframeFix: true,
+    	  stack: "#learning_path_right_zone",
+    	  cursor: "move"
       });
-      $('#learning_path_main #control .buttons img').click(function()
-      { $('#learning_path_main #control tr:eq(1)').remove();
-        minipb();
+      
+      $('#learning_path_main #control .buttons img').click(function(){ 
+    	  $('#learning_path_main #control tr:eq(1)').remove();
+    	  minipb();
       });
+      
       // Hiding navigation left zone
       $('#learning_path_left_zone').hide(50);
       $('#learning_path_right_zone').css('margin-left','10px');

+ 1 - 2
main/newscorm/learnpath.class.php

@@ -2904,8 +2904,7 @@ class learnpath {
                     } else {
                         require_once 'resourcelinker.inc.php';
                         $file = rl_get_resource_link_for_learnpath(api_get_course_id(), $this->get_id(), $item_id);
-                        
-                            //CEV CHANGE
+
                         if ($lp_item_type == 'link') {
                             require_once api_get_path(LIBRARY_PATH).'link.lib.php';
                             if (is_youtube_link($file)) {

+ 4 - 3
main/newscorm/lp_view.php

@@ -104,11 +104,12 @@ if (!isset($src)) {
             $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
             $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
             if ($prereq_check === true) {            	
-                $src = $_SESSION['oLP']->get_link('http', $lp_item_id);
+                $src = $_SESSION['oLP']->get_link('http', $lp_item_id);                
                 
                 //Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
-                $file_info = pathinfo($src);
-                if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
+                $file_info = parse_url($src); 
+                $file_info = pathinfo($file_info['path']);                
+                if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {                	
                     $src = 'lp_view_item.php?src='.$src;
                 }
                 $_SESSION['oLP']->start_current_item(); // starts time counter manually if asset