finish "import/export content", more progress on "re-do index page"
authorCindy Li <cli@ocad.ca>
Fri, 4 Jun 2010 20:34:07 +0000 (20:34 -0000)
committerCindy Li <cli@ocad.ca>
Fri, 4 Jun 2010 20:34:07 +0000 (20:34 -0000)
21 files changed:
docs/home/classes/ContentManager.class.php
docs/home/classes/ContentUtility.class.php
docs/home/editor/edit_content.php
docs/home/editor/edit_content_folder.php
docs/home/editor/import_export_content.php
docs/home/ims/ims_export.php
docs/home/ims/ims_import.php
docs/home/ims/include/ims_template.inc.php
docs/home/imscc/ims_export.php
docs/include/classes/A4a/A4aExport.class.php
docs/include/classes/A4a/A4aImport.class.php
docs/include/imscc/ims_template.inc.php [deleted file]
docs/include/jscripts/transformable.js
docs/include/lib/resources_parser.inc.php
docs/include/side_menu.inc.php
docs/include/sidemenus/content_nav.inc.php [new file with mode: 0644]
docs/include/sidemenus/getting_start.inc.php [new file with mode: 0644]
docs/themes/default/home/editor/edit_content_folder.tmpl.php
docs/themes/default/include/box.tmpl.php
docs/themes/default/include/header.tmpl.php
docs/themes/default/include/side_menu.tmpl.php [new file with mode: 0644]

