1. Modified ContentManager.class.php to adapt to the path required by find_image()
authorcindy li <cli@ocad.ca>
Fri, 3 Dec 2010 15:05:54 +0000 (15:05 -0000)
committercindy li <cli@ocad.ca>
Fri, 3 Dec 2010 15:05:54 +0000 (15:05 -0000)
2. Modified ATutor_js.php to use find_image() to get the location of expand/collapse icon images
3. move refresh_content_nav.php to root folder so that it uses the same AT_INCLUDE_PATH as index.php, which is required by find_image()

docs/include/classes/ContentManager.class.php
docs/jscripts/ATutorContentMenu.js
docs/jscripts/ATutor_js.php
docs/refresh_content_nav.php [moved from docs/mods/_core/content/refresh_content_nav.php with 92% similarity]

index b86806e..861c475 100644 (file)
@@ -48,7 +48,7 @@ class ContentManager
                
                $this->db = $db;
                $this->course_id = intval($course_id);
-               
+
                // Look for tree icons for displaying content navigation from theme image folder,
                // if the icon is not there, look up in atutor root image folder
                $this->tree_collapse_icon = find_image($rtl.'tree/tree_collapse.gif');
@@ -1058,20 +1058,20 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                        /* has children */
                                        for ($i=0; $i<$depth; $i++) {
                                                if ($children[$i] == 1) {
-                                                       echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                                       echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                } else {
                                                        echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                }
                                        }
 
                                        if (($counter == $num_items) && ($depth > 0)) {
-                                               echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                $children[$depth] = 0;
                                        } else if ($counter == $num_items) {
-                                               echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                $children[$depth] = 0;
                                        } else {
-                                               echo '<img src="'.$_base_path.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                $children[$depth] = 1;
                                        }
 
@@ -1106,23 +1106,23 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                        if ($counter == $num_items) {
                                                for ($i=0; $i<$depth; $i++) {
                                                        if ($children[$i] == 1) {
-                                                               echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                        } else {
                                                                echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                        }
                                                }
-                                               echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" class="img-size-tree" />'."\n";
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" class="img-size-tree" />'."\n";
                                        } else {
                                                for ($i=0; $i<$depth; $i++) {
                                                        if ($children[$i] == 1) {
-                                                               echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                        } else {
-                                                               echo '<img src="'.$_base_path.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                                        }
                                                }
-                                               echo '<img src="'.$_base_path.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                        }
-                                       echo '<img src="'.$_base_path.$this->tree_horizontal_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
+                                       echo '<img src="'.AT_BASE_HREF.$this->tree_horizontal_icon.'" alt="" border="0" width="16" height="16" class="img-size-tree" />'."\n";
                                }
 
                                
@@ -1236,7 +1236,7 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                                        if ($end && ($i==0)) {
                                                                echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />';
                                                        } else {
-                                                               echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
+                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
                                                        }
                                                } else {
                                                        echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />';
@@ -1244,15 +1244,15 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                        }
 
                                        if (($counter == $num_items) && ($depth > 0)) {
-                                               echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" />';
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" />';
                                                $children[$depth] = 0;
                                        } else {
                                                echo $buttons;
                                                if (($num_items == $counter) && ($parent_id == 0)) {
-                                                       echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" />';
+                                                       echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" width="16" height="16" />';
                                                        $end = true;
                                                } else {
-                                                       echo '<img src="'.$_base_path.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" />';
+                                                       echo '<img src="'.AT_BASE_HREF.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" />';
                                                }
                                                $children[$depth] = 1;
                                        }
@@ -1264,10 +1264,10 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                        }
 
                                        if ($_SESSION['menu'][$content['content_id']] == 1) {
-                                               echo '<img src="'.$_base_path.$this->tree_disabled_icon.'" alt="'._AT('toggle_disabled').'" border="0" width="16" height="16" title="'._AT('toggle_disabled').'" />';
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_disabled_icon.'" alt="'._AT('toggle_disabled').'" border="0" width="16" height="16" title="'._AT('toggle_disabled').'" />';
 
                                        } else {
-                                               echo '<img src="'.$_base_path.$this->tree_disabled_icon.'" alt="'._AT('toggle_disabled').'" border="0" width="16" height="16" title="'._AT('toggle_disabled').'" />';
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_disabled_icon.'" alt="'._AT('toggle_disabled').'" border="0" width="16" height="16" title="'._AT('toggle_disabled').'" />';
                                        }
 
                                } else {
@@ -1280,7 +1280,7 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                                                        if ($end && ($i == 0)) {
                                                                                echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />';
                                                                        } else {
-                                                                               echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
+                                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
                                                                        }
                                                                } else {
                                                                        echo '<img src="'.$_base_path.'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />';
@@ -1289,7 +1289,7 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                                } else {
                                                        echo $buttons;
                                                }
-                                               echo '<img src="'.$_base_path.$this->tree_end_icon.'" alt="" border="0" />';
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_end_icon.'" alt="" border="0" />';
                                        } else {
                                                if ($depth) {
                                                        echo $buttons;
@@ -1298,12 +1298,12 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                                                if ($children[$i] == 1) {
                                                                        if ($end && !$print) {
                                                                                $print = true;
-                                                                               echo '<img src="'.$_base_path.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" />';
+                                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" />';
                                                                        } else {
-                                                                               echo '<img src="'.$_base_path.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
+                                                                               echo '<img src="'.AT_BASE_HREF.$this->tree_vertline_icon.'" alt="" border="0" width="16" height="16" />';
                                                                        }
                                                                } else {
-                                                                       echo '<img src="'.$_base_path.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" />';
+                                                                       echo '<img src="'.AT_BASE_HREF.$this->tree_space_icon.'" alt="" border="0" width="16" height="16" />';
                                                                }
                                                        }
                                                        $print = false;
@@ -1311,9 +1311,9 @@ ATutor.course.text_collapse = "'._AT("collapse").'";
                                                        echo $buttons;
                                                }
                
-                                               echo '<img src="'.$_base_path.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" />';
+                                               echo '<img src="'.AT_BASE_HREF.$this->tree_split_icon.'" alt="" border="0" width="16" height="16" />';
                                        }
-                                       echo '<img src="'.$_base_path.$this->tree_horizontal_icon.'" alt="" border="0" width="16" height="16" />';
+                                       echo '<img src="'.AT_BASE_HREF.$this->tree_horizontal_icon.'" alt="" border="0" width="16" height="16" />';
                                }
 
                                echo '<small>';
index 1181438..e837ff4 100644 (file)
@@ -78,7 +78,7 @@ ATutor.course.contentMenu = ATutor.course.contentMenu || {};
                }
                else
                { // refresh the content navigation to exit the edit mode
-                       jQuery.post(ATutor.base_path+"mods/_core/content/refresh_content_nav.php", {}, 
+                       jQuery.post(ATutor.base_path+"refresh_content_nav.php", {}, 
                                                function(data) {jQuery("#editable_table").replaceWith(data); ATutor.course.contentMenu.initContentMenu();});
                }
        };
index d592409..c86946b 100644 (file)
 // if the icon is not there, look up in atutor root image folder
 global $rtl;
 
-$theme_image_folder = 'themes/'.$_SESSION['prefs']['PREF_THEME'].'/images/';
-$atutor_image_folder = 'images/';
-
-if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.$rtl.'tree/tree_collapse.gif')) {
-       $tree_collapse_icon = AT_BASE_HREF.$theme_image_folder.$rtl.'tree/tree_collapse.gif';
-} else {
-       $tree_collapse_icon = AT_BASE_HREF.$atutor_image_folder.$rtl.'tree/tree_collapse.gif';
-}
-
-if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_expand.gif')) {
-       $tree_expand_icon = AT_BASE_HREF.$theme_image_folder.$rtl.'tree/tree_expand.gif';
-} else {
-       $tree_expand_icon = AT_BASE_HREF.$atutor_image_folder.$rtl.'tree/tree_expand.gif';
-}
+$tree_collapse_icon = AT_BASE_HREF.find_image($rtl.'tree/tree_collapse.gif');
+$tree_expand_icon = AT_BASE_HREF.find_image($rtl.'tree/tree_expand.gif');
                
 ?>
 ATutor = ATutor || {};
similarity index 92%
rename from docs/mods/_core/content/refresh_content_nav.php
rename to docs/refresh_content_nav.php
index d435c97..dc3ba79 100644 (file)
@@ -11,7 +11,7 @@
 /* as published by the Free Software Foundation.                        */\r
 /************************************************************************/\r
 \r
-define('AT_INCLUDE_PATH', '../../../include/');\r
+define('AT_INCLUDE_PATH', 'include/');\r
 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
 \r
 global $contentManager;\r