index c2fb7dd..bb19e94 100644 (file)
@@ -643,7 +643,7 @@ function initContentMenu() {
                if (is_array($rows)) {
                        foreach ($rows as $row) {
                                echo '
-  if (trans.utility.getcookie("c'.$_course_id.'_'.$row['content_id'].'") == "1")
+  if (trans.utility.getcookie("t.c'.$_course_id.'_'.$row['content_id'].'") == "1")
   {
     jQuery("#folder"+'.$row['content_id'].').show();
     jQuery("#tree_icon"+'.$row['content_id'].').attr("src", tree_collapse_icon);
@@ -670,7 +670,7 @@ function initContentMenu() {
   jQuery("#folder"+'.$current_content_path[$i]['content_id'].').show();
   jQuery("#tree_icon"+'.$current_content_path[$i]['content_id'].').attr("src", tree_collapse_icon);
   jQuery("#tree_icon"+'.$current_content_path[$i]['content_id'].').attr("alt", "'._AT("collapse").'");
-  trans.utility.setcookie("c'.$_course_id.'_'.$current_content_path[$i]['content_id'].'", "1", 1);
+  trans.utility.setcookie("t.c'.$_course_id.'_'.$current_content_path[$i]['content_id'].'", "1", 1);
 ';
                }
                echo '}'; // end of javascript function initContentMenu()
@@ -702,10 +702,10 @@ function initContentMenu() {
                {
                        echo "\n".'
   <div class="menuedit">
-    <a href="'.$_base_path.'editor/edit_content_folder.php?_course_id='.$_course_id.'">
+    <a href="'.$_base_path.'home/editor/edit_content_folder.php?_course_id='.$_course_id.'">
       <img id="img_create_top_folder" src="'.$_base_path.'images/mfolder.gif" alt="'._AT("add_top_folder").'" title="'._AT("add_top_folder").'" style="border:0;height:1.2em" />
     </a>'."\n".'
-    <a href="'.$_base_path.'editor/edit_content.php?_course_id='.$_course_id.'">
+    <a href="'.$_base_path.'home/editor/edit_content.php?_course_id='.$_course_id.'">
       <img id="img_create_top_content" src="'.$_base_path.'images/mpage.gif" alt="'._AT("add_top_page").'" title="'._AT("add_top_page").'" style="border:0;height:1.2em" />
     </a>'."\n".'
     <a href="javascript:void(0)" onclick="javascript:switchEditMode();">
@@ -957,7 +957,7 @@ initContentMenu();
                                                        $link .= '<a href="'.$_base_path.'home/editor/edit_content_folder.php?_cid='.$content['content_id'].'" title="'.$full_title. _AT('click_edit').'">'."\n";
                                                }
                                                else {
-                                                       $link .= '<span style="cursor:pointer" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\'); ">'."\n";
+                                                       $link .= '<span style="cursor:pointer" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\', '.$this->course_id.'); ">'."\n";
                                                }
                                                
                                                if ($truncate && ($strlen($content['title']) > ($base_title_length-$depth*4)) ) {
@@ -1027,21 +1027,21 @@ initContentMenu();
                                        if (isset($_SESSION['menu'][$content['content_id']]) && $_SESSION['menu'][$content['content_id']] == 1) {
                                                if ($on) {
 //                                                     echo '<img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\'); " />'."\n";
-                                                       echo '<a href="javascript:void(0)" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\'); "><img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" /></a>'."\n";
+                                                       echo '<a href="javascript:void(0)" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\', '.$this->course_id.'); "><img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" /></a>'."\n";
                                                        
                                                } else {
                                                        echo '<a href="'.$_my_uri.'collapse='.$content['content_id'].'">'."\n";
-                                                       echo '<img src="'.$_base_path.'images/'.$rtl.'tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').' '.$content['title'].'" class="img-size-tree" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\'); " />'."\n";
+                                                       echo '<img src="'.$_base_path.'images/'.$rtl.'tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').' '.$content['title'].'" class="img-size-tree" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\', '.$this->course_id.'); " />'."\n";
                                                        echo '</a>'."\n";
                                                }
                                        } else {
                                                if ($on) {
 //                                                     echo '<img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" />'."\n";
-                                                       echo '<a href="javascript:void(0)" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\'); "><img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" /></a>'."\n";
+                                                       echo '<a href="javascript:void(0)" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\', '.$this->course_id.'); "><img src="'.$_base_path.'images/tree/tree_collapse.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('collapse').'" border="0" width="16" height="16" title="'._AT('collapse').'" class="img-size-tree" /></a>'."\n";
                                                        
                                                } else {
                                                        echo '<a href="'.$_my_uri.'expand='.$content['content_id'].'">'."\n";
-                                                       echo '<img src="'.$_base_path.'images/'.$rtl.'tree/tree_expand.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('expand').'" border="0" width="16" height="16"    title="'._AT('expand').' '.$content['title'].'" class="img-size-tree" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\'); " />';
+                                                       echo '<img src="'.$_base_path.'images/'.$rtl.'tree/tree_expand.gif" id="tree_icon'.$content['content_id'].$from.'" alt="'._AT('expand').'" border="0" width="16" height="16"    title="'._AT('expand').' '.$content['title'].'" class="img-size-tree" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\', \''._AT("expand").'\', \''._AT('collapse').'\', '.$this->course_id.'); " />';
                                                        echo '</a>'."\n";
                                                }
                                        }
index 8244998..2b8ac93 100644 (file)
@@ -716,7 +716,13 @@ class ContentUtility {
                \r
                $rows = $dao->execute($sql);\r
        \r
-               if (!is_array($rows)) return $content;\r
+               if (!is_array($rows)) {\r
+                       if (!$info_only) {\r
+                               return $content;\r
+                       } else {\r
+                               return array($has_text_alternative, $has_audio_alternative, $has_visual_alternative, $has_sign_lang_alternative);\r
+                       }\r
+               }\r
                \r
                foreach ($rows as $row) \r
                {\r
index 657d407..a72835a 100644 (file)
@@ -243,6 +243,7 @@ $pid = intval($_REQUEST['pid']);
                }
        }
        
+       echo '<input type="hidden" name="_course_id" value="'.$_course_id.'" />';
        echo '<input type="hidden" name="_cid" value="'.$cid.'" />';
        echo '<input type="hidden" name="title" value="'.htmlspecialchars($stripslashes($_POST['title'])).'" />';
        if ($_REQUEST['sub'] == 1)
index 26159fc..8d81904 100644 (file)
@@ -184,7 +184,7 @@ if ($cid > 0)
        $savant->assign('cid', $cid);
 }
 
-if ($pid > 0) {
+if ($pid > 0 || !isset($pid)) {
        $savant->assign('pid', $pid);
        $savant->assign('course_id', $_course_id);
 }
index 556e5dd..35b10ff 100644 (file)
@@ -112,7 +112,7 @@ function print_menu_sections(&$menu, $only_print_content_folder = false, $parent
 </div>
 </form>
 
-<form name="form1" method="post" action="home/imscp/ims_import.php" enctype="multipart/form-data" onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php');">
+<form name="form1" method="post" action="home/ims/ims_import.php" enctype="multipart/form-data" onsubmit="openWindow('<?php echo TR_BASE_HREF; ?>home/prog.php');">
 <div class="input-form">
        <input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />
        <fieldset class="group_form"><legend class="group_form"><?php echo _AT('import_content'); ?></legend>
index fa21243..912e981 100644 (file)
@@ -99,8 +99,8 @@ $course_language_code = $courseLanguage->getCode();
 require(TR_INCLUDE_PATH.'classes/zipfile.class.php');                          /* for zipfile */
 require(TR_INCLUDE_PATH.'classes/vcard.php');                                          /* for vcard */
 require(TR_INCLUDE_PATH.'classes/XML/XML_HTMLSax/XML_HTMLSax.php');    /* for XML_HTMLSax */
-debug('a');require(TR_INCLUDE_PATH.'../home/ims/include/ims_template.inc.php');/* for ims templates + print_organizations() */
-debug('a');
+require(TR_INCLUDE_PATH.'../home/ims/include/ims_template.inc.php');/* for ims templates + print_organizations() */
+
 if (isset($_POST['cancel'])) {
        $msg->addFeedback('EXPORT_CANCELLED');
        header('Location: ../index.php');
@@ -108,7 +108,7 @@ if (isset($_POST['cancel'])) {
 }
 
 
-$zipfile = new zipfile(); 
+$zipfile = new zipfile();
 $zipfile->create_dir('resources/');
 
 /*
index 1e8de8d..346d6cc 100644 (file)
@@ -849,7 +849,7 @@ if (!is_dir($import_path)) {
        }
 }
 
-if (isset($_SESSION['course_id'])) $import_path .= $_SESSION['course_id'].'/';
+if (isset($_POST['_course_id'])) $import_path .= $_POST['_course_id'].'/';
 else $import_path .= Utility::getRandomStr(16).'/';
 
 if (is_dir($import_path)) {
@@ -892,9 +892,9 @@ $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
 $contentTestsAssocDAO = new ContentTestsAssocDAO();
 
 // get the course's max_quota
-if (isset($_SESSION['course_id']))
+if (isset($_POST['_course_id']))
 {
-       check_available_size($_SESSION['course_id']);
+       check_available_size($_POST['_course_id']);
 }
 
 $items = array(); /* all the content pages */
@@ -1018,7 +1018,7 @@ if ($msg->containsErrors()) {
 
 // added by Cindy Li on Jan 10, 2010
 // generate a course_id if the import is not into an existing course
-if (!isset($_SESSION['course_id']))
+if (!isset($_POST['_course_id']))
 {
        if (isset($_POST['hide_course']))
                $access = 'private';
@@ -1041,7 +1041,7 @@ if (!isset($_SESSION['course_id']))
        $userCoursesDAO = new UserCoursesDAO();
        $userCoursesDAO->Create($_SESSION['user_id'], $_course_id, TR_USERROLE_AUTHOR, 0);
 }
-else $_course_id = $_SESSION['course_id'];
+else $_course_id = $_POST['_course_id'];
 
 // end of added by Cindy Li on Jan 10, 2010
 
@@ -1059,7 +1059,9 @@ $package_base_name = strtolower($package_base_name);
 $package_base_name = str_replace(array('\'', '"', ' ', '|', '\\', '/', '<', '>', ':'), '_' , $package_base_name);
 $package_base_name = preg_replace("/[^A-Za-z0-9._\-]/", '', $package_base_name);
 
-if (is_dir($import_path.$package_base_name)) {
+$course_dir = TR_CONTENT_DIR.$_course_id.'/';
+
+if (is_dir($course_dir.$package_base_name)) {
        $package_base_name .= '_'.date('ymdHis');
 }
 
@@ -1182,13 +1184,13 @@ foreach ($items as $item_id => $content_info)
                        $ext = '';
                        $last_modified = date('Y-m-d H:i:s');
                } else {
-                       //$file_info = @stat(TR_CONTENT_DIR . 'import/'.$_SESSION['course_id'].'/'.$content_info['href']);
+                       //$file_info = @stat(TR_CONTENT_DIR . 'import/'.$_POST['_course_id'].'/'.$content_info['href']);
                        $file_info = @stat($import_path.$content_info['href']);
                        if ($file_info === false) {
                                continue;
                        }
                
-                       //$path_parts = pathinfo(TR_CONTENT_DIR . 'import/'.$_SESSION['course_id'].'/'.$content_info['href']);
+                       //$path_parts = pathinfo(TR_CONTENT_DIR . 'import/'.$_POST['_course_id'].'/'.$content_info['href']);
                        $path_parts = pathinfo($import_path.$content_info['href']);
                        $ext = strtolower($path_parts['extension']);
 
@@ -1236,7 +1238,7 @@ foreach ($items as $item_id => $content_info)
                        }
 
                        /* this is a plain text file */
-                       //$content = file_get_contents(TR_CONTENT_DIR . 'import/'.$_SESSION['course_id'].'/'.$content_info['href']);
+                       //$content = file_get_contents(TR_CONTENT_DIR . 'import/'.$_POST['_course_id'].'/'.$content_info['href']);
                        $content = file_get_contents($import_path.$content_info['href']);
                        if ($content === false) {
                                /* if we can't stat() it then we're unlikely to be able to read it */
@@ -1276,7 +1278,7 @@ foreach ($items as $item_id => $content_info)
 
                        /* potential security risk? */
                        if ( strpos($content_info['href'], '..') === false && !preg_match('/((.*)\/)*tests\_[0-9]+\.xml$/', $content_info['href'])) {
-//                             @unlink(TR_CONTENT_DIR . 'import/'.$_SESSION['course_id'].'/'.$content_info['href']);
+//                             @unlink(TR_CONTENT_DIR . 'import/'.$_POST['_course_id'].'/'.$content_info['href']);
                        }
 
                        // overwrite content if this is discussion tool.
@@ -1493,7 +1495,6 @@ if ($package_base_path == '.') {
 }
 
 // create course directory
-$course_dir = TR_CONTENT_DIR.$_course_id.'/';
 if (!is_dir($course_dir)) {
        if (!@mkdir($course_dir, 0700)) {
                $msg->addError('IMPORTDIR_FAILED');
index bc8b8ee..e55e19c 100644 (file)
@@ -56,6 +56,8 @@ function print_organizations($parent_id,
        global $glossary;
        global $test_zipped_files, $use_a4a, $db;
 
+       require_once(TR_INCLUDE_PATH.'../home/classes/ContentUtility.class.php');
+       
        $space  = '    ';
        $prefix = '                    ';
 
@@ -91,21 +93,29 @@ function print_organizations($parent_id,
                        /* save the content as HTML files */
                        /* @See: include/lib/format_content.inc.php */
                        $content['text'] = str_replace('CONTENT_DIR/', '', $content['text']);
-                       /* get all the glossary terms used */
+
+                       /* Commented by Cindy Qi Li on Jan 12, 2010
+                        * Transformable does not support glossary
+                       // get all the glossary terms used
                        $terms = find_terms($content['text']);
                        if (is_array($terms)) {
                                foreach ($terms[2] as $term) {
                                        $used_glossary_terms[] = $term;
                                }
                        }
-
+*/
                        /** Test dependency **/
-                       $test_dependency = '';  //Template for test
-                       $sql = 'SELECT * FROM '.TABLE_PREFIX.'content_tests_assoc WHERE content_id='.$content['content_id'];
-                       $result = mysql_query($sql, $db);
-                       while ($row = mysql_fetch_assoc($result)){
-                               //add test dependency ontop to forums dependency
-                               $test_dependency .= $prefix.$space.'<dependency identifierref="MANIFEST01_RESOURCE_QTI'.$row['test_id'].'" />';
+//                     $test_dependency = '';  //Template for test
+//                     $sql = 'SELECT * FROM '.TABLE_PREFIX.'content_tests_assoc WHERE content_id='.$content['content_id'];
+//                     $result = mysql_query($sql, $db);
+//                     while ($row = mysql_fetch_assoc($result)){
+                       require_once(TR_INCLUDE_PATH.'classes/DAO/ContentTestsAssocDAO.class.php');
+                       $contentTestsAssocDAO = new ContentTestsAssocDAO();
+                       $rows = $contentTestsAssocDAO->getByContent($content['content_id']);
+                       if (is_array($rows)) {
+                               //add test dependency on top of forum dependency
+                               foreach ($rows as $row)
+                                       $test_dependency .= $prefix.$space.'<dependency identifierref="MANIFEST01_RESOURCE_QTI'.$row['test_id'].'" />';
                        }
 
                        /* calculate how deep this page is: */
@@ -116,7 +126,7 @@ function print_organizations($parent_id,
                                $path .= str_repeat('../', $depth);
                        }
                        
-                       $content['text'] = format_content($content['text'], $content['formatting'], $glossary, $path);
+                       $content['text'] = ContentUtility::formatContent($content['text'], $content['formatting']);
 
                        /* add HTML header and footers to the files */
                        
index bb5491a..4bc96b0 100644 (file)
@@ -102,7 +102,7 @@ $course_language_code = $courseLanguage->getCode();
 require_once(TR_INCLUDE_PATH.'classes/zipfile.class.php');                             /* for zipfile */
 require_once(TR_INCLUDE_PATH.'classes/vcard.php');                                             /* for vcard */
 require_once(TR_INCLUDE_PATH.'classes/XML/XML_HTMLSax/XML_HTMLSax.php');       /* for XML_HTMLSax */
-require_once(TR_INCLUDE_PATH.'imscc/ims_template.inc.php');                            /* for ims templates + print_organizations() */
+require_once(TR_INCLUDE_PATH.'../home/imscc/include/ims_template.inc.php');                            /* for ims templates + print_organizations() */
 
 if (isset($_POST['cancel'])) {
        $msg->addFeedback('EXPORT_CANCELLED');
index 8cf3b34..f7c12a5 100644 (file)
@@ -54,10 +54,13 @@ class A4aExport extends A4a {
                                        //add this primary file ref, and the resources type to the secondary file
                                        $this->original_files[$current_sec_file]['primary_resources'][$prop['resource']] = $rtid;
 //                                     $this->original_files[$current_sec_file]['primary_resources'][$prop['resource']]['language_code'] = $sec_resource['language_code'];
-
+                                       }
                                }
                                $res_type['resource_type'] = $rtid;     //could be 1+
                                $temp = array_merge($prop, $res_type, $secondary_array);
+                               if (isset($this->original_files[$temp['resource']])){
+                                       //use the existing temp array values, but merge in the secondary_array
+                                       $temp = array_merge($this->original_files[$temp['resource']], $secondary_array);
                        }
                        if (!empty($temp)){
                                $this->original_files[$temp['resource']] = $temp;
@@ -74,7 +77,7 @@ class A4aExport extends A4a {
                global $db;
                $secondary_files = array();
 
-               include(TR_INCLUDE_PATH.'classes/DAO/SecondaryResourcesDAO.class.php');
+               include_once(TR_INCLUDE_PATH.'classes/DAO/SecondaryResourcesDAO.class.php');
                $secondaryResourcesDAO = new SecondaryResourcesDAO();
                $rows = $secondaryResourcesDAO->getByContent($this->cid);
 //             $sql = "SELECT DISTINCT secondary_resource FROM ".TABLE_PREFIX."primary_resources a LEFT JOIN ".TABLE_PREFIX."secondary_resources s
@@ -109,6 +112,10 @@ class A4aExport extends A4a {
                                if (!is_array($type_id)){
                                        //primary resource will always have just on type
                                        $orig_access_mode[] = $this->getResourceNameById($type_id);
+                               } else {
+                                       foreach($type_id as $k=>$type_id2){
+                                               $orig_access_mode[] = $this->getResourceNameById($type_id2[0]);
+                                       }
                                }
                        }
                        $savant->assign('relative_path', $this->relative_path); //the template will need the relative path
@@ -130,9 +137,9 @@ class A4aExport extends A4a {
                                        $orig_access_mode = array(); //reinitialize
                                        foreach($resource['resource_type'][$uri] as $type_id){
                                                $orig_access_mode[] = $this->getResourceNameById($type_id);
+                                               $savant->assign('orig_access_mode', $orig_access_mode);
+                                               $xml_array[$id.' to '.$uri] = $savant->fetch(TR_INCLUDE_PATH.'classes/A4a/A4a.tmpl.php');
                                        }
-                                       $savant->assign('orig_access_mode', $orig_access_mode);
-                                       $xml_array[$id.' to '.$uri] = $savant->fetch(TR_INCLUDE_PATH.'classes/A4a/A4a.tmpl.php');
                                }
                        } else {
                                $savant->assign('primary_resource_uri', '');
@@ -149,7 +156,9 @@ class A4aExport extends A4a {
         */
        function getResourceNameById($type_id){
                $orig_access_mode = '';
-
+               if (is_array($type_id)) {
+                       $type_id = $type_id[0];
+               }
                switch($type_id){
                        case 1:
                                $orig_access_mode = 'auditory';
@@ -158,6 +167,8 @@ class A4aExport extends A4a {
                                $orig_access_mode = 'textual';
                                break;
                        case 2:
+                               $orig_access_mode = 'sign_language';
+                               break;
                        case 4:
                                $orig_access_mode = 'visual';
                                break;
index 5280724..1d0ea8d 100644 (file)
@@ -93,9 +93,10 @@ class A4aImport extends A4a {
 
        /**
         * By the given attrs array, decide which resource type it is
-        *      auditory = type 1
-        *      textual  = type 3
-        *      visual   = type 4
+        *      auditory                = type 1
+        *  sign_language       = type 2
+        *      textual                 = type 3
+        *      visual                  = type 4
         * @param       array
         * return type id array
         */
@@ -106,18 +107,32 @@ class A4aImport extends A4a {
                 if (empty($resources_attrs)){
                         return $result;
                 }
-
-                if (in_array('auditory', $resources_attrs)){
-                        $result[] = 1;
-                }
-                if (in_array('textual', $resources_attrs)){
-                        $result[] = 3;
-                }
-                if (in_array('visual', $resources_attrs)){
-                        $result[] = 4;
-                }
-                return $result;
-        }
+               if (is_array($resources_attrs)) {
+                                if (in_array('auditory', $resources_attrs)){
+                                        $result[] = 1;
+                                }
+                                if (in_array('sign_language', $resources_attrs)){
+                                        $result[] = 2;
+                                }
+                                if (in_array('textual', $resources_attrs)){
+                                        $result[] = 3;
+                                }
+                                if (in_array('visual', $resources_attrs)){
+                                        $result[] = 4;
+                                }              
+               } else {
+                       if ($resources_attrs=='auditory'){
+                               $result[] = 1;
+                       } elseif ($resources_attrs=='sign_language'){
+                               $result[] = 2;
+                       } elseif ($resources_attrs=='textual'){
+                               $result[] = 3;
+                       } elseif ($resources_attrs=='visual'){
+                               $result[] = 4;
+                       }
+               }
+               return $result;
+       }
 }
 
 ?>
diff --git a/docs/include/imscc/ims_template.inc.php b/docs/include/imscc/ims_template.inc.php
deleted file mode 100644 (file)
index 35ce270..0000000
+++ /dev/null
@@ -1,682 +0,0 @@
-<?php
-/************************************************************************/
-/* ATutor                                                               */
-/************************************************************************/
-/* Copyright (c) 2002 - 2009                                            */
-/* Adaptive Technology Resource Centre / University of Toronto          */
-/*                                                                      */
-/* This program is free software. You can redistribute it and/or        */
-/* modify it under the terms of the GNU General Public License          */
-/* as published by the Free Software Foundation.                        */
-/************************************************************************/
-// $Id: ims_template.inc.php 8180 2008-11-07 17:17:25Z hwong $
-
-if (!defined('TR_INCLUDE_PATH')) { exit; }
-
-// This function gets files from html tag @import
-function get_import_files($text)
-{
-       $text = strtolower($text);
-       $tag = '@import';
-       $files = array();
-       
-       while (strpos(strtolower($text), strtolower($tag)) > 0)
-       {
-               $start_pos      = strpos($text, $tag);
-               if ($start_pos !== false) 
-               {
-                       $text = substr($text, $start_pos);
-                       $start_pos = strlen($tag);
-                       $len = strpos($text, ';') - strlen($tag);
-                       
-                       $file = substr(trim($text), $start_pos, $len);
-                       
-                       // remove these characters from file name: url, (, ), ", '
-                       $file = trim(preg_replace('/(\'|\"|url|\(|\))/', '', $file));
-                       
-                       // strip processed tag
-                       $text = substr($text, $start_pos);
-                       array_push($files, $file);
-               }
-       
-       }
-       
-       return $files;
-}
-       
-function print_organizations($parent_id,
-                                                        &$_menu, 
-                                                        $depth, 
-                                                        $path='',
-                                                        $children,
-                                                        &$string) {
-       
-       global $html_content_template, $default_html_style, $zipfile, $resources, $ims_template_xml, $parser, $my_files;
-       global $used_glossary_terms, $course_id, $course_language_charset, $course_language_code;
-       static $paths, $zipped_files;
-//     global $glossary;
-       global $test_list, $test_zipped_files, $test_files, $test_xml_items, $use_a4a;
-       global $contentManager;
-        /* added by bologna*///TODO***********BOLOGNA**************REMOVE ME*****************/
-       global $db,$forum_list;//forum_list contiene tutti i forum distinti associati ai contenuti. poich� la funzione in questione ï¿½ ricorsiva deve essere globale in modo che in fase di creazione dell'archivio zip i file descrittori dei forum non vengano ripetuti
-
-       require_once(TR_INCLUDE_PATH.'../home/classes/ContentUtility.class.php');
-       require_once(TR_INCLUDE_PATH.'classes/DAO/ContentForumsAssocDAO.class.php');
-       
-       $space  = '    ';
-       $prefix = '                    ';
-
-       if ($depth == 0) {
-               $string .= '<ul>';
-       }
-       $top_level = $_menu[$parent_id];
-       if (!is_array($paths)) {
-               $paths = array();
-       }
-       if (!is_array($zipped_files)) {
-               $zipped_files = array();
-       }
-       if ( is_array($top_level) ) {
-               
-               $counter = 1;
-               $num_items = count($top_level);
-                
-               foreach ($top_level as $garbage => $content) {
-                       $link = '';
-                       //XSL characters handling
-                       $content['title'] = str_replace('&', '&amp;', $content['title']);
-                               
-                       if ($content['content_path'] && (substr($content['content_path'],-1)!='/')) {
-                               $content['content_path'] .= '/';
-                       }
-
-                       /* 
-                        * generate weblinks 
-                        * Reason to put it here is cause we don't want the content to be overwrittened.
-                        */
-                       if ($content['content_type']==CONTENT_TYPE_WEBLINK){
-                               $wl = new Weblinks($content['title'], $content['text']);
-                               $wlexport = new WeblinksExport($wl);
-                               $wl_xml = $wlexport->export();
-                               $wl_filename = 'weblinks_'.$content['content_id'].'.xml';
-                               $zipfile->add_file($wl_xml , 'Weblinks/'.$wl_filename, $content['u_ts']);
-                               $resources .= str_replace(      array('{PATH}', '{CONTENT_ID}'), 
-                                                                                       array($wl_filename, $content['content_id']), 
-                                                                                       $ims_template_xml['resource_weblink']);
-                               //Done.
-//                             continue;
-                       }
-
-                       if ($content['content_type']==CONTENT_TYPE_FOLDER){
-                               $link .= $prefix.'<item identifier="MANIFEST01_FOLDER'.$content['content_id'].'">'."\n";
-                               $link .= $prefix.$space.'<title>'.$content['title'].'</title>'."\n";
-                       } else {
-                               $link .= '<item identifier="MANIFEST01_ITEM'.$content['content_id'].'" identifierref="MANIFEST01_RESOURCE'.$content['content_id'].'">'."\n";
-                               $link .= $prefix.$space.'<title>'.$content['title'].'</title>'."\n$prefix$space";
-                       }
-                       $html_link = '<a href="resources/'.$content['content_path'].$content['content_id'].'.html" target="body">'.$content['title'].'</a>';
-                       
-                       /* save the content as HTML files */
-                       /* @See: include/lib/format_content.inc.php */
-                       $content['text'] = str_replace('CONTENT_DIR/', '', $content['text']);
-                       /* Commented by Cindy Qi Li on Jan 12, 2010
-                        * Transformable does not support glossary
-                       // get all the glossary terms used
-                       $terms = find_terms($content['text']);
-                       if (is_array($terms)) {
-                               foreach ($terms[2] as $term) {
-                                       $used_glossary_terms[] = $term;
-                               }
-                       }
-*/
-                       $f_count = count($forum_list); //count all distinct forum_id associated to a content page
-                                                //la funzione Ã¨ ricorsiva quindi lo devo ricavare attraverso la variabile globale forum_list
-
-                       $contentForumsAssocDAO = new ContentForumsAssocDAO();
-                       $forums = $contentForumsAssocDAO->getByContent($content[content_id]);
-//                    $sql = "SELECT cf.forum_id, f.title, f.description FROM (SELECT * FROM ".TABLE_PREFIX."content_forums_assoc WHERE content_id=$content[content_id]) AS cf LEFT JOIN ".TABLE_PREFIX."forums f ON cf.forum_id=f.forum_id";
-//                    $result_cf = mysql_query($sql,$db);
-   
-                       $find=false;
-                       $forums_dependency='';  //template for associate Discussion Topic to the current content into the manifest
-                       if (is_array($forums)) {
-                               foreach($forums as $current_forum) {
-                                       for($j=0;$j<$f_count;$j++) {
-                                               if($forum_list[$j]['id'] == $current_forum['forum_id']) $find= true;
-                                       }
-                                       if(!$find) {
-                                               $forum_list[$f_count]['id']=$current_forum['forum_id'];
-                                               $forum_list[$f_count]['title']=$current_forum['title'];
-                                               $forum_list[$f_count]['description']=$current_forum['description'];
-                                               $find=false;
-                                               $f_count++;
-                                       }
-                               }
-                               $forums_dependency .= $prefix.$space.'<dependency identifierref="Forum'.$current_forum['forum_id'].'_R" />';
-            }
-
-                        /** Test dependency **/
-                       require_once(TR_INCLUDE_PATH.'classes/DAO/ContentTestsAssocDAO.class.php');
-                       $contentTestsAssocDAO = new ContentTestsAssocDAO();
-                       
-//                     $sql = 'SELECT * FROM '.TABLE_PREFIX.'content_tests_assoc WHERE content_id='.$content['content_id'];
-//                     $result = mysql_query($sql, $db);
-//                     while ($row = mysql_fetch_assoc($result)){
-                       $rows = $contentTestsAssocDAO->getByContent($content['content_id']);
-                       if (is_array($rows)) {
-                               //add test dependency on top of forum dependency
-                               foreach ($rows as $row)
-                                       $forums_dependency .= $prefix.$space.'<dependency identifierref="MANIFEST01_RESOURCE_QTI'.$row['test_id'].'" />';
-                       }
-
-
-                       /* calculate how deep this page is: */
-                       $path = '../';
-                       if ($content['content_path']) {
-                               $depth = substr_count($content['content_path'], '/');
-
-                               $path .= str_repeat('../', $depth);
-                       }
-
-                       $content['text'] = ContentUtility::formatContent($content['text'], $content['formatting']);
-                       // add HTML header and footers to the files
-                       // use default style if <style> is not in imported html head
-                       $head = '';
-                       if ($content['use_customized_head'])
-                       {
-                               if (strpos(strtolower($content['head']), '<style') > 0)
-                               {
-                                       $head = $content['head'];
-                               }
-                               else
-                               {
-                                       if (strlen($content['head']) > 0)  
-                                               $head = $content['head'] . $default_html_style;
-                                       else 
-                                               $head = $default_html_style;
-                               }
-                       }
-
-                       $content['text'] = str_replace( array('{TITLE}',        '{CONTENT}', '{KEYWORDS}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{COURSE_PRIMARY_LANGUAGE_CODE}', '{HEAD}'),
-                                                                       array($content['title'],        $content['text'], $content['keywords'], $course_language_charset, $course_language_code, $head),
-                                                                       $html_content_template);
-                                                               
-                       /* duplicate the paths in the content_path field in the zip file */
-                       if ($content['content_path']) {
-                               if (!in_array($content['content_path'], $paths)) {
-                                       $zipfile->create_dir('resources/'.$content['content_path'], time());
-                                       $paths[] = $content['content_path'];
-                               }
-                       }
-                       //add the file iff it's a content file
-                       if($content['content_type']==CONTENT_TYPE_CONTENT){
-                               $zipfile->add_file($content['text'], 'resources/'.$content['content_path'].$content['content_id'].'.html', $content['u_ts']);
-                       }
-                       $content['title'] = htmlspecialchars($content['title']);
-
-                       /* add the resource dependancies */                     
-                       if ($my_files == null) $my_files = array();
-                       $content_files = "\n";
-                       $parser->parse($content['text']);
-
-                       /* generate the IMS QTI resource and files */
-                       //check if test export is allowed.
-                       if ($contentManager->allowTestExport($content['content_id'])){
-                               $content_test_rs = $contentManager->getContentTestsAssoc($content['content_id']);       
-                               $test_ids = array();            //reset test ids
-                               //$my_files = array();          //reset myfiles.
-                               while ($content_test_row = mysql_fetch_assoc($content_test_rs)){
-                                       //export
-                                       $test_ids[] = $content_test_row['test_id'];
-                                       //the 'added_files' is for adding into the manifest file in this zip
-                                       $added_files = test_qti_export($content_test_row['test_id'], '', $zipfile);
-                                       foreach($added_files as $xml_file=>$chunk){
-                                               foreach ($chunk as $xml_filename){
-                                                       $added_files_xml .= str_replace('{FILE}', 'QTI/'.$xml_filename, $ims_template_xml['xml']);
-                                               }
-                                       }
-                                       //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
-                                       $resources .= str_replace(      array('{TEST_ID}', '{PATH}', '{FILES}'),
-                                                                                               array($content_test_row['test_id'], 'tests_'.$content_test_row['test_id'].'.xml', $added_files_xml),
-                                                                                               $ims_template_xml['resource_test']); 
-/*     Taken out since we are gonna use dependency instead
-                                       $test_xml_items .= str_replace( array('{TEST_ID}'),
-                                                                                               array($content_test_row['test_id']),
-                                                                                               $ims_template_xml['test']); 
-*/
-                                       foreach($test_files as $filename=>$realfilepath){
-                                               $zipfile->add_file(@file_get_contents($realfilepath), 'QTI/'.$filename, filemtime($realfilepath));
-                                       }
-                               }
-                       }
-
-                       /* generate the a4a files */
-                       $a4a_xml_array = array();
-                       if ($use_a4a == true){
-                               $a4aExport = new A4aExport($content['content_id']);
-//                             $a4aExport->setRelativePath('resources/'.$content['content_path']);
-                               $secondary_files = $a4aExport->getAllSecondaryFiles();
-                               $a4a_xml_array = $a4aExport->exportA4a();
-                               $my_files = array_merge($my_files, $a4aExport->getAllSecondaryFiles());
-                       }
-
-                       /* handle @import */
-                       $import_files = get_import_files($content['text']);
-
-                       if (count($import_files) > 0) $my_files = array_merge($my_files, $import_files);
-
-                       foreach ($my_files as $file) {
-                               /* filter out full urls */
-                               $url_parts = @parse_url($file);
-                               if (isset($url_parts['scheme'])) {
-                                       continue;
-                               }
-
-                               /* file should be relative to content. let's double check */
-                               if ((substr($file, 0, 1) == '/')) {
-                                       continue;
-                               }
-
-
-                               $file_path = realpath(TR_CONTENT_DIR . $course_id . '/' . $content['content_path'] . $file);
-
-                               /* check if this file exists in the content dir, if not don't include it */
-                               if (file_exists($file_path) &&  is_file($file_path) && !in_array($file_path, $zipped_files)) {
-                                       $zipped_files[] = $file_path;
-                                       $dir = substr(dirname($file_path), strlen(TR_CONTENT_DIR . $course_id));
-
-                                       if (!in_array($dir, $paths) && $dir) {
-                                               $dir = str_replace('\\', '/', substr($dir, 1));
-                                               $zipfile->create_dir('resources/' . $dir, time());
-                                               
-                                               $paths[] = $dir;
-                                       }
-
-                                       $file_info = stat( $file_path );
-
-                                       //remove relative path in the content_path.     
-                                       $filepath_array = explode('/', 'resources/' . $content['content_path'] . $file);
-                                       $new_filepath_array = array();
-                                       if (in_array('..', $filepath_array)){
-                                               while (!empty($filepath_array)){
-                                                       $temp = array_shift($filepath_array);
-                                                       if ($temp == '..'){
-                                                               array_pop($new_filepath_array);
-                                                       } else {
-                                                               array_push($new_filepath_array, $temp);
-                                                       }
-                                               }
-                                               $zip_path = implode('/', $new_filepath_array);
-                                       } else {
-                                               $zip_path = 'resources/' . $content['content_path'] . $file;
-                                       }
-
-                                       $zipfile->add_file(@file_get_contents($file_path), $zip_path, $file_info['mtime']);
-
-                                       //a4a secondary files have mapping, save the ones that we want in order to add the tag in
-                                       $a4a_secondary_files = array();
-                                       foreach ($a4a_xml_array as $a4a_filename=>$a4a_filearray){
-                                               if (preg_match('/(.*)\sto\s(.*)/', $a4a_filename, $matches)){
-                                                       //save the actual file name
-                                                       $a4a_secondary_files[$matches[1]][] = $a4a_filename;    //values are holders
-                                               }
-                                       }
-
-                                       // If this file has a4a alternatives, link it.
-                                       if (isset($a4a_xml_array[$file]) || isset($a4a_secondary_files[$file])){
-                                               //if this is an array, meaning that it has more than 1 alternatives, print all
-                                               if (is_array($a4a_secondary_files[$file])){
-                                                       $all_secondary_files_md = '';   //reinitialize string to null
-                                                       foreach ($a4a_secondary_files[$file] as $v){
-                                                               $all_secondary_files_md .= $a4a_xml_array[$v];  //all the meta data                                                             
-                                                       }
-                                                       $content_files .= str_replace(  array('{FILE}', '{FILE_META_DATA}'), 
-                                                                                                                       array('resources/'.$content['content_path'] . $file, $all_secondary_files_md), 
-                                                                                                                       $ims_template_xml['file_meta']);
-                                               } else {        
-                                                       $content_files .= str_replace(  array('{FILE}', '{FILE_META_DATA}'), 
-                                                                                                                       array('resources/'.$content['content_path'] . $file, $a4a_xml_array[$file]), 
-                                                                                                                       $ims_template_xml['file_meta']);
-                                               }
-                                       } else {
-                                               //if this file is in the test array, add an extra link to the direct file, 
-                                               if (!empty($test_zipped_files) && in_array($file_path, $test_zipped_files)){
-                                                       $content_files .= str_replace('{FILE}', $file, $ims_template_xml['file']);
-                                               } else {
-                                                       $content_files .= str_replace('{FILE}', $content['content_path'] . $file, $ims_template_xml['file']);
-                                               }
-                                       }
-                               }
-
-                               /* check if this file is one of the test xml file, if so, we need to add the dependency
-                                * Note:  The file has already been added to the archieve before this is called.
-                                */
-                               if (preg_match('/tests\_[0-9]+\.xml$/', $file) && !in_array($file, $test_zipped_files)){
-                                       $content_files .= str_replace('{FILE}', 'QTI/'.$file, $ims_template_xml['xml']);
-                                       $test_zipped_files[] = $file;
-                               }
-                       }
-
-                       /******************************/
-                       //add it to the resources section if it hasn't been added.  
-                       //Weblinks have been added.
-                       //Folders aren't resourecs, they shouldn't be added
-                       if($content['content_type']==CONTENT_TYPE_CONTENT){
-                               $resources .= str_replace(      array('{CONTENT_ID}', '{PATH}', '{FILES}','{DEPENDENCY}'),
-                                                                                       array($content['content_id'], $content['content_path'], $content_files, $forums_dependency),
-                                                                                       $ims_template_xml['resource']); 
-                       }
-                       
-
-                       for ($i=0; $i<$depth; $i++) {
-                               $link .= $space;
-                       }
-
-                       if ( is_array($_menu[$content['content_id']]) ) {
-                               /* has children */
-
-                               $html_link = '<li>'.$html_link.'<ul>';
-                               for ($i=0; $i<$depth; $i++) {
-                                       if ($children[$i] == 1) {
-                                               echo $space;
-                                               //$html_link = $space.$html_link;
-                                       } else {
-                                               echo $space;
-                                               //$html_link = $space.$html_link;
-                                       }
-                               }
-
-                       } else {
-                               /* doesn't have children */
-
-                               $html_link = '<li>'.$html_link.'</li>';
-                               if ($counter == $num_items) {
-                                       for ($i=0; $i<$depth; $i++) {
-                                               if ($children[$i] == 1) {
-                                                       echo $space;
-                                                       //$html_link = $space.$html_link;
-                                               } else {
-                                                       echo $space;
-                                                       //$html_link = $space.$html_link;
-                                               }
-                                       }
-                               } else {
-                                       for ($i=0; $i<$depth; $i++) {
-                                               echo $space;
-                                               //$html_link = $space.$html_link;
-                                       }
-                               }
-                               $title = $space.$title;
-                       }
-
-                       echo $prefix.$link;
-//                     echo $title;
-                       echo "\n";
-
-                       $string .= $html_link."\n";
-
-                       $depth ++;
-                       print_organizations($content['content_id'],
-                                                               $_menu, 
-                                                               $depth, 
-                                                               $path.$counter.'.', 
-                                                               $children,
-                                                               $string);
-                       $depth--;
-
-                       $counter++;
-                       for ($i=0; $i<$depth; $i++) {
-                               echo $space;
-                       }
-
-//                     if (!empty($_menu[$content['content_id']])){
-                       echo $prefix.'</item>';
-//                     }
-                       echo "\n";
-               }  
-
-               $string .= '</ul>';
-               if ($depth > 0) {
-                       $string .= '</li>';
-               }
-
-       }
-}
-
-
-//TODO***************BOLOGNA******************REMOVE ME***************/
-/* Export Forum */
-function print_resources_forum() {
-
-    global $forum_list, $zipfile, $resources;           //$forum_list contiene tutti i forum DISTINTI associati ai contenuti. caricato in print_organizations()
-
-    $ims_template_xml['resource_forum'] =
-
-        '<resource identifier="Forum{FORUMID}_R" type="imsdt_xmlv1p0">
-            <metadata/>
-            <file href="Forum{FORUMID}/FileDescriptorForum{FORUMID}.xml"/>
-        </resource>
-       '."\n";
-
-    foreach ($forum_list as $f){
-    // per ogni forum associato ad uno o pi� contenuti del corso viene aggiunto un elemento resource in imsmanifest.xml
-        $resources .= str_replace("{FORUMID}", $f['id'], $ims_template_xml['resource_forum']);
-
-        //viene generato il file descrittore
-        //file Descrittore con la descrzione del forum
-        $fileDesDT_D = '<?xml version="1.0" encoding="UTF-8"?>
-
-                    <dt:topic
-
-                        xmlns:dt="http://www.imsglobal.org/xsd/imsdt_v1p0"
-
-                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-                        <title>{TitleDiscussionTopic}</title>
-
-                        <text texttype="text/plain">{DescriptionDiscussionTopic}</text>
-
-                    </dt:topic>';
-
-        //file Descrittore senza la descrizione del forum
-        $fileDesDT = '<?xml version="1.0" encoding="UTF-8"?>
-
-                    <dt:topic
-
-                        xmlns:dt="http://www.imsglobal.org/xsd/imsdt_v1p0"
-
-                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-                        <title>{TitleDiscussionTopic}</title>
-
-                        <text/>
-
-                    </dt:topic>';
-
-               $f['title'] = htmlspecialchars($f['title']);
-               $f['description'] = htmlspecialchars($f['description']);
-        if (empty($f['description']))
-            $text_file_des_xml = str_replace (array('{TitleDiscussionTopic}', '{DescriptionDiscussionTopic}'), array($f['title'], $f['description']), $fileDesDT);
-        else
-            $text_file_des_xml = str_replace (array('{TitleDiscussionTopic}', '{DescriptionDiscussionTopic}'), array($f['title'], $f['description']), $fileDesDT_D);
-
-        $zipfile->add_file($text_file_des_xml,  'Forum'.$f['id'].'/'.'FileDescriptorForum'.$f['id'].'.xml');
-    }
-    //$zipfile->add_file(file_get_contents('../../images/home-forums_sm.png'),  'resources/home-forums_sm.png');
-}
-
-
-$ims_template_xml['header'] = '<?xml version="1.0" encoding="{COURSE_PRIMARY_LANGUAGE_CHARSET}"?>
-<!--This is an ATutor 1.0 Common Cartridge document-->
-<!--Created from the ATutor Content Package Generator - http://www.atutor.ca-->
-<manifest identifier="MANIFEST-2415ad93fc44817acbe40edfd1ffb1ee" xmlns="http://www.imsglobal.org/xsd/imscc/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" xmlns:lomimscc="http://ltsc.ieee.org/xsd/imscc/LOM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscc/imscp_v1p1 imscp_v1p2_localised.xsd http://ltsc.ieee.org/xsd/imscc/LOM domainProfile_1/lomLoose_localised.xsd">
-       <metadata>
-               <schema>IMS Common Cartridge</schema>
-           <schemaversion>1.0.0</schemaversion>
-               <lomimscc:lom>
-      <lomimscc:general>
-        <lomimscc:identifier>          
-                       <lomimscc:catalog>ATutor</lomimscc:catalog>
-                       <lomimscc:entry></lomimscc:entry>
-        </lomimscc:identifier>
-        <lomimscc:title>
-                       <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{COURSE_TITLE}</lomimscc:string>
-        </lomimscc:title>
-        <lomimscc:language>en</lomimscc:language>
-        <lomimscc:description> 
-                       <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{COURSE_DESCRIPTION}</lomimscc:string>
-        </lomimscc:description>
-        <lomimscc:keyword>
-                       <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{KEYWORDS}</lomimscc:string>
-        </lomimscc:keyword>
-      </lomimscc:general>
-    </lomimscc:lom>
-       </metadata>'
-;
-
-$ims_template_xml['resource'] = '              <resource identifier="MANIFEST01_RESOURCE{CONTENT_ID}" type="webcontent" href="resources/{PATH}{CONTENT_ID}.html">
-                       <metadata/>
-                       <file href="resources/{PATH}{CONTENT_ID}.html"/>{FILES}
-                        {DEPENDENCY}
-               </resource>
-'."\n";
-$ims_template_xml['resource_glossary'] = '             <resource identifier="MANIFEST01_RESOURCE_GLOSSARY" type="associatedcontent/imscc_xmlv1p0/learning-application-resource" href="resources/GlossaryItem/glossary.xml">
-                       <metadata/>
-                       <file href="resources/GlossaryItem/glossary.xml"/>
-               </resource>
-'."\n";
-$ims_template_xml['resource_test'] = '         <resource identifier="MANIFEST01_RESOURCE_QTI{TEST_ID}" type="imsqti_xmlv1p2/imscc_xmlv1p0/assessment">
-                       <metadata/>
-                       <file href="QTI/{PATH}"/>{FILES}
-               </resource>
-'."\n";
-$ims_template_xml['resource_weblink'] = '              <resource identifier="MANIFEST01_RESOURCE{CONTENT_ID}" type="imswl_xmlv1p0">
-                       <metadata/>
-                       <file href="Weblinks/{PATH}"/>
-               </resource>
-'."\n";
-$ims_template_xml['file'] = '                  <file href="resources/{FILE}"/>'."\n";
-$ims_template_xml['xml'] = '                   <file href="{FILE}"/>'."\n";
-$ims_template_xml['glossary'] = '                      <item identifier="GlossaryItem" identifierref="MANIFEST01_RESOURCE_GLOSSARY">
-                               <title>Glossary</title>
-                       </item>';
-$ims_template_xml['test'] = '                  <item identifier="QTI{TEST_ID}" identifierref="MANIFEST01_RESOURCE_QTI{TEST_ID}">
-                               <title>Test {TEST_ID}</title>
-                       </item>';
-$ims_template_xml['file_meta'] = '                     <file href="{FILE}">
-                               <metadata>
-                               {FILE_META_DATA}
-                               </metadata>
-                       </file>'."\n";
-
-$ims_template_xml['final'] = '
-       <organizations>
-               <organization identifier="MANIFEST01_ORG1" structure="rooted-hierarchy">
-                       <item identifier="resources">           
-               {ORGANIZATIONS}
-                   </item>
-               </organization>
-       </organizations>
-       <resources>
-{RESOURCES}
-       </resources>
-</manifest>';
-
-$html_template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
-<head>
-       <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
-       <title>{TITLE}</title>
-       <meta name="Generator" content="ATutor">
-       <meta name="Keywords" content="{KEYWORDS}">
-</head>
-<body>{CONTENT}</body>
-</html>';
-
-$html_content_template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
-<head>
-       <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
-       {HEAD}
-       <title>{TITLE}</title>
-       <meta name="Generator" content="ATutor">
-       <meta name="Keywords" content="{KEYWORDS}">
-</head>
-<body>{CONTENT}</body>
-</html>';
-
-$default_html_style = '        <style type="text/css">
-       body { font-family: Verdana, Arial, Helvetica, sans-serif;}
-       a.at-term {     font-style: italic; }
-       </style>';
-       
-//output this as header.html
-$html_mainheader = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
-<head>
-       <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
-       <link rel="stylesheet" type="text/css" href="ims.css"/>
-       <title>{COURSE_TITLE}</title>
-</head>
-<body class="headerbody"><h3>{COURSE_TITLE}</h3></body></html>';
-
-
-$html_toc = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
-<head>
-       <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
-       <link rel="stylesheet" type="text/css" href="ims.css" />
-       <title></title>
-</head>
-<body>{TOC}</body></html>';
-
-// index.html
-$html_frame = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
-   "http://www.w3.org/TR/html4/frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
-       <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
-       <title>{COURSE_TITLE}</title>
-</head>
-<frameset rows="50,*,50">
-<frame src="header.html" name="header" title="header" scrolling="no">
-       <frameset cols="25%, *" frameborder="1" framespacing="3">
-               <frame frameborder="2" marginwidth="0" marginheight="0" src="toc.html" name="frame" title="TOC">
-               <frame frameborder="2" src="resources/{PATH}{FIRST_ID}.html" name="body" title="{COURSE_TITLE}">
-       </frameset>
-<frame src="footer.html" name="footer" title="footer" scrolling="no">
-       <noframes>
-               <h1>{COURSE_TITLE}</h1>
-      <p><a href="toc.html">Table of Contents</a> | <a href="footer.html">About</a><br />
-         </p>
-  </noframes>
-</frameset>
-</html>';
-
-
-
-$glossary_xml = '<?xml version="1.0" encoding="{COURSE_PRIMARY_LANGUAGE_CHARSET}"?>
-<!--This is an ATutor Glossary terms document-->
-<!--Created from the ATutor Content Package Generator - http://www.atutor.ca-->
-<glossary:glossary xmlns:glossary="http://www.atutor.ca/xsd/glossary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-      {GLOSSARY_TERMS}
-</glossary:glossary>
-';
-
-$glossary_term_xml = ' <item>
-               <term>{TERM}</term>
-               <definition>{DEFINITION}</definition>
-       </item>';
-
-$glossary_body_html = '<h2>Glossary</h2>
-       <ul>
-{BODY}
-</ul>';
-
-$glossary_term_html = '        <li><a name="{ENCODED_TERM}"></a><strong>{TERM}</strong><br />
-               {DEFINITION}<br /><br /></li>';
-
-?>
index b20a3a1..84b6a10 100644 (file)
@@ -153,19 +153,19 @@ trans.utility.selected;
   };\r
   \r
   // toggle content folder in side menu "content navigation"\r
-  trans.utility.toggleFolder = function (cid, expand_text, collapse_text)\r
+  trans.utility.toggleFolder = function (cid, expand_text, collapse_text, course_id)\r
   {\r
     if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {\r
       jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);\r
       jQuery("#tree_icon"+cid).attr("alt", expand_text);\r
       jQuery("#tree_icon"+cid).attr("title", expand_text);\r
-      trans.utility.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);\r
+      trans.utility.setcookie("t.c"+course_id+"_"+cid, null, 1);\r
     }\r
     else {\r
       jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);\r
       jQuery("#tree_icon"+cid).attr("alt", collapse_text);\r
       jQuery("#tree_icon"+cid).attr("title", collapse_text);\r
-      trans.utility.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);\r
+      trans.utility.setcookie("t.c"+course_id+"_"+cid, "1", 1);\r
     }\r
     \r
     jQuery("#folder"+cid).slideToggle();\r
@@ -187,23 +187,24 @@ trans.utility.selected;
       jQuery(elem).attr("src", element_collapse_icon);\r
       jQuery(elem).attr("alt", hide_text + " "+ title);\r
       jQuery(elem).attr("title", hide_text + " "+ title);\r
-      trans.utility.setcookie("m_"+title, null, 1);;\r
+      trans.utility.setcookie("m_"+title, 1, 1);;\r
     }\r
     \r
     jQuery(elem).parent().next().slideToggle();\r
   };\r
   \r
-  trans.utility.printSubmenuHeader = function (title, base_path, show_text, hide_text)\r
+  trans.utility.printSubmenuHeader = function (title, base_path, show_text, hide_text, default_value)\r
   {\r
-    if (trans.utility.getcookie("m_"+title) == "0")\r
+       cookie_value = trans.utility.getcookie("m_"+title);\r
+       if (cookie_value == "0" || cookie_value == "" && default_value == "hide")\r
     {\r
       image = base_path + "images/mswitch_plus.gif";\r
-      alt_text = show_text + title;\r
+      alt_text = show_text + " " + title;\r
     }\r
-    else\r
+    else if (cookie_value == "1")\r
     {\r
       image = base_path+"images/mswitch_minus.gif";\r
-      alt_text = hide_text + title;\r
+      alt_text = hide_text + " " + title;\r
     }\r
     \r
     document.writeln('<h4 class="box">'+\r
index 48dba28..9d2e3cd 100644 (file)
@@ -21,7 +21,7 @@ $body_text    = htmlspecialchars($stripslashes($_POST['body_text']));
 $body          = html_entity_decode($body_text);
 
 require(TR_INCLUDE_PATH.'classes/XML/XML_HTMLSax/XML_HTMLSax.php');    /* for XML_HTMLSax */
-require(TR_INCLUDE_PATH.'imscc/ims_template.inc.php');                         /* for ims templates + print_organizations() */
+require(TR_INCLUDE_PATH.'../home/imscc/include/ims_template.inc.php');                         /* for ims templates + print_organizations() */
 
 /*
 the following resources are to be identified:
index 7660427..e6fc51e 100644 (file)
 
 if (!defined('TR_INCLUDE_PATH')) { exit; }
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
 
-global $_base_path;
-global $savant;
-global $contentManager, $_course_id;
+global $savant, $_course_id;
 
-ob_start();
+if (!isset($_SESSION['user_id']) || $_SESSION['user_id'] == 0) {
+       $side_menu[] = TR_INCLUDE_PATH.'sidemenus/getting_start.inc.php';
+}
+if ($_course_id > 0) {
+       $side_menu[] = TR_INCLUDE_PATH.'sidemenus/content_nav.inc.php';
+}
 
-echo '<div style="white-space:nowrap;">';
-
-echo '<a href="'.$_base_path.'home/course/outline.php?_course_id='.$_course_id.'">'._AT('outline').'</a><br />';
-
-/* @See classes/ContentManager.class.php       */
-$contentManager->printMainMenu();
-
-echo '</div>';
-
-$savant->assign('dropdown_contents', ob_get_contents());
-ob_end_clean();
-
-$coursesDAO = new CoursesDAO();
-$course_row = $coursesDAO->get($_course_id);
-
-$savant->assign('title', $course_row['title']);
-//$savant->assign('title', _AT('content_navigation'));
-$savant->display('include/box.tmpl.php');
+$savant->assign('side_menu', $side_menu);
+$savant->display('include/side_menu.tmpl.php');
 ?>
\ No newline at end of file
diff --git a/docs/include/sidemenus/content_nav.inc.php b/docs/include/sidemenus/content_nav.inc.php
new file mode 100644 (file)
index 0000000..7660427
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/************************************************************************/
+/* Transformable                                                        */
+/************************************************************************/
+/* Copyright (c) 2009                                                   */
+/* Adaptive Technology Resource Centre / University of Toronto          */
+/*                                                                      */
+/* This program is free software. You can redistribute it and/or        */
+/* modify it under the terms of the GNU General Public License          */
+/* as published by the Free Software Foundation.                        */
+/************************************************************************/
+
+if (!defined('TR_INCLUDE_PATH')) { exit; }
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
+
+global $_base_path;
+global $savant;
+global $contentManager, $_course_id;
+
+ob_start();
+
+echo '<div style="white-space:nowrap;">';
+
+echo '<a href="'.$_base_path.'home/course/outline.php?_course_id='.$_course_id.'">'._AT('outline').'</a><br />';
+
+/* @See classes/ContentManager.class.php       */
+$contentManager->printMainMenu();
+
+echo '</div>';
+
+$savant->assign('dropdown_contents', ob_get_contents());
+ob_end_clean();
+
+$coursesDAO = new CoursesDAO();
+$course_row = $coursesDAO->get($_course_id);
+
+$savant->assign('title', $course_row['title']);
+//$savant->assign('title', _AT('content_navigation'));
+$savant->display('include/box.tmpl.php');
+?>
\ No newline at end of file
diff --git a/docs/include/sidemenus/getting_start.inc.php b/docs/include/sidemenus/getting_start.inc.php
new file mode 100644 (file)
index 0000000..fcdf7ee
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/************************************************************************/
+/* Transformable                                                        */
+/************************************************************************/
+/* Copyright (c) 2009                                                   */
+/* Adaptive Technology Resource Centre / University of Toronto          */
+/*                                                                      */
+/* This program is free software. You can redistribute it and/or        */
+/* modify it under the terms of the GNU General Public License          */
+/* as published by the Free Software Foundation.                        */
+/************************************************************************/
+
+if (!defined('TR_INCLUDE_PATH')) { exit; }
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+
+global $savant;
+
+$savant->assign('title', _AT('getting_start'));
+$savant->assign('dropdown_contents', _AT('getting_start_info'));
+$savant->assign('default_status', "hide");
+
+$savant->display('include/box.tmpl.php');
+?>
\ No newline at end of file
index 72518a4..3237170 100644 (file)
@@ -15,7 +15,7 @@ if (!defined('TR_INCLUDE_PATH')) { exit; }
 global $onload;\r
 $onload = 'document.form.title.focus();';\r
 ?>\r
-<form action="<?php echo $_SERVER['PHP_SELF'].'?'; if ($this->cid > 0) echo '_cid='.$this->cid; if ($this->pid > 0) echo 'pid='.$this->pid.SEP.'_course_id='.$this->course_id;?>" method="post" name="form"> \r
+<form action="<?php echo $_SERVER['PHP_SELF'].'?'; if ($this->cid > 0) echo '_cid='.$this->cid; else if ($this->pid > 0) echo 'pid='.$this->pid.SEP.'_course_id='.$this->course_id; else echo '_course_id='.$this->course_id;?>" method="post" name="form"> \r
 <div class="input-form" style="width:95%;margin-left:1.5em;">\r
 <!-- <?php\r
 if ($this->shortcuts): \r
index b130d88..39cc1c4 100644 (file)
@@ -1,13 +1,13 @@
 <?php 
 if (!defined('TR_INCLUDE_PATH')) { exit; } 
 global $_base_path;
-
+//debug($this->default_status);
 $compact_title = str_replace(' ', '', $this->title);
 ?>
 
 <br />
 <script language="javascript" type="text/javascript">
-  trans.utility.printSubmenuHeader("<?php echo $this->title; ?>", "<?php echo $_base_path; ?>", "<?php echo _AT('show'); ?>", "<?php echo _AT('hide'); ?>");
+  trans.utility.printSubmenuHeader("<?php echo $this->title; ?>", "<?php echo $_base_path; ?>", "<?php echo _AT('show'); ?>", "<?php echo _AT('hide'); ?>", "<?php echo $this->default_status; ?>");
 </script>
 
 <div class="box" id="menu_<?php echo $compact_title ?>">
@@ -15,11 +15,12 @@ $compact_title = str_replace(' ', '', $this->title);
 </div>
 
 <script language="javascript" type="text/javascript">
-if (trans.utility.getcookie("m_<?php echo $this->title; ?>") == "0")
+cookie_value = trans.utility.getcookie("m_<?php echo $this->title; ?>");
+if (cookie_value == "0" || cookie_value == "" && "<?php echo $this->default_status; ?>" == "hide")
 {
        jQuery("#menu_<?php echo $compact_title; ?>").hide();
 }
-else
+else if (cookie_value == "1")
 {
        jQuery("#menu_<?php echo $compact_title; ?>").show();
 }
index 1380214..8178a40 100644 (file)
@@ -225,7 +225,7 @@ foreach ($this->top_level_pages as $page) {
 //if ($this->course_id > 0) {
 ?>
   <div id="contentwrapper">
-    <?php if ((isset($this->course_id) && $this->course_id > 0)): ?>
+    <?php //if ((isset($this->course_id) && $this->course_id > 0)): ?>
     <div id="leftcolumn">
       <script type="text/javascript">
       //<![CDATA[
@@ -237,16 +237,14 @@ foreach ($this->top_level_pages as $page) {
       }
       //]]>
       </script>
-
       <?php require(TR_INCLUDE_PATH.'side_menu.inc.php'); ?>
-
       <script type="text/javascript">
       //<![CDATA[
       document.writeln('</div>');
       //]]>
       </script>
     </div>
-       <?php endif; ?>
+       <?php //endif; ?>
 
     <div id="contentcolumn"
     <?php if (isset($this->course_id) && $this->course_id <= 0): ?>
@@ -254,9 +252,9 @@ foreach ($this->top_level_pages as $page) {
     <?php endif; ?>
     >
 
-    <?php if (isset($this->course_id) && $this->course_id > 0): ?>
+    <?php //if (isset($this->course_id) && $this->course_id > 0): ?>
       <div id="menutoggle">
-        <?php if ($this->course_id > 0): ?>
+        <?php //if ($this->course_id > 0): ?>
         <script type="text/javascript" language="javascript">
         //<![CDATA[
         var state = trans.utility.getcookie("side-menu");
@@ -268,7 +266,7 @@ foreach ($this->top_level_pages as $page) {
         }
         //]]>
         </script>
-        <?php endif; ?>
+        <?php //endif; ?>
       </div>
 
       <div id="sequence-links">
@@ -286,7 +284,7 @@ foreach ($this->top_level_pages as $page) {
                <?php // } ?>
                        &nbsp;
       </div>
-        <?php endif; ?>
+    <?php //endif; ?>
 
       <!-- the page title -->
       <a name="content" title="<?php echo _AT('content'); ?>"></a>
diff --git a/docs/themes/default/include/side_menu.tmpl.php b/docs/themes/default/include/side_menu.tmpl.php
new file mode 100644 (file)
index 0000000..cd8c63d
--- /dev/null
@@ -0,0 +1,10 @@
+<?php 
+if (!defined('TR_INCLUDE_PATH')) { exit; } 
+
+if (!is_array($this->side_menu)) return;
+
+foreach ($this->side_menu as $dropdown_file){
+       if (file_exists($dropdown_file)) { require($dropdown_file); } 
+}
+?>
+<div style="position:absolute; bottom:0px;">&nbsp;</div>