add in "test & surveys" and "file manager" modules
authorCindy Li <cli@ocad.ca>
Fri, 9 Apr 2010 20:16:19 +0000 (20:16 -0000)
committerCindy Li <cli@ocad.ca>
Fri, 9 Apr 2010 20:16:19 +0000 (20:16 -0000)
86 files changed:
docs/documentation/oauth_server_api.php
docs/file_manager/delete.php [new file with mode: 0644]
docs/file_manager/edit.php [new file with mode: 0644]
docs/file_manager/filemanager_display.inc.php [new file with mode: 0644]
docs/file_manager/index.php [new file with mode: 0644]
docs/file_manager/move.php [new file with mode: 0644]
docs/file_manager/new.php [new file with mode: 0644]
docs/file_manager/preview.php [new file with mode: 0644]
docs/file_manager/preview_top.php [new file with mode: 0644]
docs/file_manager/rename.php [new file with mode: 0644]
docs/file_manager/top.php [new file with mode: 0644]
docs/file_manager/upload.php [new file with mode: 0644]
docs/file_manager/zip.php [new file with mode: 0644]
docs/home/classes/ContentManager.class.php
docs/home/ims/ims_import.php
docs/home/ims/index.php [deleted file]
docs/images/archive.gif [new file with mode: 0644]
docs/images/edit.gif [new file with mode: 0644]
docs/include/classes/DAO/ContentTestsAssocDAO.class.php
docs/include/classes/DAO/PrimaryResourcesDAO.class.php
docs/include/classes/DAO/PrimaryResourcesTypesDAO.class.php
docs/include/classes/DAO/SecondaryResourcesDAO.class.php
docs/include/classes/DAO/SecondaryResourcesTypesDAO.class.php
docs/include/classes/DAO/TestsQuestionsAssocDAO.class.php
docs/include/classes/DAO/TestsQuestionsDAO.class.php [new file with mode: 0644]
docs/include/classes/FileUtility.class.php
docs/include/classes/Menu.class.php
docs/include/classes/QTI/QTIImport.class.php
docs/include/classes/Utility.class.php
docs/include/classes/testQuestions.class.php [moved from docs/tests/classes/testQuestions.class.php with 97% similarity]
docs/include/footer.inc.php
docs/include/header.inc.php
docs/include/jscripts/interface.js [new file with mode: 0644]
docs/include/jscripts/transformable.js
docs/include/jscripts/wz_jsgraphics.js [new file with mode: 0644]
docs/include/lib/output.inc.php
docs/include/lib/pclzip_callback.lib.php
docs/include/lib/tinymce.inc.php
docs/include/page_constants.inc.php
docs/include/vitals.inc.php
docs/install/db/Copy of language_text.sql [deleted file]
docs/install/db/db_schema.sql
docs/oauth/authorization.php
docs/oauth/register_consumer.php
docs/tests/add_test_questions.php
docs/tests/add_test_questions_confirm.php
docs/tests/classes/TestsUtility.class.php
docs/tests/create_question_likert.php
docs/tests/create_question_long.php
docs/tests/create_question_matching.php
docs/tests/create_question_matchingdd.php
docs/tests/create_question_multianswer.php
docs/tests/create_question_multichoice.php
docs/tests/create_question_ordering.php
docs/tests/create_question_truefalse.php
docs/tests/dd.php
docs/tests/delete_test.php
docs/tests/edit_question_long.php
docs/tests/edit_question_matching.php
docs/tests/edit_question_multianswer.php
docs/tests/export_test.php
docs/tests/form_editor.php
docs/tests/html/tests_questions.inc.php
docs/tests/import_test.php
docs/tests/index.php
docs/tests/lib/test_question_queries.inc.php [deleted file]
docs/tests/lib/test_result_functions.inc.php [deleted file]
docs/tests/preview.php
docs/tests/preview_question.php
docs/tests/question_db.php
docs/tests/question_import.php
docs/tests/question_remove.php
docs/tests/questions.php
docs/themes/default/home/index_course.tmpl.php
docs/themes/default/include/box.tmpl.php
docs/themes/default/include/fm_footer.tmpl.php [new file with mode: 0644]
docs/themes/default/include/fm_header.tmpl.php [new file with mode: 0644]
docs/themes/default/include/header.tmpl.php
docs/themes/default/language/index.tmpl.php
docs/themes/default/tests/index.tmpl.php
docs/themes/default/tests/question_db_top.tmpl.php
docs/themes/default/tests/questions.tmpl.php [new file with mode: 0644]
docs/themes/default/tests/test_questions/matchingdd.tmpl.php
docs/themes/default/updater/myown_patches.tmpl.php
docs/themes/default/user/user_group_create_edit.tmpl.php
docs/updater/index.php

index fb0f2a8..7c2467a 100644 (file)
@@ -75,7 +75,7 @@ consumer_key=8862a51faa12c1b1&consumer_secret=79d591810c803167&expire=300<br />
 \r
 <span style="font-weight:bold">Fail response</span>\r
 <pre style="background-color:#F7F3ED;"> \r
-error=Empty+parameter+%22consumer%22.<br />\r
+error=Empty+parameter+%22consumer%22<br />\r
 </pre>\r
 <p>A fail response returns error message.</p> \r
 \r
@@ -143,7 +143,7 @@ oauth_token=086cbfe90b41a7fdf9&oauth_token_secret=55e2bd8454b2f75a21<br />
 \r
 <span style="font-weight:bold">Fail response</span>\r
 <pre style="background-color:#F7F3ED;"> \r
-error=Consumer+is+not+registered.<br />\r
+error=Consumer+is+not+registered<br />\r
 </pre>\r
 <p>A fail response returns error message.</p> \r
 \r
@@ -188,7 +188,7 @@ If oauth_callback is not given or empty, the message "User is authenticated succ
 \r
 <span style="font-weight:bold">Fail response</span>\r
 <pre style="background-color:#F7F3ED;"> \r
-error=Empty+oauth+token.<br />\r
+error=Empty+oauth+token<br />\r
 </pre>\r
 <p>A fail response returns error message.</p> \r
 \r
@@ -263,7 +263,7 @@ oauth_token=086cbfe90b41a7fdf9&oauth_token_secret=55e2bd8454b2f75a21<br />
 \r
 <span style="font-weight:bold">Fail response</span>\r
 <pre style="background-color:#F7F3ED;"> \r
-error=Invalid+oauth+request+token.<br />\r
+error=Invalid+oauth+request+token<br />\r
 </pre>\r
 <p>A fail response returns error message.</p> \r
 <p>Note that the access token can be reused during the expire threshold is reached. Expire threshold is defined in the \r
@@ -310,14 +310,14 @@ Refer to <a href="<?php echo TR_BASE_HREF;?>documentation/web_service_api.php">W
 \r
 <span style="font-weight:bold">Fail response</span>\r
 <pre style="background-color:#F7F3ED;"> \r
-error=User+has+no+author+privilege.<br />\r
-error=Empty+OAuth+token.<br />\r
-error=Invalid+OAuth+token.<br />\r
-error=OAuth+token+expired.<br />\r
-error=Invalid+imported+file.<br />\r
-error=Cannot+create+import+directory.<br />\r
-error=IMS+manifest+file+does+not+appear+to+be+valid.<br />\r
-error=Error+at+parsing+IMS+manifest+file.<br />\r
+error=User+has+no+author+privilege<br />\r
+error=Empty+OAuth+token<br />\r
+error=Invalid+OAuth+token<br />\r
+error=OAuth+token+expired<br />\r
+error=Invalid+imported+file<br />\r
+error=Cannot+create+import+directory<br />\r
+error=IMS+manifest+file+does+not+appear+to+be+valid<br />\r
+error=Error+at+parsing+IMS+manifest+file<br />\r
 </pre>\r
 <p>A fail response returns error message. Could be any of the above.</p> \r
 \r
diff --git a/docs/file_manager/delete.php b/docs/file_manager/delete.php
new file mode 100644 (file)
index 0000000..7254ad4
--- /dev/null
@@ -0,0 +1,172 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/PrimaryResourcesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/PrimaryResourcesTypesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/SecondaryResourcesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/SecondaryResourcesTypesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+
+$current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+$popup = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+
+if (isset($_POST['submit_no'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['submit_yes'])) {
+       /* delete files and directories */
+       /* delete the file  */
+       $pathext = $_POST['pathext'];
+       if (isset($_POST['listoffiles']))  {
+               $checkbox = explode(',',$_POST['listoffiles']);
+               $count = count($checkbox);
+               $result=true;
+               for ($i=0; $i<$count; $i++) {
+                       $filename=$checkbox[$i];
+
+                       if (FileUtility::course_realpath($current_path . $pathext . $filename) == FALSE) {
+                               $msg->addError('FILE_NOT_DELETED');
+                               $result=false;
+                               break;
+                       } else if (!(@unlink($current_path.$pathext.$filename))) {
+                               $msg->addError('FILE_NOT_DELETED');
+                               $result=false;
+                               break;
+                       }                       
+               }
+               if ($result)
+               { 
+                       // delete according definition of primary resources and alternatives for adapted content
+                       $filename = '../'.$pathext.$filename;
+                       
+                       // 1. delete secondary resources types
+                       $secondaryResourcesTypesDAO = new SecondaryResourcesTypesDAO();
+                       $secondaryResourcesTypesDAO->DeleteByResourceName($filename);
+                       
+                       // 2. delete secondary resources 
+                       $secondaryResourcesDAO = new SecondaryResourcesDAO();
+                       $secondaryResourcesDAO->DeleteByResourceName($filename);
+                       
+                       // 3. delete primary resources types
+                       $primaryResourcesTypesDAO = new PrimaryResourcesTypesDAO();
+                       $primaryResourcesTypesDAO->DeleteByResourceName($filename);
+                       
+                       // 4. delete primary resources 
+                       $primaryResourcesDAO = new PrimaryResourcesDAO();
+                       $primaryResourcesDAO->DeleteByResourceName($filename);
+                       
+                       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+               }
+       }
+       /* delete directory */
+       if (isset($_POST['listofdirs'])) {
+                               
+               $checkbox = explode(',',$_POST['listofdirs']);
+               $count = count($checkbox);
+               $result=true;
+               for ($i=0; $i<$count; $i++) {
+                       $filename=$checkbox[$i];
+                               
+                       if (strpos($filename, '..') !== false) {
+                               $msg->addError('UNKNOWN');
+                               $result=false;
+                               header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       } else if (!is_dir($current_path.$pathext.$filename)) {
+                               $msg->addError(array('DIR_NOT_DELETED',$filename));
+                               $result=false;
+                               header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       } else if (!($result = clr_dir($current_path.$pathext.$filename))) { 
+                               $msg->addError('DIR_NO_PERMISSION');
+                               $result=false;
+                               header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       } 
+               }
+               if ($result)
+                       $msg->addFeedback('DIR_DELETED');
+       }
+       
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+       require(TR_INCLUDE_PATH.'header.inc.php');
+       // find the files and directories to be deleted 
+       $total_list = explode(',', $_GET['list']);
+       $pathext = $_GET['pathext']; 
+       $popup   = $_GET['popup'];
+       $framed  = $_GET['framed'];
+       $cp = $_GET['cp'];
+       $cid = $_GET['cid'];
+       $pid = $_GET['pid'];
+       $a_type = $_GET['a_type'];
+       
+       $count = count($total_list);
+       $countd = 0;
+       $countf = 0;
+       
+       foreach ($total_list as $list_item) {
+               if (is_dir($current_path.$pathext.$list_item)) {
+                       $_dirs[$countd]  = $list_item;
+                       $countd++;
+               } else {
+                       $_files[$countf] = $list_item;
+                       $countf++;
+               }
+       }
+                               
+       $hidden_vars['pathext'] = $pathext;
+       $hidden_vars['popup']   = $popup;
+       $hidden_vars['framed']  = $framed;
+       $hidden_vars['cp']  = $cp;
+       $hidden_vars['cid']  = $cid;
+       $hidden_vars['pid']  = $pid;
+       $hidden_vars['a_type']  = $a_type;
+       $hidden_vars['_course_id']  = $_course_id;
+       
+       if (isset($_files)) {
+               $list_of_files = implode(',', $_files);
+               $hidden_vars['listoffiles'] = $list_of_files;
+
+               foreach ($_files as $file) {
+                       $file_list_to_print .= '<li>'.$file.'</li>';
+               }
+               $msg->addConfirm(array('FILE_DELETE', $file_list_to_print), $hidden_vars);
+       }
+               
+       if (isset($_dirs)) {
+               $list_of_dirs = implode(',', $_dirs);
+               $hidden_vars['listofdirs'] = $list_of_dirs;
+
+               foreach ($_dirs as $dir) {
+                       $dir_list_to_print .= '<li>'.$dir.'</li>';
+               }
+
+               $msg->addConfirm(array('DIR_DELETE',$dir_list_to_print), $hidden_vars);
+       }
+
+       $msg->printConfirm();
+       
+       require(TR_INCLUDE_PATH.'footer.inc.php');
+?>
\ No newline at end of file
diff --git a/docs/file_manager/edit.php b/docs/file_manager/edit.php
new file mode 100644 (file)
index 0000000..6f41e38
--- /dev/null
@@ -0,0 +1,151 @@
+<?php\r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+\r
+define('TR_INCLUDE_PATH', '../include/');\r
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');\r
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');\r
+\r
+global $_course_id;\r
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);\r
+$editable_file_types = array('txt', 'html', 'htm', 'xml', 'css', 'asc', 'csv', 'sql');\r
+\r
+$current_path = TR_CONTENT_DIR.$_course_id.'/';\r
+\r
+$popup  = $_REQUEST['popup'];\r
+$framed = $_REQUEST['framed'];\r
+$file    = $_REQUEST['file'];\r
+$pathext = $_REQUEST['pathext']; \r
+\r
+if (isset($_POST['cancel'])) {\r
+       $msg->addFeedback('CANCELLED');\r
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);\r
+       exit;\r
+}\r
+\r
+if (isset($_POST['save'])) {\r
+       $content = str_replace("\r\n", "\n", $stripslashes($_POST['body_text']));\r
+       $file = $_POST['file'];\r
+\r
+       if (FileUtility::course_realpath($current_path . $pathext . $file) == FALSE) {\r
+               $msg->addError('FILE_NOT_SAVED');\r
+       } else {\r
+               if (($f = @fopen($current_path.$pathext.$file, 'w')) && (@fwrite($f, $content) !== false) && @fclose($f)) {\r
+                       $msg->addFeedback(array('FILE_SAVED', $file));\r
+                       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);\r
+                       exit;\r
+               } else {\r
+                       $msg->addError('FILE_NOT_SAVED');\r
+               }\r
+       }\r
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);\r
+       exit;\r
+}\r
+\r
+\r
+$path_parts = pathinfo($current_path.$pathext.$file);\r
+$ext = strtolower($path_parts['extension']);\r
+\r
+// open file to edit\r
+$real = realpath($current_path . $pathext . $file);\r
+\r
+if (FileUtility::course_realpath($current_path . $pathext . $file) == FALSE) {\r
+       // error: File does not exist\r
+       $msg->addError('FILE_NOT_EXIST');\r
+       header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);\r
+       exit;\r
+} else if (is_dir($current_path.$pathext.$file)) {\r
+       // error: cannot edit folder\r
+       debug($current_path.$pathext.$file);exit;\r
+       $msg->addError('BAD_FILE_TYPE');\r
+       header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);\r
+       exit;\r
+} else if (!is_readable($current_path.$pathext.$file)) {\r
+       // error: File cannot open file\r
+       $msg->addError(array('CANNOT_OPEN_FILE', $file));\r
+       header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);\r
+       exit;\r
+} else if (in_array($ext, $editable_file_types)) {\r
+       $_POST['body_text'] = file_get_contents($current_path.$pathext.$file);\r
+} else {\r
+       //error: bad file type\r
+       $msg->addError('BAD_FILE_TYPE');\r
+       header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);\r
+       exit;\r
+}\r
+\r
+$onload = "on_load();";\r
+require(TR_INCLUDE_PATH.'header.inc.php');\r
+require(TR_INCLUDE_PATH.'lib/tinymce.inc.php');\r
+\r
+// load tinymce library\r
+load_editor(true, false, "none");\r
+\r
+if (!isset($_POST['extension'])) {\r
+       if ($ext == 'html' || $ext == 'htm')\r
+               $_POST['extension'] = 'html';\r
+       else\r
+               $_POST['extension'] = 'txt';\r
+}\r
+?>\r
+\r
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">\r
+<input type="hidden" name="pathext" value="<?php echo $pathext; ?>" />\r
+<input type="hidden" name="framed" value="<?php echo $framed; ?>" />\r
+<input type="hidden" name="popup" value="<?php echo $popup; ?>" />\r
+<input type="hidden" name="file" value="<?php echo $file; ?>" />\r
+<input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />\r
+<input type="submit" name="submit" style="display:none;"/>\r
+<div class="input-form">\r
+       <div class="row">\r
+               <h3><?php echo $file; ?></h3>\r
+       </div>\r
+       <div class="row">\r
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('type'); ?><br />\r
+               <input type="radio" name="extension" value="txt" id="text" <?php if ($_POST['extension'] == 'txt') { echo 'checked="checked"'; } ?> onclick="trans.editor.switch_content_type(this.value);" />\r
+               <label for="text"><?php echo _AT('plain_text'); ?></label>\r
+\r
+               , <input type="radio" name="extension" value="html" id="html" <?php if ($_POST['extension'] == 'html') { echo 'checked="checked"'; } ?> onclick="trans.editor.switch_content_type(this.value);" />\r
+               <label for="html"><?php echo _AT('html'); ?></label>\r
+       </div>\r
+       <div class="row">\r
+               <label for="body_text"><?php echo _AT('body'); ?></label><br />\r
+               <textarea  name="body_text" id="body_text" rows="25"><?php echo htmlspecialchars($_POST['body_text']); ?></textarea>\r
+       </div>\r
+\r
+       <div class="row buttons">\r
+               <input type="submit" name="save" value="<?php echo _AT('save'); ?>" accesskey="s" />\r
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />\r
+       </div>\r
+</div>\r
+</form>\r
+\r
+<script type="text/javascript" language="javascript">\r
+//<!--\r
+function on_load()\r
+{\r
+       if (jQuery('#html').attr("checked")) { \r
+               tinyMCE.execCommand('mceAddControl', false, 'body_text');\r
+       }\r
+}\r
+\r
+trans.editor.switch_content_type = function (extension) {\r
+  if (extension === 'txt') { //text type\r
+    tinyMCE.execCommand('mceRemoveControl', false, 'body_text');\r
+  }\r
+  else { //html type\r
+    tinyMCE.execCommand('mceAddControl', false, 'body_text');\r
+  }\r
+};\r
+\r
+//-->\r
+</script>\r
+<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/file_manager/filemanager_display.inc.php b/docs/file_manager/filemanager_display.inc.php
new file mode 100644 (file)
index 0000000..40e8592
--- /dev/null
@@ -0,0 +1,592 @@
+<?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.'classes/DAO/CoursesDAO.class.php');
+
+global $_course_id, $MaxCourseSize;
+$editable_file_types = array('txt', 'html', 'htm', 'xml', 'css', 'asc', 'csv', 'sql');
+$_SESSION['prefs']['PREF_CONTENT_EDITOR'] = 1;
+
+$coursesDAO = new CoursesDAO();
+
+function get_file_extension($file_name) {
+       $ext = pathinfo($file_name);
+       return $ext['extension'];
+}
+
+function get_file_type_icon($file_name) {
+       static $mime;
+
+       $ext = get_file_extension($file_name);
+
+       if (!isset($mime)) {
+               require(TR_INCLUDE_PATH .'lib/mime.inc.php');
+       }
+
+       if (isset($mime[$ext]) && $mime[$ext][1]) {
+               return $mime[$ext][1];
+       }
+       return 'generic';
+}
+
+function get_relative_path($src, $dest) {
+       if ($src == '') {
+               $path = $dest;
+       } else if (substr($dest, 0, strlen($src)) == $src) {
+               $path = substr($dest, strlen($src) + 1);
+       } else {
+               $path = '../' . $dest;
+       }
+
+       return $path;
+}
+
+// get the course total in Bytes 
+$course_total = FileUtility::dirsize($current_path);
+
+$framed = intval($_GET['framed']);
+$popup = intval($_GET['popup']);
+$cp = $_GET['cp'];
+$cid = intval($_GET['cid']);        // content id, used at "adapted content" page, => add/edit alternatives
+$pid = intval($_GET['pid']);        // primary resource id, used at "adapted content" page, => add/edit alternatives
+$a_type = intval($_GET['a_type']);  // alternative_type, used at "adapted content" page, => add/edit alternatives
+
+if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
+       $get_file = 'get.php/';
+} else {
+       $get_file = 'content/' . $_course_id . '/';
+}
+
+function fm_path(){
+       global $pathext, $framed, $popup, $cp, $cid, $pid, $a_type, $_course_id;
+echo '<p>'._AT('current_path').' ';
+
+if (isset($pathext) && $pathext != '') {
+       echo '<a href="'.$_SERVER['PHP_SELF'].'?popup=' . $popup . SEP . 'framed=' . $framed.SEP . 'cp=' . $cp.SEP . 'cid=' . $cid.SEP . 'pid=' . $pid.SEP . 'a_type=' . $a_type.SEP.'_course_id='.$_course_id.'">'._AT('home').'</a> ';
+}
+else {
+       $pathext = '';
+       echo _AT('home');
+}
+
+
+if ($pathext == '' && isset($_POST['pathext'])) {
+
+       $pathext = urlencode($_POST['pathext']);
+}
+
+if ($pathext != '') {
+       $bits = explode('/', $pathext);
+
+       foreach ($bits as $bit) {
+               if ($bit != '') {
+                       $bit_path .= $bit . '/';
+                       echo ' / ';
+
+                       if ($bit_path == $pathext) {
+                               echo $bit;
+                       } else {
+                               echo '<a href="'.$_SERVER['PHP_SELF'].'?pathext=' . urlencode($bit_path) . SEP . 'popup=' . $popup . SEP . 'framed=' . $framed . SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type.SEP.'_course_id='.$_course_id.'">' . $bit . '</a>';
+                       }
+               }
+       }
+       $bit_path = "";
+       $bit = "";
+}
+echo '</p>';
+
+}
+
+if ($popup == TRUE) {
+       $totalcol = 6;
+} else {
+       $totalcol = 5;
+}
+$labelcol = 3;
+
+if (TRUE || $framed != TRUE) {
+
+       if ($_GET['overwrite'] != '') {
+               // get file name, out of the full path
+               $path_parts = pathinfo($current_path.$_GET['overwrite']);
+
+               if (!file_exists($path_parts['dirname'].'/'.$pathext.$path_parts['basename'])
+                       || !file_exists($path_parts['dirname'].'/'.$pathext.substr($path_parts['basename'], 5))) {
+                       /* source and/or destination does not exist */
+                       $msg->addErrors('CANNOT_OVERWRITE_FILE');
+               } else {
+                       @unlink($path_parts['dirname'].'/'.$pathext.substr($path_parts['basename'], 5));
+                       $result = @rename($path_parts['dirname'].'/'.$pathext.$path_parts['basename'], $path_parts['dirname'].'/'.$pathext.substr($path_parts['basename'], 5));
+
+                       if ($result) {
+                               $msg->addFeedback('FILE_OVERWRITE');
+                       } else {
+                               $msg->addErrors('CANNOT_OVERWRITE_FILE');
+                       }
+               }
+       }
+       
+       // filemanager listing table
+       // make new directory 
+       echo '<div class="input-form"><fieldset class="group_form"><legend class="group_form">'._AT('add_file_folder').'</legend>'."\n";
+       echo '  <div class="row">'."\n";
+       echo '          <form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'?'.(($pathext != '') ? 'pathext='.urlencode($pathext).SEP : ''). 'popup='.$popup.SEP.'cp='.SEP.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type.SEP.'_course_id='.$_course_id.'">'."\n";
+       if( $MakeDirOn ) {
+               if ($depth < $MaxDirDepth) {
+                       echo '          <label for="dirname">'._AT('create_folder_here').'</label><br />'."\n";
+                       echo '          &nbsp;<small class="spacer">'._AT('keep_it_short').'</small><br />'."\n";
+                       echo '          <input type="text" name="dirname" id="dirname" size="20" /> '."\n";
+                       echo '          <input type="hidden" name="mkdir_value" value="true" /> '."\n";
+                       echo '          <input type="hidden" name="_course_id" value="'.$_course_id.'" /> '."\n";
+                       echo '          <input type="submit" name="mkdir" value="'._AT('create_folder').'" class="button" />'."\n";
+               } else {
+                       echo _AT('depth_reached')."\n";
+               }
+       }
+       echo '          <input type="hidden" name="pathext" value="'.$pathext.'" />'."\n";
+       echo '          </form>'."\n";
+       echo '  </div>'."\n";
+
+       echo '  <div class="row"><hr /></div>'."\n";
+
+
+       // If flash is available, provide the option of using Fluid's uploader or the basic uploader
+       if (isset($_SESSION['flash']) && $_SESSION['flash'] == "yes") {
+               echo '<div class="row">'."\n";
+               if (isset($_COOKIE["fluid_on"]) && $_COOKIE["fluid_on"]=="yes")
+                       $fluid_on = 'checked="checked"';
+               echo '(<input type="checkbox" id="fluid_on" name="fluid_on" onclick="toggleform(\'simple-container\', \'fluid-container\'); setCheckboxCookie(this, \'fluid_on=yes\', \'fluid_on=no\',\'December 31, 2099\');" value="yes" '.$fluid_on.' /> '."\n";
+               echo '<label for="fluid_on" >'._AT('enable_uploader').'</label>)'."\n";
+               echo '</div>'."\n";
+       }
+
+
+       // Create a new file
+       echo '  <div class="row" style="float: left;"><input type="button" class="button" name="new_file" value="' . _AT('file_manager_new') . '" onclick="window.location.href=\''.TR_BASE_HREF.'file_manager/new.php?pathext=' . urlencode($pathext) . SEP . 'framed=' . $framed . SEP . 'popup=' . $popup . SEP.'_course_id='.$_course_id. '\'"/></div>'."\n";
+
+       $course_row = $coursesDAO->get($_course_id);
+       if ($course_row['max_quota'] == '' || is_null($course_row['max_quota']))
+               $my_MaxCourseSize = $MaxCourseSize;
+
+       // upload file 
+       if ($course_row['max_quota'] == TR_COURSESIZE_UNLIMITED || $my_MaxCourseSize-$course_total > 0) {
+               echo '  <div class="row" style="float: left;">'._AT('OR').'</div>'."\n".'       <div class="row" style="float: left;">'."\n";
+               if (isset($_SESSION['flash']) && $_SESSION['flash'] == "yes") {
+               ?>
+                       <div id="fluid-container" <?php echo (isset($_COOKIE["fluid_on"]) && $_COOKIE["fluid_on"]=="yes") ? '' : 'style="display:none;"'; ?>>
+                               <input type="button" id="uploader_link" class="button" name="upload_file" value="<?php echo _AT('upload_files'); ?>" onclick="toggleform('uploader', 'uploader_link');" />
+                               <div id="uploader" style="display: none;">
+                                       <form id="flc-uploader" class="flc-uploader fl-uploader fl-progEnhance-enhanced" method="get" enctype="multipart/form-data" action="" style="margin: 0px; padding: 0px;">
+                                               <div class="start">
+                                                       <div class="fl-uploader-queue-wrapper">
+                                                               <div class="fl-uploader-queue-header">
+                                                                       <table cellspacing="0" cellpadding="0">
+                                                                                       <tr>
+                                                                                               <th scope="col" class="fileName"><?php echo _AT('file_name'); ?></th>
+                                                                                               <th scope="col" class="fileSize"><?php echo _AT('size'); ?>&nbsp;&nbsp;</th>
+                                                                                               <th scope="col" class="fileRemove">&nbsp;</th>
+                                                                                       </tr>
+                                                                       </table>
+                                                               </div>
+
+                                      <div class="flc-scroller fl-scroller">
+                                               <div class="fl-scroller-inner">
+                                                   <table cellspacing="0" class="flc-uploader-queue fl-uploader-queue" summary="Queue of files to upload.">
+                                                       <tbody>
+                                                           <!-- Rows will be rendered in here. -->
+                                                           
+                                                           <!-- Template markup for the file queue rows -->
+                                                           <tr class="flc-uploader-file-tmplt flc-uploader-file fl-uploader-hidden-templates">
+                                                               <th class="flc-uploader-file-name fl-uploader-file-name" scope="row"><?php echo _AT('file_placeholder'); ?></th>
+                                                               <td class="flc-uploader-file-size fl-uploader-file-size">0 <?php echo _AT('kb'); ?></td>
+                                                               <td class="fl-uploader-file-actions">
+                                                                   <button type="button" class="flc-uploader-file-action fl-uploader-file-action" title="<?php echo _AT('remove_queued_file'); ?>" tabindex="-1">
+                                                                       <span class="fl-uploader-button-text fl-uploader-hidden"><?php echo _AT('remove_queued_file'); ?></span>
+                                                                   </button>
+                                                               </td>
+                                                           </tr>
+                                                           
+                                                           <!-- Template for the file error info rows -->
+                                                           <tr class="flc-uploader-file-error-tmplt fl-uploader-file-error fl-uploader-hidden-templates">
+                                                               <td colspan="3" class="flc-uploader-file-error"></td>
+                                                           </tr>
+                                                       </tbody>
+                                                   </table>
+                                                   <div class="flc-uploader-file-progressor-tmplt fl-uploader-file-progress"><span class="fl-uploader-file-progress-text fl-uploader-hidden">76%</span></div>
+                                               </div>
+                                           </div>
+
+                                                               <div class="flc-uploader-browse-instructions fl-uploader-browse-instructions"> <?php echo _AT('click_browse_files'); ?> </div>
+
+                                                               <div class="flc-uploader-queue-footer fl-uploader-queue-footer">
+                                                                       <table cellspacing="0" cellpadding="0">
+                                                                                       <tr>
+                                                                                               <td class="flc-uploader-total-progress-text"><?php echo _AT('total'); ?>: <span class="fluid-uploader-totalFiles">0</span> <?php echo _AT('files'); ?> (<span class="fluid-uploader-totalBytes">0 <?php echo _AT('kb'); ?></span>)</td>
+                                                                                               <td class="fl-uploader-footer-buttons" align="right" ><a class="flc-uploader-button-browse fl-uploader-browse" tabindex="0" ><?php echo _AT('browse_files'); ?></a></td>
+                                                                                       </tr>
+                                                                       </table>
+                                                                       <div class="flc-uploader-total-progress fl-uploader-total-progress-okay">&nbsp;</div>
+                                                               </div>
+                                                       </div>
+                                                       
+                                                       <div class="fl-uploader-btns">
+                                                               <button type="button" class="flc-uploader-button-pause fl-uploader-pause fl-uploader-hidden" onclick="toggleform('uploader', 'uploader_link');"><?php echo _AT('cancel'); ?></button>
+                                                               <button type="button" class="flc-uploader-button-upload fl-uploader-upload fl-uploader-button-default fl-uploader-dim" ><?php echo _AT('upload'); ?></button>
+                                                       </div>
+                                                       
+                                               </div>
+                                       </form>
+
+                               </div>
+                       </div>
+               <?php
+                       if (isset($_COOKIE["fluid_on"]) && $_COOKIE["fluid_on"]=="yes")
+                               echo '<div id="simple-container" style="display: none;">';
+                       else
+                               echo '<div id="simple-container">';
+               } else {
+                       // Display as regular if there's no Flash detected
+                       echo '<div id="simple-container">'."\n";
+               }
+
+               // Simple single file uploader
+               echo '<form onsubmit="openWindow(\''.TR_BASE_HREF.'home/prog.php\');" class="fl-ProgEnhance-basic" name="form1" method="post" action="file_manager/upload.php?popup='.$popup.SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type.SEP.'_course_id='.$_course_id.'" enctype="multipart/form-data">';
+               echo '<input type="hidden" name="MAX_FILE_SIZE" value="'.$my_MaxFileSize.'" />';
+               echo '<label for="uploadedfile">'._AT('upload_files').'</label>'."\n";
+               echo '<input type="file" name="uploadedfile" id="uploadedfile" class="formfield" size="20" /> ';
+               echo '<input type="submit" name="submit" value="'._AT('upload').'" class="button" />';
+               echo '<input type="hidden" name="pathext" value="'.$pathext.'" />  ';
+
+               if ($popup == TRUE) {
+                       echo '<input type="hidden" name="popup" value="1" />';
+               }
+               echo '</form>';
+               echo '</div>';
+
+               echo '          </div>'."\n".'  </fieldset></div>';
+
+       } else {
+               echo '  </fieldset></div>'."\n";
+               $msg->printInfos('OVER_QUOTA');
+       }
+       echo '<br />';
+}
+
+// Directory and File listing 
+echo '<form name="checkform" action="'.$_SERVER['PHP_SELF'].'?'.(($pathext!='') ? 'pathext='.urlencode($pathext).SEP : '').'popup='.$popup .SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type.'" method="post">';
+echo '<input type="hidden" name="pathext" value ="'.$pathext.'" />';
+echo '<input type="hidden" name="_course_id" value ="'.$_course_id.'" />';
+?>
+<table class="data static" summary="" border="0" rules="groups" style="width: 90%">
+<thead>
+<tr>
+<td colspan="5">
+<?php fm_path(); ?>
+</td>
+</tr>
+<tr>
+       <th scope="col"><input type="checkbox" name="checkall" onclick="Checkall(checkform);" id="selectall" title="<?php echo _AT('select_all'); ?>" /></th>
+       <th>&nbsp;</th>
+       <th scope="col"><?php echo _AT('name');   ?></th>
+       <th scope="col"><?php echo _AT('date');   ?></th>
+       <th scope="col"><?php echo _AT('size');   ?></th>
+</tr>
+</thead>
+<tfoot>
+<tr>
+       <td colspan="5"><input type="submit" name="rename" value="<?php echo _AT('rename'); ?>" /> 
+               <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /> 
+               <input type="submit" name="move"   value="<?php echo _AT('move'); ?>" /></td>
+</tr>
+
+<tr>
+       <td colspan="4" align="right"><strong><?php echo _AT('directory_total'); ?>:</strong></td>
+       <td align="right">&nbsp;<strong><?php echo FileUtility::get_human_size(FileUtility::dirsize($current_path.$pathext.$file.'/')); ?></strong>&nbsp;</td>
+</tr>
+
+<tr>
+       <td colspan="4" align="right"><strong><?php echo _AT('course_total'); ?>:</strong></td>
+       <td align="right">&nbsp;<strong><?php echo FileUtility::get_human_size($course_total); ?></strong>&nbsp;</td>
+</tr>
+<tr>
+       <td colspan="4" align="right"><strong><?php echo _AT('course_available'); ?>:</strong></td>
+       <td align="right"><strong><?php
+               if ($my_MaxCourseSize == TR_COURSESIZE_UNLIMITED) {
+                       echo _AT('unlimited');
+               } else if ($my_MaxCourseSize == TR_COURSESIZE_DEFAULT) {
+                       echo FileUtility::get_human_size($MaxCourseSize-$course_total);
+               } else {
+                       echo FileUtility::get_human_size($my_MaxCourseSize-$course_total);
+               } ?></strong>&nbsp;</td>
+</tr>
+</tfoot>
+<?php
+
+
+if($pathext) : ?>
+       <tr>
+               <td colspan="5"><a href="<?php echo $_SERVER['PHP_SELF'].'?back=1'.SEP.'pathext='.$pathext.SEP. 'popup=' . $popup .SEP. 'framed=' . $framed .SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type; ?>"><img src="images/arrowicon.gif" border="0" height="11" width="10" alt="" /> <?php echo _AT('back'); ?></a></td>
+       </tr>
+<?php endif; ?>
+<?php
+$totalBytes = 0;
+
+if ($dir == '')
+       $dir=opendir($current_path);
+       
+// loop through folder to get files and directory listing
+while (false !== ($file = readdir($dir)) ) {
+
+       // if the name is not a directory 
+       if( ($file == '.') || ($file == '..') ) {
+               continue;
+       }
+
+       // get some info about the file
+       $filedata = stat($current_path.$pathext.$file);
+       $path_parts = pathinfo($file);
+       $ext = strtolower($path_parts['extension']);
+
+       $is_dir = false;
+
+       // if it is a directory change the file name to a directory link 
+       if(is_dir($current_path.$pathext.$file)) {
+               $size = FileUtility::dirsize($current_path.$pathext.$file.'/');
+               $totalBytes += $size;
+               $filename = '<a href="'.$_SERVER['PHP_SELF'].'?pathext='.urlencode($pathext.$file.'/'). SEP . 'popup=' . $popup . SEP . 'framed='. $framed . SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$cid.SEP.'a_type='.$a_type.SEP.'_course_id='.$_course_id.'">'.$file.'</a>';
+               $fileicon = '&nbsp;';
+               $fileicon .= '<img src="images/folder.gif" alt="'._AT('folder').':'.$file.'" height="18" width="20" class="img-size-fm1" />';
+               $fileicon .= '&nbsp;';
+               if(!$MakeDirOn) {
+                       $deletelink = '';
+               }
+
+               $is_dir = true;
+       } else if ($ext == 'zip') {
+
+               $totalBytes += $filedata[7];
+               $filename = $file;
+               $fileicon = '&nbsp;<img src="images/icon-zip.gif" alt="'._AT('zip_archive').':'.$file.'" height="16" width="16" border="0" class="img-size-fm2" />&nbsp;';
+
+       } else {
+               $totalBytes += $filedata[7];
+               $filename = $file;
+               $fileicon = '&nbsp;<img src="images/file_types/'.get_file_type_icon($filename).'.gif" height="16" width="16" alt="" title="" class="img-size-fm2" />&nbsp;';
+       } 
+       $file1 = strtolower($file);
+       // create listing for dirctor or file
+       if ($is_dir) {
+               
+               $dirs[$file1] .= '<tr><td  align="center" width="0%">';
+               $dirs[$file1] .= '<input type="checkbox" id="'.$file.'" value="'.$file.'" name="check[]"/></td>';
+               $dirs[$file1] .= '<td  align="center"><label for="'.$file.'" >'.$fileicon.'</label></td>';
+               $dirs[$file1] .= '<td >&nbsp;';
+               $dirs[$file1] .= $filename.'</td>';
+               $dirs[$file1] .= '<td  align="right">&nbsp;';
+               $dirs[$file1] .= AT_date(_AT('filemanager_date_format'), $filedata[10], TR_DATE_UNIX_TIMESTAMP);
+               $dirs[$file1] .= '&nbsp;</td>';
+               $dirs[$file1] .= '<td  align="right">';
+               $dirs[$file1] .= FileUtility::get_human_size($size).'</td></tr>';
+
+               
+       } else {
+               $files[$file1] .= '<tr> <td  align="center">';
+               $files[$file1] .= '<input type="checkbox" id="'.$file.'" value="'.$file.'" name="check[]"/> </td>';
+               $files[$file1] .= '<td  align="center"><label for="'.$file.'">'.$fileicon.'</label></td>';
+               $files[$file1] .= '<td >&nbsp;';
+
+               if ($framed) {
+                       $files[$file1] .= '<a href="'.$get_file.$pathext.urlencode($filename).'">'.$filename.'</a>';
+               } else {
+                       $files[$file1] .= '<a href="file_manager/preview.php?file='.$pathext.$filename.SEP.'pathext='.urlencode($pathext).SEP.'popup='.$popup.SEP.'_course_id='.$_course_id.'">'.$filename.'</a>';
+               }
+
+               if ($ext == 'zip') {
+                       $files[$file1] .= ' <a href="file_manager/zip.php?'.(($pathext!='') ? 'pathext='.urlencode($pathext).SEP : ''). 'file=' . urlencode($file) . SEP . 'popup=' . $popup . SEP . 'framed=' . $framed .SEP.'_course_id='.$_course_id.'">';
+                       $files[$file1] .= '<img src="images/archive.gif" border="0" alt="'._AT('extract_archive').'" title="'._AT('extract_archive').'"height="16" width="11" class="img-size-fm3" />';
+                       $files[$file1] .= '</a>';
+               }
+
+               if (in_array($ext, $editable_file_types)) {
+                       $files[$file1] .= ' <a href="file_manager/edit.php?'.(($pathext!='') ? 'pathext='.urlencode($pathext).SEP : ''). 'popup=' . $popup . SEP . 'framed=' . $framed . SEP.'_course_id='.$_course_id. SEP . 'file=' . urlencode($file) . '">';
+                       $files[$file1] .= '<img src="images/edit.gif" border="0" alt="'._AT('edit').'" title="'._AT('edit').'" height="15" width="18" class="img-size-fm4" />';
+                       $files[$file1] .= '</a>';
+               }
+
+               $files[$file1] .= '&nbsp;</td>';
+
+               $files[$file1] .= '<td  align="right" style="white-space:nowrap">';
+
+               if ($popup == TRUE) {
+                       if ($a_type > 0)  // define content alternative
+                       {
+                               $files[$file1] .= '<input class="button" type="button" name="alternative" value="' ._AT('use_as_alternative') . '" onclick="javascript: setAlternative(\''.get_relative_path($_GET['cp'], $pathext).$file.'\', \''.TR_BASE_HREF.$get_file.$pathext.urlencode($file).'\', \''.$cid.'\', \''.$pid.'\', \''.$a_type.'\');" />&nbsp;';
+                       }
+                       else
+                               $files[$file1] .= '<input class="button" type="button" name="insert" value="' ._AT('insert') . '" onclick="javascript:insertFile(\'' . $file . '\', \'' . get_relative_path($_GET['cp'], $pathext) . '\', \'' . $ext . '\', \'' .$_SESSION['prefs']['PREF_CONTENT_EDITOR']. '\');" />&nbsp;';
+               }
+
+               $files[$file1] .= AT_date(_AT('filemanager_date_format'), $filedata[10], TR_DATE_UNIX_TIMESTAMP);
+               $files[$file1] .= '&nbsp;</td>';
+               
+               $files[$file1] .= '<td  align="right" style="white-space:nowrap">';
+               $files[$file1] .= FileUtility::get_human_size($filedata[7]).'</td></tr>';
+       }
+} // end while
+
+// sort listing and output directories
+if (is_array($dirs)) {
+       ksort($dirs, SORT_STRING);
+       foreach($dirs as $x => $y) {
+               echo $y;
+       }
+}
+
+//sort listing and output files
+if (is_array($files)) {
+       ksort($files, SORT_STRING);
+       foreach($files as $x => $y) {
+               echo $y;
+       }
+}
+
+echo '</table></form>';
+?>
+
+<script type="text/javascript">
+//<!--
+function insertFile(fileName, pathTo, ext, ed_pref) { 
+       // pathTo + fileName should be relative to current path (specified by the Content Package Path)
+       if (ext == "gif" || ext == "jpg" || ext == "jpeg" || ext == "png") {
+               var info = "<?php echo _AT('alternate_text'); ?>";
+               var html = '<img src="' + pathTo+fileName + '" border="0" alt="' + info + '" />';
+       } else if (ext == "mpg" || ext == "avi" || ext == "wmv" || ext == "mov" || ext == "swf" || ext == "mp3" || ext == "wav" || ext == "ogg" || ext == "mid") {
+               var html = '[media]'+ pathTo + fileName + '[/media]';
+       } else {
+               var info = "<?php echo _AT('put_link'); ?>";
+               var html = '<a href="' + pathTo+fileName + '">' + info + '</a>';
+       }
+       insertLink(html, ed_pref);
+}
+
+function insertLink(html, ed_pref)
+{
+    if (window.opener) {
+        var isNotVisual = window.opener.document.form.html.checked && (ed_pref === '1');
+    }
+
+       if (!window.opener || !isNotVisual) {
+               if (!window.opener && window.parent.tinyMCE)
+                       window.parent.tinyMCE.execCommand('mceInsertContent', false, html);
+               else
+                       if (window.opener && window.opener.tinyMCE)
+                               window.opener.tinyMCE.execCommand('mceInsertContent', false, html);
+       } else {
+                       insertAtCursor(window.opener.document.form.body_text, html);
+       }
+}
+
+function insertAtCursor(myField, myValue) {
+       //IE support
+       if (window.opener.document.selection) {
+               myField.focus();
+               sel = window.opener.document.selection.createRange();
+               sel.text = myValue;
+       }
+       //MOZILLA/NETSCAPE support
+       else if (myField.selectionStart || myField.selectionStart == '0') {
+               var startPos = myField.selectionStart;
+               var endPos = myField.selectionEnd;
+               myField.value = myField.value.substring(0, startPos)
+               + myValue
+               + myField.value.substring(endPos, myField.value.length);
+               myField.focus();
+       } else {
+               myField.value += myValue;
+               myField.focus();
+       }
+}
+
+// This function does:
+// 1. save into db via ajax
+// 2. set the according field in opener window to the selected file
+// 3. close file manager itself
+function setAlternative(file, file_preview_link, cid, pid, a_type) {
+       jQuery.post("<?php echo TR_BASE_HREF; ?>home/course/save_alternative.php", 
+                       {"pid":pid, "a_type":a_type, "alternative":file, "course_id":$_course_id}, 
+                       function(data) {});
+
+       link_html = '\
+      <a href="'+file_preview_link+'" title="<?php echo _AT('new_window'); ?>" target="_new">'+file+'</a><br /> \
+      <a href="#" onclick="trans.utility.poptastic(\\\'<?php echo TR_BASE_HREF; ?>file_manager/index.php?framed=1<?php echo SEP; ?>popup=1<?php echo SEP; ?>cp=<?php echo $cp.SEP; ?>cid='+cid+'<?php echo SEP; ?>pid='+pid+'<?php echo SEP; ?>a_type='+a_type+'<?php echo SEP; ?>_course_id=<?php echo $_course_id; ?>\\\');return false;" title="<?php echo _AT('new_window'); ?>"> \
+        <img src="<?php echo TR_BASE_HREF; ?>images/home-tests_sm.png" border="0" title="<?php echo _AT('alter'); ?>" alt="<?php echo _AT('alter'); ?>" /> \
+      </a> \
+      <a href="#" onclick="removeAlternative(\\\'<?php echo $cp; ?>\\\', '+cid+','+pid+','+a_type+');return false;"> \
+        <img src="<?php echo TR_BASE_HREF; ?>images/icon_delete.gif" border="0" title="<?php echo _AT('remove'); ?>" alt="<?php echo _AT('remove'); ?>" /> \
+      </a> \
+    </div> \
+';
+       eval("window.opener.document.getElementById(\""+pid+"_"+a_type+"\").innerHTML = '"+link_html+"'");
+       
+       window.close();
+}
+
+<?php  if (isset($_SESSION['flash']) && $_SESSION['flash'] == "yes") { ?>
+// toggle the view between div object and button
+function toggleform(id, link) {
+       var obj = document.getElementById(id);
+       var btn = document.getElementById(link);
+
+       if (obj.style.display == "none") {
+               //show
+               obj.style.display='';
+               obj.focus();
+
+               btn.style.display = 'none';
+
+
+       } else {
+               //hide
+               obj.style.display='none';
+               btn.style.display = '';
+       }
+}
+
+// set a cookie
+function setCheckboxCookie(obj, value1, value2, date)
+{
+       var today = new Date();
+       var the_date = new Date(date);
+       var the_cookie_date = the_date.toGMTString();
+       if (obj.checked==true)
+               var the_cookie = value1 + ";expires=" + the_cookie_date;
+       else
+               var the_cookie = value2 + ";expires=" + the_cookie_date;
+       document.cookie = the_cookie;
+}
+<?php } ?>
+
+<?php 
+// When uploading a file as an alternative content, set the alternative field in the opener window 
+// and close "file manager" once the upload is successful
+if ($a_type > 0 && isset($_GET['uploadfile']) && $_GET['uploadfile'] <> '') { ?>
+function setAlternativeAndClose() {
+       setAlternative('<?php echo get_relative_path($_GET['cp'], $pathext).$_GET['uploadfile']; ?>', '<?php echo TR_BASE_HREF.$get_file.$pathext.urlencode($_GET['uploadfile']); ?>', '<?php echo $cid; ?>', '<?php echo $pid; ?>', '<?php echo $a_type; ?>');
+       window.close();
+}
+
+window.onload=setAlternativeAndClose;
+<?php } ?>
+
+//-->
+</script>
\ No newline at end of file
diff --git a/docs/file_manager/index.php b/docs/file_manager/index.php
new file mode 100644 (file)
index 0000000..79c44c4
--- /dev/null
@@ -0,0 +1,123 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+if ((isset($_REQUEST['popup']) && $_REQUEST['popup']) && 
+       (!isset($_REQUEST['framed']) || !$_REQUEST['framed'])) {
+       $popup = TRUE;
+       $framed = FALSE;
+} else if (isset($_REQUEST['framed']) && $_REQUEST['framed'] && isset($_REQUEST['popup']) && $_REQUEST['popup']) {
+       $popup = TRUE;
+       $framed = TRUE;
+} else {
+       $popup = FALSE;
+       $framed = FALSE;
+}
+
+// If Flash is detected, call the necessary css and js, and configure settings to use the Fluid Uploader
+if (isset($_SESSION['flash']) && $_SESSION['flash'] == "yes") {
+    /* Provide the option of switching between Fluid Uploader and simple single file uploader
+       and save the user preference as a cookie */
+    if (!isset($_COOKIE["fluid_on"]))
+        trans.utility.setcookie("fluid_on", "yes", time()+1200); 
+
+    $fluid_dir = 'jscripts/infusion/';
+    $framed = intval($_GET['framed']);
+    $popup = intval($_GET['popup']);
+    $current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+    if ($_GET['pathext'] != '') {
+        $pathext = urldecode($_GET['pathext']);
+    } else if ($_POST['pathext'] != '') {
+        $pathext = $_POST['pathext'];
+    }
+
+    if($_GET['back'] == 1) {
+        $pathext  = substr($pathext, 0, -1);
+        $slashpos = strrpos($pathext, '/');
+        if($slashpos == 0) {
+            $pathext = '';
+        } else {
+            $pathext = substr($pathext, 0, ($slashpos+1));
+        }
+
+    }
+
+    $_custom_head .= '
+        <link href="'.$fluid_dir.'components/uploader/css/Uploader.css" rel="stylesheet" type="text/css" />
+        <script src="'.$fluid_dir.'InfusionAll.js" type="text/javascript"></script>
+        <script language="JavaScript" type="text/javascript">
+
+            var myUpload; // mostly used for testing
+
+            jQuery(document).ready(function () {
+                   myUpload = fluid.progressiveEnhanceableUploader(".flc-uploader", ".fl-ProgEnhance-basic", {
+                       uploadManager: {
+                                   type: "fluid.swfUploadManager",
+               
+                                   options: {
+                                      // Set the uploadURL to the URL for posting files to your server.
+                                      uploadURL: "'.$_base_href.'include/lib/upload.php?path='.urlencode($current_path.$pathext).'",
+               
+                                      // This option points to the location of the SWFUpload Flash object that ships with Fluid Infusion.
+                                      flashURL: "jscripts/infusion/lib/swfupload/flash/swfupload.swf"
+                                       }
+                               },
+               
+                       listeners: {
+                       onFileSuccess: function (file, serverData){
+                               // example assumes that the server code passes the new image URL in the serverData
+                               window.location="'.$_SERVER['PHP_SELF'].'?pathext=' . urlencode($pathext) . SEP . 'popup=' . $popup . SEP . 'framed=' . $framed . SEP . 'msg=FILEUPLOAD_DONE'.SEP.'_course_id='.$_course_id.'";
+                       }
+                   },
+               
+                 decorators: [{
+                    type: "fluid.swfUploadSetupDecorator",
+                    options: {
+                         // This option points to the location of the Browse Files button used with Flash 10 clients.
+                         flashButtonImageURL: "'.TR_BASE_HREF.'jscripts/infusion/components/uploader/images/browse.png"
+                                       }
+                 }]
+                    });
+               });
+        </script>
+    ';
+}
+
+global $msg;
+if (isset($_GET['msg'])) $msg->addFeedback($_GET['msg']);
+
+require('top.php');
+$_SESSION['done'] = 1;
+
+require(TR_INCLUDE_PATH.'../file_manager/filemanager_display.inc.php');
+
+closedir($dir);
+
+?>
+<script type="text/javascript">
+//<!--
+function Checkall(form){ 
+  for (var i = 0; i < form.elements.length; i++){    
+    eval("form.elements[" + i + "].checked = form.checkall.checked");  
+  } 
+}
+function openWindow(page) {
+       newWindow = window.open(page, "progWin", "width=400,height=200,toolbar=no,location=no");
+       newWindow.focus();
+}
+//-->
+</script>
+<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/file_manager/move.php b/docs/file_manager/move.php
new file mode 100644 (file)
index 0000000..da848d8
--- /dev/null
@@ -0,0 +1,206 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require(TR_INCLUDE_PATH.'vitals.inc.php');
+require(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+
+$current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+$popup = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+
+if (isset($_POST['submit_no'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_REQUEST['framed'].SEP.'popup='.$_REQUEST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['submit_yes'])) {
+       $dest = $_POST['dest'] .'/';
+       $pathext = $_POST['pathext'];
+
+       if (isset($_POST['listofdirs'])) {
+
+               $_dirs = explode(',',$_POST['listofdirs']);
+               $count = count($_dirs);
+               
+               for ($i = 0; $i < $count; $i++) {
+                       $source = $_dirs[$i];
+                       
+                       if (FileUtility::course_realpath($current_path . $pathext . $source) == FALSE) {
+                               // error: File does not exist
+                               $msg->addError('DIR_NOT_EXIST');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+                       else if (FileUtility::course_realpath($current_path . $dest) == FALSE) {
+                               // error: File does not exist
+                               $msg->addError('UNKNOWN');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+                       else if (strpos($source, '..') !== false) {
+                               $msg->addError('UNKNOWN');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }       
+                       else {
+                               @rename($current_path.$pathext.$source, $current_path.$dest.$source);
+                       }
+               }
+               $msg->addFeedback('DIRS_MOVED');
+       }
+       if (isset($_POST['listoffiles'])) {
+
+               $_files = explode(',',$_POST['listoffiles']);
+               $count = count($_files);
+
+               for ($i = 0; $i < $count; $i++) {
+                       $source = $_files[$i];
+                       
+                       if (FileUtility::course_realpath($current_path . $pathext . $source) == FALSE) {
+                               // error: File does not exist
+                               $msg->addError('FILE_NOT_EXIST');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+                       else if (FileUtility::course_realpath($current_path . $dest) == FALSE) {
+                               // error: File does not exist
+                               $msg->addError('UNKNOWN');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+                       else if (strpos($source, '..') !== false) {
+                               $msg->addError('UNKNOWN');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       }       
+                       else {
+                               @rename($current_path.$pathext.$source, $current_path.$dest.$source);
+                       }
+               }
+               $msg->addFeedback('MOVED_FILES');
+       }
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['dir_chosen'])) {
+       $hidden_vars['framed'] = $_REQUEST['framed'];
+       $hidden_vars['popup'] = $_REQUEST['popup'];
+       $hidden_vars['pathext'] = $_REQUEST['pathext'];
+       $hidden_vars['dest'] = $_REQUEST['dir_name'];
+       $hidden_vars['cp'] = $_REQUEST['cp'];
+       $hidden_vars['cid'] = $_REQUEST['cid'];
+       $hidden_vars['pid'] = $_REQUEST['pid'];
+       $hidden_vars['a_type'] = $_REQUEST['a_type'];
+       $hidden_vars['_course_id'] = $_course_id;
+       
+       if (isset($_POST['files'])) {
+               $list_of_files = implode(',', $_POST['files']);
+               $hidden_vars['listoffiles'] = $list_of_files;
+               $msg->addConfirm(array('FILE_MOVE', $list_of_files, $_POST['dir_name']), $hidden_vars);
+       }
+       if (isset($_POST['dirs'])) {
+               $list_of_dirs = implode(',', $_POST['dirs']);
+               $hidden_vars['listoffiles'] = $list_of_dirs;
+               $msg->addConfirm(array('DIR_MOVE', $list_of_dirs, $_POST['dir_name']), $hidden_vars);
+       }
+       require(TR_INCLUDE_PATH.'header.inc.php');
+       $msg->printConfirm();
+       require(TR_INCLUDE_PATH.'footer.inc.php');
+} 
+else {
+       require(TR_INCLUDE_PATH.'header.inc.php');
+       
+       $tree = TR_CONTENT_DIR.$_course_id.'/';
+       $file    = $_GET['file'];
+       $pathext = $_GET['pathext']; 
+       $popup   = $_GET['popup'];
+       $framed  = $_GET['framed'];
+       $cp  = $_GET['cp'];
+       $cid  = $_GET['cid'];
+       $pid  = $_GET['pid'];
+       $a_type  = $_GET['a_type'];
+       
+       /* find the files and directories to be copied */
+       $total_list = explode(',', $_GET['list']);
+
+       $count = count($total_list);
+       $countd = 0;
+       $countf = 0;
+       for ($i=0; $i<$count; $i++) {
+               if (is_dir($current_path.$pathext.$total_list[$i])) {
+                       $_dirs[$countd] = $total_list[$i];
+                       $hidden_dirs  .= '<input type="hidden" name="dirs['.$countd.']"   value="'.$_dirs[$countd].'" />';
+                       $countd++;
+               } else {
+                       $_files[$countf] = $total_list[$i];
+                       $hidden_files .= '<input type="hidden" name="files['.$countf.']" value="'.$_files[$countf].'" />';
+                       $countf++;
+               }
+       }
+?>
+
+<form name="move_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
+<div class="input-form">
+       <div class="row">
+               <p><?php echo _AT('select_directory'); ?></p>
+       </div>
+       
+       <div class="row">
+               <ul>
+                       <li class="folders"><label><input type="radio" name="dir_name" value=""<?php
+                               if ($pathext == '') {
+                                       echo ' checked="checked"';
+                                       $here = ' ' . _AT('current_location');
+                               } 
+                               echo '/>Home ' .$here.'</label>';
+                       
+                               echo FileUtility::display_tree($current_path, '', $pathext);
+                       ?></li>
+               </ul>
+       </div>
+
+       <div class="row buttons">
+               <input type="submit" name="dir_chosen" value="<?php echo _AT('move'); ?>" accesskey="s" /> 
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
+       </div>
+</div>
+
+<input type="hidden" name="pathext" value="<?php echo $pathext; ?>" />
+<input type="hidden" name="framed" value="<?php echo $framed; ?>" />
+<input type="hidden" name="popup" value="<?php echo $popup; ?>" />
+<input type="hidden" name="cp" value="<?php echo $cp; ?>" />
+<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
+<input type="hidden" name="pid" value="<?php echo $pid; ?>" />
+<input type="hidden" name="a_type" value="<?php echo $a_type; ?>" />
+<input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />
+<?php
+       echo $hidden_dirs;
+       echo $hidden_files;
+?>
+</form>
+
+<?php require(TR_INCLUDE_PATH.'footer.inc.php');
+}
+?>
\ No newline at end of file
diff --git a/docs/file_manager/new.php b/docs/file_manager/new.php
new file mode 100644 (file)
index 0000000..e376bc7
--- /dev/null
@@ -0,0 +1,201 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require(TR_INCLUDE_PATH.'vitals.inc.php');
+require(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+
+$current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+$popup  = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['submit_no'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['submit_yes'])) {
+       $filename = preg_replace("{[^a-zA-Z0-9_]}","_", trim($_POST['filename']));
+       $pathext  = $_POST['pathext'];
+
+       /* only html or txt extensions allowed */
+       if ($_POST['extension'] == 'html') {
+               $extension = 'html';
+       } else {
+               $extension = 'txt';
+       }
+       
+       if (FileUtility::course_realpath($current_path . $pathext . $filename.'.'.$extension) == FALSE) {
+               $msg->addError('FILE_NOT_SAVED');
+               /* take user to home page to avoid unspecified error warning */
+               header('Location: index.php?pathext='.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);
+               exit;
+       }
+
+       if (($f = @fopen($current_path.$pathext.$filename.'.'.$extension,'w')) && @fwrite($f, stripslashes($_POST['body_text'])) !== FALSE && @fclose($f)){
+               $msg->addFeedback('FILE_OVERWRITE');
+       } else {
+               $msg->addError('CANNOT_OVERWRITE_FILE');
+       }
+       unset($_POST['newfile']);
+       header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['savenewfile'])) {
+
+       if (isset($_POST['filename']) && ($_POST['filename'] != "")) {
+               $filename     = preg_replace("{[^a-zA-Z0-9_]}","_", trim($_POST['filename']));
+               $pathext      = $_POST['pathext'];
+               $current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+               /* only html or txt extensions allowed */
+               if ($_POST['extension'] == 'html') {
+                       $extension = 'html';
+                       $head_html = "<html>\n<head>\n<title>".$_POST['filename']."</title>\n<head>\n<body>";
+                       $foot_html ="\n</body>\n</html>";
+               } else {
+                       $extension = 'txt';
+               }
+
+               if (!@file_exists($current_path.$pathext.$filename.'.'.$extension)) {
+                       $content = str_replace("\r\n", "\n", $head_html.$_POST['body_text'].$foot_html);
+                       
+                       if (FileUtility::course_realpath($current_path . $pathext . $filename.'.'.$extension) == FALSE) {
+                               $msg->addError('FILE_NOT_SAVED');
+                               /* take user to home page to avoid unspecified error warning */
+                               header('Location: index.php?pathext='.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+
+                       if (($f = fopen($current_path.$pathext.$filename.'.'.$extension, 'w')) && (@fwrite($f, stripslashes($content)) !== false)  && (@fclose($f))) {
+                               $msg->addFeedback(array('FILE_SAVED', $filename.'.'.$extension));
+                               header('Location: index.php?pathext='.urlencode($_POST['pathext']).SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);
+                               exit;
+                       } else {
+                               $msg->addError('FILE_NOT_SAVED');
+                               header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'_course_id='.$_course_id);
+                               exit;
+                       }
+               }
+               else {
+                       require(TR_INCLUDE_PATH.'header.inc.php');
+                       $pathext = $_POST['pathext']; 
+                       $popup   = $_POST['popup'];
+
+                       $_POST['newfile'] = "new";
+
+                       $hidden_vars['pathext']   = $pathext;
+                       $hidden_vars['filename']  = $filename;
+                       $hidden_vars['extension'] = $extension;
+                       $hidden_vars['_course_id'] = $_course_id;
+                       $hidden_vars['body_text'] = $_POST['body_text'];
+
+                       $hidden_vars['popup']  = $popup;
+                       $hidden_vars['framed'] = $framed;
+
+                       $msg->addConfirm(array('FILE_EXISTS', $filename.'.'.$extension), $hidden_vars);
+                       $msg->printConfirm();
+
+                       require(TR_INCLUDE_PATH.'footer.inc.php');
+                       exit;
+               }
+       } else {
+               $msg->addError(array('EMPTY_FIELDS', _AT('file_name')));
+       }
+}
+
+$onload="on_load()";
+
+require(TR_INCLUDE_PATH.'header.inc.php');
+require(TR_INCLUDE_PATH.'lib/tinymce.inc.php');
+
+// set default body editor to tinymce editor
+if (!isset($_POST['extension'])) $_POST['extension'] = 'html';
+
+// load tinymce library
+load_editor(true, false, "none");
+
+$pathext = $_GET['pathext']; 
+$popup   = $_GET['popup'];
+
+$msg->printAll();
+
+?>
+       <form action="<?php echo $_SERVER['PHP_SELF'].'?_course_id='.$_course_id; ?>" method="post" name="form">
+       <input type="hidden" name="pathext" value="<?php echo $_REQUEST['pathext'] ?>" />
+       <input type="hidden" name="popup" value="<?php echo $popup; ?>" />
+
+       <div class="input-form">        
+       <fieldset class="group_form"><legend class="group_form"><?php echo _AT('create_new_file'); ?></legend>
+               <div class="row">
+                       <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="ctitle"><?php echo _AT('file_name');  ?></label><br />
+                       <input type="text" name="filename" id="ctitle" size="40" <?php if (isset($_POST['filename'])) echo 'value="'.$_POST['filename'].'"'?> />
+               </div>
+
+               <div class="row">
+                       <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('type'); ?><br />
+                       <input type="radio" name="extension" value="txt" id="text" <?php if ($_POST['extension'] == 'txt') { echo 'checked="checked"'; } ?> onclick="trans.editor.switch_content_type(this.value);" />
+                       <label for="text"><?php echo _AT('plain_text'); ?></label>
+       
+                       , <input type="radio" name="extension" value="html" id="html" <?php if ($_POST['extension'] == 'html') { echo 'checked="checked"'; } ?> onclick="trans.editor.switch_content_type(this.value);" />
+                       <label for="html"><?php echo _AT('html'); ?></label>
+               </div>
+       
+               <div class="row">
+                       <label for="body_text"><?php echo _AT('body');  ?></label><br />
+                       <textarea name="body_text" id="body_text" rows="25"><?php echo ContentManager::cleanOutput($_POST['body_text']); ?></textarea>
+               </div>
+       
+               <div class="row buttons">
+                       <input type="submit" name="savenewfile" value="<?php echo _AT('save'); ?>" accesskey="s" />
+                       <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>"  />             
+               </div>
+       </fieldset>
+       </div>
+       </form>
+
+<script type="text/javascript" language="javascript">
+//<!--
+function on_load()
+{
+       document.form.filename.focus();
+       if (jQuery('#html').attr("checked")) { 
+               tinyMCE.execCommand('mceAddControl', false, 'body_text');
+       }
+}
+
+trans.editor.switch_content_type = function (extension) {
+  if (extension === 'txt') { //text type
+    tinyMCE.execCommand('mceRemoveControl', false, 'body_text');
+  }
+  else { //html type
+    tinyMCE.execCommand('mceAddControl', false, 'body_text');
+  }
+};
+
+//-->
+</script>
+
+<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/file_manager/preview.php b/docs/file_manager/preview.php
new file mode 100644 (file)
index 0000000..9287a54
--- /dev/null
@@ -0,0 +1,45 @@
+<?php\r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+\r
+define('TR_INCLUDE_PATH', '../include/');\r
+require(TR_INCLUDE_PATH.'vitals.inc.php');\r
+global $_course_id;\r
+\r
+if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {\r
+       $get_file = $_base_path . 'get.php/';\r
+       $file = 'b64:'.base64_encode($_GET['file']);\r
+} else {\r
+       $get_file = $_base_path . 'content/' . $_course_id . '/';\r
+       $file = $_GET['file'];\r
+}\r
+\r
+?>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd" />\r
+<html lang="<?php echo $myLang->getCode(); ?>">\r
+<head>\r
+       <title><?php echo _AT('file_manager_frame'); ?></title>\r
+       <meta http-equiv="Content-Type" content="text/html; <?php echo $myLang->getCharacterSet(); ?>" />\r
+</head>\r
+\r
+<frameset rows="50,*">\r
+\r
+<frame src="preview_top.php?file=<?php echo $file.SEP.'pathext='. $_GET['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP.'_course_id='.$_course_id; ?>" scrolling="no" marginwidth="0" marginheight="0" />\r
+<frame src="<?php echo $get_file; ?><?php echo $file; ?>" />\r
+\r
+<noframes>\r
+  <p><?php echo _AT('frame_contains'); ?><br />\r
+  * <a href="../mods/_core/file_manager/file_manager.php"><?php echo _AT('file_manager'); ?></a>\r
+  </p>\r
+</noframes>\r
+\r
+</frameset>\r
+</html>
\ No newline at end of file
diff --git a/docs/file_manager/preview_top.php b/docs/file_manager/preview_top.php
new file mode 100644 (file)
index 0000000..9310850
--- /dev/null
@@ -0,0 +1,43 @@
+<?php\r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+\r
+define('TR_INCLUDE_PATH', '../include/');\r
+require(TR_INCLUDE_PATH.'vitals.inc.php');\r
+global $_course_id;\r
+\r
+if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {\r
+       $get_file = TR_BASE_HREF.'get.php/';\r
+} else {\r
+       $get_file = TR_BASE_HREF.'content/' . $_course_id . '/';\r
+}\r
+\r
+?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />\r
+<html lang="<?php echo $myLang->getCode(); ?>">\r
+<head>\r
+       <title><?php echo _AT('file_manager_frame'); ?></title>\r
+       <meta http-equiv="Content-Type" content="text/html; <?php echo $myLang->getCharacterSet(); ?>" />\r
+</head>\r
+\r
+<body>\r
+<p align="bottom">\r
+\r
+<a href="index.php?framed=<?php echo SEP; ?>popup=<?php echo SEP; ?>pathext=<?php echo $_GET['pathext'].SEP . 'popup=' . $_GET['popup'] . SEP . 'framed=' . $_GET['framed'].SEP.'_course_id='.$_course_id; ?>" target="_top"><?php echo _AT('return_file_manager'); ?></a> \r
+<?php if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE): ?>\r
+        | \r
+       <a href="<?php echo $get_file; ?>@/<?php echo $_GET['file']; ?>" target="_top"><?php echo _AT('download_file'); ?></a>\r
+<?php endif; ?> |\r
+<a href="<?php echo $get_file; ?><?php echo $_GET['file']; ?>" target="_top"><?php echo _AT('remove_frame'); ?></a>\r
+</p>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/docs/file_manager/rename.php b/docs/file_manager/rename.php
new file mode 100644 (file)
index 0000000..bf511bc
--- /dev/null
@@ -0,0 +1,99 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require(TR_INCLUDE_PATH.'vitals.inc.php');
+require(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+
+$current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+$popup = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+if (isset($_POST['rename_action'])) {
+
+       $_POST['new_name'] = trim($_POST['new_name']);
+       $_POST['new_name'] = str_replace(' ', '_', $_POST['new_name']);
+       $_POST['new_name'] = str_replace(array(' ', '/', '\\', ':', '*', '?', '"', '<', '>', '|', '\''), '', $_POST['new_name']);
+
+       $_POST['oldname'] = trim($_POST['oldname']);
+       $_POST['oldname'] = str_replace(' ', '_', $_POST['oldname']);
+       $_POST['oldname'] = str_replace(array(' ', '/', '\\', ':', '*', '?', '"', '<', '>', '|', '\''), '', $_POST['oldname']);
+
+       $path_parts_new = pathinfo($_POST['new_name']);
+       $ext_new = $path_parts_new['extension'];
+       $pathext = $_POST['pathext'];
+
+       /* check if this file extension is allowed: */
+       /* $IllegalExtentions is defined in ./include/config.inc.php */
+       if (in_array($ext_new, $IllegalExtentions)) {
+               $errors = array('FILE_ILLEGAL', $ext_new);
+               $msg->addError($errors);
+       }
+       else if ($current_path.$pathext.$_POST['new_name'] == $current_path.$pathext.$_POST['oldname']) {
+               //do nothing
+               $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+               header('Location: index.php?pathext='.urlencode($_POST['pathext']).SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+
+       //make sure new file is inside content directory
+       else if (FileUtility::course_realpath($current_path . $pathext . $_POST['new_name']) == FALSE) {
+               $msg->addError('CANNOT_RENAME');
+       }       
+       else if (FileUtility::course_realpath($current_path . $pathext . $_POST['oldname']) == FALSE) {
+               $msg->addError('CANNOT_RENAME');
+       }
+       else if (file_exists($current_path . $pathext . $_POST['new_name'])) {
+               $msg->addError('CANNOT_RENAME');
+       }
+       else {
+               @rename($current_path.$pathext.$_POST['oldname'], $current_path.$pathext.$_POST['new_name']);
+               $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+               header('Location: index.php?pathext='.urlencode($_POST['pathext']).SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+}
+
+require(TR_INCLUDE_PATH.'header.inc.php');
+?>
+<form name="rename" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input type="hidden" name="pathext" value="<?php echo $_REQUEST['pathext']; ?>" />
+<input type="hidden" name="oldname" value="<?php echo $_REQUEST['oldname']; ?>" />
+<input type="hidden" name="framed" value="<?php echo $_REQUEST['framed']; ?>" />
+<input type="hidden" name="popup" value="<?php echo $_REQUEST['popup']; ?>" />
+<input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />
+
+<div class="input-form">
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div>
+               <label for="new"><?php echo _AT('new_name'); ?></label><br />
+               <?php echo $_GET['pathext']; ?><input type="text" name="new_name" id="new" value="<?php echo $_REQUEST['oldname']; ?>" size="30" />
+       </div>
+
+       <div class="row buttons">
+               <input type="submit" name="rename_action" value="<?php echo _AT('save'); ?>" accesskey="s" />
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
+       </div>
+</div>
+</form>
+
+<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/file_manager/top.php b/docs/file_manager/top.php
new file mode 100644 (file)
index 0000000..9b9fa8d
--- /dev/null
@@ -0,0 +1,183 @@
+<?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.'classes/DAO/CoursesDAO.class.php');
+
+if (!$_GET['f']) {
+       $_SESSION['done'] = 0;
+}
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$coursesDAO = new CoursesDAO();
+
+$current_path = TR_CONTENT_DIR.$_course_id.'/';
+
+
+if (isset($_POST['rename'])) {
+       if (!is_array($_POST['check'])) {
+               // error: you must select a file/dir to rename
+               $msg->addError('NO_ITEM_SELECTED');
+       } else if (count($_POST['check']) < 1) {
+               // error: you must select one file/dir to rename
+               $msg->addError('NO_ITEM_SELECTED');
+       } else if (count($_POST['check']) > 1) {
+               // error: you must select ONLY one file/dir to rename
+               $msg->addError('SELECT_ONE_ITEM');
+       } else {
+               header('Location: rename.php?pathext='.urlencode($_POST['pathext']).SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'oldname='.urlencode($_POST['check'][0]).SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+} else if (isset($_POST['delete'])) {
+       
+       if (!is_array($_POST['check'])) {
+               $msg->addError('NO_ITEM_SELECTED');
+       } else {
+
+               $list = implode(',', $_POST['check']);
+               header('Location: delete.php?pathext=' . urlencode($_POST['pathext']) . SEP . 'framed=' . $framed . SEP . 'popup=' . $popup . SEP . 'list=' . urlencode($list).SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+} else if (isset($_POST['move'])) {
+
+       if (!is_array($_POST['check'])) {
+               $msg->addError('NO_ITEM_SELECTED');
+       } else {
+
+               $list = implode(',', $_POST['check']);          
+               header('Location: move.php?pathext='.urlencode($_POST['pathext']).SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'list='.urlencode($list).SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+}
+
+$MakeDirOn = true;
+
+/* get this courses MaxQuota and MaxFileSize: */
+$row = $coursesDAO->get($_course_id);
+$my_MaxCourseSize      = $row['max_quota'];
+$my_MaxFileSize                = $row['max_file_size'];
+
+if ($my_MaxCourseSize == TR_COURSESIZE_DEFAULT) {
+       $my_MaxCourseSize = $MaxCourseSize;
+}
+if ($my_MaxFileSize == TR_FILESIZE_DEFAULT) {
+       $my_MaxFileSize = $MaxFileSize;
+} else if ($my_MaxFileSize == TR_FILESIZE_SYSTEM_MAX) {
+       $my_MaxFileSize = megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
+}
+
+$MaxSubDirs  = 5;
+$MaxDirDepth = 10;
+
+if ($_GET['pathext'] != '') {
+       $pathext = urldecode($_GET['pathext']);
+} else if ($_POST['pathext'] != '') {
+       $pathext = $_POST['pathext'];
+}
+
+if (strpos($pathext, '..') !== false) {
+       require(TR_INCLUDE_PATH.'header.inc.php');
+       $msg->printErrors('UNKNOWN');   
+       require(TR_INCLUDE_PATH.'footer.inc.php');
+       exit;
+}
+if($_GET['back'] == 1) {
+       $pathext  = substr($pathext, 0, -1);
+       $slashpos = strrpos($pathext, '/');
+       if($slashpos == 0) {
+               $pathext = '';
+       } else {
+               $pathext = substr($pathext, 0, ($slashpos+1));
+       }
+
+}
+
+$start_at = 2;
+/* remove the forward or backwards slash from the path */
+$newpath = $current_path;
+$depth = substr_count($pathext, '/');
+
+if ($pathext != '') {
+       $bits = explode('/', $pathext);
+       foreach ($bits as $bit) {
+               if ($bit != '') {
+                       $bit_path .= $bit;
+
+                       $_section[$start_at][0] = $bit;
+                       $_section[$start_at][1] = '../file_manager/index.php?pathext=' . urlencode($bit_path) . SEP . 'popup=' . $popup . SEP . 'framed=' . $framed.SEP.'_course_id='.$_course_id;
+
+                       $start_at++;
+               }
+       }
+       $bit_path = "";
+       $bit = "";
+}
+
+/* if upload successful, close the window */
+if ($f) {
+       $onload = 'closeWindow(\'progWin\');';
+}
+
+/* make new directory */
+if ($_POST['mkdir_value'] && ($depth < $MaxDirDepth) ) {
+       $_POST['dirname'] = trim($_POST['dirname']);
+
+       /* anything else should be okay, since we're on *nix..hopefully */
+       $_POST['dirname'] = preg_replace('/[^a-zA-Z0-9._]/', '', $_POST['dirname']);
+
+       if ($_POST['dirname'] == '') {
+               $msg->addError(array('FOLDER_NOT_CREATED', $_POST['dirname'] ));
+       } 
+       else if (strpos($_POST['dirname'], '..') !== false) {
+               $msg->addError('BAD_FOLDER_NAME');
+       }       
+       else {
+               $result = @mkdir($current_path.$pathext.$_POST['dirname'], 0700);
+               if($result == 0) {
+                       $msg->addError(array('FOLDER_NOT_CREATED', $_POST['dirname'] ));
+               }
+               else {
+                       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+               }
+       }
+}
+
+$newpath = substr($current_path.$pathext, 0, -1);
+
+/* open the directory */
+if (!($dir = @opendir($newpath))) {
+       if (isset($_GET['create']) && ($newpath.'/' == $current_path)) {
+               @mkdir($newpath);
+               if (!($dir = @opendir($newpath))) {
+                       require(TR_INCLUDE_PATH.'header.inc.php');
+                       $msg->printErrors('CANNOT_CREATE_DIR');                 
+                       require(TR_INCLUDE_PATH.'footer.inc.php');
+                       exit;
+               } else {
+                       $msg->addFeedback('CONTENT_DIR_CREATED');
+               }
+       } else {
+               require(TR_INCLUDE_PATH.'header.inc.php');
+
+               $msg->printErrors('CANNOT_OPEN_DIR');
+               require(TR_INCLUDE_PATH.'footer.inc.php');
+               exit;
+       }
+}
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+}
+
+require(TR_INCLUDE_PATH.'header.inc.php');
+?>
\ No newline at end of file
diff --git a/docs/file_manager/upload.php b/docs/file_manager/upload.php
new file mode 100644 (file)
index 0000000..896f915
--- /dev/null
@@ -0,0 +1,170 @@
+<?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.                        */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../include/');
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$coursesDAO = new CoursesDAO();
+
+$_SESSION['done'] = 1;
+$popup = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+$alter = $_REQUEST['alter'];
+
+//echo $_REQUEST['cid'];
+//echo $_REQUEST['tab'];
+
+//echo $alter;
+
+/* get this courses MaxQuota and MaxFileSize: */
+$row = $coursesDAO->get($_course_id);
+$my_MaxCourseSize = $row['max_quota'];
+$my_MaxFileSize        = $row['max_file_size'];
+
+if ($my_MaxCourseSize != TR_COURSESIZE_UNLIMITED) $my_MaxCourseSize = $MaxCourseSize;
+$my_MaxFileSize = FileUtility::megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
+
+//     if ($my_MaxCourseSize == TR_COURSESIZE_DEFAULT) {
+//             $my_MaxCourseSize = $MaxCourseSize;
+//     }
+//     if ($my_MaxFileSize == TR_FILESIZE_DEFAULT) {
+//             $my_MaxFileSize = $MaxFileSize;
+//     } else if ($my_MaxFileSize == TR_FILESIZE_SYSTEM_MAX) {
+//             $my_MaxFileSize = megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
+//     }
+
+$path = TR_CONTENT_DIR . $_course_id.'/'.$_POST['pathext'];
+
+if (isset($_POST['submit'])) {
+
+       if($_FILES['uploadedfile']['name'])     {
+
+               $_FILES['uploadedfile']['name'] = trim($_FILES['uploadedfile']['name']);
+               $_FILES['uploadedfile']['name'] = str_replace(' ', '_', $_FILES['uploadedfile']['name']);
+
+               $path_parts = pathinfo($_FILES['uploadedfile']['name']);
+               $ext = $path_parts['extension'];
+
+               /* check if this file extension is allowed: */
+               /* $IllegalExtentions is defined in ./include/config.inc.php */
+               if (in_array($ext, $IllegalExtentions)) {
+                       $errors = array('FILE_ILLEGAL', $ext);
+                       $msg->addError($errors);
+                       header('Location: index.php?pathext='.$_POST['pathext'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+                       exit;
+               }
+
+               /* also have to handle the 'application/x-zip-compressed'  case */
+               if (   ($_FILES['uploadedfile']['type'] == 'application/x-zip-compressed')
+                       || ($_FILES['uploadedfile']['type'] == 'application/zip')
+                       || ($_FILES['uploadedfile']['type'] == 'application/x-zip')){
+                       $is_zip = true;                                         
+               }
+
+       
+               /* anything else should be okay, since we're on *nix.. hopefully */
+               $_FILES['uploadedfile']['name'] = str_replace(array(' ', '/', '\\', ':', '*', '?', '"', '<', '>', '|', '\''), '', $_FILES['uploadedfile']['name']);
+
+
+               /* if the file size is within allowed limits */
+               if( ($_FILES['uploadedfile']['size'] > 0) && ($_FILES['uploadedfile']['size'] <= $my_MaxFileSize) ) {
+
+                       /* if adding the file will not exceed the maximum allowed total */
+                       $course_total = FileUtility::dirsize($path);
+
+                       if ((($course_total + $_FILES['uploadedfile']['size']) <= $my_MaxCourseSize) || ($my_MaxCourseSize == TR_COURSESIZE_UNLIMITED)) {
+
+                               /* check if this file exists first */
+                               if (file_exists($path.$_FILES['uploadedfile']['name'])) {
+                                       /* this file already exists, so we want to prompt for override */
+
+                                       /* save it somewhere else, temporarily first                    */
+                                       /* file_name.time ? */
+                                       $_FILES['uploadedfile']['name'] = substr(time(), -4).'.'.$_FILES['uploadedfile']['name'];
+
+                                       $f = array('FILE_EXISTS',
+                                                                       substr($_FILES['uploadedfile']['name'], 5));
+                                       $msg->addFeedback($f);
+                               }
+
+                               /* copy the file in the directory */
+                               $result = move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $path.$_FILES['uploadedfile']['name'] );
+
+                               if (!$result) {
+                                       require(TR_INCLUDE_PATH.'header.inc.php');
+                                       $msg->printErrors('FILE_NOT_SAVED');
+                                       echo '<a href="../file_manager/index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id.'">' . _AT('back') . '</a>';
+                                       require(TR_INCLUDE_PATH.'footer.inc.php');
+                                       exit;
+                               } else {
+                                       if ($is_zip) {
+                                               $f = array('FILE_UPLOADED_ZIP',
+                                                                               urlencode($_POST['pathext']), 
+                                                                               urlencode($_FILES['uploadedfile']['name']), 
+                                                                               $_GET['popup'],
+                                                                               $_course_id,
+                                                                               SEP);
+                                               $msg->addFeedback($f);
+                                               if ($alter)
+                                                       header('Location: '.$_base_href.'editor/edit_content.php?cid='.$_REQUEST['cid'].SEP . 'pathext='.$_POST['pathext'].SEP. 'popup='.$_GET['popup'].SEP. 'tab='.$_REQUEST['tab'].SEP.'_course_id='.$_course_id);
+                                               else
+                                                       header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+                                               exit;
+                                       } /* else */
+
+                                       // uploading an alternative content object
+                                       if ($_GET['a_type'] > 0) {
+                                               header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'uploadfile='.urlencode($_FILES['uploadedfile']['name']).SEP.'_course_id='.$_course_id);
+                                       }
+                                       else {
+                                               $msg->addFeedback('FILE_UPLOADED');
+
+                                               if ($alter)
+                                                       header('Location: '.$_base_href.'editor/edit_content.php?cid='.$_REQUEST['cid'].SEP . 'pathext='.$_POST['pathext'].SEP. 'popup='.$_GET['popup'].SEP. 'tab='.$_REQUEST['tab'].SEP.'_course_id='.$_course_id);
+                                               else
+                                                       header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+                                       }
+                                       exit;
+                               }
+                       } else {
+                               $msg->addError(array('MAX_STORAGE_EXCEEDED', get_human_size($my_MaxCourseSize)));
+                               if ($alter)
+                                                       header('Location: '.$_base_href.'editor/edit_content.php?cid='.$_REQUEST['cid'].SEP . 'pathext='.$_POST['pathext'].SEP. 'popup='.$_GET['popup'].SEP. 'tab='.$_REQUEST['tab'].SEP.'_course_id='.$_course_id);
+                                               else
+                                                       header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+                                               
+                               exit;
+                       }
+               } else {
+                       $msg->addError(array('FILE_TOO_BIG', get_human_size($my_MaxFileSize)));
+                       if ($alter)
+                                                       header('Location: '.$_base_href.'editor/edit_content.php?cid='.$_REQUEST['cid'].SEP . 'pathext='.$_POST['pathext'].SEP. 'popup='.$_GET['popup'].SEP. 'tab='.$_REQUEST['tab'].SEP.'_course_id='.$_course_id);
+                                               else
+                                                       header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+                                               
+                       exit;
+               }
+       } else {
+               $msg->addError('FILE_NOT_SELECTED');
+               if ($alter)
+                       header('Location: '.$_base_href.'editor/edit_content.php?cid='.$_REQUEST['cid'].SEP . 'pathext='.$_POST['pathext'].SEP. 'popup='.$_GET['popup'].SEP. 'tab='.$_REQUEST['tab'].SEP.'_course_id='.$_course_id);
+               else
+                       header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'].SEP. 'framed='.$framed.SEP.'cp='.$_GET['cp'].SEP.'pid='.$_GET['pid'].SEP.'cid='.$_GET['cid'].SEP.'a_type='.$_GET['a_type'].SEP.'_course_id='.$_course_id);
+               exit;
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/docs/file_manager/zip.php b/docs/file_manager/zip.php
new file mode 100644 (file)
index 0000000..11aaca4
--- /dev/null
@@ -0,0 +1,290 @@
+<?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.                        */
+/************************************************************************/
+
+$page = 'file_manager';
+
+define('TR_INCLUDE_PATH', '../include/');
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/pclzip.lib.php');
+require_once(TR_INCLUDE_PATH.'lib/pclzip_callback.lib.php');
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
+
+global $_course_id;
+Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$coursesDAO = new CoursesDAO();
+
+$popup = $_REQUEST['popup'];
+$framed = $_REQUEST['framed'];
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'popup='.$_POST['popup'].SEP.'framed='.$_POST['framed'].SEP.'_course_id='.$_course_id);
+       exit;
+}
+
+       $path = TR_CONTENT_DIR . $_course_id.'/';
+
+       if ($_REQUEST['pathext'] != '') {
+               $pathext = $_REQUEST['pathext'];
+       }
+       if ($_REQUEST['file'] != '') {
+               $file = $_REQUEST['file'];
+       }
+
+       if (strpos($file, '..') !== false) {
+               require(TR_INCLUDE_PATH.'header.inc.php');
+               $msg->printErrors('UNKNOWN');
+               require(TR_INCLUDE_PATH.'footer.inc.php');
+               exit;
+       }
+
+       $path_parts = pathinfo($pathext.$file);
+
+       $temp_name = substr($file, 0, -strlen('.'.$path_parts['extension']));
+
+       $zip = new PclZip($path.$pathext.$file);
+
+       if (($list = $zip->listContent()) == 0) {
+               die("Error : ".$zip->errorInfo(true));
+       }
+
+/*****************************************************************/
+       $totalBytes = 0;
+       $translated_file_names = array();
+
+       for ($i=0; $i<sizeof($list); $i++) {
+               $path_parts = pathinfo($list[$i]['stored_filename']);
+               if ($path_parts['dirname'] == '.') {
+                       $path_parts['dirname'] = '';
+               } else {
+                       $path_parts['dirname'] .= '/';
+               }
+               $ext = $path_parts['extension'];
+
+               $is_dir = false;
+               if($list[$i]['folder']) {
+
+                       $filename = $list[$i]['stored_filename'];
+                       $fileicon = '<img src="images/folder.gif" alt="'._AT('folder').'" />';
+
+                       $is_dir = true;
+
+               } else if ($ext == 'zip') {
+
+                       $totalBytes += $list[$i]['size'];
+                       $filename = $list[$i]['stored_filename'];
+                       $fileicon = '<img src="images/icon-zip.gif" alt="'._AT('zip_archive').'" height="16" width="16" border="0" />';
+
+               } else {
+                       $totalBytes += $list[$i]['size'];
+                       $filename = $list[$i]['stored_filename'];
+                       $fileicon = '<img src="images/icon_minipost.gif" alt="'._AT('file').'" height="11" width="16" />';
+               }
+               
+               if ($is_dir) {
+                       $dirs[strtolower($filename)] .= '<tr>
+                               <td>'.$filename.'</td>';
+
+                               $dirs[strtolower($filename)] .= '<td class="row1" align="right">'.FileUtility::get_human_size($list[$i]['size']).' </td>';
+                               $dirs[strtolower($filename)] .= '<td class="row1">&nbsp;';
+                               
+                               $dirs[strtolower($filename)] .= AT_date(_AT('filemanager_date_format'), $filedata[10], TR_DATE_UNIX_TIMESTAMP);
+                                       
+                               $dirs[strtolower($filename)] .= '&nbsp;</td>';
+
+                               $dirs[strtolower($filename)] .= '</tr>';
+               } else {
+
+                       $files[strtolower($filename)] .= '<tr>
+                               <td>';
+
+                               if (in_array($ext, $IllegalExtentions)) {
+                                       $files[strtolower($filename)] .=  '<span style="text-decoration: line-through;" title="'._AT('illegal_file').'">'.$filename.'</span>';
+                               } else {
+                                       $files[strtolower($filename)] .= $filename;
+                                       
+                                       $trans_name = str_replace(' ', '_', $path_parts['basename']);
+                                       $trans_name = preg_replace("/[^A-Za-z0-9._\-]/", '', $trans_name);
+
+                                       if (in_array($path_parts['dirname'].$trans_name, $translated_file_names)) {
+                                               $trans_count = 2;
+                                               while (in_array($trans_name, $translated_file_names)) {
+                                                       $part = substr($trans_name, 0, -strlen($ext)- 1 - (2*($trans_count-2)));
+                                                       $trans_name = $part.'_'.$trans_count.'.'.$ext;
+                                                       $trans_count++;
+                                                       if ($trans_count>15){
+                                                               exit; // INF loop safety thing..
+                                                       }
+                                               }
+                                       }
+                                       
+                                       $translated_file_names[$list[$i]['index']] = $path_parts['dirname'].$trans_name;
+
+                                       if ($path_parts['dirname'].$trans_name != $filename) {
+                                               $files[strtolower($filename)] .= ' => '.$trans_name;
+                                       }
+                                       
+                               }
+                                       
+                               $files[strtolower($filename)] .= '</td>';
+
+                               $files[strtolower($filename)] .= '<td align="right">'.FileUtility::get_human_size($list[$i]['size']).' </td>';
+                               $files[strtolower($filename)] .= '<td>&nbsp;';
+                               
+                               $files[strtolower($filename)] .= AT_date(_AT('filemanager_date_format'), $list[$i]['mtime'], TR_DATE_UNIX_TIMESTAMP);
+                                       
+                               $files[strtolower($filename)] .= '</td>';
+               
+                               $files[strtolower($filename)] .= '</tr>';
+               }
+       }
+
+       $row = $coursesDAO->get($_course_id);
+       $my_MaxCourseSize       = $row['max_quota'];
+       $my_MaxFileSize     = $row['max_file_size'];
+
+       $course_total = FileUtility::dirsize($path);
+       if ($my_MaxCourseSize == TR_COURSESIZE_UNLIMITED) {
+               $total_after = 1;
+       } else {
+               $my_MaxCourseSize = $MaxCourseSize;
+               $total_after = FileUtility::get_human_size($my_MaxCourseSize-$course_total-$totalBytes);
+       }
+//     else{
+//             $total_after = get_human_size($my_MaxCourseSize - $course_total - $totalBytes);
+//     }
+
+       // if $total_after < 0: redirect with error msg
+
+       if (isset($_POST['submit']) && ($total_after > 0)) {
+               $_POST['custom_path'] = trim($_POST['custom_path']);
+               $_POST['custom_path'] = str_replace(' ', '_', $_POST['custom_path']);
+
+               /* anything else should be okay, since we're on *nix.. hopefully */
+               $_POST['custom_path'] = preg_replace('/[^a-zA-Z0-9._\/]/', '', $_POST['custom_path']);
+
+               if (strpos($_POST['pathext'].$_POST['custom_path'], '..') !== false) {
+                       $msg->addError('UNKNOWN');
+                       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'_course_id='.$_course_id);
+                       exit;
+               } else if ($zip->extract(       PCLZIP_OPT_PATH,                $path. $_POST['pathext'] . $_POST['custom_path'],  
+                                                       PCLZIP_CB_PRE_EXTRACT,  'preExtractCallBack')                   == 0) {
+
+                       echo ("Error : ".$zip->errorInfo(true));
+               } else {
+                       $msg->addFeedback('ARCHIVE_EXTRACTED');
+                       header('Location: index.php?pathext='.$_POST['pathext'].SEP.'popup='.$_POST['popup'].SEP.'framed='.$_POST['framed'].SEP.'_course_id='.$_course_id);
+                       exit;
+               }
+
+               header('Location: index.php'.SEP.'_course_id='.$_course_id);
+               exit;
+       }
+
+       require(TR_INCLUDE_PATH.'header.inc.php');
+
+       if ($total_after <= 0) {
+               $msg->printErrors('NO_SPACE_LEFT');
+       } else {
+?>
+               <form method="post" action="file_manager/zip.php">
+               <input type="hidden" name="pathext" value="<?php echo $_GET['pathext']; ?>" />
+               <input type="hidden" name="file"    value="<?php echo $_GET['file']; ?>" />
+               <input type="hidden" name="popup"   value="<?php echo $_GET['popup']; ?>" />
+               <input type="hidden" name="framed"   value="<?php echo $_GET['framed']; ?>" />
+               <input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />
+               <div class="input-form">
+                       <div class="row">
+                               <p><?php echo _AT('zip_illegal_contents'); ?></p>
+                               <p><?php echo _AT('extract_tip'); ?></p>
+                       </div>
+
+                       <div class="row">
+                               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('directory_name'); ?><br />
+                               <input type="text" name="custom_path" value="<?php echo $temp_name; ?>" />
+                       </div>
+
+                       <div class="row buttons">
+                               <input type="submit" name="submit" value="<?php echo _AT('extract'); ?>" /> 
+                               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
+                       </div>
+               </div>
+               </form>
+<?php
+       } // end if
+?>
+
+<table class="data static" summary="" rules="groups">
+<thead>
+<tr>
+       <th><?php echo _AT('name'); ?></th>
+       <th><?php echo _AT('size'); ?></th>
+       <th><?php echo _AT('date'); ?></th>
+</tr>
+</thead>
+<tbody>
+       <?php
+       if (is_array($dirs)) {
+               foreach($dirs as $x => $y) {
+                       echo $y;
+               }
+       }
+
+       if (is_array($files)) {
+               foreach($files as $x => $y) {
+                       echo $y;
+               }
+       }
+?>
+</tbody>
+<tfoot>
+<tr>
+       <td align="right"><?php echo _AT('archive_total'); ?>:</td>
+       <td align="right"><?php echo FileUtility::get_human_size($totalBytes); ?></td>
+       <td>&nbsp;</td>
+</tr>
+<tr>
+       <td align="right"><?php echo _AT('course_total_zip'); ?>:</td>
+       <td align="right"><?php echo FileUtility::get_human_size($course_total); ?></td>
+       <td>&nbsp;</td>
+</tr>
+<tr>
+       <td align="right"><?php echo _AT('course_available_zip1'); ?>:</td>
+       <td align="right"><?php
+                       if ($my_MaxCourseSize == TR_COURSESIZE_UNLIMITED) {
+                               echo _AT('unlimited');
+                       } else {
+                               echo FileUtility::get_human_size($my_MaxCourseSize-$course_total);
+                       } ?></td>
+       <td>&nbsp;</td>
+</tr>
+<tr>
+       <td align="right"><?php echo _AT('course_available_zip2'); ?>:</td>
+       <td align="right"><?php
+                       if ($my_MaxCourseSize == TR_COURSESIZE_UNLIMITED) {
+                               echo _AT('unlimited');
+                       } else {
+                               if ($total_after <= 0) {
+                                       echo '<span style="color: red;">';
+                                       echo $total_after;
+                                       echo '</span>';
+                               } else {
+                                       echo $total_after;
+                               }
+                       } ?></td>
+       <td>&nbsp;</td>
+</tr>
+</tfoot>
+</table>
+
+<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
index b1287a8..3dd5731 100644 (file)
@@ -754,7 +754,7 @@ function initContentMenu() {
                if (is_array($rows)) {
                        foreach ($rows as $row) {
                                echo '
-  if (getcookie("c'.$_SESSION['course_id'].'_'.$row['content_id'].'") == "1")
+  if (trans.utility.getcookie("c'.$_SESSION['course_id'].'_'.$row['content_id'].'") == "1")
   {
     jQuery("#folder"+'.$row['content_id'].').show();
     jQuery("#tree_icon"+'.$row['content_id'].').attr("src", tree_collapse_icon);
@@ -781,7 +781,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").'");
-  setcookie("c'.$_SESSION['course_id'].'_'.$current_content_path[$i]['content_id'].'", "1", 1);
+  trans.utility.setcookie("c'.$_SESSION['course_id'].'_'.$current_content_path[$i]['content_id'].'", "1", 1);
 ';
                }
                echo '}'; // end of javascript function initContentMenu()
@@ -1060,7 +1060,7 @@ initContentMenu();
                                        }
                                        else
                                        { // nodes with content type "CONTENT_TYPE_FOLDER"
-//                                             $link .= '<a href="javascript:void(0)" onclick="javascript: toggleFolder(\''.$content['content_id'].$from.'\'); "><img src="'.$_base_path.'images/clr.gif" alt="'._AT('content_folder').': '.$content['title'].'" height="1" width="1" border="0" /></a>'."\n";
+//                                             $link .= '<a href="javascript:void(0)" onclick="javascript: trans.utility.toggleFolder(\''.$content['content_id'].$from.'\'); "><img src="'.$_base_path.'images/clr.gif" alt="'._AT('content_folder').': '.$content['title'].'" height="1" width="1" border="0" /></a>'."\n";
                                                
                                                $full_title = $content['title'];
                                                if (isset($_current_user) && $_current_user->isAuthor($this->course_id) && !Utility::isMobileTheme()) {
@@ -1068,7 +1068,7 @@ initContentMenu();
                                                        $link .= '<a href="editor/edit_content_folder.php?_cid='.$content['content_id'].'" title="'.$full_title. _AT('click_edit').'">'."\n";
                                                }
                                                else {
-                                                       $link .= '<span style="cursor:pointer" onclick="javascript: 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').'\'); ">'."\n";
                                                }
                                                
                                                if ($truncate && ($strlen($content['title']) > ($base_title_length-$depth*4)) ) {
@@ -1137,22 +1137,22 @@ 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: toggleFolder(\''.$content['content_id'].$from.'\'); " />'."\n";
-                                                       echo '<a href="javascript:void(0)" onclick="javascript: 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 '<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";
                                                        
                                                } 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: 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').'\'); " />'."\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: 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').'\'); "><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: 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').'\'); " />';
                                                        echo '</a>'."\n";
                                                }
                                        }
@@ -1394,128 +1394,6 @@ initContentMenu();
                }
        }
 
-       /* returns the timestamp of release if this page has not yet been released, or is under a page that has not been released, true otherwise */
-       /* finds the max(timestamp) of all parents and returns that, true if less than now */
-       /* Access: public */
-/* Transformable does not have content.release_date 
-       function isReleased($cid) {
-               if ($this->_menu_info[$cid]['content_parent_id'] == 0) {
-                       // this $cid has no parent, so we check its release date directly
-                       if ($this->_menu_info[$cid]['u_release_date'] <= time()) {      
-                               // yup! it's released
-                               return true;
-                       } else {
-                               // nope! not released
-                               return $this->_menu_info[$cid]['u_release_date'];
-                       }
-               }
-               // this is a sub page, need to check ALL its parents
-               $parent = $this->isReleased($this->_menu_info[$cid]['content_parent_id']); // recursion
-
-               if ($parent !== TRUE && $parent > $this->_menu_info[$cid]['u_release_date']) {
-                       return $parent;
-               } else if ($this->_menu_info[$cid]['u_release_date'] <= time()) {
-                       return true;
-               } else {
-                       return $this->_menu_info[$cid]['u_release_date'];
-               }
-       }
-*/
-       
-       /* returns the first test_id if this page has pre-test(s) to be passed, 
-        * or is under a page that has pre-test(s) to be passed, 
-        * 0 if has no pre-test(s) to be passed
-        * -1 if one of the pre-test(s) has expired, the content should not be displayed in this case
-        * Access: public 
-        */
-       function getPretest($cid) {
-               $this_pre_test_id = $this->getOnePretest($cid);
-               
-               if ($this->_menu_info[$cid]['content_parent_id'] == 0) {
-                       // this $cid has no parent, so we check its release date directly
-                       return $this_pre_test_id;
-               }
-               
-               // this is a sub page, need to check ALL its parents
-               $parent_pre_test_id = $this->getOnePretest($this->_menu_info[$cid]['content_parent_id']);
-               
-               if ($this_pre_test_id > 0 || $this_pre_test_id == -1)
-                       return $this_pre_test_id;
-               else if ($parent_pre_test_id > 0 || $parent_pre_test_id == -1)
-                       return $parent_pre_test_id;
-               else
-                       return 0;
-       }
-
-       /* returns the first test_id if this content has pre-test(s) to be passed, 
-        * 0 if has no pre-test(s) to be passed
-        * -1 if one of the pre-test(s) has expired, the content should not be displayed in this case
-        * Access: public 
-        */
-       function getOnePretest($cid) {
-               global $db, $msg;
-               include_once(TR_INCLUDE_PATH.'../home/lib/test_result_functions.inc.php');
-               
-               $sql = "SELECT *, UNIX_TIMESTAMP(t.start_date) AS start_date, UNIX_TIMESTAMP(t.end_date) AS end_date 
-                         FROM ".TABLE_PREFIX."tests t, ".TABLE_PREFIX."content_prerequisites cp
-                        WHERE cp.content_id=".$cid."
-                          AND cp.type = '".CONTENT_PRE_TEST."'
-                          AND cp.item_id=t.test_id";
-               $result= mysql_query($sql, $db);
-               
-               while ($row = mysql_fetch_assoc($result))
-               {
-                       // check to make sure we can access this test
-//                     if (!$row['guests'] && ($_SESSION['enroll'] == AT_ENROLL_NO || $_SESSION['enroll'] == AT_ENROLL_ALUMNUS)) {
-//                             $msg->addInfo('NOT_ENROLLED');
-//                     }
-                       
-                       if (!$row['guests'] && !authenticate_test($row['test_id'])) {
-                               $msg->addInfo(array('PRETEST_NO_PRIV',$row['title']));
-                       }
-                       
-                       // if the test is not release, not allow student to view the content
-                       if ($row['start_date'] > time() || $row['end_date'] < time()) {
-                               $msg->addInfo(array('PRETEST_EXPIRED',$row['title']));
-                               return -1;
-                       }
-                       
-                       $sql = "SELECT tr.result_id, count(*) num_of_questions, sum(ta.score) score, sum(tqa.weight) total_weight
-                                 FROM ".TABLE_PREFIX."tests_results tr, ".TABLE_PREFIX."tests_answers ta, ".TABLE_PREFIX."tests_questions_assoc tqa 
-                                WHERE tr.test_id = ".$row['test_id']."
-                                  AND tr.member_id = ".$_SESSION['user_id']."
-                                  AND tr.result_id = ta.result_id
-                                  AND tr.test_id = tqa.test_id
-                                  AND ta.question_id = tqa.question_id
-                                GROUP BY tr.result_id";
-                       $result_score = mysql_query($sql, $db);
-                       
-                       $num_of_attempts = 0;
-                       while ($row_score = mysql_fetch_assoc($result_score))
-                       {
-                               // skip the test when:
-                               // 1. no pass score is defined. this is a survey.
-                               // 2. the student has passed the test 
-                               // 3. the test has no question
-                               if (($row['passscore'] == 0 && $row['passpercent'] == 0) ||
-                                   $row_score['num_of_questions'] == 0 ||
-                                   ($row['passscore']<>0 && $row_score['score']>=$row['passscore']) || 
-                                   ($row['passpercent']<>0 && ($row_score['score']/$row_score['total_weight']*100)>=$row['passpercent']))
-                                   continue 2;
-                               
-                               $num_of_attempts++;
-                       }
-                       
-                       if ($row['num_takes'] != TR_TESTS_TAKE_UNLIMITED && $num_of_attempts >= $row['num_takes'])
-                       {
-                               $msg->addInfo(array('PRETEST_FAILED',$row['title']));
-                       }
-                       else
-                               return $row['test_id'];
-               }
-               return 0;
-       }
-
        /** 
         * Return true if this content page allows export, else false.
         * @param       int     content id
index c35debe..9f2ba2b 100644 (file)
@@ -29,7 +29,7 @@ if (isset($_GET['oauth_token']))
        
        if ($_GET['oauth_token'] == '')
        {
-               echo "error=".urlencode('Empty OAuth token.');
+               echo "error=".urlencode('Empty OAuth token');
                exit;
        }
        else
@@ -41,12 +41,12 @@ if (isset($_GET['oauth_token']))
 
                if (!is_array($token_row))
                {
-                       echo "error=".urlencode('Invalid OAuth token.');
+                       echo "error=".urlencode('Invalid OAuth token');
                        exit;
                }
                else if ($oAuthServerTokensDAO->isTokenExpired($_GET['oauth_token']))
                {
-                       echo "error=".urlencode('OAuth token expired.');
+                       echo "error=".urlencode('OAuth token expired');
                        exit;
                }
                
@@ -136,7 +136,7 @@ function check_available_size($course_id)
                        header('Location: '.$_base_path.'tools/tile/index.php');
                } 
                else if ($oauth_import) {
-                       echo "error=".urlencode('Empty OAuth token.');
+                       echo "error=".urlencode('Empty OAuth token');
                }
                else {
                        header('Location: ../create_course.php');
@@ -827,7 +827,7 @@ if ($msg->containsErrors()) {
        if (isset($_GET['tile'])) {
                header('Location: '.$_base_path.'tools/tile/index.php');
        } else if ($oauth_import) {
-               echo "error=".urlencode('Invalid imported file.');
+               echo "error=".urlencode('Invalid imported file');
        } else {
                header('Location: ../create_course.php');
        }
@@ -859,7 +859,7 @@ if ($msg->containsErrors()) {
        if (isset($_GET['tile'])) {
                header('Location: '.$_base_path.'tools/tile/index.php');
        } else if ($oauth_import) {
-               echo "error=".urlencode('Cannot create import directory.');
+               echo "error=".urlencode('Cannot create import directory');
        } else {
                header('Location: ../create_course.php');
        }
@@ -941,7 +941,7 @@ if ($ims_manifest_xml === false) {
        if (isset($_GET['tile'])) {
                header('Location: '.$_base_path.'tools/tile/index.php');
        } else if ($oauth_import) {
-               echo "error=".urlencode('IMS manifest file does not appear to be valid.');
+               echo "error=".urlencode('IMS manifest file does not appear to be valid');
        } else {
                header('Location: ../create_course.php');
        }
@@ -1003,7 +1003,7 @@ if ($msg->containsErrors()) {
        if (isset($_GET['tile'])) {
                header('Location: '.$_base_path.'tools/tile/index.php');
        } else if ($oauth_import) {
-               echo "error=".urlencode('Error at parsing IMS manifest file.');
+               echo "error=".urlencode('Error at parsing IMS manifest file');
        } else {
                header('Location: ../create_course.php');
        }
@@ -1422,7 +1422,7 @@ foreach ($items as $item_id => $content_info)
                                        $weight = 0;
                                }
                                $new_order = $order + 1;
-                               $testsQuestionsAssocDAO->Create($tid, $qid, $weight, $new_order, 0);
+                               $testsQuestionsAssocDAO->Create($tid, $qid, $weight, $new_order);
 //                             $sql = "INSERT INTO " . TABLE_PREFIX . "tests_questions_assoc" . 
 //                                             "(test_id, question_id, weight, ordering, required) " .
 //                                             "VALUES ($tid, $qid, $weight, $new_order, 0)";
diff --git a/docs/home/ims/index.php b/docs/home/ims/index.php
deleted file mode 100644 (file)
index 5e3814f..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-/****************************************************************/
-/* ATutor                                                                                                              */
-/****************************************************************/
-/* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg        */
-/* Adaptive Technology Resource Centre / University of Toronto  */
-/* http://atutor.ca                                                                                            */
-/*                                                              */
-/* 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: index.php 8901 2009-11-11 19:10:19Z cindy $
-
-define('AT_INCLUDE_PATH', '../../include/');
-require(AT_INCLUDE_PATH.'vitals.inc.php');
-
-require(AT_INCLUDE_PATH.'header.inc.php');
-
-if (!isset($_main_menu)) {
-       $_main_menu = $contentManager->getContent();
-}
-
-function print_menu_sections(&$menu, $parent_content_id = 0, $depth = 0, $ordering = '') {
-       $my_children = $menu[$parent_content_id];
-       $cid = $_GET['cid'];
-
-       if (!is_array($my_children)) {
-               return;
-       }
-       foreach ($my_children as $children) {
-               /* test content association, we don't want to display the test pages
-                * as part of the menu section.  If test, skip it.
-                */
-               if (isset($children['test_id'])){
-                       continue;
-               }
-
-               echo '<option value="'.$children['content_id'].'"';
-               if ($cid == $children['content_id']) {
-                       echo ' selected="selected"';
-               }
-               echo '>';
-               echo str_pad('', $depth, '-') . ' ';
-               if ($parent_content_id == 0) {
-                       $new_ordering = $children['ordering'];
-                       echo $children['ordering'];
-               } else {
-                       $new_ordering = $ordering.'.'.$children['ordering'];
-                       echo $ordering . '.'. $children['ordering'];
-               }
-               echo ' '.$children['title'].'</option>';
-
-               print_menu_sections($menu, $children['content_id'], $depth+1, $new_ordering);
-       }
-}
-
-if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && ($_SESSION['packaging'] == 'none')) {
-       echo '<p>'._AT('content_packaging_disabled').'</p>';
-       require (AT_INCLUDE_PATH.'footer.inc.php'); 
-       exit;
-} else if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && ($_SESSION['packaging'] == 'top')) {
-       $_main_menu = array($_main_menu[0]);
-}
-?>
-<form name="exportForm" method="post" action="tools/ims/ims_export.php">
-<div class="input-form">
-       <fieldset class="group_form"><legend class="group_form"><?php echo _AT('export_content'); ?></legend>
-       <div class="row">
-               <p><?php echo _AT('export_content_info'); ?></p>
-       </div>
-
-<?php if ($_main_menu[0]): ?>
-       <div class="row">
-               <label for="select_cid"><?php echo _AT('export_content_package_what'); ?></label><br />
-               <select name="cid" id="select_cid">
-                       <option value="0"><?php echo _AT('export_entire_course_or_chap'); ?></option>
-                       <option value="0"></option>
-                       <?php
-                               print_menu_sections($_main_menu);
-                       ?>
-               </select>
-       </div>
-
-       <?php if (authenticate(AT_PRIV_ADMIN, AT_PRIV_RETURN)): ?>
-                       <div class="row">
-                               <input type="radio" name="export_as" id="to_cp" value="1" checked="checked" onclick="changeFormAction('cp');" />
-                               <label for="to_cp"><?php echo _AT('content_package'); ?></label> <br />
-                               <input type="radio" name="export_as" id="to_cc" value="1" onclick="changeFormAction('cc');" />
-                               <label for="to_cc"><?php echo _AT('common_cartridge'); ?> </label>
-                       </div>
-                       <div class="row">
-                               <!--<input type="checkbox" name="to_tile" id="to_tile" value="1" />
-                               <label for="to_tile"><?php echo _AT('tile_export'); ?></label> <br /> -->
-                               <input type="checkbox" name="to_a4a" id="to_a4a" value="1" />
-                               <label for="to_a4a"><?php echo _AT('a4a_export'); ?></label>
-                       </div>
-       <?php endif; ?>
-       
-       <div class="row buttons">
-               <input type="submit" name="submit" value="<?php echo _AT('export'); ?>" />
-               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
-       </div>
-       </fieldset>
-<?php else: ?>
-       <div class="row">
-               <strong><?php echo _AT('none_found'); ?></strong>
-       </div>
-<?php endif; ?>
-
-</div>
-</form>
-
-<?php if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN)) {
-               require (AT_INCLUDE_PATH.'footer.inc.php'); 
-               exit;
-}
-?>
-<br /><br />
-
-
-<form name="form1" method="post" action="tools/ims/ims_import.php" enctype="multipart/form-data" onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php');">
-<div class="input-form">
-       <fieldset class="group_form"><legend class="group_form"><?php echo _AT('import_content'); ?></legend>
-       <div class="row">
-
-               <p><?php echo _AT('import_content_info'); ?></p>
-       </div>
-
-       <div class="row">
-               <label for="select_cid2"><?php echo _AT('import_content_package_where'); ?></label><br />
-               <select name="cid" id="select_cid2">
-                       <option value="0"><?php echo _AT('import_content_package_bottom_subcontent'); ?></option>
-                       <option value="0"></option>
-                       <?php
-                               print_menu_sections($_main_menu);
-                       ?>
-               </select>
-       </div>
-
-       <div class="row">
-               <input type="checkbox" name="allow_test_import" id="allow_test_import" checked="checked" />
-               <label for="allow_test_import"><?php echo _AT('test_import_package'); ?></label> <br />
-               <input type="checkbox" name="allow_a4a_import" id="allow_a4a_import" checked="checked" />
-               <label for="allow_a4a_import"><?php echo _AT('a4a_import_package'); ?></label>          
-       </div>
-       
-       <div class="row">
-               <label for="to_file"><?php echo _AT('upload_content_package'); ?></label><br />
-               <input type="file" name="file" id="to_file" />
-       </div>
-
-       <div class="row">
-               <label for="to_url"><?php echo _AT('specify_url_to_content_package'); ?></label><br />
-               <input type="text" name="url" value="http://" size="40" id="to_url" />
-       </div>
-
-       <div class="row buttons">
-               <input type="submit" name="submit" onclick="setClickSource('submit');" value="<?php echo _AT('import'); ?>" />
-               <input type="submit" name="cancel" onclick="document.form1.enctype='';setClickSource('cancel');" value="<?php echo _AT('cancel'); ?>" />
-       </div>
-</div>
-</form>
-
-<script language="javascript" type="text/javascript">
-
-var but_src;
-function setClickSource(name) {
-       but_src = name;
-}
-
-function openWindow(page) {
-       if (but_src != "cancel") {
-               newWindow = window.open(page, "progWin", "width=400,height=200,toolbar=no,location=no");
-               newWindow.focus();
-       }
-}
-
-//Change form action 
-function changeFormAction(type){
-       var obj = document.exportForm;
-       if (type=="cc"){
-               obj.action = "home/imscc/ims_export.php";
-       } else if (type=="cp"){
-               obj.action = "home/ims/ims_export.php";
-       }
-}
-
-</script>
-
-<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/images/archive.gif b/docs/images/archive.gif
new file mode 100644 (file)
index 0000000..06c4daa
Binary files /dev/null and b/docs/images/archive.gif differ
diff --git a/docs/images/edit.gif b/docs/images/edit.gif
new file mode 100644 (file)
index 0000000..2fa804d
Binary files /dev/null and b/docs/images/edit.gif differ
index ca86cfd..b9f48e6 100644 (file)
@@ -39,18 +39,32 @@ class ContentTestsAssocDAO extends DAO {
        }
        
        /**
-       * Delete a row
+       * Delete row by content ID
        * @access  public
-       * @param   name
+       * @param   contentID
        * @return  true or false
        * @author  Cindy Qi Li
-       function Delete($name)
+       */
+       function DeleteByContentID($contentID)
        {
-           $sql = "DELETE FROM ".TABLE_PREFIX."config 
-                    WHERE name = '".$name."'";
+           $sql = "DELETE FROM ".TABLE_PREFIX."content_tests_assoc 
+                    WHERE content_id = ".$contentID."";
            return $this->execute($sql);
        }
+       
+       /**
+       * Delete row by test ID
+       * @access  public
+       * @param   testID
+       * @return  true or false
+       * @author  Cindy Qi Li
        */
+       function DeleteByTestID($testID)
+       {
+           $sql = "DELETE FROM ".TABLE_PREFIX."content_tests_assoc 
+                    WHERE test_id = ".$testID."";
+           return $this->execute($sql);
+       }
        
        /**
        * Return rows by content ID
index 0ad1dee..692c82e 100644 (file)
@@ -30,7 +30,7 @@ class PrimaryResourcesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function Create($content_id, $file_name, $lang)
+       public function Create($content_id, $file_name, $lang)
        {
                global $addslashes;
                
@@ -47,13 +47,13 @@ class PrimaryResourcesDAO extends DAO {
        }
        
        /**
-       * Delete a config row
+       * Delete rows by content_id
        * @access  public
        * @param   content_id
        * @return  true or false
        * @author  Cindy Qi Li
        */
-       function Delete($cid)
+       public function Delete($cid)
        {
                $pri_resource_ids = array();
                
@@ -85,6 +85,20 @@ class PrimaryResourcesDAO extends DAO {
                return true;
        }
        
+       /**
+       * Delete rows that primary resource name is the given $resourceName
+       * @access  public
+       * @param   $resourceName: primary resource name
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       function DeleteByResourceName($resourceName)
+       {
+               $sql = "DELETE FROM ".TABLE_PREFIX."primary_resources
+                        WHERE resource = '".$resourceName."'";
+               return $this->execute($sql);
+       }
+       
        /**
        * Return a config row by content_id
        * @access  public
@@ -92,7 +106,7 @@ class PrimaryResourcesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function getByContent($cid)
+       public function getByContent($cid)
        {
            $sql = 'SELECT * FROM '.TABLE_PREFIX.'primary_resources WHERE content_id='.$cid;
            return $this->execute($sql);
index 9b5236d..e592ff2 100644 (file)
@@ -30,7 +30,7 @@ class PrimaryResourcesTypesDAO extends DAO {
        * @return  true, if successful; false, otherwise
        * @author  Cindy Qi Li
        */
-       function Create($primary_resource_id, $type_id)
+       public function Create($primary_resource_id, $type_id)
        {
                $primary_resource_id= intval($primary_resource_id);
                $type_id = intval($type_id);
@@ -41,6 +41,22 @@ class PrimaryResourcesTypesDAO extends DAO {
                return $this->execute($sql);
        }
        
+       /**
+       * Delete rows that primary resource name is the given $resourceName
+       * @access  public
+       * @param   $resourceName: primary resource name
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       function DeleteByResourceName($resourceName)
+       {
+               $sql = "DELETE FROM ".TABLE_PREFIX."primary_resources_types
+                        WHERE primary_resource_id in (SELECT primary_resource_id 
+                                     FROM ".TABLE_PREFIX."primary_resources
+                                    WHERE resource = '".$resourceName."')";
+               return $this->execute($sql);
+       }
+       
        /**
        * Return a config row by content_id
        * @access  public
@@ -48,7 +64,7 @@ class PrimaryResourcesTypesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function getByResourceID($resource_id)
+       public function getByResourceID($resource_id)
        {
            $sql = 'SELECT * FROM '.TABLE_PREFIX.'primary_resources_types WHERE primary_resource_id='.$resource_id;
            return $this->execute($sql);
index aacbc28..58e87cf 100644 (file)
@@ -30,7 +30,7 @@ class SecondaryResourcesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function Create($primary_resource_id, $file_name, $lang)
+       public function Create($primary_resource_id, $file_name, $lang)
        {
                global $addslashes;
                
@@ -46,13 +46,30 @@ class SecondaryResourcesDAO extends DAO {
        }
        
        /**
-       * Return a config row by content_id
+       * Delete rows that primary or secondary resource name is the given $resourceName
+       * @access  public
+       * @param   $resourceName: primary or secondary resource name
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       function DeleteByResourceName($resourceName)
+       {
+               $sql = "DELETE FROM ".TABLE_PREFIX."secondary_resources
+                        WHERE secondary_resource = '".$resourceName."'
+                           OR primary_resource_id in (SELECT primary_resource_id
+                                    FROM ".TABLE_PREFIX."primary_resources
+                                   WHERE resource='".$resourceName."')";
+               return $this->execute($sql);
+       }
+       
+       /**
+       * Return distinct rows by content_id
        * @access  public
        * @param   content_id
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function getByContent($content_id)
+       public function getByContent($content_id)
        {
                $sql = "SELECT DISTINCT secondary_resource_id, secondary_resource FROM ".TABLE_PREFIX."primary_resources a 
                          LEFT JOIN ".TABLE_PREFIX."secondary_resources s
@@ -61,13 +78,13 @@ class SecondaryResourcesDAO extends DAO {
                return $this->execute($sql);
        }
        /**
-       * Return a config row by content_id
+       * Return rows by primary resource id
        * @access  public
        * @param   name
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function getByPrimaryResourceID($primary_resource_id)
+       public function getByPrimaryResourceID($primary_resource_id)
        {
            $sql = 'SELECT * FROM '.TABLE_PREFIX.'secondary_resources WHERE primary_resource_id='.$primary_resource_id;
            return $this->execute($sql);
index 0176845..dd09fcf 100644 (file)
@@ -30,7 +30,7 @@ class SecondaryResourcesTypesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function Create($secondary_resource, $type_id)
+       public function Create($secondary_resource, $type_id)
        {
                $secondary_resource = intval($secondary_resource);
                $type_id = intval($type_id);
@@ -41,6 +41,25 @@ class SecondaryResourcesTypesDAO extends DAO {
                return $this->execute($sql);
        }
        
+       /**
+       * Delete rows that primary or secondary resource name is the given $resourceName
+       * @access  public
+       * @param   $resourceName: primary or secondary resource name
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       public function DeleteByResourceName($resourceName)
+       {
+               $sql = "DELETE FROM ".TABLE_PREFIX."secondary_resources_types
+                        WHERE secondary_resource_id in (SELECT secondary_resource_id 
+                                     FROM ".TABLE_PREFIX."secondary_resources
+                                    WHERE secondary_resource = '".$resourceName."'
+                                       OR primary_resource_id in (SELECT primary_resource_id
+                                                     FROM ".TABLE_PREFIX."primary_resources
+                                                    WHERE resource='".$resourceName."'))";
+               return $this->execute($sql);
+       }
+       
        /**
        * Return a config row by content_id
        * @access  public
@@ -48,7 +67,7 @@ class SecondaryResourcesTypesDAO extends DAO {
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function getByResourceID($resource_id)
+       public function getByResourceID($resource_id)
        {
            $sql = 'SELECT * FROM '.TABLE_PREFIX.'secondary_resources_types WHERE secondary_resource_id='.$resource_id;
            return $this->execute($sql);
index 2675c36..a317a4d 100644 (file)
@@ -26,15 +26,45 @@ class TestsQuestionsAssocDAO extends DAO {
        /**
        * Insert a new row
        * @access  public
-       * @param   test_id, question_id, weight, order, required
+       * @param   test_id, question_id, weight, order
        * @return  table rows
        * @author  Cindy Qi Li
        */
-       function Create($test_id, $question_id, $weight, $order, $required)
+       function Create($testID, $questionID, $weight, $order)
        {
                $sql = "INSERT INTO " . TABLE_PREFIX . "tests_questions_assoc" . 
-                               "(test_id, question_id, weight, ordering, required) " .
-                               "VALUES ($test_id, $question_id, $weight, $order, $required)";
+                               "(test_id, question_id, weight, ordering) " .
+                               "VALUES ($testID, $questionID, $weight, $order)";
+           return $this->execute($sql);
+       }
+       
+       /**
+       * Update an existing row
+       * @access  public
+       * @param   test_id, question_id, weight, order
+       * @return  table rows
+       * @author  Cindy Qi Li
+       */
+       function Update($testID, $questionID, $weight, $order)
+       {
+               $sql    = "UPDATE ".TABLE_PREFIX."tests_questions_assoc 
+                             SET weight=".$weight.", ordering=".$order." 
+                           WHERE question_id=".$questionID." AND test_id=".$testID;
+               return $this->execute($sql);
+       }
+       
+       /**
+       * Delete a row by test id and question id
+       * @access  public
+       * @param   testID, questionID
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       function Delete($testID, $questionID)
+       {
+           $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc 
+                    WHERE test_id = ".$testID."
+                      AND question_id = ".$questionID;
            return $this->execute($sql);
        }
        
@@ -48,7 +78,21 @@ class TestsQuestionsAssocDAO extends DAO {
        function DeleteByQuestionID($questionID)
        {
            $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc 
-                    WHERE question_id = '".$questionID."'";
+                    WHERE question_id = ".$questionID;
+           return $this->execute($sql);
+       }
+       
+       /**
+       * Delete rows by test id
+       * @access  public
+       * @param   testID
+       * @return  true or false
+       * @author  Cindy Qi Li
+       */
+       function DeleteByTestID($testID)
+       {
+           $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc 
+                    WHERE test_id = ".$testID;
            return $this->execute($sql);
        }
        
@@ -61,7 +105,7 @@ class TestsQuestionsAssocDAO extends DAO {
        */
        function getByTestID($testID)
        {
-           $sql = "SELECT TQ.*, TQA.weight, TQA.ordering, TQA.required 
+           $sql = "SELECT TQ.*, TQA.test_id, TQA.weight, TQA.ordering 
                      FROM ".TABLE_PREFIX."tests_questions TQ 
                     INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA 
                     USING (question_id) 
@@ -69,5 +113,36 @@ class TestsQuestionsAssocDAO extends DAO {
                     ORDER BY TQA.ordering, TQA.question_id";
            return $this->execute($sql);
        }
+
+       /**
+       * Return all associated questions with the weight 0 in the given test
+       * @access  public
+       * @param   testID
+       * @return  table rows if successful. false if unsuccessful
+       * @author  Cindy Qi Li
+       */
+       function getZeroWeightRowsByTestID($testID)
+       {
+           $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions_assoc QA, ".TABLE_PREFIX."tests_questions Q 
+                    WHERE QA.test_id=$testID 
+                      AND QA.weight=0 
+                      AND QA.question_id=Q.question_id 
+                      AND Q.type<>4";
+           return $this->execute($sql);
+       }
+       
+       /**
+       * Return the maximum ordering number in the given test
+       * @access  public
+       * @param   testID
+       * @return  the maximum ordering number
+       * @author  Cindy Qi Li
+       */
+       function getMaxOrderByTestID($testID)
+       {
+               $sql = "SELECT MAX(ordering) AS max_ordering FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=".$testID;
+           $rows = $this->execute($sql);
+           return $rows[0]['max_ordering'];
+       }
 }
 ?>
\ No newline at end of file
diff --git a/docs/include/classes/DAO/TestsQuestionsDAO.class.php b/docs/include/classes/DAO/TestsQuestionsDAO.class.php
new file mode 100644 (file)
index 0000000..1723744
--- /dev/null
@@ -0,0 +1,170 @@
+<?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.                        */
+/************************************************************************/
+
+/**
+ * DAO for "tests_questions" table
+ * @access     public
+ * @author     Cindy Qi Li
+ * @package    DAO
+ */
+
+if (!defined('TR_INCLUDE_PATH')) exit;
+
+require_once(TR_INCLUDE_PATH. 'classes/DAO/DAO.class.php');
+
+class TestsQuestionsDAO extends DAO {
+       
+       /**
+        * Update an the given field to a given value of an existing record
+        * @access  public
+        * @param   questionID: question ID
+        *          fieldName: the name of the table field to update
+        *          fieldValue: the value to update
+        * @return  true if successful
+        *          error message array if failed; false if update db failed
+        * @author  Cindy Qi Li
+        */
+       public function UpdateField($questionID, $fieldName, $fieldValue)
+       {
+               global $addslashes;
+               
+               $sql = "UPDATE ".TABLE_PREFIX."tests_questions 
+                          SET ".$fieldName."='".$addslashes($fieldValue)."'
+                        WHERE question_id = ".$questionID;
+               
+               return $this->execute($sql);
+       }
+       
+       /**
+        * Delete a row
+        * @access  public
+        * @param   question ID
+        * @return  true, if successful
+        *          false if unsuccessful
+        * @author  Cindy Qi Li
+        */
+       public function Delete($questionID)
+       {
+               $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions WHERE question_id = ".$questionID;
+               return $this->execute($sql);
+       }
+
+       /**
+        * Return information by a given question id
+        * @access  public
+        * @param   questionID: category id
+        * @return  the row if successful, otherwise, return false
+        * @author  Cindy Qi Li
+        */
+       public function get($questionID)
+       {
+               $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions 
+                            WHERE question_id=".$questionID;
+               
+               $rows = $this->execute($sql);
+               
+               if (is_array($rows)) return $rows[0];
+               else return false;
+       }
+       
+       /**
+        * Return information by an array of question ids
+        * @access  public
+        * @param   questionIDsArray: an array of question ids
+        * @return  the row if successful, otherwise, return false
+        * @author  Cindy Qi Li
+        */
+       public function getByQuestionIDs($questionIDsArray)
+       {
+               if (!is_array($questionIDsArray) || count($questionIDsArray) == 0) return false;
+               
+               $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions 
+                            WHERE question_id in (".implode(',', $questionIDsArray). ")";
+               
+               return $this->execute($sql);
+       }
+       
+       /**
+        * Return content information by given course id and category id
+        * @access  public
+        * @param   courseID
+        *          categoryID
+        * @return  rows
+        * @author  Cindy Qi Li
+        */
+       public function getByCourseIDAndCategoryID($courseID, $categoryID)
+       {
+               $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions 
+                        WHERE course_id=".$courseID."
+                          AND category_id = ".$categoryID."
+                        ORDER BY question";
+               
+               return $this->execute($sql);
+       }
+
+       /**
+        * Return content information by given course id and question type
+        * @access  public
+        * @param   courseID
+        *          type: question type
+        * @return  rows
+        * @author  Cindy Qi Li
+        */
+       public function getByCourseIDAndType($courseID, $type)
+       {
+               $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions 
+                        WHERE course_id=".$courseID."
+                          AND type = ".$type;;
+               
+               return $this->execute($sql);
+       }
+
+       /**
+        * Validates fields preparing for insert and update
+        * @access  private
+        * @param   $validate_type : new/update. When "new", $ID is course_id. When "update", $ID is category_id
+        *          $title
+        *          $ID
+        * @return  true    if update successfully
+        *          false   if update unsuccessful
+        * @author  Cindy Qi Li
+        */
+       private function isFieldsValid($validate_type, $title, $ID)
+       {
+               global $msg;
+               
+               $missing_fields = array();
+               /* login name check */
+               if ($title == '')
+               {
+                       $missing_fields[] = _AT('title');
+               }
+
+               if ($ID == 0)
+               {
+                       if ($validate_type == 'new') $missing_fields[] = _AT('course_id');
+                       if ($validate_type == 'update') $missing_fields[] = _AT('category_id');
+               }
+
+               if ($missing_fields)
+               {
+                       $missing_fields = implode(', ', $missing_fields);
+                       $msg->addError(array('EMPTY_FIELDS', $missing_fields));
+               }
+               
+               if (!$msg->containsErrors())
+                       return true;
+               else
+                       return false;
+       }
+}
+?>
\ No newline at end of file
index c475831..1ea2d8c 100644 (file)
@@ -125,30 +125,6 @@ class FileUtility {
                return $size;
        }
        
-       /**
-       * This function gets used by PclZip when extracting a zip archive.
-       * @access  private
-       * @return  int                          whether or not to include the file
-       * @author  Joel Kronenberg
-       */
-       public static function preExtractCallBack($p_event, &$p_header) {
-               global $translated_file_names;
-
-               if ($p_header['folder'] == 1) {
-                       return 1;
-               }
-
-               if ($translated_file_names[$p_header['index']] == '') {
-                       return 0;
-               }
-
-               if ($translated_file_names[$p_header['index']]) {
-                       $p_header['filename'] = substr($p_header['filename'], 0, -strlen($p_header['stored_filename']));
-                       $p_header['filename'] .= $translated_file_names[$p_header['index']];
-               }
-               return 1;
-       }
-
        /* prints the <options> out of $cats which is an array of course categories where */
        /* $cats[parent_cat_id][] = $row */
        public static function print_course_cats($parent_cat_id, &$cats, $cat_row, $depth=0) {
@@ -175,9 +151,9 @@ class FileUtility {
                $abs_num_bytes = abs($num_bytes);
        
                if ($abs_num_bytes >= TR_KBYTE_SIZE * TR_KBYTE_SIZE) {
-                       return round(bytes_to_megabytes($num_bytes), 2) .' '. _AT('mb');
+                       return round(FileUtility::bytes_to_megabytes($num_bytes), 2) .' '. _AT('mb');
                } else if ($abs_num_bytes >= TR_KBYTE_SIZE) {
-                       return round(bytes_to_kilobytes($num_bytes), 2) .' '._AT('kb') ;
+                       return round(FileUtility::bytes_to_kilobytes($num_bytes), 2) .' '._AT('kb') ;
                }
                // else:
        
@@ -303,7 +279,7 @@ class FileUtility {
        
                                        $dir_option .= '<ul><li class="folders'.$class.'">';
                                        $dir_option .= '<label><input type="radio" name="dir_name" value="'.$cur_dir.$file.'" '.$check. '/>'. $file . $here. '</label>';
-                                       $dir_option .= ''.display_tree($current_path,$cur_dir.$file.'/', $pathext, $ignore_children).'';
+                                       $dir_option .= ''.FileUtility::display_tree($current_path,$cur_dir.$file.'/', $pathext, $ignore_children).'';
                                        $dir_option .= '</li></ul>';
        
                                        if (($cur_dir == $pathext) && in_array($file, $list_array)) {
@@ -321,11 +297,11 @@ class FileUtility {
        }
        
        public static function course_realpath($file) {
-               if (!$_SESSION['course_id']) {
-                       return FALSE;
-               }
+               global $_course_id;
                
-               $course_path = TR_CONTENT_DIR . $_SESSION['course_id'];
+               if (!$_course_id) return FALSE;
+               
+               $course_path = TR_CONTENT_DIR . $_course_id;
                
                $path_parts = pathinfo($file);
                
index 8c4fcad..c4bf091 100644 (file)
@@ -121,7 +121,6 @@ class Menu {
                        {
                                // replace the required constants in link
                                $row['link'] = Utility::replaceConstants($row['link']);
-                               
                                list($url, $param) = Utility::separateURLAndParam($row['link']);
                                if (Utility::authenticate($row['user_requirement'], false)) {
                                        $this->pages[TR_NAV_TOP][] = array('url' => $_base_path.$row['link'], 
@@ -169,9 +168,11 @@ class Menu {
                        // re-direct to first $_pages URL
                        foreach ($this->pages[TR_NAV_TOP] as $page)
                        {
+//                             debug($_base_path.$this->current_page);debug($page);
                                if ($_base_path.$this->current_page != $page['url'])
                                {
-                                       header('location: '.$page['url']);
+//                                     debug('here');exit;
+                                       header('Location: '.$page['url']);
                                                
                                        // reset current_page after re-direction
                                        $this->current_page = substr($_SERVER['PHP_SELF'], strlen($_base_path));
@@ -206,7 +207,7 @@ class Menu {
                        foreach ($this->pages[$page]['children'] as $child) 
                        {
                                $this->pages[$child]['param'] = $param;
-                               $sub_menus[] = array('url' => $_base_path . $child.$param
+                               $sub_menus[] = array('url' => $this->addUrlParam($_base_path . $child, $param)
                                                    'title' => $this->getPageTitle($child), 
                                                    'has_children' => isset($this->pages[$child]['children']),
                                                    'param' => $param);
@@ -285,6 +286,46 @@ class Menu {
                return $page_title;
        }
        
+       /**
+        * Return the URL with the given parameter attached. $param can have multiple parameters.
+        * The repetitive parameter is skipped
+        * @access  private
+        * @param   $url: URL, can be completed or not completed. For example: tests/index.php?a=1
+        *          $param: URL parameters. For example: ?a=3&b=4
+        * @return  the URL with the given parameter attached at the end. The repetitive parameter is skipped.
+        * @author  Cindy Qi Li
+        */
+       private function addUrlParam($url, $param)
+       {
+               // remove '?'
+               $param = str_replace('?', '', trim($param));
+               if ($param == '') return $url;
+               
+               $has_question_mark = false;
+               if (strpos($url, '?') > 0) $has_question_mark = true;
+               else $counter = 0;
+               
+               $all_params = explode('&', $param);
+               if (is_array($all_params)) {
+                       foreach ($all_params as $each_param)
+                       {
+                               $pair = explode('=', $each_param);
+                               // check if the parameter is already in the url
+                               if (strpos($url, $pair[0].'=') > 0) continue;
+                               else {
+                                       if ($has_question_mark || $counter > 0)
+                                               $url .= '&'.$each_param;
+                                       else {
+                                               $url .= '?'.$each_param;
+                                               $counter++;
+                                       }
+                               }
+                       }
+               }
+               
+               return $url;
+       }
+       
        /**
         * Return all pages array
         * @access  public
@@ -429,7 +470,7 @@ class Menu {
        {
                if (isset($this->pages[$page]['param'])) return $this->pages[$page]['param'];
                
-               if ($page == TR_NAV_TOP) return '';
+               if ($page == TR_NAV_TOP || $page == TR_NAV_PUBLIC) return '';
                
                if (isset($this->pages[$this->pages[$page]['parent']]['param']))
                        return $this->pages[$this->pages[$page]['parent']]['param'];
index c7cc411..674e967 100644 (file)
@@ -11,7 +11,7 @@
 /************************************************************************/
 
 define('TR_INCLUDE_PATH', '../../');
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');
 require_once(TR_INCLUDE_PATH.'classes/QTI/QTIParser.class.php');       
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
 
@@ -197,123 +197,12 @@ class QTIImport {
         * @return      int             test id
         */
        function importTest($title='') {
-               global $msg, $db;
-
-               $missing_fields                         = array();
-               $test_obj['title']                      = ($title=='')?$this->title:$title;
-               $test_obj['description']        = '';
-               $test_obj['num_questions']      = 0;
-               $test_obj['num_takes']          = 0;
-               $test_obj['content_id']         = 0;
-               $test_obj['passpercent']        = 0;
-               $test_obj['passscore']          = 0;
-               $test_obj['passfeedback']       = 0;
-               $test_obj['failfeedback']       = 0;
-               $test_obj['num_takes']          = 0;
-               $test_obj['anonymous']          = 0;
-               $test_obj['allow_guests']       = $_POST['allow_guests'] ? 1 : 0;
-               $test_obj['instructions']       = '';
-               $test_obj['display']            = 0;
-               $test_obj['result_release']     = 0;
-               $test_obj['random']                     = 0;
-
-               // currently these options are ignored for tests:
-               $test_obj['format']                     = intval($test_obj['format']);
-               $test_obj['order']                      = 1;  //intval($test_obj['order']);
-               $test_obj['difficulty']         = 0;  //intval($test_obj['difficulty']);        /* avman */
-                       
-               //Title of the test is empty, could be from question database export or some other system's export.
-               //Either prompt for a title, or generate a random title
-               if ($test_obj['title'] == '') {
-                       if ($this->title != '') {
-                               $test_obj['title'] = $this->title;
-                       } else {
-                               //set marks to 0 if no title? 
-                               $this->weights = array();
-                       }
-               }
-
-               $day_start      = intval(date('j'));
-               $month_start= intval(date('n'));
-               $year_start     = intval(date('Y'));
-               $hour_start     = intval(date('G'));
-               $min_start      = intval(date('i'));
-
-               $day_end        = $day_start;
-               $month_end      = $month_start;
-               $year_end       = $year_start;  //as of Oct 21,09. Check http://www.atutor.ca/atutor/mantis/view.php?id=3961
-               $hour_end       = $hour_start;
-               $min_end        = $min_start;
-
-               if (!checkdate($month_start, $day_start, $year_start)) {
-                       $msg->addError('START_DATE_INVALID');
-               }
-
-               if (!checkdate($month_end, $day_end, $year_end)) {
-                       $msg->addError('END_DATE_INVALID');
-               }
-
-               if (mktime($hour_end,   $min_end,   0, $month_end,   $day_end,   $year_end) < 
-                       mktime($hour_start, $min_start, 0, $month_start, $day_start, $year_start)) {
-                               $msg->addError('END_DATE_INVALID');
-               }
-
-               if (!$msg->containsErrors()) {
-                       if (strlen($month_start) == 1){
-                               $month_start = "0$month_start";
-                       }
-                       if (strlen($day_start) == 1){
-                               $day_start = "0$day_start";
-                       }
-                       if (strlen($hour_start) == 1){
-                               $hour_start = "0$hour_start";
-                       }
-                       if (strlen($min_start) == 1){
-                               $min_start = "0$min_start";
-                       }
-
-                       if (strlen($month_end) == 1){
-                               $month_end = "0$month_end";
-                       }
-                       if (strlen($day_end) == 1){
-                               $day_end = "0$day_end";
-                       }
-                       if (strlen($hour_end) == 1){
-                               $hour_end = "0$hour_end";
-                       }
-                       if (strlen($min_end) == 1){
-                               $min_end = "0$min_end";
-                       }
-
-                       $start_date = "$year_start-$month_start-$day_start $hour_start:$min_start:00";
-                       $end_date       = "$year_end-$month_end-$day_end $hour_end:$min_end:00";
-
-                       //If title exceeded database defined length, truncate it.
-                       $test_obj['title'] = validate_length($test_obj['title'], 100);
-                       
-                       $testsDAO = new TestsDAO();
-                       $tid = $testsDAO->Create(       $_SESSION['course_id'], 
-                                                                       $test_obj['title'], 
-                                                                       $test_obj['description'], 
-                                                                       $test_obj['format'], 
-                                                                       $start_date, 
-                                                                       $end_date, 
-                                                                       $test_obj['order'], 
-                                                                       $test_obj['num_questions'], 
-                                                                       $test_obj['instructions'], 
-                                                                       $test_obj['content_id'], 
-                                                                       $test_obj['passscore'], 
-                                                                       $test_obj['passpercent'], 
-                                                                       $test_obj['passfeedback'], 
-                                                                       $test_obj['failfeedback'], 
-                                                                       $test_obj['result_release'], 
-                                                                       $test_obj['random'], 
-                                                                       $test_obj['difficulty'], 
-                                                                       $test_obj['num_takes'], 
-                                                                       $test_obj['anonymous'], 
-                                                                       '', 
-                                                                       $test_obj['allow_guests'], 
-                                                                       $test_obj['display']);
+               global $_course_id;
+               
+               $testsDAO = new TestsDAO();
+               $tid = $testsDAO->Create($_course_id, 
+                                                               $this->title, 
+                                                               $test_obj['description']);
 
 //                     $sql_params = array (   $_SESSION['course_id'], 
 //                                                                     $test_obj['title'], 
@@ -342,7 +231,6 @@ class QTIImport {
 //                     $result = mysql_query($sql, $db);
 //                     $tid = mysql_insert_id($db);
                //debug($qti_import->weights, 'weights');                       
-               }
                return $tid;
        }
 
index f354afe..2f114fe 100644 (file)
@@ -35,80 +35,6 @@ class Utility {
                else return $code;\r
        }\r
 \r
-       /**\r
-       * This function deletes $dir recrusively without deleting $dir itself.\r
-       * @access  public\r
-       * @param   string $charsets_array       The name of the directory where all files and folders under needs to be deleted\r
-       * @author  Cindy Qi Li\r
-       */\r
-       public static function clearDir($dir) {\r
-               if(!$opendir = @opendir($dir)) {\r
-                       return false;\r
-               }\r
-               \r
-               while(($readdir=readdir($opendir)) !== false) {\r
-                       if (($readdir !== '..') && ($readdir !== '.')) {\r
-                               $readdir = trim($readdir);\r
-       \r
-                               clearstatcache(); /* especially needed for Windows machines: */\r
-       \r
-                               if (is_file($dir.'/'.$readdir)) {\r
-                                       if(!@unlink($dir.'/'.$readdir)) {\r
-                                               return false;\r
-                                       }\r
-                               } else if (is_dir($dir.'/'.$readdir)) {\r
-                                       /* calls lib function to clear subdirectories recrusively */\r
-                                       if(!Utility::clrDir($dir.'/'.$readdir)) {\r
-                                               return false;\r
-                                       }\r
-                               }\r
-                       }\r
-               } /* end while */\r
-       \r
-               @closedir($opendir);\r
-               \r
-               return true;\r
-       }\r
-\r
-       /**\r
-       * Enables deletion of directory if not empty\r
-       * @access  public\r
-       * @param   string $dir          the directory to delete\r
-       * @return  boolean                      whether the deletion was successful\r
-       * @author  Joel Kronenberg\r
-       */\r
-       public static function clrDir($dir) {\r
-               if(!$opendir = @opendir($dir)) {\r
-                       return false;\r
-               }\r
-               \r
-               while(($readdir=readdir($opendir)) !== false) {\r
-                       if (($readdir !== '..') && ($readdir !== '.')) {\r
-                               $readdir = trim($readdir);\r
-       \r
-                               clearstatcache(); /* especially needed for Windows machines: */\r
-       \r
-                               if (is_file($dir.'/'.$readdir)) {\r
-                                       if(!@unlink($dir.'/'.$readdir)) {\r
-                                               return false;\r
-                                       }\r
-                               } else if (is_dir($dir.'/'.$readdir)) {\r
-                                       /* calls itself to clear subdirectories */\r
-                                       if(!Utility::clrDir($dir.'/'.$readdir)) {\r
-                                               return false;\r
-                                       }\r
-                               }\r
-                       }\r
-               } /* end while */\r
-       \r
-               @closedir($opendir);\r
-               \r
-               if(!@rmdir($dir)) {\r
-                       return false;\r
-               }\r
-               return true;\r
-       }\r
-\r
        /* takes the array of valid prefs and assigns them to the current session */\r
        public static function assign_session_prefs($prefs) {\r
                unset($_SESSION['prefs']);\r
@@ -256,7 +182,7 @@ class Utility {
                {\r
                        if ($oauth_import)\r
                        {\r
-                               echo "error=".urlencode('User has no author privilege.');\r
+                               echo "error=".urlencode('User has no author privilege');\r
                                exit;\r
                        }\r
                        else if ($printMsg)\r
similarity index 97%
rename from docs/tests/classes/testQuestions.class.php
rename to docs/include/classes/testQuestions.class.php
index 94b8ce1..9c87b17 100644 (file)
@@ -10,7 +10,7 @@
 /* as published by the Free Software Foundation.                        */
 /************************************************************************/
 
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 
 /*
  * Steps to follow when adding a new question type:
@@ -138,12 +138,8 @@ function test_question_qti_export_v2p1($question_ids) {
 
        asort($question_ids);
 
-//     $question_ids_delim = implode(',',$question_ids);
        $testsQuestionsDAO = new TestsQuestionsDAO();
        $rows = $testsQuestionsDAO->getByQuestionIDs($question_ids);
-//     $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions WHERE course_id=$_SESSION[course_id] AND question_id IN($question_ids_delim)";
-//     $result = mysql_query($sql, $db);
-//     while ($row = mysql_fetch_assoc($result)) {
        if (is_array($rows)) {
                foreach ($rows as $row) {
                        $obj = TestQuestions::getQuestion($row['type']);
@@ -215,11 +211,6 @@ function test_question_qti_export($question_ids) {
 
        asort($question_ids);
 
-//     $question_ids_delim = implode(',',$question_ids);
-
-//     $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions WHERE course_id=$_SESSION[course_id] AND question_id IN($question_ids_delim)";
-//     $result = mysql_query($sql, $db);
-//     while ($row = mysql_fetch_assoc($result)) {
        $testsQuestionsDAO = new TestsQuestionsDAO();
        $rows = $testsQuestionsDAO->getByQuestionIDs($question_ids);
        if (is_array($rows)) {
@@ -745,7 +736,8 @@ class OrderingQuestion extends AbstractTestQuestion {
        function importQTI($_POST){
                global $_course_id;
                
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
                global $msg, $db;
                
                if ($_POST['question'] == ''){
@@ -773,7 +765,7 @@ class OrderingQuestion extends AbstractTestQuestion {
                                 * Db defined it to be 255 length, chop strings off it it's less than that
                                 * @harris
                                 */
-                               $_POST['choice'][$i] = validate_length($_POST['choice'][$i], 255);
+                               $_POST['choice'][$i] = Utility::validateLength($_POST['choice'][$i], 255);
                                $_POST['choice'][$i] = trim($_POST['choice'][$i]);
 
                                if ($_POST['choice'][$i] != '') {
@@ -873,7 +865,7 @@ class TruefalseQuestion extends AbstracttestQuestion {
 
        //QTI Import True/False Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
                global $msg, $db, $_course_id;
 
                if ($_POST['question'] == ''){
@@ -973,7 +965,7 @@ class LikertQuestion extends AbstracttestQuestion {
 
        //QTI Import Likert Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
                global $msg, $db, $_course_id;
 //             $_POST = $this->_POST; 
 
@@ -1085,7 +1077,7 @@ class LongQuestion extends AbstracttestQuestion {
 
        //QTI Import Open end/long Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
                global $msg, $db, $_course_id;
 //             $_POST = $this->_POST; 
 
@@ -1244,7 +1236,7 @@ class MatchingQuestion extends AbstracttestQuestion {
 
        //QTI Import Matching Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
                global $msg, $db, $_course_id;
 //             $_POST = $this->_POST; 
 
@@ -1311,8 +1303,6 @@ class MatchingQuestion extends AbstracttestQuestion {
 
                        $sql = vsprintf(TR_SQL_QUESTION_MATCHINGDD, $sql_params);
 
-//                     $result = mysql_query($sql, $db);
-//                     if ($result==true){
                        $dao = new DAO();
                        if ($dao->execute($sql)) {
                                return mysql_insert_id();
@@ -1417,7 +1407,7 @@ class MultichoiceQuestion extends AbstracttestQuestion {
 
        //QTI Import Multiple Choice Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
                global $msg, $db, $_course_id;
 //             $_POST = $this->_POST; 
                if ($_POST['question'] == ''){
@@ -1516,7 +1506,8 @@ class MultianswerQuestion extends MultichoiceQuestion {
 
        //QTI Import multianswer Question
        function importQTI($_POST){
-               require_once(TR_INCLUDE.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/DAO/DAO.class.php');
+               require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
                global $msg, $db, $_course_id;
 //             $_POST = $this->_POST; 
 
@@ -1533,7 +1524,7 @@ class MultianswerQuestion extends MultichoiceQuestion {
                        $answer_new = array(); // stores the associated "answer" for the choices
 
                        foreach ($_POST['choice'] as $choiceNum=>$choiceOpt) {
-                               $choiceOpt = validate_length($choiceOpt, 255);
+                               $choiceOpt = Utility::validateLength($choiceOpt, 255);
                                $choiceOpt = trim($choiceOpt);
                                $_POST['answer'][$choiceNum] = intval($_POST['answer'][$choiceNum]);
                                if ($choiceOpt == '') {
index be970a4..4960b37 100644 (file)
@@ -12,6 +12,7 @@
 
 global $savant;
 global $_base_path, $_course_id;
+global $framed, $popup;
 
 if (!defined('TR_INCLUDE_PATH')) { exit; }
 
@@ -28,5 +29,10 @@ $savant->assign('course_id', $_course_id);
 $savant->assign('base_path', $_base_path);
 $savant->assign('theme', $_SESSION['prefs']['PREF_THEME']);
 
-$savant->display('include/footer.tmpl.php');
+if ($framed || $popup) {
+       $savant->display('include/fm_footer.tmpl.php');
+}
+else {
+       $savant->display('include/footer.tmpl.php');
+}
 ?>
index 5915b5d..b049409 100644 (file)
@@ -26,6 +26,7 @@ global $_custom_css;
 global $_custom_head;
 global $_base_path;
 global $_pages;
+global $framed, $popup;
 global $_current_user, $_course_id, $_sequence_links;
 global $validate_content;
 global $contentManager;
@@ -100,7 +101,7 @@ if (isset($course_base_href) || isset($content_base_href)) {
 $savant->assign('content_base_href', $_tmp_base_href);
 $savant->assign('lang_code', $_SESSION['lang']);
 $savant->assign('lang_charset', $myLang->getCharacterSet());
-$savant->assign('base_path', TR_BASE_HREF);
+$savant->assign('base_path', $_base_path);
 $savant->assign('theme', $_SESSION['prefs']['PREF_THEME']);
 
 $theme_img  = $_base_path . 'themes/'. $_SESSION['prefs']['PREF_THEME'] . '/images/';
@@ -128,6 +129,14 @@ $savant->assign('custom_css', $custom_css);
 if ($onload) $savant->assign('onload', $onload);
 $savant->assign('course_id', $_course_id);
 
-$savant->display('include/header.tmpl.php');
+if ($framed || $popup) {
+    $savant->assign('framed', 1);
+    $savant->assign('popup', 1);
+
+       $savant->display('include/fm_header.tmpl.php');
+
+} else {
+    $savant->display('include/header.tmpl.php');
+}
 
 ?>
diff --git a/docs/include/jscripts/interface.js b/docs/include/jscripts/interface.js
new file mode 100644 (file)
index 0000000..eb5dfa9
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+ * Interface elements for jQuery - http://interface.eyecon.ro
+ *
+ * Copyright (c) 2006 Stefan Petre
+ * Dual licensed under the MIT (MIT-LICENSE.txt) 
+ * and GPL (GPL-LICENSE.txt) licenses.
+ */
+ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6.M={4Z:z(e,s){J l=0;J t=0;J 26=0;J 22=0;J w=6.C(e,\'1S\');J h=6.C(e,\'1T\');J 10=e.3c;J R=e.3d;3b(e.3a){l+=e.2b+(e.16?A(e.16.2H)||0:0);t+=e.2k+(e.16?A(e.16.2E)||0:0);9(s){26+=e.1r.1A||0;22+=e.1r.1n||0}e=e.3a}l+=e.2b+(e.16?A(e.16.2H)||0:0);t+=e.2k+(e.16?A(e.16.2E)||0:0);22=t-22;26=l-26;v{x:l,y:t,4A:26,4B:22,w:w,h:h,10:10,R:R}},1C:z(e){J x=0;J y=0;J 35=n;O=e.L;9(6(e).C(\'N\')==\'15\'){2e=O.1M;2n=O.1b;O.1M=\'36\';O.N=\'2L\';O.1b=\'2v\';35=D}u=e;3b(u){x+=u.2b+(u.16&&!6.1t.2c?A(u.16.2H)||0:0);y+=u.2k+(u.16&&!6.1t.2c?A(u.16.2E)||0:0);u=u.3a}u=e;3b(u&&u.4C.4D()!=\'Y\'){x-=u.1A||0;y-=u.1n||0;u=u.1r}9(35){O.N=\'15\';O.1b=2n;O.1M=2e}v{x:x,y:y}},1u:z(e){J w=6.C(e,\'1S\');J h=6.C(e,\'1T\');J 10=0;J R=0;O=e.L;9(6(e).C(\'N\')!=\'15\'){10=e.3c;R=e.3d}P{2e=O.1M;2n=O.1b;O.1M=\'36\';O.N=\'2L\';O.1b=\'2v\';10=e.3c;R=e.3d;O.N=\'15\';O.1b=2n;O.1M=2e}v{w:w,h:h,10:10,R:R}},3v:z(e){9(e){w=e.27;h=e.2a}P{1U=E.18;w=1H.2Z||2J.2Z||(1U&&1U.27)||E.Y.27;h=1H.3h||2J.3h||(1U&&1U.2a)||E.Y.2a}v{w:w,h:h}},4G:z(e){9(e){t=e.1n;l=e.1A;w=e.3e;h=e.2V;2I=0;2G=0}P{9(E.18&&E.18.1n){t=E.18.1n;l=E.18.1A;w=E.18.3e;h=E.18.2V}P 9(E.Y){t=E.Y.1n;l=E.Y.1A;w=E.Y.3e;h=E.Y.2V}2I=2J.2Z||E.18.27||E.Y.27||0;2G=2J.3h||E.18.2a||E.Y.2a||0}v{t:t,l:l,w:w,h:h,2I:2I,2G:2G}},4J:z(e,1I){u=6(e);t=u.C(\'3l\')||\'\';r=u.C(\'2M\')||\'\';b=u.C(\'2W\')||\'\';l=u.C(\'2N\')||\'\';9(1I)v{t:A(t)||0,r:A(r)||0,b:A(b)||0,l:A(l)};P v{t:t,r:r,b:b,l:l}},4K:z(e,1I){u=6(e);t=u.C(\'4S\')||\'\';r=u.C(\'4L\')||\'\';b=u.C(\'4M\')||\'\';l=u.C(\'4N\')||\'\';9(1I)v{t:A(t)||0,r:A(r)||0,b:A(b)||0,l:A(l)};P v{t:t,r:r,b:b,l:l}},2d:z(e,1I){u=6(e);t=u.C(\'2E\')||\'\';r=u.C(\'4O\')||\'\';b=u.C(\'4P\')||\'\';l=u.C(\'2H\')||\'\';9(1I)v{t:A(t)||0,r:A(r)||0,b:A(b)||0,l:A(l)||0};P v{t:t,r:r,b:b,l:l}},2Y:z(23){x=23.4R||(23.4T+(E.18.1A||E.Y.1A))||0;y=23.4V||(23.4X+(E.18.1n||E.Y.1n))||0;v{x:x,y:y}}};6.g={H:Z,8:Z,2K:z(){v j.2o(z(){9(j.2O){j.1V=Z;6(j).34(\'3r\',6.g.30)}})},3s:z(e){9(6.g.8!=Z){6.g.2w(e);v n}J 7=j.1V;6(E).2S(\'3A\',6.g.2X).2S(\'3B\',6.g.2w);7.5.T=6.M.2Y(e);7.5.17=7.5.T;7.5.2g=n;7.5.4Y=j!=j.1V;6.g.8=7;9(7.5.1y&&j!=j.1V){3m=6.M.1C(7.1r);3n=6.M.1u(7);3o={x:A(6.C(7,\'19\'))||0,y:A(6.C(7,\'1a\'))||0};F=7.5.17.x-3m.x-3n.10/2-3o.x;G=7.5.17.y-3m.y-3n.R/2-3o.y;6.31.50(7,[F,G])}v n},30:z(e){7=6.g.8;7.5.2g=D;2i=7.L;7.5.1G=6.C(7,\'N\');7.5.24=6.C(7,\'1b\');9(!7.5.47)7.5.47=7.5.24;7.5.S={x:A(6.C(7,\'19\'))||0,y:A(6.C(7,\'1a\'))||0};7.5.2q=0;7.5.2r=0;9(6.1t.3q){3p=6.M.2d(7,D);7.5.2q=3p.l||0;7.5.2r=3p.t||0}7.5.B=6.1x(6.M.1C(7),6.M.1u(7));9(7.5.24!=\'48\'&&7.5.24!=\'2v\'){2i.1b=\'48\'}6.g.H.3w();14=7.51(D);6(14).C({N:\'2L\',19:\'1E\',1a:\'1E\'});14.L.3l=\'0\';14.L.2M=\'0\';14.L.2W=\'0\';14.L.2N=\'0\';6.g.H.20(14);9(7.5.1O)7.5.1O.1w(7,[14]);12=6.g.H.W(0).L;9(7.5.3f){12.1S=\'49\';12.1T=\'49\'}P{12.1T=7.5.B.R+\'1e\';12.1S=7.5.B.10+\'1e\'}12.N=\'2L\';12.3l=\'1E\';12.2M=\'1E\';12.2W=\'1E\';12.2N=\'1E\';6.1x(7.5.B,6.M.1u(14));9(7.5.V){9(7.5.V.19){7.5.S.x+=7.5.T.x-7.5.B.x-7.5.V.19;7.5.B.x=7.5.T.x-7.5.V.19}9(7.5.V.1a){7.5.S.y+=7.5.T.y-7.5.B.y-7.5.V.1a;7.5.B.y=7.5.T.y-7.5.V.1a}9(7.5.V.2P){7.5.S.x+=7.5.T.x-7.5.B.x-7.5.B.R+7.5.V.2P;7.5.B.x=7.5.T.x-7.5.B.10+7.5.V.2P}9(7.5.V.2Q){7.5.S.y+=7.5.T.y-7.5.B.y-7.5.B.R+7.5.V.2Q;7.5.B.y=7.5.T.y-7.5.B.R+7.5.V.2Q}}7.5.1q=7.5.S.x;7.5.1p=7.5.S.y;9(7.5.21||7.5.K==\'2F\'){1R=6.M.2d(7.1r,D);7.5.B.x=7.2b+(6.1t.3q?0:6.1t.2c?-1R.l:1R.l);7.5.B.y=7.2k+(6.1t.3q?0:6.1t.2c?-1R.t:1R.t);6(7.1r).20(6.g.H.W(0))}9(7.5.K){6.g.3t(7);7.5.1j.K=6.g.3K}9(7.5.1y){6.31.4a(7)}12.19=7.5.B.x-7.5.2q+\'1e\';12.1a=7.5.B.y-7.5.2r+\'1e\';12.1S=7.5.B.10+\'1e\';12.1T=7.5.B.R+\'1e\';6.g.8.5.2l=n;9(7.5.1P){7.5.1j.1m=6.g.3H}9(7.5.1K!=n){6.g.H.C(\'1K\',7.5.1K)}9(7.5.1c){6.g.H.C(\'1c\',7.5.1c);9(1H.2z){6.g.H.C(\'3x\',\'3y(1c=\'+7.5.1c*3z+\')\')}}9(7.5.1J==n){2i.N=\'15\'}9(6.q&&6.q.1W>0){6.q.3C(7)}v n},3t:z(7){9(7.5.K.1d==41){9(7.5.K==\'2F\'){7.5.Q=6.1x({x:0,y:0},6.M.1u(7.1r));25=6.M.2d(7.1r,D);7.5.Q.w=7.5.Q.10-25.l-25.r;7.5.Q.h=7.5.Q.R-25.t-25.b}P 9(7.5.K==\'E\'){3j=6.M.3v();7.5.Q={x:0,y:0,w:3j.w,h:3j.h}}}P 9(7.5.K.1d==42){7.5.Q={x:A(7.5.K[0])||0,y:A(7.5.K[1])||0,w:A(7.5.K[2])||0,h:A(7.5.K[3])||0}}7.5.Q.F=7.5.Q.x-7.5.B.x;7.5.Q.G=7.5.Q.y-7.5.B.y},2j:z(8){9(8.5.21||8.5.K==\'2F\'){6(\'Y\',E).20(6.g.H.W(0))}6.g.H.3w().4d().C(\'1c\',1);9(1H.2z){6.g.H.C(\'3x\',\'3y(1c=3z)\')}},2w:z(e){6(E).34(\'3A\',6.g.2X).34(\'3B\',6.g.2w);9(6.g.8==Z){v}8=6.g.8;6.g.8=Z;9(8.5.2g==n){v n}9(8.5.2A==D){6(8).C(\'1b\',8.5.24)}2i=8.L;9(8.1y){6.g.H.C(\'3R\',\'3S\')}9(8.5.38==n){9(8.5.11>0){9(!8.5.X||8.5.X==\'2x\'){x=3D 6.11(8,8.5.11,\'19\');x.3E(8.5.S.x,8.5.29)}9(!8.5.X||8.5.X==\'2B\'){y=3D 6.11(8,8.5.11,\'1a\');y.3E(8.5.S.y,8.5.1X)}}P{9(!8.5.X||8.5.X==\'2x\')8.L.19=8.5.29+\'1e\';9(!8.5.X||8.5.X==\'2B\')8.L.1a=8.5.1X+\'1e\'}6.g.2j(8);9(8.5.1J==n){6(8).C(\'N\',8.5.1G)}}P 9(8.5.11>0){8.5.2l=D;9(6.q&&6.q.1i&&6.I){1B=6.M.1C(6.I.H.W(0))}P{1B=n}6.g.H.4i({19:1B?1B.x:8.5.B.x,1a:1B?1B.y:8.5.B.y},8.5.11,z(){8.5.2l=n;9(8.5.1J==n){8.L.N=8.5.1G}6.g.2j(8)})}P{6.g.2j(8);9(8.5.1J==n){6(8).C(\'N\',8.5.1G)}}9(6.q&&6.q.1W>0){6.q.3Z(8)}9(6.I&&6.q.1i){6.I.4j(8)}9(8.5.1z&&(8.5.29!=8.5.S.x||8.5.1X!=8.5.S.y)){8.5.1z.1w(8,8.5.4k||[0,0,8.5.29,8.5.1X])}9(8.5.1N)8.5.1N.1w(8);v n},3H:z(x,y,F,G){9(F!=0)F=A((F+(j.5.1P*F/1f.3I(F))/2)/j.5.1P)*j.5.1P;9(G!=0)G=A((G+(j.5.1Z*G/1f.3I(G))/2)/j.5.1Z)*j.5.1Z;v{F:F,G:G,x:0,y:0}},3K:z(x,y,F,G){F=1f.3L(1f.3M(F,j.5.Q.F),j.5.Q.w+j.5.Q.F-j.5.B.10);G=1f.3L(1f.3M(G,j.5.Q.G),j.5.Q.h+j.5.Q.G-j.5.B.R);v{F:F,G:G,x:0,y:0}},2X:z(e){9(6.g.8==Z||6.g.8.5.2l==D){v}J 8=6.g.8;8.5.17=6.M.2Y(e);9(8.5.2g==n){3O=1f.4o(1f.3N(8.5.T.x-8.5.17.x,2)+1f.3N(8.5.T.y-8.5.17.y,2));9(3O<8.5.2C){v}P{6.g.30(e)}}F=8.5.17.x-8.5.T.x;G=8.5.17.y-8.5.T.y;28(i 1Q 8.5.1j){1s=8.5.1j[i].1w(8,[8.5.S.x+F,8.5.S.y+G,F,G]);9(1s&&1s.1d==4p){F=i!=\'3g\'?1s.F:(1s.x-8.5.S.x);G=i!=\'3g\'?1s.G:(1s.y-8.5.S.y)}}8.5.1q=8.5.B.x+F-8.5.2q;8.5.1p=8.5.B.y+G-8.5.2r;9(8.5.1y&&(8.5.1F||8.5.1z)){6.31.1F(8,8.5.1q,8.5.1p)}9(!8.5.X||8.5.X==\'2x\'){8.5.29=8.5.S.x+F;6.g.H.W(0).L.19=8.5.1q+\'1e\'}9(!8.5.X||8.5.X==\'2B\'){8.5.1X=8.5.S.y+G;6.g.H.W(0).L.1a=8.5.1p+\'1e\'}9(6.q&&6.q.1W>0){6.q.33(8,14)}v n},2p:z(o){9(!6.g.H){6(\'Y\',E).20(\'<3P 1o="3Q"></3P>\');6.g.H=6(\'#3Q\');u=6.g.H.W(0);1l=u.L;1l.1b=\'2v\';1l.N=\'15\';1l.3R=\'3S\';1l.4u=\'15\';1l.4v=\'36\';9(1H.2z){u.3W=z(){v n};u.3X=z(){v n}}P{1l.4w=\'15\';1l.4x=\'15\'}}9(!o){o={}}v j.2o(z(){9(j.2O||!6.M)v;9(1H.2z){j.3W=z(){v n};j.3X=z(){v n}}J 2R=o.3Y?6(j).4y(o.3Y):6(j);j.5={38:o.38?D:n,1J:o.1J?D:n,2A:o.2A?o.2A:n,1y:o.1y?o.1y:n,21:o.21?o.21:n,1K:o.1K?A(o.1K)||0:n,1c:o.1c?4z(o.1c):n,11:A(o.11)||Z,39:o.39?o.39:n,1j:{},T:{},1O:o.1O&&o.1O.1d==1Y?o.1O:n,1N:o.1N&&o.1N.1d==1Y?o.1N:n,1z:o.1z&&o.1z.1d==1Y?o.1z:n,X:/2B|2x/.4E(o.X)?o.X:n,2C:o.2C?A(o.2C)||0:0,V:o.V?o.V:n,3f:o.3f?D:n};9(o.1j&&o.1j.1d==1Y)j.5.1j.3g=o.1j;9(o.K&&((o.K.1d==41&&(o.K==\'2F\'||o.K==\'E\'))||(o.K.1d==42&&o.K.3i==4))){j.5.K=o.K}9(o.3k){j.5.3k=o.3k}9(o.1m){9(4U o.1m==\'4W\'){j.5.1P=A(o.1m)||1;j.5.1Z=A(o.1m)||1}P 9(o.1m.3i==2){j.5.1P=A(o.1m[0])||1;j.5.1Z=A(o.1m[1])||1}}9(o.1F&&o.1F.1d==1Y){j.5.1F=o.1F}j.2O=D;2R.W(0).1V=j;2R.2S(\'3r\',6.g.3s)})}};6.3U.1x({46:6.g.2K,4b:6.g.2p});6.q={3T:z(1k,1g,1D,1L){v 1k<=6.g.8.5.1q&&(1k+1D)>=(6.g.8.5.1q+6.g.8.5.B.w)&&1g<=6.g.8.5.1p&&(1g+1L)>=(6.g.8.5.1p+6.g.8.5.B.h)?D:n},3V:z(1k,1g,1D,1L){v!(1k>(6.g.8.5.1q+6.g.8.5.B.w)||(1k+1D)<6.g.8.5.1q||1g>(6.g.8.5.1p+6.g.8.5.B.h)||(1g+1L)<6.g.8.5.1p)?D:n},T:z(1k,1g,1D,1L){v 1k<6.g.8.5.17.x&&(1k+1D)>6.g.8.5.17.x&&1g<6.g.8.5.17.y&&(1g+1L)>6.g.8.5.17.y?D:n},1i:n,U:{},1W:0,13:{},3C:z(7){9(6.g.8==Z){v}J i;6.q.U={};2f=n;28(i 1Q 6.q.13){9(6.q.13[i]!=Z){c=6.q.13[i].W(0);9(6.32.3F(6.g.8,c.k.a)){9(c.k.m==n){c.k.p=6.1x(6.M.1C(c),6.M.1u(c));c.k.m=D}9(c.k.1h){6.q.13[i].2t(c.k.1h)}6.q.U[i]=6.q.13[i];9(6.I&&c.k.s==D){c.k.u=6(\'.\'+c.k.a,c);7.L.N=\'15\';6.I.3J(c);7.L.N=7.5.1G;2f=D}}}}9(2f){6.I.4f()}},45:z(){6.q.U={};28(i 1Q 6.q.13){9(6.q.13[i]!=Z){c=6.q.13[i].W(0);9(6.32.3F(6.g.8,c.k.a)){c.k.p=6.1x(6.M.1C(c),6.M.1u(c));9(c.k.1h){6.q.13[i].2t(c.k.1h)}6.q.U[i]=6.q.13[i];9(6.I&&c.k.s==D){c.k.u=6(\'.\'+c.k.a,c);7.L.N=\'15\';6.I.3J(c);7.L.N=7.5.1G;2f=D}}}}},33:z(e){9(6.g.8==Z){v}6.q.1i=n;J i;37=n;28(i 1Q 6.q.U){c=6.q.U[i].W(0);9(6.q.1i==n&&6.q[c.k.t](c.k.p.x,c.k.p.y,c.k.p.10,c.k.p.R)){9(c.k.1v&&c.k.h==n){6.q.U[i].2D(c.k.1h);6.q.U[i].2t(c.k.1v)}9(c.k.h==n&&c.k.2h){37=D}c.k.h=D;6.q.1i=c;9(6.I&&c.k.s==D){6.I.H.W(0).32=c.k.3G;6.I.33(c)}}P{9(c.k.2s&&c.k.h==D){c.k.2s.1w(c,[e,14,c.k.11])}9(c.k.1v){6.q.U[i].2D(c.k.1v);6.q.U[i].2t(c.k.1h)}c.k.h=n}}9(6.I&&6.q.1i==n){6.I.H.W(0).L.N=\'15\';6(\'Y\').20(6.I.H.W(0))}9(37){6.q.1i.k.2h.1w(6.q.1i,[e,14])}},3Z:z(e){J i;28(i 1Q 6.q.U){c=6.q.U[i].W(0);9(c.k.1h){6.q.U[i].2D(c.k.1h)}9(c.k.1v){6.q.U[i].2D(c.k.1v)}9(c.k.s){6.I.40[6.I.40.3i]=i}9(c.k.2m&&c.k.h==D){c.k.h=n;c.k.2m.1w(c,[e,c.k.11])}c.k.m=n;c.k.h=n}6.q.U={}},2K:z(){v j.2o(z(){9(j.2u){9(j.k.s){1o=6.44(j,\'1o\');6.I.43[1o]=Z;6(\'.\'+j.k.a,j).46()}6.q.13[\'d\'+j.2U]=Z;j.2u=n;j.f=Z}})},2p:z(o){v j.2o(z(){9(j.2u==D||!o.3u||!6.M||!6.g){v}j.k={a:o.3u,1h:o.4e,1v:o.4g,3G:o.4l,2m:o.4m||o.2m,2h:o.2h||o.4q,2s:o.2s||o.4s,t:o.2y&&(o.2y==\'3T\'||o.2y==\'3V\')?o.2y:\'T\',11:o.11?o.11:n,m:n,h:n};9(o.4H==D&&6.I){1o=6.44(j,\'1o\');6.I.43[1o]=j.k.a;j.k.s=D;9(o.2T){j.k.2T=o.2T;j.k.4h=6.I.4n(1o).4r}}j.2u=D;j.2U=A(1f.4F()*4Q);6.q.13[\'d\'+j.2U]=6(j);6.q.1W++})}};6.3U.1x({4I:6.q.2K,4c:6.q.2p});6.4t=6.q.45;',62,312,'|||||dragCfg|jQuery|elm|dragged|if|||iEL||||iDrag|||this|dropCfg|||false|||iDrop||||el|return||||function|parseInt|oC|css|true|document|dx|dy|helper|iSort|var|containment|style|iUtil|display|es|else|cont|hb|oR|pointer|highlighted|cursorAt|get|axis|body|null|wb|fx|dhs|zones|clonedEl|none|currentStyle|currentPointer|documentElement|left|top|position|opacity|constructor|px|Math|zoney|ac|overzone|onDrag|zonex|els|grid|scrollTop|id|ny|nx|parentNode|newCoords|browser|getSize|hc|apply|extend|si|onChange|scrollLeft|dh|getPosition|zonew|0px|onSlide|oD|window|toInteger|ghosting|zIndex|zoneh|visibility|onStop|onStart|gx|in|parentBorders|width|height|de|dragElem|count|nRy|Function|gy|append|insideParent|st|event|oP|contBorders|sl|clientWidth|for|nRx|clientHeight|offsetLeft|opera|getBorder|oldVisibility|oneIsSortable|init|onHover|dEs|hidehelper|offsetTop|prot|onDrop|oldPosition|each|build|diffX|diffY|onOut|addClass|isDroppable|absolute|dragstop|horizontally|tolerance|ActiveXObject|so|vertically|snapDistance|removeClass|borderTopWidth|parent|ih|borderLeftWidth|iw|self|destroy|block|marginRight|marginLeft|isDraggable|right|bottom|dhe|bind|onchange|idsa|scrollHeight|marginBottom|dragmove|getPointer|innerWidth|dragstart|iSlider|className|checkhover|unbind|restoreStyle|hidden|applyOnHover|revert|hpc|offsetParent|while|offsetWidth|offsetHeight|scrollWidth|autoSize|user|innerHeight|length|clnt|fractions|marginTop|parentPos|sliderSize|sliderPos|oldBorder|msie|mousedown|draginit|getContainment|accept|getClient|empty|filter|alpha|100|mousemove|mouseup|highlight|new|custom|has|shc|snapToGrid|abs|measure|fitToContainer|min|max|pow|distance|div|dragHelper|cursor|move|fit|fn|intersect|onselectstart|ondragstart|handle|checkdrop|changed|String|Array|collected|attr|remeasure|DraggableDestroy|initialPosition|relative|auto|modifyContainer|Draggable|Droppable|hide|activeclass|start|hoverclass|os|animate|check|lastSi|helperclass|ondrop|serialize|sqrt|Object|onhover|hash|onout|recallDroppables|listStyle|overflow|mozUserSelect|userSelect|find|parseFloat|sx|sy|tagName|toLowerCase|test|random|getScroll|sortable|DroppableDestroy|getMargins|getPadding|paddingRight|paddingBottom|paddingLeft|borderRightWidth|borderBottomWidth|10000|pageX|paddingTop|clientX|typeof|pageY|number|clientY|fromHandler|getPos|dragmoveBy|cloneNode'.split('|'),0,{}))\r
index a47c1cd..27aa2f9 100644 (file)
 // * as published by the Free Software Foundation.                        *\r
 // ************************************************************************\r
 \r
-var newwindow;\r
-\r
-function poptastic(url) {\r
-       newwindow=window.open(url,'popup','height=600,width=600,scrollbars=yes,resizable=yes');\r
-       if (window.focus) {newwindow.focus()}\r
-}\r
-\r
-function getexpirydate(nodays){\r
-       var UTCstring;\r
-       Today = new Date();\r
-       nomilli=Date.parse(Today);\r
-       Today.setTime(nomilli+nodays*24*60*60*1000);\r
-       UTCstring = Today.toUTCString();\r
-       return UTCstring;\r
-}\r
-\r
-function setcookie(name,value,duration){\r
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);\r
-       document.cookie=cookiestring;\r
-       if(!getcookie(name)){\r
-               return false;\r
-       } else {\r
-               return true;\r
-       }\r
-}\r
-\r
-function getcookie(cookiename) {\r
-       var cookiestring=""+document.cookie;\r
-       var index1=cookiestring.indexOf(cookiename);\r
-       if (index1==-1 || cookiename=="") return ""; \r
-       var index2=cookiestring.indexOf(';',index1);\r
-       if (index2==-1) index2=cookiestring.length; \r
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));\r
-}\r
-\r
-function setDisplay(objId) {\r
-       var toc = document.getElementById(objId);\r
-\r
-       var state = getcookie(objId);\r
-       if (document.getElementById(objId) && state && (state == 'none')) {\r
-               toggleToc(objId);\r
-       }\r
-}\r
-\r
-\r
-function setstates() {\r
-       return;\r
-       var objId = "side-menu";\r
-       var state = getcookie(objId);\r
-       if (document.getElementById(objId) && state && (state == 'none')) {\r
-               toggleToc(objId);\r
-       }\r
-\r
-       var objId = "toccontent";\r
-       var state = getcookie(objId);\r
-       if (document.getElementById(objId) && state && (state == 'none')) {\r
-               toggleToc(objId);\r
-       }\r
-\r
-}\r
-\r
-function showTocToggle(objId, show, hide, key, selected) {\r
-       if(document.getElementById) {\r
-               if (key) {\r
-                       var accesskey = " accesskey='" + key + "' title='"+ show + "/" + hide + " Alt - "+ key +"'";\r
-               } else {\r
-                       var accesskey = "";\r
-               }\r
-\r
-               if (selected == 'hide') {\r
-                       document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +\r
-                       '<span id="' + objId + 'showlink" style="display:none;">' + show + '</span>' +\r
-                       '<span id="' + objId + 'hidelink">' + hide + '</span>'  + '</a>');\r
-               } else {\r
-                       document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +\r
-                       '<span id="' + objId + 'showlink">' + show + '</span>' +\r
-                       '<span id="' + objId + 'hidelink" style="display:none;">' + hide + '</span>'    + '</a>');\r
-               }\r
-       }\r
-}\r
-\r
-function toggleToc(objId) {\r
-       var toc = document.getElementById(objId);\r
-       if (toc == null) {\r
-               return;\r
-       }\r
-       var showlink=document.getElementById(objId + 'showlink');\r
-       var hidelink=document.getElementById(objId + 'hidelink');\r
-\r
-       if (hidelink.style.display == 'none') {\r
-               document.getElementById('contentcolumn').id="contentcolumn_shiftright";\r
-               jQuery("[id="+objId+"]").slideDown("slow");\r
-               hidelink.style.display='';\r
-               showlink.style.display='none';\r
-       } else {\r
-               document.getElementById('contentcolumn_shiftright').id="contentcolumn";\r
-               jQuery("[id="+objId+"]").slideUp("slow");\r
-               hidelink.style.display='none';\r
-               showlink.style.display='';\r
-       }\r
-       setcookie(objId, hidelink.style.display, 1);\r
-}\r
-\r
-// toggle a div, for example "create user group" => "add privileges" section\r
-function toggleDiv(objId) {\r
-       var toc = document.getElementById(objId);\r
-       if (toc == null) return;\r
-\r
-       if (toc.style.display == 'none')\r
-       {\r
-               toc.style.display = '';\r
-               document.getElementById("toggle_image").src = "images/arrow-open.png";\r
-               document.getElementById("toggle_image").alt = "Collapse";\r
-               document.getElementById("toggle_image").title = "Collapse";\r
-       }\r
-       else\r
-       {\r
-               toc.style.display = 'none';\r
-               document.getElementById("toggle_image").src = "images/arrow-closed.png";\r
-               document.getElementById("toggle_image").alt = "Expand";\r
-               document.getElementById("toggle_image").title = "Expand";\r
-       }\r
-}\r
-\r
-// toggle content folder in side menu "content navigation"\r
-function toggleFolder(cid, expand_text, collapse_text)\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
-               setcookie("c<?php echo $this->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
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);\r
-       }\r
-       \r
-       jQuery("#folder"+cid).slideToggle();\r
-}\r
-\r
-// toggle elements in side menu\r
-function elementToggle(elem, title, base_path, show_text, hide_text)\r
-{\r
-       element_collapse_icon = base_path+"images/mswitch_minus.gif";\r
-       element_expand_icon = base_path+"images/mswitch_plus.gif";\r
-       \r
-       if (jQuery(elem).attr("src") == element_collapse_icon) {\r
-               jQuery(elem).attr("src", element_expand_icon);\r
-               jQuery(elem).attr("alt", show_text + " "+ title);\r
-               jQuery(elem).attr("title", show_text + " "+ title);\r
-               setcookie("m_"+title, 0, 1);\r
-       }\r
-       else {\r
-               jQuery(elem).attr("src", element_collapse_icon);\r
-               jQuery(elem).attr("alt", hide_text + " "+ title);\r
-               jQuery(elem).attr("title", hide_text + " "+ title);\r
-               setcookie("m_"+title, null, 1);;\r
-       }\r
-       \r
-       jQuery(elem).parent().next().slideToggle();\r
-}\r
-\r
-function printSubmenuHeader(title, base_path, show_text, hide_text)\r
-{\r
-       if (getcookie("m_"+title) == "0")\r
-       {\r
-               image = base_path + "images/mswitch_plus.gif";\r
-               alt_text = show_text + title;\r
-       }\r
-       else\r
-       {\r
-               image = base_path+"images/mswitch_minus.gif";\r
-               alt_text = hide_text + title;\r
-       }\r
-       \r
-       document.writeln('<h4 class="box">'+\r
-       '       <input src="'+image+'"' + \r
-       '              onclick="elementToggle(this, \''+title+'\', \''+base_path+'\', \''+show_text+'\', \''+hide_text+'\'); return false;"' +\r
-       '              alt="'+ alt_text + '" ' +\r
-       '              title="'+ alt_text + '"' +\r
-       '              style="float:right" type="image" /> '+ title +\r
-       '</h4>');\r
-}\r
-\r
-var selected;\r
-\r
-function rowselect(obj) {\r
-       obj.className = 'selected';\r
-       if (selected && selected != obj.id)\r
-               document.getElementById(selected).className = '';\r
-       selected = obj.id;\r
-}\r
-function rowselectbox(obj, checked, handler) {\r
-       var functionDemo = new Function(handler + ";");\r
-       functionDemo();\r
-\r
-       if (checked)\r
-               obj.className = 'selected';\r
-       else\r
-               obj.className = '';\r
-}\r
-\r
-/**\r
- * Easy to define namespace.\r
- * Usage: namespace('Trans', 'Trans.course')\r
- */\r
-namespace = function() { \r
-    var a=arguments, o=null, i, j, d; \r
-    for (i=0; i<a.length; i=i+1) { \r
-        d=a[i].split("."); \r
-        o=window; \r
-        for (j=0; j<d.length; j=j+1) { \r
-            o[d[j]]=o[d[j]] || {}; \r
-            o=o[d[j]]; \r
-        } \r
-    } \r
-    return o; \r
-}; \r
+var trans = trans || {};\r
+trans.utility = trans.utility || {};\r
+trans.course = trans.course || {};\r
+trans.editor = trans.editor || {};\r
+trans.newwindow;\r
+trans.utility.selected;\r
+\r
+(function() {\r
+  /**\r
+   * pops up a 600 * 600 new window\r
+   */\r
+  trans.utility.poptastic = function (url) {\r
+    trans.newwindow=window.open(url,'popup','height=600,width=600,scrollbars=yes,resizable=yes');\r
+    if (window.focus) {trans.newwindow.focus()}\r
+  };\r
+\r
+  trans.utility.getexpirydate = function (nodays){\r
+    var UTCstring;\r
+    Today = new Date();\r
+    nomilli=Date.parse(Today);\r
+    Today.setTime(nomilli+nodays*24*60*60*1000);\r
+    UTCstring = Today.toUTCString();\r
+    return UTCstring;\r
+  };\r
+  \r
+  /**\r
+   * set cookie value and expiry\r
+   */\r
+  trans.utility.setcookie = function (name,value,duration){\r
+    cookiestring=name+"="+escape(value)+";path=/;expires="+trans.utility.getexpirydate(duration);\r
+    document.cookie=cookiestring;\r
+    if(!trans.utility.getcookie(name)){\r
+      return false;\r
+    } else {\r
+      return true;\r
+    }\r
+  };\r
+  \r
+  /**\r
+   * get cookie value\r
+   */\r
+  trans.utility.getcookie = function (cookiename) {\r
+    var cookiestring=""+document.cookie;\r
+    var index1=cookiestring.indexOf(cookiename);\r
+    if (index1==-1 || cookiename=="") return ""; \r
+    var index2=cookiestring.indexOf(';',index1);\r
+    if (index2==-1) index2=cookiestring.length; \r
+    return unescape(cookiestring.substring(index1+cookiename.length+1,index2));\r
+  };\r
+  \r
+  trans.utility.setDisplay = function (objId) {\r
+    var toc = document.getElementById(objId);\r
+  \r
+    var state = trans.utility.getcookie(objId);\r
+    if (document.getElementById(objId) && state && (state == 'none')) {\r
+      trans.utility.toggleToc(objId);\r
+    }\r
+  };\r
+  \r
+  trans.utility.setstates = function () {\r
+    return;\r
+    var objId = "side-menu";\r
+    var state = trans.utility.getcookie(objId);\r
+    if (document.getElementById(objId) && state && (state == 'none')) {\r
+      trans.utility.toggleToc(objId);\r
+    }\r
+  \r
+    var objId = "toccontent";\r
+    var state = trans.utility.getcookie(objId);\r
+    if (document.getElementById(objId) && state && (state == 'none')) {\r
+      trans.utility.toggleToc(objId);\r
+    }\r
+  };\r
+  \r
+  trans.utility.showTocToggle = function (objId, show, hide, key, selected) {\r
+    if(document.getElementById) {\r
+      if (key) {\r
+        var accesskey = " accesskey='" + key + "' title='"+ show + "/" + hide + " Alt - "+ key +"'";\r
+      } else {\r
+        var accesskey = "";\r
+      }\r
+  \r
+      if (selected == 'hide') {\r
+        document.writeln('<a href="javascript:trans.utility.toggleToc(\'' + objId + '\')" ' + accesskey + '>' +\r
+        '<span id="' + objId + 'showlink" style="display:none;">' + show + '</span>' +\r
+        '<span id="' + objId + 'hidelink">' + hide + '</span>'  + '</a>');\r
+      } else {\r
+        document.writeln('<a href="javascript:trans.utility.toggleToc(\'' + objId + '\')" ' + accesskey + '>' +\r
+        '<span id="' + objId + 'showlink">' + show + '</span>' +\r
+        '<span id="' + objId + 'hidelink" style="display:none;">' + hide + '</span>'  + '</a>');\r
+      }\r
+    }\r
+  };\r
+  \r
+  trans.utility.toggleToc = function (objId) {\r
+    var toc = document.getElementById(objId);\r
+    if (toc == null) {\r
+      return;\r
+    }\r
+    var showlink=document.getElementById(objId + 'showlink');\r
+    var hidelink=document.getElementById(objId + 'hidelink');\r
+  \r
+    if (hidelink.style.display == 'none') {\r
+      document.getElementById('contentcolumn').id="contentcolumn_shiftright";\r
+      jQuery("[id="+objId+"]").slideDown("slow");\r
+      hidelink.style.display='';\r
+      showlink.style.display='none';\r
+    } else {\r
+      document.getElementById('contentcolumn_shiftright').id="contentcolumn";\r
+      jQuery("[id="+objId+"]").slideUp("slow");\r
+      hidelink.style.display='none';\r
+      showlink.style.display='';\r
+    }\r
+    trans.utility.setcookie(objId, hidelink.style.display, 1);\r
+  };\r
+  \r
+  // toggle a div, for example "create user group" => "add privileges" section\r
+  trans.utility.toggleDiv = function (objId) {\r
+    var toc = document.getElementById(objId);\r
+    if (toc == null) return;\r
+  \r
+    if (toc.style.display == 'none')\r
+    {\r
+      toc.style.display = '';\r
+      document.getElementById("toggle_image").src = "images/arrow-open.png";\r
+      document.getElementById("toggle_image").alt = "Collapse";\r
+      document.getElementById("toggle_image").title = "Collapse";\r
+    }\r
+    else\r
+    {\r
+      toc.style.display = 'none';\r
+      document.getElementById("toggle_image").src = "images/arrow-closed.png";\r
+      document.getElementById("toggle_image").alt = "Expand";\r
+      document.getElementById("toggle_image").title = "Expand";\r
+    }\r
+  };\r
+  \r
+  // toggle content folder in side menu "content navigation"\r
+  trans.utility.toggleFolder = function (cid, expand_text, collapse_text)\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
+    }\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
+    }\r
+    \r
+    jQuery("#folder"+cid).slideToggle();\r
+  };\r
+  \r
+  // toggle elements in side menu\r
+  trans.utility.elementToggle = function (elem, title, base_path, show_text, hide_text)\r
+  {\r
+    element_collapse_icon = base_path+"images/mswitch_minus.gif";\r
+    element_expand_icon = base_path+"images/mswitch_plus.gif";\r
+    \r
+    if (jQuery(elem).attr("src") == element_collapse_icon) {\r
+      jQuery(elem).attr("src", element_expand_icon);\r
+      jQuery(elem).attr("alt", show_text + " "+ title);\r
+      jQuery(elem).attr("title", show_text + " "+ title);\r
+      trans.utility.setcookie("m_"+title, 0, 1);\r
+    }\r
+    else {\r
+      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
+    }\r
+    \r
+    jQuery(elem).parent().next().slideToggle();\r
+  };\r
+  \r
+  trans.utility.printSubmenuHeader = function (title, base_path, show_text, hide_text)\r
+  {\r
+    if (trans.utility.getcookie("m_"+title) == "0")\r
+    {\r
+      image = base_path + "images/mswitch_plus.gif";\r
+      alt_text = show_text + title;\r
+    }\r
+    else\r
+    {\r
+      image = base_path+"images/mswitch_minus.gif";\r
+      alt_text = hide_text + title;\r
+    }\r
+    \r
+    document.writeln('<h4 class="box">'+\r
+    '  <input src="'+image+'"' + \r
+    '         onclick="trans.utility.elementToggle(this, \''+title+'\', \''+base_path+'\', \''+show_text+'\', \''+hide_text+'\'); return false;"' +\r
+    '         alt="'+ alt_text + '" ' +\r
+    '         title="'+ alt_text + '"' +\r
+    '         style="float:right" type="image" /> '+ title +\r
+    '</h4>');\r
+  };\r
+  \r
+  trans.utility.rowselect = function (obj) {\r
+    obj.className = 'selected';\r
+    if (trans.utility.selected && trans.utility.selected != obj.id)\r
+      document.getElementById(trans.utility.selected).className = '';\r
+    trans.utility.selected = obj.id;\r
+  };\r
+  \r
+  trans.utility.rowselectbox = function (obj, checked, handler) {\r
+    var functionDemo = new Function(handler + ";");\r
+    functionDemo();\r
+  \r
+    if (checked)\r
+      obj.className = 'selected';\r
+    else\r
+      obj.className = '';\r
+  };\r
+\r
+})();\r
diff --git a/docs/include/jscripts/wz_jsgraphics.js b/docs/include/jscripts/wz_jsgraphics.js
new file mode 100644 (file)
index 0000000..07e0194
--- /dev/null
@@ -0,0 +1,943 @@
+/* This notice must be untouched at all times.\r
+\r
+wz_jsgraphics.js    v. 2.36\r
+The latest version is available at\r
+http://www.walterzorn.com\r
+or http://www.devira.com\r
+or http://www.walterzorn.de\r
+\r
+Copyright (c) 2002-2008 Walter Zorn. All rights reserved.\r
+Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )\r
+Last modified: 21. 6. 2006\r
+\r
+Performance optimizations for Internet Explorer\r
+by Thomas Frank and John Holdsworth.\r
+fillPolygon method implemented by Matthieu Haller.\r
+\r
+High Performance JavaScript Graphics Library.\r
+Provides methods\r
+- to draw lines, rectangles, ellipses, polygons\r
+       with specifiable line thickness,\r
+- to fill rectangles and ellipses\r
+- to draw text.\r
+NOTE: Operations, functions and branching have rather been optimized\r
+to efficiency and speed than to shortness of source code.\r
+\r
+LICENSE: LGPL\r
+\r
+This library is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU Lesser General Public\r
+License (LGPL) as published by the Free Software Foundation; either\r
+version 2.1 of the License, or (at your option) any later version.\r
+\r
+This library is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+Lesser General Public License for more details.\r
+\r
+You should have received a copy of the GNU Lesser General Public\r
+License along with this library; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,\r
+or see http://www.gnu.org/copyleft/lesser.html\r
+*/\r
+\r
+\r
+var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,\r
+jg_n4 = (document.layers && typeof document.classes != "undefined");\r
+\r
+\r
+function chkDHTM(x, i)\r
+{\r
+       x = document.body || null;\r
+       jg_ie = x && typeof x.insertAdjacentHTML != "undefined";\r
+       jg_dom = (x && !jg_ie &&\r
+               typeof x.appendChild != "undefined" &&\r
+               typeof document.createRange != "undefined" &&\r
+               typeof (i = document.createRange()).setStartBefore != "undefined" &&\r
+               typeof i.createContextualFragment != "undefined");\r
+       jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined";\r
+       jg_fast = jg_ie && document.all && !window.opera;\r
+       jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";\r
+}\r
+\r
+\r
+function pntDoc()\r
+{\r
+       this.wnd.document.write(jg_fast? this.htmRpc() : this.htm);\r
+       this.htm = '';\r
+}\r
+\r
+\r
+function pntCnvDom()\r
+{\r
+       var x = this.wnd.document.createRange();\r
+       x.setStartBefore(this.cnv);\r
+       x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm);\r
+       if(this.cnv) this.cnv.appendChild(x);\r
+       this.htm = '';\r
+}\r
+\r
+\r
+function pntCnvIe()\r
+{\r
+       if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);\r
+       this.htm = '';\r
+}\r
+\r
+\r
+function pntCnvIhtm()\r
+{\r
+       if(this.cnv) this.cnv.innerHTML += this.htm;\r
+       this.htm = '';\r
+}\r
+\r
+\r
+function pntCnv()\r
+{\r
+       this.htm = '';\r
+}\r
+\r
+\r
+function mkDiv(x, y, w, h)\r
+{\r
+       this.htm += '<div style="position:absolute;'+\r
+               'left:' + x + 'px;'+\r
+               'top:' + y + 'px;'+\r
+               'width:' + w + 'px;'+\r
+               'height:' + h + 'px;'+\r
+               'clip:rect(0,'+w+'px,'+h+'px,0);'+\r
+               'background-color:' + this.color +\r
+               (!jg_moz? ';overflow:hidden' : '')+\r
+               ';"><\/div>';\r
+}\r
+\r
+\r
+function mkDivIe(x, y, w, h)\r
+{\r
+       this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';\r
+}\r
+\r
+\r
+function mkDivPrt(x, y, w, h)\r
+{\r
+       this.htm += '<div style="position:absolute;'+\r
+               'border-left:' + w + 'px solid ' + this.color + ';'+\r
+               'left:' + x + 'px;'+\r
+               'top:' + y + 'px;'+\r
+               'width:0px;'+\r
+               'height:' + h + 'px;'+\r
+               'clip:rect(0,'+w+'px,'+h+'px,0);'+\r
+               'background-color:' + this.color +\r
+               (!jg_moz? ';overflow:hidden' : '')+\r
+               ';"><\/div>';\r
+}\r
+\r
+\r
+function mkLyr(x, y, w, h)\r
+{\r
+       this.htm += '<layer '+\r
+               'left="' + x + '" '+\r
+               'top="' + y + '" '+\r
+               'width="' + w + '" '+\r
+               'height="' + h + '" '+\r
+               'bgcolor="' + this.color + '"><\/layer>\n';\r
+}\r
+\r
+\r
+var regex =  /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;\r
+function htmRpc()\r
+{\r
+       return this.htm.replace(\r
+               regex,\r
+               '<div style="overflow:hidden;position:absolute;background-color:'+\r
+               '$1;left:$2;top:$3;width:$4;height:$5"></div>\n');\r
+}\r
+\r
+\r
+function htmPrtRpc()\r
+{\r
+       return this.htm.replace(\r
+               regex,\r
+               '<div style="overflow:hidden;position:absolute;background-color:'+\r
+               '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');\r
+}\r
+\r
+\r
+function mkLin(x1, y1, x2, y2)\r
+{\r
+       if (x1 > x2)\r
+       {\r
+               var _x2 = x2;\r
+               var _y2 = y2;\r
+               x2 = x1;\r
+               y2 = y1;\r
+               x1 = _x2;\r
+               y1 = _y2;\r
+       }\r
+       var dx = x2-x1, dy = Math.abs(y2-y1),\r
+       x = x1, y = y1,\r
+       yIncr = (y1 > y2)? -1 : 1;\r
+\r
+       if (dx >= dy)\r
+       {\r
+               var pr = dy<<1,\r
+               pru = pr - (dx<<1),\r
+               p = pr-dx,\r
+               ox = x;\r
+               while ((dx--) > 0)\r
+               {\r
+                       ++x;\r
+                       if (p > 0)\r
+                       {\r
+                               this.mkDiv(ox, y, x-ox, 1);\r
+                               y += yIncr;\r
+                               p += pru;\r
+                               ox = x;\r
+                       }\r
+                       else p += pr;\r
+               }\r
+               this.mkDiv(ox, y, x2-ox+1, 1);\r
+       }\r
+\r
+       else\r
+       {\r
+               var pr = dx<<1,\r
+               pru = pr - (dy<<1),\r
+               p = pr-dy,\r
+               oy = y;\r
+               if (y2 <= y1)\r
+               {\r
+                       while ((dy--) > 0)\r
+                       {\r
+                               if (p > 0)\r
+                               {\r
+                                       this.mkDiv(x++, y, 1, oy-y+1);\r
+                                       y += yIncr;\r
+                                       p += pru;\r
+                                       oy = y;\r
+                               }\r
+                               else\r
+                               {\r
+                                       y += yIncr;\r
+                                       p += pr;\r
+                               }\r
+                       }\r
+                       this.mkDiv(x2, y2, 1, oy-y2+1);\r
+               }\r
+               else\r
+               {\r
+                       while ((dy--) > 0)\r
+                       {\r
+                               y += yIncr;\r
+                               if (p > 0)\r
+                               {\r
+                                       this.mkDiv(x++, oy, 1, y-oy);\r
+                                       p += pru;\r
+                                       oy = y;\r
+                               }\r
+                               else p += pr;\r
+                       }\r
+                       this.mkDiv(x2, oy, 1, y2-oy+1);\r
+               }\r
+       }\r
+}\r
+\r
+\r
+function mkLin2D(x1, y1, x2, y2)\r
+{\r
+       if (x1 > x2)\r
+       {\r
+               var _x2 = x2;\r
+               var _y2 = y2;\r
+               x2 = x1;\r
+               y2 = y1;\r
+               x1 = _x2;\r
+               y1 = _y2;\r
+       }\r
+       var dx = x2-x1, dy = Math.abs(y2-y1),\r
+       x = x1, y = y1,\r
+       yIncr = (y1 > y2)? -1 : 1;\r
+\r
+       var s = this.stroke;\r
+       if (dx >= dy)\r
+       {\r
+               if (dx > 0 && s-3 > 0)\r
+               {\r
+                       var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;\r
+                       _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;\r
+               }\r
+               else var _s = s;\r
+               var ad = Math.ceil(s/2);\r
+\r
+               var pr = dy<<1,\r
+               pru = pr - (dx<<1),\r
+               p = pr-dx,\r
+               ox = x;\r
+               while ((dx--) > 0)\r
+               {\r
+                       ++x;\r
+                       if (p > 0)\r
+                       {\r
+                               this.mkDiv(ox, y, x-ox+ad, _s);\r
+                               y += yIncr;\r
+                               p += pru;\r
+                               ox = x;\r
+                       }\r
+                       else p += pr;\r
+               }\r
+               this.mkDiv(ox, y, x2-ox+ad+1, _s);\r
+       }\r
+\r
+       else\r
+       {\r
+               if (s-3 > 0)\r
+               {\r
+                       var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;\r
+                       _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;\r
+               }\r
+               else var _s = s;\r
+               var ad = Math.round(s/2);\r
+\r
+               var pr = dx<<1,\r
+               pru = pr - (dy<<1),\r
+               p = pr-dy,\r
+               oy = y;\r
+               if (y2 <= y1)\r
+               {\r
+                       ++ad;\r
+                       while ((dy--) > 0)\r
+                       {\r
+                               if (p > 0)\r
+                               {\r
+                                       this.mkDiv(x++, y, _s, oy-y+ad);\r
+                                       y += yIncr;\r
+                                       p += pru;\r
+                                       oy = y;\r
+                               }\r
+                               else\r
+                               {\r
+                                       y += yIncr;\r
+                                       p += pr;\r
+                               }\r
+                       }\r
+                       this.mkDiv(x2, y2, _s, oy-y2+ad);\r
+               }\r
+               else\r
+               {\r
+                       while ((dy--) > 0)\r
+                       {\r
+                               y += yIncr;\r
+                               if (p > 0)\r
+                               {\r
+                                       this.mkDiv(x++, oy, _s, y-oy+ad);\r
+                                       p += pru;\r
+                                       oy = y;\r
+                               }\r
+                               else p += pr;\r
+                       }\r
+                       this.mkDiv(x2, oy, _s, y2-oy+ad+1);\r
+               }\r
+       }\r
+}\r
+\r
+\r
+function mkLinDott(x1, y1, x2, y2)\r
+{\r
+       if (x1 > x2)\r
+       {\r
+               var _x2 = x2;\r
+               var _y2 = y2;\r
+               x2 = x1;\r
+               y2 = y1;\r
+               x1 = _x2;\r
+               y1 = _y2;\r
+       }\r
+       var dx = x2-x1, dy = Math.abs(y2-y1),\r
+       x = x1, y = y1,\r
+       yIncr = (y1 > y2)? -1 : 1,\r
+       drw = true;\r
+       if (dx >= dy)\r
+       {\r
+               var pr = dy<<1,\r
+               pru = pr - (dx<<1),\r
+               p = pr-dx;\r
+               while ((dx--) > 0)\r
+               {\r
+                       if (drw) this.mkDiv(x, y, 1, 1);\r
+                       drw = !drw;\r
+                       if (p > 0)\r
+                       {\r
+                               y += yIncr;\r
+                               p += pru;\r
+                       }\r
+                       else p += pr;\r
+                       ++x;\r
+               }\r
+               if (drw) this.mkDiv(x, y, 1, 1);\r
+       }\r
+\r
+       else\r
+       {\r
+               var pr = dx<<1,\r
+               pru = pr - (dy<<1),\r
+               p = pr-dy;\r
+               while ((dy--) > 0)\r
+               {\r
+                       if (drw) this.mkDiv(x, y, 1, 1);\r
+                       drw = !drw;\r
+                       y += yIncr;\r
+                       if (p > 0)\r
+                       {\r
+                               ++x;\r
+                               p += pru;\r
+                       }\r
+                       else p += pr;\r
+               }\r
+               if (drw) this.mkDiv(x, y, 1, 1);\r
+       }\r
+}\r
+\r
+\r
+function mkOv(left, top, width, height)\r
+{\r
+       var a = width>>1, b = height>>1,\r
+       wod = width&1, hod = (height&1)+1,\r
+       cx = left+a, cy = top+b,\r
+       x = 0, y = b,\r
+       ox = 0, oy = b,\r
+       aa = (a*a)<<1, bb = (b*b)<<1,\r
+       st = (aa>>1)*(1-(b<<1)) + bb,\r
+       tt = (bb>>1) - aa*((b<<1)-1),\r
+       w, h;\r
+       while (y > 0)\r
+       {\r
+               if (st < 0)\r
+               {\r
+                       st += bb*((x<<1)+3);\r
+                       tt += (bb<<1)*(++x);\r
+               }\r
+               else if (tt < 0)\r
+               {\r
+                       st += bb*((x<<1)+3) - (aa<<1)*(y-1);\r
+                       tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);\r
+                       w = x-ox;\r
+                       h = oy-y;\r
+                       if (w&2 && h&2)\r
+                       {\r
+                               this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1);\r
+                               this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);\r
+                       }\r
+                       else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);\r
+                       ox = x;\r
+                       oy = y;\r
+               }\r
+               else\r
+               {\r
+                       tt -= aa*((y<<1)-3);\r
+                       st -= (aa<<1)*(--y);\r
+               }\r
+       }\r
+       this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);\r
+       this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);\r
+}\r
+\r
+\r
+function mkOv2D(left, top, width, height)\r
+{\r
+       var s = this.stroke;\r
+       width += s-1;\r
+       height += s-1;\r
+       var a = width>>1, b = height>>1,\r
+       wod = width&1, hod = (height&1)+1,\r
+       cx = left+a, cy = top+b,\r
+       x = 0, y = b,\r
+       aa = (a*a)<<1, bb = (b*b)<<1,\r
+       st = (aa>>1)*(1-(b<<1)) + bb,\r
+       tt = (bb>>1) - aa*((b<<1)-1);\r
+\r
+       if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))\r
+       {\r
+               var ox = 0, oy = b,\r
+               w, h,\r
+               pxl, pxr, pxt, pxb, pxw;\r
+               while (y > 0)\r
+               {\r
+                       if (st < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3);\r
+                               tt += (bb<<1)*(++x);\r
+                       }\r
+                       else if (tt < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3) - (aa<<1)*(y-1);\r
+                               tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);\r
+                               w = x-ox;\r
+                               h = oy-y;\r
+\r
+                               if (w-1)\r
+                               {\r
+                                       pxw = w+1+(s&1);\r
+                                       h = s;\r
+                               }\r
+                               else if (h-1)\r
+                               {\r
+                                       pxw = s;\r
+                                       h += 1+(s&1);\r
+                               }\r
+                               else pxw = h = s;\r
+                               this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);\r
+                               ox = x;\r
+                               oy = y;\r
+                       }\r
+                       else\r
+                       {\r
+                               tt -= aa*((y<<1)-3);\r
+                               st -= (aa<<1)*(--y);\r
+                       }\r
+               }\r
+               this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);\r
+               this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);\r
+       }\r
+\r
+       else\r
+       {\r
+               var _a = (width-((s-1)<<1))>>1,\r
+               _b = (height-((s-1)<<1))>>1,\r
+               _x = 0, _y = _b,\r
+               _aa = (_a*_a)<<1, _bb = (_b*_b)<<1,\r
+               _st = (_aa>>1)*(1-(_b<<1)) + _bb,\r
+               _tt = (_bb>>1) - _aa*((_b<<1)-1),\r
+\r
+               pxl = new Array(),\r
+               pxt = new Array(),\r
+               _pxb = new Array();\r
+               pxl[0] = 0;\r
+               pxt[0] = b;\r
+               _pxb[0] = _b-1;\r
+               while (y > 0)\r
+               {\r
+                       if (st < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3);\r
+                               tt += (bb<<1)*(++x);\r
+                               pxl[pxl.length] = x;\r
+                               pxt[pxt.length] = y;\r
+                       }\r
+                       else if (tt < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3) - (aa<<1)*(y-1);\r
+                               tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);\r
+                               pxl[pxl.length] = x;\r
+                               pxt[pxt.length] = y;\r
+                       }\r
+                       else\r
+                       {\r
+                               tt -= aa*((y<<1)-3);\r
+                               st -= (aa<<1)*(--y);\r
+                       }\r
+\r
+                       if (_y > 0)\r
+                       {\r
+                               if (_st < 0)\r
+                               {\r
+                                       _st += _bb*((_x<<1)+3);\r
+                                       _tt += (_bb<<1)*(++_x);\r
+                                       _pxb[_pxb.length] = _y-1;\r
+                               }\r
+                               else if (_tt < 0)\r
+                               {\r
+                                       _st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1);\r
+                                       _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3);\r
+                                       _pxb[_pxb.length] = _y-1;\r
+                               }\r
+                               else\r
+                               {\r
+                                       _tt -= _aa*((_y<<1)-3);\r
+                                       _st -= (_aa<<1)*(--_y);\r
+                                       _pxb[_pxb.length-1]--;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               var ox = 0, oy = b,\r
+               _oy = _pxb[0],\r
+               l = pxl.length,\r
+               w, h;\r
+               for (var i = 0; i < l; i++)\r
+               {\r
+                       if (typeof _pxb[i] != "undefined")\r
+                       {\r
+                               if (_pxb[i] < _oy || pxt[i] < oy)\r
+                               {\r
+                                       x = pxl[i];\r
+                                       this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);\r
+                                       ox = x;\r
+                                       oy = pxt[i];\r
+                                       _oy = _pxb[i];\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               x = pxl[i];\r
+                               this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod);\r
+                               this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);\r
+                               ox = x;\r
+                               oy = pxt[i];\r
+                       }\r
+               }\r
+               this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);\r
+               this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);\r
+       }\r
+}\r
+\r
+\r
+function mkOvDott(left, top, width, height)\r
+{\r
+       var a = width>>1, b = height>>1,\r
+       wod = width&1, hod = height&1,\r
+       cx = left+a, cy = top+b,\r
+       x = 0, y = b,\r
+       aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,\r
+       st = (aa2>>1)*(1-(b<<1)) + bb,\r
+       tt = (bb>>1) - aa2*((b<<1)-1),\r
+       drw = true;\r
+       while (y > 0)\r
+       {\r
+               if (st < 0)\r
+               {\r
+                       st += bb*((x<<1)+3);\r
+                       tt += (bb<<1)*(++x);\r
+               }\r
+               else if (tt < 0)\r
+               {\r
+                       st += bb*((x<<1)+3) - aa4*(y-1);\r
+                       tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);\r
+               }\r
+               else\r
+               {\r
+                       tt -= aa2*((y<<1)-3);\r
+                       st -= aa4*(--y);\r
+               }\r
+               if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);\r
+               drw = !drw;\r
+       }\r
+}\r
+\r
+\r
+function mkRect(x, y, w, h)\r
+{\r
+       var s = this.stroke;\r
+       this.mkDiv(x, y, w, s);\r
+       this.mkDiv(x+w, y, s, h);\r
+       this.mkDiv(x, y+h, w+s, s);\r
+       this.mkDiv(x, y+s, s, h-s);\r
+}\r
+\r
+\r
+function mkRectDott(x, y, w, h)\r
+{\r
+       this.drawLine(x, y, x+w, y);\r
+       this.drawLine(x+w, y, x+w, y+h);\r
+       this.drawLine(x, y+h, x+w, y+h);\r
+       this.drawLine(x, y, x, y+h);\r
+}\r
+\r
+\r
+function jsgFont()\r
+{\r
+       this.PLAIN = 'font-weight:normal;';\r
+       this.BOLD = 'font-weight:bold;';\r
+       this.ITALIC = 'font-style:italic;';\r
+       this.ITALIC_BOLD = this.ITALIC + this.BOLD;\r
+       this.BOLD_ITALIC = this.ITALIC_BOLD;\r
+}\r
+var Font = new jsgFont();\r
+\r
+\r
+function jsgStroke()\r
+{\r
+       this.DOTTED = -1;\r
+}\r
+var Stroke = new jsgStroke();\r
+\r
+\r
+function jsGraphics(id, wnd)\r
+{\r
+       this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');\r
+\r
+       this.setStroke = function(x)\r
+       {\r
+               this.stroke = x;\r
+               if (!(x+1))\r
+               {\r
+                       this.drawLine = mkLinDott;\r
+                       this.mkOv = mkOvDott;\r
+                       this.drawRect = mkRectDott;\r
+               }\r
+               else if (x-1 > 0)\r
+               {\r
+                       this.drawLine = mkLin2D;\r
+                       this.mkOv = mkOv2D;\r
+                       this.drawRect = mkRect;\r
+               }\r
+               else\r
+               {\r
+                       this.drawLine = mkLin;\r
+                       this.mkOv = mkOv;\r
+                       this.drawRect = mkRect;\r
+               }\r
+       };\r
+\r
+\r
+       this.setPrintable = function(arg)\r
+       {\r
+               this.printable = arg;\r
+               if (jg_fast)\r
+               {\r
+                       this.mkDiv = mkDivIe;\r
+                       this.htmRpc = arg? htmPrtRpc : htmRpc;\r
+               }\r
+               else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv;\r
+       };\r
+\r
+\r
+       this.setFont = function(fam, sz, sty)\r
+       {\r
+               this.ftFam = fam;\r
+               this.ftSz = sz;\r
+               this.ftSty = sty || Font.PLAIN;\r
+       };\r
+\r
+\r
+       this.drawPolyline = this.drawPolyLine = function(x, y, s)\r
+       {\r
+               for (var i=0 ; i<x.length-1 ; i++ )\r
+                       this.drawLine(x[i], y[i], x[i+1], y[i+1]);\r
+       };\r
+\r
+\r
+       this.fillRect = function(x, y, w, h)\r
+       {\r
+               this.mkDiv(x, y, w, h);\r
+       };\r
+\r
+\r
+       this.drawPolygon = function(x, y)\r
+       {\r
+               this.drawPolyline(x, y);\r
+               this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);\r
+       };\r
+\r
+\r
+       this.drawEllipse = this.drawOval = function(x, y, w, h)\r
+       {\r
+               this.mkOv(x, y, w, h);\r
+       };\r
+\r
+\r
+       this.fillEllipse = this.fillOval = function(left, top, w, h)\r
+       {\r
+               var a = (w -= 1)>>1, b = (h -= 1)>>1,\r
+               wod = (w&1)+1, hod = (h&1)+1,\r
+               cx = left+a, cy = top+b,\r
+               x = 0, y = b,\r
+               ox = 0, oy = b,\r
+               aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,\r
+               st = (aa2>>1)*(1-(b<<1)) + bb,\r
+               tt = (bb>>1) - aa2*((b<<1)-1),\r
+               pxl, dw, dh;\r
+               if (w+1) while (y > 0)\r
+               {\r
+                       if (st < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3);\r
+                               tt += (bb<<1)*(++x);\r
+                       }\r
+                       else if (tt < 0)\r
+                       {\r
+                               st += bb*((x<<1)+3) - aa4*(y-1);\r
+                               pxl = cx-x;\r
+                               dw = (x<<1)+wod;\r
+                               tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);\r
+                               dh = oy-y;\r
+                               this.mkDiv(pxl, cy-oy, dw, dh);\r
+                               this.mkDiv(pxl, cy+y+hod, dw, dh);\r
+                               ox = x;\r
+                               oy = y;\r
+                       }\r
+                       else\r
+                       {\r
+                               tt -= aa2*((y<<1)-3);\r
+                               st -= aa4*(--y);\r
+                       }\r
+               }\r
+               this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);\r
+       };\r
+\r
+\r
+/* fillPolygon method, implemented by Matthieu Haller.\r
+This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.\r
+C source of GD 1.8.4 found at http://www.boutell.com/gd/\r
+\r
+THANKS to Kirsten Schulz for the polygon fixes!\r
+\r
+The intersection finding technique of this code could be improved\r
+by remembering the previous intertersection, and by using the slope.\r
+That could help to adjust intersections to produce a nice\r
+interior_extrema. */\r
+       this.fillPolygon = function(array_x, array_y)\r
+       {\r
+               var i;\r
+               var y;\r
+               var miny, maxy;\r
+               var x1, y1;\r
+               var x2, y2;\r
+               var ind1, ind2;\r
+               var ints;\r
+\r
+               var n = array_x.length;\r
+\r
+               if (!n) return;\r
+\r
+\r
+               miny = array_y[0];\r
+               maxy = array_y[0];\r
+               for (i = 1; i < n; i++)\r
+               {\r
+                       if (array_y[i] < miny)\r
+                               miny = array_y[i];\r
+\r
+                       if (array_y[i] > maxy)\r
+                               maxy = array_y[i];\r
+               }\r
+               for (y = miny; y <= maxy; y++)\r
+               {\r
+                       var polyInts = new Array();\r
+                       ints = 0;\r
+                       for (i = 0; i < n; i++)\r
+                       {\r
+                               if (!i)\r
+                               {\r
+                                       ind1 = n-1;\r
+                                       ind2 = 0;\r
+                               }\r
+                               else\r
+                               {\r
+                                       ind1 = i-1;\r
+                                       ind2 = i;\r
+                               }\r
+                               y1 = array_y[ind1];\r
+                               y2 = array_y[ind2];\r
+                               if (y1 < y2)\r
+                               {\r
+                                       x1 = array_x[ind1];\r
+                                       x2 = array_x[ind2];\r
+                               }\r
+                               else if (y1 > y2)\r
+                               {\r
+                                       y2 = array_y[ind1];\r
+                                       y1 = array_y[ind2];\r
+                                       x2 = array_x[ind1];\r
+                                       x1 = array_x[ind2];\r
+                               }\r
+                               else continue;\r
+\r
+                                // modified 11. 2. 2004 Walter Zorn\r
+                               if ((y >= y1) && (y < y2))\r
+                                       polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);\r
+\r
+                               else if ((y == maxy) && (y > y1) && (y <= y2))\r
+                                       polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);\r
+                       }\r
+                       polyInts.sort(integer_compare);\r
+                       for (i = 0; i < ints; i+=2)\r
+                               this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);\r
+               }\r
+       };\r
+\r
+\r
+       this.drawString = function(txt, x, y)\r
+       {\r
+               this.htm += '<div style="position:absolute;white-space:nowrap;'+\r
+                       'left:' + x + 'px;'+\r
+                       'top:' + y + 'px;'+\r
+                       'font-family:' +  this.ftFam + ';'+\r
+                       'font-size:' + this.ftSz + ';'+\r
+                       'color:' + this.color + ';' + this.ftSty + '">'+\r
+                       txt +\r
+                       '<\/div>';\r
+       };\r
+\r
+\r
+/* drawStringRect() added by Rick Blommers.\r
+Allows to specify the size of the text rectangle and to align the\r
+text both horizontally (e.g. right) and vertically within that rectangle */\r
+       this.drawStringRect = function(txt, x, y, width, halign)\r
+       {\r
+               this.htm += '<div style="position:absolute;overflow:hidden;'+\r
+                       'left:' + x + 'px;'+\r
+                       'top:' + y + 'px;'+\r
+                       'width:'+width +'px;'+\r
+                       'text-align:'+halign+';'+\r
+                       'font-family:' +  this.ftFam + ';'+\r
+                       'font-size:' + this.ftSz + ';'+\r
+                       'color:' + this.color + ';' + this.ftSty + '">'+\r
+                       txt +\r
+                       '<\/div>';\r
+       };\r
+\r
+\r
+       this.drawImage = function(imgSrc, x, y, w, h, a)\r
+       {\r
+               this.htm += '<div style="position:absolute;'+\r
+                       'left:' + x + 'px;'+\r
+                       'top:' + y + 'px;'+\r
+                       'width:' +  w + 'px;'+\r
+                       'height:' + h + 'px;">'+\r
+                       '<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+\r
+                       '<\/div>';\r
+       };\r
+\r
+\r
+       this.clear = function()\r
+       {\r
+               this.htm = "";\r
+               if (this.cnv) this.cnv.innerHTML = this.defhtm;\r
+       };\r
+\r
+\r
+       this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)\r
+       {\r
+               this.mkDiv(xr+cx, yt+cy, w, h);\r
+               this.mkDiv(xr+cx, yb+cy, w, h);\r
+               this.mkDiv(xl+cx, yb+cy, w, h);\r
+               this.mkDiv(xl+cx, yt+cy, w, h);\r
+       };\r
+\r
+       this.setStroke(1);\r
+       this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);\r
+       this.color = '#000000';\r
+       this.htm = '';\r
+       this.wnd = wnd || window;\r
+\r
+       if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();\r
+       if (typeof id != 'string' || !id) this.paint = pntDoc;\r
+       else\r
+       {\r
+               this.cnv = document.all? (this.wnd.document.all[id] || null)\r
+                       : document.getElementById? (this.wnd.document.getElementById(id) || null)\r
+                       : null;\r
+               this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';\r
+               this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;\r
+       }\r
+\r
+       this.setPrintable(false);\r
+}\r
+\r
+\r
+\r
+function integer_compare(x,y)\r
+{\r
+       return (x < y) ? -1 : ((x > y)*1);\r
+}\r
+\r
index 3b54b05..c560271 100644 (file)
@@ -166,7 +166,7 @@ function _AT() {
        TR_DATE_UNIX_TIMESTAMP:         seconds since epoch
        TR_DATE_INDEX_VALUE:            0-x, index into a date array
 */
-function AT_date($format='%Y-%M-%d', $timestamp = '', $formTR_type=TR_DATE_MYSQL_DATETIME) {   
+function AT_date($format='%Y-%M-%d', $timestamp = '', $format_type=TR_DATE_MYSQL_DATETIME) {   
        static $day_name_ext, $day_name_con, $month_name_ext, $month_name_con;
        global $_config;
 
@@ -214,7 +214,7 @@ function AT_date($format='%Y-%M-%d', $timestamp = '', $formTR_type=TR_DATE_MYSQL
                                                                'date_dec');
        }
 
-       if ($formTR_type == TR_DATE_INDEX_VALUE) {
+       if ($format_type == TR_DATE_INDEX_VALUE) {
                // apply timezone offset
                apply_timezone($timestamp);
        
@@ -231,11 +231,11 @@ function AT_date($format='%Y-%M-%d', $timestamp = '', $formTR_type=TR_DATE_MYSQL
 
        if ($timestamp == '') {
                $timestamp = time();
-               $formTR_type = TR_DATE_UNIX_TIMESTAMP;
+               $format_type = TR_DATE_UNIX_TIMESTAMP;
        }
 
        /* convert the date to a Unix timestamp before we do anything with it */
-       if ($formTR_type == TR_DATE_MYSQL_DATETIME) {
+       if ($format_type == TR_DATE_MYSQL_DATETIME) {
                $year   = substr($timestamp,0,4);
                $month  = substr($timestamp,5,2);
                $day    = substr($timestamp,8,2);
@@ -244,7 +244,7 @@ function AT_date($format='%Y-%M-%d', $timestamp = '', $formTR_type=TR_DATE_MYSQL
                $sec    = substr($timestamp,17,2);
                $timestamp      = mktime($hour, $min, $sec, $month, $day, $year);
 
-       } else if ($formTR_type == TR_DATE_MYSQL_TIMESTAMP_14) {
+       } else if ($format_type == TR_DATE_MYSQL_TIMESTAMP_14) {
            $year               = substr($timestamp,0,4);
            $month              = substr($timestamp,4,2);
            $day                = substr($timestamp,6,2);
index 17e29d3..e9afafb 100644 (file)
@@ -41,4 +41,29 @@ function preImportCallBack($p_event, &$p_header) {
        return 1;\r
 }\r
 \r
+/**\r
+* This function gets used by PclZip when extracting a zip archive.\r
+* @see file_manager/zip.php\r
+* @access  public\r
+* @return  int                         whether or not to include the file\r
+* @author  Joel Kronenberg\r
+*/\r
+function preExtractCallBack($p_event, &$p_header) {\r
+       global $translated_file_names;\r
+\r
+       if ($p_header['folder'] == 1) {\r
+               return 1;\r
+       }\r
+\r
+       if ($translated_file_names[$p_header['index']] == '') {\r
+               return 0;\r
+       }\r
+\r
+       if ($translated_file_names[$p_header['index']]) {\r
+               $p_header['filename'] = substr($p_header['filename'], 0, -strlen($p_header['stored_filename']));\r
+               $p_header['filename'] .= $translated_file_names[$p_header['index']];\r
+       }\r
+       return 1;\r
+}\r
+\r
 ?>
\ No newline at end of file
index 04e29cb..b53fb1e 100644 (file)
@@ -43,7 +43,7 @@ function load_editor($simple = TRUE, $name = FALSE, $mode="textareas") {
 //insert predefined template: template
 //insert page break: pagebreak
 
-echo '<script language="javascript" type="text/javascript" src="'.TR_BASE_HREF.'include/jscripts/tiny_mce/tiny_mce.js"></script>
+echo '<script language="javascript" type="text/javascript" src="'.TR_BASE_HREF.'include/jscripts/tiny_mce/tiny_mce_src.js"></script>
 <script language="javascript" type="text/javascript">';
 
 echo 'var ATutor = ATutor || {};
index 04a987a..0683dd2 100644 (file)
 /* as published by the Free Software Foundation.                        */\r
 /************************************************************************/\r
 \r
-/* constants to map privileges.privilege_id, used to load constant pages */\r
-\r
+/*******************************************************************\r
+ * How to add a new module\r
+ * 1. Add a privilege row into table "privileges";\r
+ * 2. Define the new privilege as a new constant in this script, \r
+ *    the privilege number must be same as privileges.privilege_id.\r
+ *    @see below\r
+ * 3. define all accessible pages in the new module down below.\r
+ *    If the page is accessible by public, define it outside the\r
+ *    if statement to check user privilege. Otherwise, define inside\r
+ *    privilege check "if" statment.\r
+*******************************************************************/\r
+\r
+/* when the request is an oauth import request, this script is not loaded. \r
+ Because the Utility::authenticate on the following each page section \r
+ messes up the oauth user authentication. \r
+*/\r
+global $oauth_import;\r
+if ($oauth_import) return;\r
+\r
+// constants to map privileges.privilege_id, used to load constant pages\r
 define('TR_PRIV_HOME', 1);\r
 define('TR_PRIV_SYSTEM', 2);\r
 define('TR_PRIV_USER_MANAGEMENT', 3);\r
@@ -19,7 +37,7 @@ define('TR_PRIV_LANGUAGE_MANAGEMENT', 4);
 define('TR_PRIV_TRANSLATION', 5);\r
 define('TR_PRIV_UPDATER', 6);\r
 define('TR_PRIV_MANAGE_TESTS', 7);\r
-define('TR_PRIV_MY_TESTS', 8);\r
+define('TR_PRIV_FILE_MANAGER', 8);\r
 define('TR_PRIV_PROFILE', 9);\r
 \r
 /* constants used for menu item generation. Used in class Menu (include/classes/Menu.class.php) */\r
@@ -221,28 +239,6 @@ if (array_key_exists(TR_PRIV_UPDATER, $privs) && Utility::authenticate($privs[TR
        $_pages['updater/patch_delete.php']['parent']    = 'updater/index.php';\r
 }\r
 \r
-// "manage tests" & "my tests" pages\r
-if (array_key_exists(TR_PRIV_MY_TESTS, $privs) && Utility::authenticate($privs[TR_PRIV_MY_TESTS], false))\r
-{\r
-       $_pages['tests/take_test.php']['title_var'] = 'take_test';\r
-       $_pages['tests/take_test.php']['parent']    = 'tests/my_tests.php';\r
-       \r
-       $_pages['tests/take_test_q.php']['title_var'] = 'take_test';\r
-       $_pages['tests/take_test_q.php']['parent']    = 'tests/my_tests.php';\r
-       \r
-       $_pages['tests/test_intro.php']['title_var'] = 'take_test';\r
-       $_pages['tests/test_intro.php']['parent']    = 'tests/my_tests.php';\r
-\r
-       //student page\r
-       $_pages['tests/my_tests.php']['title_var'] = 'my_tests';\r
-       $_pages['tests/my_tests.php']['img']       = 'images/home-tests.png';\r
-       $_pages['tests/my_tests.php']['icon']       = 'images/home-tests_sm.png';       \r
-       \r
-       $_pages['tests/view_results.php']['title_var'] = 'view_results';\r
-       $_pages['tests/view_results.php']['parent']    = 'tests/my_tests.php';\r
-       $_pages['tests/view_results.php']['children']  = array(); // to create the "back to tests" link\r
-}\r
-\r
 // manage tests\r
 if (array_key_exists(TR_PRIV_MANAGE_TESTS, $privs) && Utility::authenticate($privs[TR_PRIV_MANAGE_TESTS], false))\r
 {\r
@@ -351,4 +347,31 @@ if (array_key_exists(TR_PRIV_MANAGE_TESTS, $privs) && Utility::authenticate($pri
        $_pages['tests/delete_question.php']['title_var'] = 'delete';\r
        $_pages['tests/delete_question.php']['parent'] = 'tests/question_db.php';\r
 }\r
+\r
+// file manager\r
+if (array_key_exists(TR_PRIV_FILE_MANAGER, $privs) && Utility::authenticate($privs[TR_PRIV_FILE_MANAGER], false))\r
+{\r
+       $_pages['file_manager/index.php']['title_var'] = 'file_manager';\r
+       $_pages['file_manager/index.php']['parent']    = TR_NAV_TOP;\r
+       $_pages['file_manager/index.php']['guide']     = 'instructor/?p=file_manager.php';\r
+       $_pages['file_manager/index.php']['children']  = array('file_manager/new.php');\r
+       \r
+       $_pages['file_manager/new.php']['title_var'] = 'create_new_file';\r
+       $_pages['file_manager/new.php']['parent']    = 'file_manager/index.php';\r
+       \r
+       $_pages['file_manager/zip.php']['title_var'] = 'zip_file_manager';\r
+       $_pages['file_manager/zip.php']['parent']    = 'file_manager/index.php';\r
+       \r
+       $_pages['file_manager/rename.php']['title_var'] = 'rename';\r
+       $_pages['file_manager/rename.php']['parent']    = 'file_manager/index.php';\r
+       \r
+       $_pages['file_manager/move.php']['title_var'] = 'move';\r
+       $_pages['file_manager/move.php']['parent']    = 'file_manager/index.php';\r
+       \r
+       $_pages['file_manager/edit.php']['title_var'] = 'edit';\r
+       $_pages['file_manager/edit.php']['parent']    = 'file_manager/index.php';\r
+       \r
+       $_pages['file_manager/delete.php']['title_var'] = 'delete';\r
+       $_pages['file_manager/delete.php']['parent']    = 'file_manager/index.php';\r
+}\r
 ?>
\ No newline at end of file
index a8c731a..94d629b 100644 (file)
@@ -108,11 +108,11 @@ if (is_array($rows))
 }
 
 // define as constants. more constants are defined in include/constants.inc.php
-define('EMAIL',                     $_config['contact_email']);
-define('SITE_NAME',                 $_config['site_name']);
-$MaxFileSize       = $_config['max_file_size']; 
-$MaxCourseSize     = $_config['max_course_size'];
-$MaxFileSize       = $_config['max_file_size']; 
+define('EMAIL', $_config['contact_email']);
+define('SITE_NAME', $_config['site_name']);
+$MaxFileSize = $_config['max_file_size']; 
+$MaxCourseSize = $_config['max_course_size'];
+$MaxFileSize = $_config['max_file_size']; 
 $IllegalExtentions = explode('|',$_config['illegal_extentions']);
 /***** end loading $_config *****/
 
diff --git a/docs/install/db/Copy of language_text.sql b/docs/install/db/Copy of language_text.sql
deleted file mode 100644 (file)
index 68087d8..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-# Table structure for table 'language_text'
-#
-
-CREATE TABLE `AF_language_text` (
-  `language_code` varchar(5) NOT NULL default '',
-  `variable` varchar(30) NOT NULL default '',
-  `term` varchar(50) NOT NULL default '',
-  `text` blob NOT NULL,
-  `revised_date` datetime NOT NULL default '0000-00-00 00:00:00',
-  `context` text NOT NULL,
-  PRIMARY KEY  (`language_code`,`variable`,`term`)
-) TYPE=MyISAM;
-
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','aframe','AFrame',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','login','Login',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','register','Register',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','registration','Registration',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','required_field_text','<div class=\"required\" title=\"Required Field\">*</div> indicates required fields.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','login_name','Login Name',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','20_max_chars','20 character maximum',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','15_max_chars','15 character maximum',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','contain_only','May contain only letters, numbers, underscores, hyphens or periods.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password','Password',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','combination','Use a combination of letters, numbers and symbols',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_again','Password Again',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email_address','Email Address',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','first_name','First Name',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','last_name','Last Name',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','cancel','Cancel',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','copyright','Web site engine\'s code is copyright &copy; 2009',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','web_service_api','Web Service API',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','lesson_builder','Lesson Builder',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','logout','Logout',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','welcome','Welcome',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','profile','Profile',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','options','Options',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','input','Input',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','search','Search',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','web_service_id','Web Service ID',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_REGISTER_SUCCESS','You have registered successfully. Your web service ID is %s. This ID must be presented when using web service. This ID can always be retrieved from \"Profile\" page.',now(),'');
-
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','edit_profile','Edit Profile',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','consumer','Consumer',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','oauth_server','OAuth server',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','oauth_authenticate','OAuth User Authenticate',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','oauth_server_api','OAuth Server API',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','system','System',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','system_settings','System Settings',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','site_name','Site Name',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','contact_email','Contact Email',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','max_file_size','Maximum File Size',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','illegal_extentions','Illegal File Extensions',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','use_captcha','Allow the use of CAPTCHA',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','default_language','Default Language',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','latex_server','MimeTex Server for the LaTex service',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','latex_server_info','For production purposes, please install mimeTeX on your own server.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','theme','Theme',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','default_use_captcha','Default: Disable',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','default_max_file_size','Default: 1048576',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','factory_default','Reset to Factory Defaults',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','image_validation_text','In the above image there are numbers and/or letters displayed.  Please type them into the following field.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','audible_captcha','Audible Version of CAPTCHA',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','refresh_image','Refresh Image',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','image_validation_text2','This helps ensure a live person is registering on this system.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','or','Or',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','','',now(),'');
-
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_INVALID_TOKEN_TYPE','Invalid token type.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_SECRET_ERROR','Letters or numbers entered from the CAPTCHA image are incorrect. Try again.',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','','',now(),'');
-
-
-
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_CONFIRM_DELETE_ITEM','Are you sure you want to delete the following items? <strong>%s</strong>','2009-03-17 15:19:54','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_CONFIRM_DELETE_LANG','Are you sure you want to delete the language (<strong>%s</strong>)?','2009-02-23 15:13:50','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_CONFIRM_DELETE_MYOWN_UPDATE','Are you sure you want to <strong>delete</strong> update <strong>%s</strong>?','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_CONFIRM_DELETE_USER','Are you sure you want to delete the following users? <strong>%s</strong>','2009-02-06 11:58:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_CONFIRM_DELETE_USER_GROUP','Are you sure you want to delete the following user groups? <strong>%s</strong>','2009-02-12 15:08:53','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_ACCOUNT_DISABLED','That account has been disabled.','2009-01-08 11:43:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CANNOT_CONNECT','Cannot connect to URL: %s','2009-04-22 09:26:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CANNOT_DEL_DEFAULT_LANG','Cannot delete default language <strong>%s</strong>. The system cannot run properly without it.','2009-02-23 15:47:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CANNOT_UNZIP','Can NOT unzip the uploaded file.','2009-06-22 14:49:02','error msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CHOOSE_ACTION','Please choose action for file <strong>%s</strong>','2009-06-22 14:49:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CHOOSE_UNINSTALLED_UPDATE','Please choose an uninstalled update.','2009-06-22 14:49:02','Updater: error msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_CONFIRM_BAD','Your email address and account could not be confirmed.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_DB_NOT_UPDATED','Information could not be added to the database.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMAIL_EXISTS','An account with that email address already exists.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMAIL_INVALID','Email address was invalid.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMAIL_NOT_FOUND','No account found with that email address.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMPTY_FIELDS','The following required field(s) are empty:<br />\r\n%s.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMPTY_FIELD','Field cannot be empty. Data is not saved.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMPTY_SESSIONID','Empty Session ID.','2009-03-03 13:44:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMPTY_USER','Empty user.','2009-03-03 13:44:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_EMPTY_WEB_SERVICE_ID','Empty web service ID.','2009-03-04 14:53:18','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_FIRST_LAST_NAME_UNIQUE','First, second, and last names combination must be unique.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_INVALID_FORMAT','Invalid format.','2009-03-03 13:44:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_INVALID_LOGIN','Invalid login/password combination.','2009-01-08 11:43:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_INVALID_SESSION','Invalid session.','2009-03-03 13:44:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_INVALID_WEB_SERVICE_ID','Invalid web service ID.','2009-03-04 14:49:59','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_LANG_EMPTY','The text for this language has not been translated yet.','2009-02-24 13:57:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_LANG_EXISTS','The language you are trying to create already exists.','2009-02-24 09:20:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_LANG_WRONG_VERSION','The language pack you are trying to import is not compatible with this version of AFrame.','2009-02-24 13:58:25','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_LOGIN_CHARS','Your Login Name must only contain letters, numbers, periods, or underscores (_\'s).','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_LOGIN_EXISTS','That login already exists, please choose another.','2009-01-09 11:34:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_NOT_LOCALHOST','Sorry, the IP address of localhost is not public. For security reasons, validating resources located at non-public IP addresses has been disabled in this service.','2009-04-22 09:26:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_NO_ACTION_SELECTED','No action selected.','2009-02-04 15:31:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_NO_ITEM_SELECTED','You must select an item before using a button.','2009-02-04 15:31:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_PAGE_NOT_FOUND','Page (%s) cannot be found','2008-12-12 13:28:09','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_PASSWORD_CHARS','The password must contain letters, numbers, and symbols.','2009-01-09 13:41:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_PASSWORD_LENGTH','Password must be at least 8 characters long.','2009-01-09 13:41:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_PASSWORD_MISMATCH','Passwords did not match.','2009-01-09 13:41:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_REMOVE_WRITE_PERMISSION','Please remove write permission from the listed files.','2009-06-22 14:49:02','error msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_SELECT_ONE_ITEM','Only <em>one</em> item must be selected.','2009-02-04 15:31:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_SENDING_ERROR','There was an error sending the email message.','2009-01-16 13:14:08','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_UPDATE_ALREADY_INSTALLED','The selected update is already installed.','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_UPDATE_DEPENDENCY','Due to update dependency, please install the listed updates before installing this update: %s','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_UPDATE_XML_NOT_FOUND','Update XML file is not found.','2009-06-22 14:49:02','error msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_ERROR_WRONG_PASSWORD','Incorrect password.','2009-01-16 10:29:47','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_ACCOUNT_CONFIRMED','Account has been confirmed.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY','Action completed successfully.','2009-01-16 11:29:41','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_CANCELLED','Successfully cancelled without any changes.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_CHANGE_TO_SAME_EMAIL','The email address is same as what you currently have.','2009-01-16 11:54:46','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_CONFIRMATION_SENT','An email confirmation message has been sent.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_CONFIRM_EMAIL2','An email with instructions on retrieving your password has been sent.','2009-01-16 13:14:08','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_CONFIRM_GOOD','Your email address has been confirmed successfully.','2009-01-14 14:40:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_IMPORT_LANG_SUCCESS','New language was successfully imported.','2009-02-24 13:58:25','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_LOGIN_SUCCESS','You have logged in successfully.','2009-01-08 11:43:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_LOGOUT','You have successfully been logged out.','2009-01-08 09:38:14','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_ONLY_ENGLISH','Only English language is defined in the system. There is no foreign languages to translate.','2009-02-18 11:52:10','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_PASSWORD_CHANGED','Password changed successfully.','2009-01-16 10:35:40','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_PROFILE_UPDATED','Your Profile was successfully updated.','2009-01-15 10:59:58','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_REGISTER_SUCCESS','You have registered successfully. Your web service ID is %s. This ID must be presented when using web service. This ID can always be retrieved from \"Profile\" page.','2009-03-04 13:30:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_REG_THANKS_CONFIRM','Thank-you for registering. Please follow the instructions in the email we sent you on how to confirm your account. You will need to confirm your account before you can login.','2009-01-09 14:07:11','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_UPDATE_CREATED_SUCCESSFULLY','The update has been created successfully.','2009-06-22 14:49:02','Updater: feedback msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_FEEDBACK_UPDATE_INSTALLED_SUCCESSFULLY','The update has been installed successfully.','2009-06-22 14:49:02','Updater: feedback msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_ADD_EDIT_LANGUAGE','<h2>Add/Edit Language</h2>\r\n\r\n  <p>Adding and Editing the language properties allows users to change the following:\r\n <ul>\r\n                <li>Language Code (3 digit ISO-639-2 language code)</li>\r\n            <li>Locale (two letter abritrary code to represent a variation of a language)</li>\r\n          <li>Character Set (should always be UTF-8)</li>\r\n             <li>Regular Expression (leave blank)</li>\r\n           <li>Language name translated</li>\r\n           <li>Language name in English</li>\r\n           <li>Status (enabled/disabled)</li>\r\n  </ul>\r\n       </p>\r\n        <p>When \"Status\" is set to enabled, the language is displayed in the selector at the bottom of AFrame pages, which allows users to switch to this language.</p>\r\n','2009-04-15 09:46:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_CHANGE_EMAIL','<h2>Change Email</h2>\r\n<p>This page allows users to change email addresses. </p>\r\n','2009-04-15 09:47:18','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_CHANGE_PASSWORD','<h2>Change Password</h2>\r\n<p>This page allows users to change passwords. The form authenticates users by checking their old password first, and then setting a new password and typing it again.</p>\r\n','2009-04-15 09:53:55','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_CREATE_EDIT_USER ','<h2>Create/Edit User</h2>\r\n\r\n<p>All fields on \"Create User\" and \"Edit User\" forms are required. Most fields are self-explanatory. When the \"Account Status\" field is set to disabled, the user is not able to login. </p>\r\n<p>User accounts can also be created by individuals using the Registration form available through the public pages of AFrame. The accounts created via the Registration form are automatically set to user group \"Regular User\". </p>','2009-06-04 13:00:03','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_CREATE_EDIT_USER_GROUP','<h2>Create/Edit User Group</h2>\r\n\r\n<p>All fields are relatively self-explanatory.</p>\r\n\r\n<p>There are six privileges provided by AFrame. Privileges are fixed and not changeable.\r\n  <dl>\r\n                <dt>Home</dt>\r\n               <dd>This is where user implements own functions.</dd>\r\n               <dt>User Management</dt>\r\n            <dd>Create, edit, delete users.</dd>\r\n                <dt>Language Management</dt>\r\n                <dd>Create, edit, delete, enable, disable languages.</dd>\r\n           <dt>Translation</dt>\r\n                <dd>Translate all AFrame terms into languages other than English, or edit existing English text.</dd>\r\n               <dt>Profile Management</dt>\r\n         <dd>Edit profile, change password or email.</dd>\r\n    </dl>\r\n</p>','2009-06-04 13:05:21','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_CREATE_UPDATE','<h2>Creating Update</h2>\r\n\r\n<p>If you happen to come across a bug you can fix, or have a new feature you would like added to the AFrame public distribution, you can use Create Update to put your changes into a form that can be easily added to the AFrame public code. Or, if you have a feature you are adding to one AFrame installation that you would like to have added to another, Create Update is ideal for reproducing your feature across installations. If you are creating new features that are not going to become part of the AFrame public source code, you can build them into a update so they can be reapplied from version to version as you upgrade your AFrame system. Creating updates does require knowledge of PHP, and of SQL if you plan on creating a update that changes the AFrame database. Please refer to the appropriate documentation for information on PHP and SQL. <p>\r\n\r\n<dl>\r\n    <dt>AFrame Update ID</dt>\r\n   <dd>The update id you give to your update must be different from all updates available for the particular version of AFrame it applies to. It is suggested you prefix your updates with a special identifier that represents the author or the authoring organization. If for example the University of Toronto is creating the update, a update ID might look like \"uoft_0002.\"</dd>\r\n     <dt>AFrame Version to Apply</dt>\r\n    <dd>This needs to be the exact version number of the AFrame version the update applies to (e.g 1.6). including any minor version numbers (e.g 1.6.1.2)  The exact version number can be found on the Administrator open screen under \"Statistics and Information.\" In most cases when applying a update created for an older version of AFrame, the \"AFrame version to Apply\" will need to be adjusted. Or, this can be adjusted manually in the patch.xml file included with the source code of the update.\r\n    </dd>\r\n       <dt>Description</dt>\r\n        <dd>This should be a detailed description of what the update does. Example might include \"fixes problem uploading files to filemanager\" for a bug fix, or \"added a timer function to tests\" for an added feature, or \"removes registration tab\" for a feature adjustment, etc. Include enough detail so those applying the update understand exactly what it will do..</dd>\r\n   <dt>SQL Statement</dt>\r\n      <dd>This optional field can be used to insert SQL commands which modify the AFrame database. It might be used to write an SQL statement to modify and existing table, such as changing a data type, or a field size, or to add or remove an field. It can also be used to insert SQL that generates a new table for a new feature created by a update, or it can be used to insert data into a table used by a feature created by the update. Any SQL can be included in this field. Be careful when running SQL, that that SQL is not going to interfere with upgrade SQL. If you are changing table structures and those same tables are being altered during an upgrade, the upgrade may fail.</dd>\r\n      <dt>Dependant Updates</dt>\r\n  <dd>It is common for later updates to require changes from earlier updates before they can be installed. If this is the case for the update you are creating, enter the update IDs into the Dependant Update ID field. Click on Add Dependent Update if additional dependencies are required. Be sure to check the updates on the opening screen of the Updater to see if the file you are modifying with your update is  being modified by an update.AFrame.ca update. If they are modifying the same files, you may need to include the ID numbers for those updates in the Dependant Updates for the update your are creating.</dd>\r\n      <dt>Files</dt>  \r\n    <dd>This area is where most AFrame updates are created. Click on <strong>Add File</strong>  to generate a update block. A update block can include one of four actions on the file being modified, as described below. As many update blocks as required can be added to a update. </dd>\r\n            <dl>\r\n        <dt>Add File</dt>\r\n   <dd>The <strong>Add</strong> action can be used to add a new file to AFrame. This action is often used in conjuction with other update blocks that alter or delete files, to add a replacement file for one deleted, or to perhaps add a required or include file needed by a modified section in the file being changed. In the <strong>File Name</strong> field enter the file name to be assigned to the file when it is installed. In the <strong>Directory</strong> field enter the <i>relative path</i> from the AFrame root directory in which the modified file is or will exist. Select  from <strong>Upload File</strong> using the Browse button to locate the file in your local computer\'s file system. Note that the upload file can have any name. It will be renamed to the file name listed in the File Name field when it is installed.</dd>\r\n     <dt>Alter File</dt>\r\n <dd>This option is used when you wish to make changes to a piece of code within an existing source code file. In the <strong>File Name</strong> field enter the name of the file in the AFrame source code that will be altered. In the <strong>Directory</strong> field enter the relative path to the directory in which the to be alter file exists, relative to the AFrame root directory. In the <strong>Code To Replace From</strong> field copy the code from the original file the will be replaced, or appended to, and in the <strong>Code To Replace To</strong> field enter to code that will replace the code above in the <i>From</i> field. Or, if you are adding code instead of replacing code, include the code from the field above so it gets added back if you are only using that code as a way of identifying a location in the file where new code is being added.</dd>\r\n     <dt>Delete File</dt>\r\n        <dd>This option will remove files from AFrame. In the <strong>File Name</strong>  field enter the name of the file to be deleted. In the <strong>Directory</strong> field enter the path to the directory in which the to be delete file exists, relative to the root directory of the AFrame installation. </dd>\r\n   <dt>Overwrite File</dt>\r\n     <dd>This option is used to replace an existing file in AFrame with a new one. In the <strong>File Name</strong>  field enter the name of the file to be replaced. In the <strong>Directory</strong> field enter the path to the directory in which the to be replaced file exists, relative to the root directory of the AFrame installation. In the <strong>Upload File</strong> field use the Browse button to choose a file from your local computer to replace the specified file. The upload file may be named anything. It will be renamed to the file it is replacing when the update is installed.</dd>\r\n     </dl>\r\n       <dt>Create Update</dt>\r\n      <dd>Click on this button to build the update into a downloadable zip file. This zip file can then be uploaded in the Upload field on the main Updater screen to apply a update to a system.</dd>\r\n    <dt>Save Update</dt>\r\n        <dd>Click on this button to save the developing update to the AFrame database for future reference. Though it is not required, you should save a copy of the update in this way, so it can be retrieved and edited if necessary. Or, if a update takes more than a single sitting to build, you can save it, then retrieve it later to continue.</dd>\r\n       <dt>Cancel</dt>\r\n     <dd>Press this button to ignore the latest changes to the update, and return to My Own Updates Screen.</dd>\r\n\r\n</dl>','2009-06-22 15:32:56','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_LANGUAGE','<h2>Language Management</h2>\r\n\r\n <p>AFrame can be displayed in many different languages! Through the Language Manager language packs can be selected and imported.</p>\r\n\r\n<h3>Managing Existing Languages</h3>\r\n   <p>Installed languages can be edited, deleted, or exported as an AFrame language pack for redistribution. When exporting a language, a download prompt will appear asking to download a zip file of the language pack.</p>\r\n  <p>Note that the English language (language code: eng) cannot be deleted. This is the base language pack that ensures AFrame runs properly. When other languages are installed, users can disable it if they don\'t want AFrame to be displayed in English.</p>\r\n     \r\n<h3>Importing Languages</h3>\r\n    <p>Language packs can be imported by retreiving the package and then importing it into AFrame.</p>\r\n  <ol>\r\n                <li>Visit <a href=\"http://www.atutor.ca/aframe/translate/index.php\" target=\"_new\">AFrame Language Packs</a> to download one of the available language packs for your version.</li>\r\n              <li>Use the <code>Browse...</code> button to find the downloaded language pack.</li>\r\n                <li>Use the <code>Import</code> button to import the language.</li>\r\n </ol>\r\n\r\n   <p>You can contribute to the AFrame community by exporting a language pack from your AFrame installation, and attaching it to a message in the atutor.ca <a href=\"http://atutor.ca/forum/4/1.html\">Translation Forum</a>. Also see the <a href=\"http://atutor.ca/atutor/docs/translate.php\">Translator Documentation</a> for further details about translating AFrame.</p>','2009-06-04 13:08:15','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_LOGIN','<h2>Login</h2>\r\n\r\n<p>A user may login to AFrame with their Login Name or Email address, and the Password entered during <a href=\"../register.php\">registration</a>. Logging in gives users access to use more functions provided to regular user.</p>\r\n','2009-04-15 09:51:28','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_PASSWORD_REMINDER','<h2>Forgot Your Password</h2>\r\n\r\n<p>If you have forgotten your password, use the <em>Forgot your password?</em> link on the Login screen. The form will email the login name to you, along with a link you must follow to change your password.</p>\r\n','2009-04-15 09:51:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_PROFILE','<h2>Profile</h2>\r\n<p>This section allows a user to change elements of his/her personal profile.</p>\r\n\r\n<p>Although the login name cannot be altered, password, email address, and other personal information are editable.</p>\r\n','2009-04-15 09:51:47','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_REGISTRATION','<h2>Register</h2>\r\n\r\n<p>In order for a user to login to the AFrame system and save results from accessibility reviews, manage translate or administer the system, a unique system account needs to be created.  Use the <em>Register</em> link on the login screen to access the registration form. If email-confirmation has been enabled by the system administrator, a message will be sent to the email address entered, containing a link that must be followed to confirm the new account. Once this has been done, the login name or email address, and the password entered during registration can now be used on the <a href=\"../login.php\">Login</a> screen.</p>','2009-04-15 09:52:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_TRANSLATION','<h2>Translation</h2>\r\n\r\n      <p>All fields are self-explanatory. Note that language drop down box lists all the languages defined in the current installation of AFrame, no matter the language status (enabled or disabled). If you are translating a new language for AFrame, first define the language using the Language management tool\'s Add Language feature. If you do not have access to the Language management tools, ask your AFrame administrators to add the language.</p>\r\n\r\n<p>You can contribute to the AFrame community by exporting a language pack from your AFrame installation, and attaching it to a message in the atutor.ca <a href=\"http://atutor.ca/forum/4/1.html\">Translation Forum</a>. Also see the <a href=\"http://atutor.ca/atutor/docs/translate.php\">Translator Documentation</a> for further details about translating AFrame.</p>','2009-06-04 13:17:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_UPDATER','<h2>Updater</h2>\r\n  <p>The Updater was introduce in AFrame 1.6 to allow administrators to update their systems with feature adjustments, security fixes, and other AFrame code changes in between AFrame releases. The Updater is included as a standard module with AFrame 1.6.1+, and installs as an extra module for 1.6.</p>\r\n<dl>\r\n        <dt>The Update List</dt>\r\n    <dd>On the opening screen of the Updater will appear a list of updates available for the version of AFrame you are using, along with a description of each update.  This list is retrieved from update.atutor.ca, as are the updates themselves, so you must be connected to the Internet. Updates are retrieved from update.atutor.ca by AFrame and applied as necessary. </dd>\r\n    <dt>File Permissions</dt>\r\n   <dd>In most cases you will be asked to temporarily grant write permission to the files that need to be updated or replaced, then once the update has been applied, you will be asked to change the permissions back to read only. It is important that you follow the instructions after updates have been applied, otherwise you run the risk of opening a security hole. \r\n </dd>\r\n       <dt>Types of Updates</dt>\r\n   <dd>Updates come in various forms. Some updates replace code in a file with new code. Others replace a file with a new file.  Others may do both on multiple files and multiple code changes. Other updates delete files that are no longer required.</dd>\r\n  <dt>Required and Non-Required Updates</dt>\r\n  <dd>In most cases you will want to install updates in the order they appear in the update list, but not all updates are required updates.  Some feature updates can be ignored if you do not need the features they would add or modify on your system. Other updates will have dependencies, requiring the administrator to install earlier updates before installing a later one. You will be prompted to install previous updates if there are dependencies.</dd>\r\n        <dt>Checks and File Backups</dt>\r\n    <dd>If you have made changes to a file the Updater wishes to change,  you will be prompted to continue or not. The updater compares your local file with the same file in the AFrame code repository, and if they differ the prompt will display. In many cases  the Updater can apply updates without changing the code you have modified, but if the code to be replaced was modified, the update will fail, or if the update replaces a file, your changes will be lost. In all cases the updater will create a backup of the files that were modified, identified by the filename plus the update number added as a suffix. Rename the file to its original name to restore that file back to its original state. You can list these files by clicking the view messages button next to the update listing after the update is installed. After you have confirmed that the updates were applied and are working properly, it is safe to delete the backup files, though it does not hurt to keep them around. </dd>\r\n    <dt>Private Updates</dt>\r\n    <dd>In some cases private updates can be applied by uploading a update file through the upload form below the update list.  Private updates are often those used to apply changes that are not being applied to the AFrame default source code, or to apply custom features, or to share updates between users, etc. When uploading a update, be sure the update id, defined in the patch.xml file, is unique . </dd>\r\n</dl>','2009-06-22 15:37:42','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_USER','<h2>User Management</h2>\r\n\r\n <p>This section allows administrators to manage all user accounts. Each user belongs to a user group to which privileges are assigned.</p>\r\n\r\n<p>There are three types of default user groups that are created when AFrame is installed. These are described below along with the default privileges associated with each groups. \r\n      <dl>\r\n                <dt>Administrator</dt>\r\n              <dd>Administrators have privileges to use the Home, manage users, languages and manage their own profile.</dd>\r\n              <dt>Regular User</dt>\r\n               <dd>Regular users have privileges to use the Home and manage their own profile.</dd>\r\n                <dt>Translator</dt>\r\n         <dd>Translators have privileges to use the Home, translate AFrame terms from English to other languages, and to manage their own profile. The languages that can be used in the system are defined by users who have \"Language Management\" privileges.</dd>\r\n       </dl>\r\n</p>\r\n\r\n<h3>Creating User Accounts</h3>\r\n\r\n<p>The users who belong to a group that has \"User Management\" privileges can manually add users to the system by using <em>Create User</em>.</p>\r\n<p>User accounts can also be created by individuals using the Registration form available through the public pages of AFrame. The accounts created via the Registration form are automatically set to user group \"Regular User\". </p>\r\n\r\n<h3>User Group</h3>\r\n\r\n<p><em>User Group</em> is used to create new user groups and edit existing user groups.</p>','2009-06-04 12:55:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_USER_GROUP ','<h2>User Group</h2>\r\n\r\n<p>The User Group section allows administrators to manage user groups. User groups define the privileges that are granted to the users who are members of a group. Note that \"Administrator\" and \"Regular User\" groups can not  be deleted. They must exist for AFrame\'s proper operations. All other groups are optional.</p>\r\n\r\n<p>There are three default user groups in AFrame. Below is a description of the default privileges that are granted to each group. The privileges in user groups are editable by users who are a member of a group that has the \"User Management\" privilege.\r\n<dl>\r\n<dt>Administrator</dt>\r\n<dd>Administrators have privileges to use the Home, manage users, languages and manage their own profile.</dd>\r\n<dt>Regular User</dt>\r\n<dd>Regular users have privileges to use the Home and manage their own profile. </dd>\r\n<dt>Translator</dt>\r\n<dd>Translators have privileges to use the Home, translate AFrame terms from English to other languages, and to manage their own profile. The languages that can be used in the system are defined by users who have \"Language Management\" privileges.</dd>\r\n</dl>\r\n</p>','2009-06-04 13:04:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_HELP_USER_PASSWORD ','<h2>Change Password</h2>\r\n\r\n<p>All fields are required and self-explanatory. Once the new password is set successfully, an email notification is sent to the user.</p>\r\n','2009-04-15 09:53:11','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_INFOS_INVALID_USER','You must <a href=\"login.php\">login</a> to use this section.','2009-01-15 16:13:14','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_msgs','AF_INFOS_UPDATE_INSTALLED_AND_REMOVE_PERMISSION','The update has been installed. Please remove write permission as instruction.','2009-06-22 14:49:02','Updater: info msg');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','15_max_chars','8 characters minimum, 15 characters maximum','2009-01-09 10:16:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','20_max_chars','20 character maximum','2009-01-09 10:16:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','aframe_documentation','AFrame Documentation','2009-06-16 10:25:25','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','aframe_handbook','AFrame Handbook','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','aframe_version_to_apply','AFrame Version to Apply','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','aframe_whatis','AFrame provides a basic frame to build an application. It has build-in functions to support multiple languages, translation, user/user group managment, updater and user profile managment.','2009-05-29 08:55:24','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','copyright','Web site engine\'s code is copyright &copy; 2009','2009-05-25 10:57:43','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add','Add','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_a_file','Add A File','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_dependent_update','Add A Dependent Update','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_edit_group','Add/Edit Group','2009-04-08 15:20:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_edit_language','Add/Edit Language','2009-02-23 13:27:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_language','Add Language','2009-02-18 15:56:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','add_privileges','Add Privileges','2009-02-17 09:45:53','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','all','All','2008-11-27 09:49:41','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','alter','Alter','2009-06-22 14:49:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','available_updates','Available Updates','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','calendar','Calendar','2009-04-06 10:43:09','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','cancel','Cancel','2009-01-09 10:29:35','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','change_email','Change Email','2009-01-15 11:29:34','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','change_password','Change Password','2009-01-15 11:29:34','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','charset','Character Set','2009-02-20 11:43:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','choose_lang','Choose a language to translate','2008-11-26 10:11:15','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','close_popup','Close Popup','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','code_to_replace_from','Code To Replace From','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','code_to_replace_to','Code To Replace To','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','combination','Use a combination of letters, numbers and symbols','2009-01-09 10:16:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','confirm_delete','Are you sure you want to delete these records?','2009-04-09 11:29:46','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','contain_only','May contain only letters, numbers, underscores, hyphens or periods.','2009-01-09 10:16:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','continue','Continue','2009-06-22 14:49:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','create_edit_update','Create/Edit Update','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','create_edit_user','Create/Edit User','2009-02-05 10:25:08','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','create_edit_user_group','Create User Group','2009-02-18 11:13:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','create_update','Create Update','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','create_user','Create User','2009-01-21 15:58:32','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','date','Date','2009-02-27 16:07:19','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','date_created','Date Created','2009-02-17 12:02:27','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete','Delete','2009-01-22 16:02:07','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete_language','Delete Language','2009-02-18 15:56:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete_this_file','Delete This File','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete_update','Delete Update','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete_user','Delete User','2009-02-06 11:41:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','delete_user_group','Delete User Group','2009-02-12 15:08:53','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','dependent_updates','Dependent Updates','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','dependent_update_id','Dependent Update ID','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','dependent_update_not_installed','<br><span style=\"color: red\">Waring: Due to update dependency, please install the listed updates first: </span>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','description','Description','2008-11-24 14:25:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','directory','Directory','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','disable','Disable','2009-01-20 11:47:15','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','disabled','Disabled','2009-01-20 11:45:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','done','Done','2009-06-22 16:16:50','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','edit','Edit','2009-01-22 16:02:07','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','edit_function','Edit Function','2009-03-17 14:58:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','edit_profile','Edit Profile','2009-01-16 10:52:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','edit_update','Edit Update','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email','Email','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email_address','Email Address','2009-01-09 10:40:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email_confirmation_message','You have registered for an account on %1s. Please finish the registration process by confirming your email address by using the following link: %2s .','2009-01-14 13:25:55','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email_confirmation_message2','To finish changing your account\'s email address on %1s, please confirm your email address by using the following link: %2s .','2009-01-16 11:07:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','email_confirmation_subject','Email Confirmation','2009-01-14 13:25:55','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','enable','Enable','2009-01-20 11:47:15','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','enabled','Enabled','2009-01-20 11:45:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','english_context','English Context','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','english_text','English Text','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','error','Error','2008-11-24 14:25:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','errors','Errors','2009-03-09 09:55:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','error_type','Error Type','2009-01-21 12:38:17','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','expand_add_privileges','Expand Add Privileges','2009-02-17 09:45:53','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','expected_result','Expected Result','2008-11-24 14:25:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','export','Export','2009-02-24 13:58:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','file','File','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','files','Files','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','file_name','File Name','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','filter','Filter','2008-11-27 09:48:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','first_name','First Name','2009-01-09 10:40:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','get_my_update','Get My Update','2009-06-22 14:49:01','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','grant_write_permission','Please grant <strong>write</strong> permission to folders and files listed below:<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','handbook_toc','Handbook Toc','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','import','Import','2009-02-18 15:56:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','import_a_new_lang','Import a New Language','2009-02-24 13:58:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','info','Information','2009-03-06 11:29:10','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','input','Input','2008-11-21 14:16:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','install','Install','2009-06-22 14:49:03','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','installed_date','Installed Date','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','jump_to_content','Jump to Content','2009-05-25 10:17:46','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','language','Language','2009-04-14 10:35:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','lang_code','Language Code','2009-02-20 11:43:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','last_login','Last Login','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','last_modified','Last Modified','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','last_name','Last Name','2009-01-09 10:28:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','last_update','Last Update','2009-02-17 12:02:27','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','locale','Locale','2009-02-23 13:27:38','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','login_name_or_email','Login Name or Email','2009-01-09 10:40:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','login_text','Enter the Login Name (or email) and Password you chose at registration.<br /><br /><br />Not registered yet? <a href=\"register.php\" >Register</a> Or, <a href=\"password_reminder.php\">Forgot your password?</a><br /><br />','2009-01-29 14:24:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','logout','Logout','2009-01-08 09:31:41','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','msg_terms','Message Terms','2009-05-05 09:05:33','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','myown_updates','My Own Updates','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','na','N/A','2009-02-23 14:31:55','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','name','Name','2009-03-18 14:53:42','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','name_in_english','Language name in English','2009-02-20 11:43:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','name_in_language','Language name translated','2009-02-23 13:28:12','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','name_in_translated','Language name translated','2009-02-20 11:43:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','never','Never','2009-02-05 11:25:19','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','new_or_translated','New or Translated Terms','2008-11-27 09:48:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','new_password','New Password','2009-01-16 10:52:03','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','no','No','2009-01-21 12:38:17','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','none_found','None Found.','2009-01-21 15:06:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','not_installed','Not Installed','2009-06-22 14:49:03','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','no_results_found','No results found.','2009-01-21 12:38:17','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','overwrite','Overwrite','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password','Password','2009-01-09 10:40:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_again','New Password Again','2009-01-16 10:52:03','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_blurb','Enter your account\'s email address below and an email with instructions on retrieving your password will be sent to you. The email address must be the same as the one you used for registration.','2009-01-16 13:19:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_changed','Password Changed','2009-02-06 09:08:32','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_change_confirm','Your password on %s has been changed successfully. Go to %s to login.','2009-01-16 13:17:32','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_change_msg','Your password has been altered. Please use the information below.','2009-02-06 09:08:31','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_new_blurb','Enter a new password for your account.','2009-01-16 13:55:40','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_old','Old Password','2009-01-16 10:27:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_reminder','Password Reminder','2009-01-07 16:14:08','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','password_request2','Dear %1$s,\r\n\r\nYour login name is %1$s.\r\n\r\nTo set a new password, follow the link below.\r\n\r\n%4$s\r\n\r\n(If this link does not take you to the site, copy and paste it into the address bar of your internet browser)\r\n\r\nThe link will become invalid after %3$s days.','2009-01-16 13:05:25','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','privileges','Privileges','2009-02-12 14:15:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','profile','Profile','2009-01-15 10:02:55','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','published_date','Published Date','2009-01-21 12:38:17','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','register','Register','2009-01-08 09:30:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','registration','Registration','2009-01-08 15:51:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','relative_directory','Directory is relative directory to AFrame root, for example: docs/images/ or tools/tests/. Leave empty if it is AFrame root directory.','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','remove','Remove','2009-01-23 14:04:46','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','remove_write_permission','<span style=\"color:red\">Please <strong>REMOVE</strong> write permission on the listed folders and files for your security:</span><p><strong>Note:</strong> To remove permissions on Unix use <kbd>chmod 755</kbd> then the file name..</p>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','repair_example','Repair Example','2008-11-24 14:25:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','replace_file','Replace File','2009-06-22 14:49:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','required_field','Required Field','2009-01-08 15:51:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','required_field_text','<div class=\"required\" title=\"Required Field\">*</div> indicates required fields.','2009-01-08 15:51:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','requirement','Requirement','2008-11-24 14:25:44','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','reset_filter','Reset Filter','2008-11-27 09:48:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','result','Result','2008-12-01 14:45:48','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','results_found','Results Found: %s','2008-11-27 09:48:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','return_to_handbook','Return to Handbook','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','save','Save','2009-01-15 10:01:07','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','save_and_close','Save and Close','2009-04-09 11:36:31','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','search','Search','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','search_phase','Search Phase','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','search_str','Search String','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','search_text','Search for terms that contains the given string. For example, search for phase \"desc\" returns all terms that contain string \"desc\".','2008-12-02 11:06:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','select','Select','2009-02-05 14:16:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','select_all','select/unselect all','2009-01-23 14:04:46','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','sent_via_aframe','Sent via an AFrame system at %s','2009-01-09 14:15:29','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','sql_statement','SQL Statement','2009-06-22 14:49:02','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','status','Status','2009-01-21 12:38:52','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','submit','Submit','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','submit_no','No','2009-01-23 11:25:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','submit_yes','Yes','2009-01-23 11:25:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','the_follow_errors_occurred','The following errors occurred:','2008-12-15 09:25:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','title','Title','2009-01-20 11:45:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translated_context','Translated Context','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translated_terms','Translated Terms','2008-11-27 09:48:36','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translated_text','Translated Text','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translate_to','Translate to','2008-12-01 13:18:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translation','Translation','2009-02-18 11:01:39','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','translator','Translator','2009-01-07 15:05:34','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updated_terms','Updated Terms','2008-12-02 09:16:45','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updater','Updater','2009-06-22 14:49:01','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updater_alter_modified_files','The listed files have been modified locally. If you choose to proceed, your local file will be modified. The original\nfile will be backup before the modification. Please note that the modification on your customized code may break your customization.<br>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updater_overwrite_modified_files','The listed files have been modified locally. If you choose to proceed, the update file will be copied to your local machine. \nYou have to manually merge this file and your local copy.<br>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updater_show_backup_files','Below is the list of the backup files created by update installation. After ensuring AFrame works properly with the update, you may want to delete these files. If AFrame does not work properly with the update, you can always revert back to the old files by renaming the backup files \nto the original file names,  removing the [update_id].old portion of the file name. <br>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updater_show_update_files','Below is the list of the update files copied to your computer. \nPlease manually merge the change between the update files and your local copy. <br>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','updates','Updates','2009-06-22 14:49:01','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','update_dependent_update_not_installed','<br /><span style=\"color: red\">Warning: There are update dependencies, please install the listed updates first: </span>','2009-06-22 14:49:03','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','update_local_file_not_exist','Cannot proceed. The listed files are not exist in your local machine. If you renamed them to your copy, in order to proceed, please rename back.<br>','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','upload','Upload','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','upload_file','Upload File','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','upload_update','Upload a zip file to install update:','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','user','User','2009-02-27 16:07:19','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','users','Users','2009-04-14 10:41:51','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','user_group','User Group','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','user_status','User Status','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','version_not_match','This update is for AFrame version %s. Does not match with your current AFrame version. The installation of it may break AFrame. Are you sure you want to proceed?','2009-06-22 14:49:02','Updater');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','view','View','2009-01-20 11:47:15','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','view_message','View Message','2009-06-22 14:49:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','warning','Warning','2009-05-29 16:19:57','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','web_service_api','Web Service API','2009-03-13 11:56:12','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','web_service_id','Web Service ID','2009-03-04 13:48:23','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','web_site','Web Site','2009-02-06 09:08:32','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','welcome','Welcome','2009-01-08 09:30:56','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','yes','Yes','2009-01-21 12:38:17','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','yyyy-mm-dd','yyyy-mm-dd','2009-01-21 15:06:01','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','match_all_words','Match All Words','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','match_any_word','Match Any Word','2009-02-04 11:51:16','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','next_chapter','Next Chapter','2009-01-28 15:28:06','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','print_version','Print Version','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','hide_contents','Hide Contents','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','previous_chapter','Previous Chapter','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','home','Home','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','term_type','Term Type','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','new_terms','New Terms','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','interface_terms','Interface Terms','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','system_update_id','System Update ID','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','available_to','Available To','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','author','Author','2009-03-24 13:47:37','');
-INSERT INTO `AF_language_text` VALUES ('eng', '_template','back_to','Back To:','2009-03-24 13:47:37','');
index b67d3e5..e8d4171 100644 (file)
@@ -346,7 +346,6 @@ CREATE TABLE `tests_questions_assoc` (
   `question_id` mediumint(8) unsigned NOT NULL default '0',\r
   `weight` varchar(4) NOT NULL default '',\r
   `ordering` mediumint(8) unsigned NOT NULL default '0',\r
-  `required` tinyint(3) unsigned NOT NULL default '0',\r
   PRIMARY KEY  (`test_id`,`question_id`)\r
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
 \r
@@ -1019,8 +1018,8 @@ INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_da
 INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (4, 'language', 'Language management: Create, edit, delete, enable, disable languages.', NOW(), 'language/index.php', 40, 0);\r
 INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (5, 'translation', 'Translation: Translate all Transformable terms into other languages.', NOW(), 'translation/index.php', 50, 0);\r
 INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (6, 'updater', 'Updater: Install, create, edit updates.', NOW(), 'updater/index.php', 60, 0);\r
-INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (7, 'manage_tests', 'Tests management: Create, edit, delete test questions and tests.', NOW(), 'tests/index.php?_course_id={COURSE_ID}', 70, 0);\r
-INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (8, 'my_tests', 'My Tests: Take available test and view test results.', NOW(), 'tests/my_tests.php', 80, 0);\r
+INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (7, 'manage_tests', 'Tests management: Used by instructors to create, edit, delete course-related test questions and tests.', NOW(), 'tests/index.php?_course_id={COURSE_ID}', 70, 0);\r
+INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (8, 'file_manager', 'File Manager: Allows an instructor to upload and manage files for a course. Files can then be made available to students by linking them into content pages.', NOW(), 'file_manager/index.php?_course_id={COURSE_ID}', 80, 0);\r
 INSERT INTO `privileges` (`privilege_id`, `title_var`, `description`, `create_date`, `link`, `menu_sequence`, `open_to_public`) VALUES (9, 'profile', 'Profile management: Edit profile, change password or email.', NOW(), 'profile/index.php', 90, 0);\r
 \r
 INSERT INTO `user_groups` (`user_group_id`, `title`, `description`, `create_date`) VALUES (1, 'Administrator', 'Administrate users, user groups, languages and updates.', now());\r
@@ -1036,7 +1035,7 @@ INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requi
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (1, 9, 0);\r
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (2, 1, 0);\r
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (2, 7, 2);\r
-INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (2, 8, 3);\r
+INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (2, 8, 2);\r
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (2, 9, 0);\r
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (3, 1, 0);\r
 INSERT INTO `user_group_privilege` (`user_group_id`, `privilege_id`, `user_requirement`) VALUES (3, 4, 0);\r
index a9e2573..f1f13e2 100644 (file)
@@ -29,14 +29,14 @@ $oAuthServerTokensDAO = new OAuthServerTokensDAO();
 // Validation input parameters
 if ($_REQUEST['oauth_token'] == '')
 {
-       echo 'error='.urlencode('Empty oauth token.');
+       echo 'error='.urlencode('Empty oauth token');
        exit;
 }
 
 $token_row = $oAuthServerTokensDAO->getByTokenAndType($_REQUEST['oauth_token'], 'request');
 if (!is_array($token_row))
 {
-       echo 'error='.urlencode('Invalid oauth token.');
+       echo 'error='.urlencode('Invalid oauth token');
        exit;
 }
 
index 8a81a1b..45a637b 100644 (file)
@@ -17,7 +17,7 @@ require_once(TR_INCLUDE_PATH.'classes/DAO/OAuthServerConsumersDAO.class.php');
 \r
 if (!isset($_GET['consumer']))\r
 {\r
-       echo "error=".urlencode('Empty parameter: consumer.');\r
+       echo "error=".urlencode('Empty parameter: consumer');\r
        return;\r
 }\r
 else\r
index 5b44ab6..9c9850d 100644 (file)
 \r
 define('TR_INCLUDE_PATH', '../include/');\r
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');\r
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');\r
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');\r
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');\r
 \r
+global $_course_id;\r
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);\r
 \r
 if (isset($_GET['submit_create'])) {\r
-       header('Location: create_question_'.$_GET['question_type'].'.php');\r
+       header('Location: create_question_'.$_GET['question_type'].'.php?_course_id='.$_course_id);\r
        exit;\r
 }\r
 \r
-$_pages['tests/questions.php?tid='.$_GET['tid']]['title_var']    = 'questions';\r
-$_pages['tests/questions.php?tid='.$_GET['tid']]['parent']   = 'tests/index.php';\r
-$_pages['tests/questions.php?tid='.$_GET['tid']]['children'] = array('tests/add_test_questions.php');\r
+$_pages['tests/questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id]['title_var']    = 'questions';\r
+$_pages['tests/questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id]['parent']   = 'tests/index.php';\r
+$_pages['tests/questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id]['children'] = array('tests/add_test_questions.php');\r
 \r
 $_pages['tests/add_test_questions.php']['title_var']    = 'add_questions';\r
-$_pages['tests/add_test_questions.php']['parent']   = 'tests/questions.php?tid='.$_GET['tid'];\r
+$_pages['tests/add_test_questions.php']['parent']   = 'tests/questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id;\r
 \r
 require_once(TR_INCLUDE_PATH.'header.inc.php');\r
 ?>\r
index 2cdc80b..796583a 100644 (file)
@@ -14,79 +14,83 @@ $page = 'tests';
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 
+global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$testsQuestionsDAO = new TestsQuestionsDAO();
+$testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
 
 $tid = intval($_POST['tid']);
 
-$_pages['tests/questions.php?tid='.$tid]['title_var']    = 'questions';
-$_pages['tests/questions.php?tid='.$tid]['parent']   = 'tests/index.php';
-$_pages['tests/questions.php?tid='.$tid]['children'] = array('tests/add_test_questions.php?tid='.$tid);
+$_pages['tests/questions.php?tid='.$tid.'&_course_id='.$_course_id]['title_var']    = 'questions';
+$_pages['tests/questions.php?tid='.$tid.'&_course_id='.$_course_id]['parent']   = 'tests/index.php';
+$_pages['tests/questions.php?tid='.$tid.'&_course_id='.$_course_id]['children'] = array('tests/add_test_questions.php?tid='.$tid.'&_course_id='.$_course_id);
 
-$_pages['tests/add_test_questions.php?tid='.$tid]['title_var']  = 'add_questions';
-$_pages['tests/add_test_questions.php?tid='.$tid]['parent'] = 'tests/questions.php?tid='.$tid;
+$_pages['tests/add_test_questions.php']['title_var']  = 'add_questions';
+$_pages['tests/add_test_questions.php']['parent'] = 'tests/questions.php?tid='.$tid.'&_course_id='.$_course_id;
 
 $_pages['tests/add_test_questions_confirm.php']['title_var'] = 'add_questions';
-$_pages['tests/add_test_questions_confirm.php']['parent']    = 'tests/questions.php?tid='.$tid;
+$_pages['tests/add_test_questions_confirm.php']['parent']    = 'tests/questions.php?tid='.$tid.'&_course_id='.$_course_id;
 
 if (isset($_POST['cancel'])) {
        $msg->addFeedback('CANCELLED');
-       header('Location: questions.php?tid='.$tid);
+       header('Location: questions.php?tid='.$tid.'&_course_id='.$_course_id);
        exit;
 } else if (isset($_POST['submit_yes'])) {
        //get order
-       $sql = "SELECT MAX(ordering) AS max_ordering FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=".$tid;
-       $result = mysql_query($sql, $db);
-       $order  = mysql_fetch_assoc($result);
-       $order = $order['max_ordering'];
+       $order = $testsQuestionsAssocDAO->getMaxOrderByTestID($tid);
 
        $sql = "REPLACE INTO ".TABLE_PREFIX."tests_questions_assoc VALUES ";
        foreach ($_POST['questions'] as $question) {
                $order++;
                $question = intval($question);
-               $sql .= '('.$tid.', '.$question.', 0, '.$order.', 0),';
+               $sql .= '('.$tid.', '.$question.', 0, '.$order.'),';
        }
        $sql = substr($sql, 0, -1);
-       $result = mysql_query($sql, $db);
-
-       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
-       header('Location: questions.php?tid='.$tid);
-       exit;
+       
+       if ($testsQuestionsAssocDAO->execute($sql)) {
+               $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+               header('Location: questions.php?tid='.$tid.'&_course_id='.$_course_id);
+               exit;
+       }
+       else {
+               $msg->addError('DB_NOT_UPDATED');
+       }
 } else if (isset($_POST['submit_no'])) {
        $msg->addFeedback('CANCELLED');
-       header('Location: add_test_questions.php?tid='.$tid);
+       header('Location: add_test_questions.php?tid='.$tid.'&_course_id='.$_course_id);
        exit;
 }
 
 if (!is_array($_POST['questions']) || !count($_POST['questions'])) {
        $msg->addError('NO_QUESTIONS_SELECTED');
-       header('Location: add_test_questions.php?tid='.$tid);
+       header('Location: add_test_questions.php?tid='.$tid.'&_course_id='.$_course_id);
        require_once(TR_INCLUDE_PATH.'footer.inc.php');
        exit;
 }
 
 require_once(TR_INCLUDE_PATH.'header.inc.php');
 
-foreach ($_POST['questions'] as $id => $cTR_array) {
-       foreach ($cTR_array as $idx => $q) {
+foreach ($_POST['questions'] as $id => $cat_array) {
+       foreach ($cat_array as $idx => $q) {
                $_POST['questions'][$id][$idx] = intval($q);
+               $questions[] = intval($q);
        }
 }
-foreach ($_POST['questions'] as $cTR_array) {
-       $questions .= addslashes(implode(',',$cTR_array)).',';
-}
-
-$questions = substr($questions, 0, -1);
 
-$sql = "SELECT question, question_id FROM ".TABLE_PREFIX."tests_questions WHERE question_id IN ($questions) AND course_id=$_SESSION[course_id] ORDER BY question";
-$result = mysql_query($sql, $db);
+$rows = $testsQuestionsDAO->getByQuestionIDs($questions);
 
 $questions = '';
-while ($row = mysql_fetch_assoc($result)) {
-       $questions .= '<li>'.htmlspecialchars($row['question']).'</li>';
-       $questions_array['questions['.$row['question_id'].']'] = $row['question_id'];
+if (is_array($rows)) {
+       foreach ($rows as $row) {
+               $questions .= '<li>'.htmlspecialchars($row['question']).'</li>';
+               $questions_array['questions['.$row['question_id'].']'] = $row['question_id'];
+       }
 }
 $questions_array['tid'] = $_POST['tid'];
+$questions_array['_course_id'] = $_course_id;
 $msg->addConfirm(array('ADD_TEST_QUESTIONS', $questions), $questions_array);
 
 $msg->printConfirm();
index 6bf1f1e..45df36e 100644 (file)
@@ -61,7 +61,7 @@ class TestsUtility {
                global $_course_id;\r
 ?>\r
        <script type="text/javascript" language="javascript">\r
-               document.writeln('<a href="#" onclick="javascript:window.open(\'<?php echo TR_BASE_HREF; ?>tests/form_editor.php?area=<?php echo $area; ?>&_course_id=<?php echo $_course_id; ?>\',\'newWin1\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=640,height=480\'); return false;" style="cursor: pointer; text-decoration: none" ><?php echo _AT('use_visual_editor'); ?></a>');\r
+               document.writeln('<a href="#" onclick="javascript:window.open(\'<?php echo TR_BASE_HREF; ?>tests/form_editor.php?area=<?php echo $area; ?>&_course_id=<?php echo $_course_id; ?>\',\'formEditorWin\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=640,height=480\'); return false;" style="cursor: pointer; text-decoration: none" ><?php echo _AT('use_visual_editor'); ?></a>');\r
        </script>\r
 \r
 <?php\r
index f79b188..65fd543 100644 (file)
@@ -13,7 +13,7 @@
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
 require_once(TR_INCLUDE_PATH.'../tests/lib/likert_presets.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
index d4fb2e5..7ecc9af 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
 $testsQuestionsDAO = new TestsQuestionsDAO();
 
 if (isset($_POST['cancel'])) {
index a1eee4a..aa1068f 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
 global $_course_id;
 
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
 $testsQuestionsDAO = new TestsQuestionsDAO();
 
 if (isset($_POST['cancel'])) {
index 8a1dc85..6218acb 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
@@ -20,7 +20,6 @@ global $_course_id;
 
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 $testsQuestionsDAO = new TestsQuestionsDAO();
-//require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
 
 if (isset($_POST['cancel'])) {
        $msg->addFeedback('CANCELLED');
index c080685..a0629fb 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
index de9c8b6..ec79e2f 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
index b7d7fa4..b248db8 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
index 2cc61d3..d5de18e 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_question_queries.inc.php');
+require_once(TR_INCLUDE_PATH.'lib/test_question_queries.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
index 1fec8b9..3619b20 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
+
+global $_course_id;
 
 if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
        $content_base_href = 'get.php/';
 } else {
-       $content_base_href = 'content/' . $_SESSION['course_id'] . '/';
+       $content_base_href = 'content/' . $_course_id . '/';
 }
 // Verify that we may access this question
 if (!isset($_SESSION['dd_question_ids']) || !is_array($_SESSION['dd_question_ids']) || !isset($_SESSION['dd_question_ids'][$_GET['qid']])) {
@@ -30,9 +33,9 @@ if (count($_SESSION['dd_question_ids']) == 0) {
 }
 session_write_close();
 $_GET['qid'] = intval($_GET['qid']);
-$sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions WHERE question_id=$_GET[qid]";
-$result = mysql_query($sql, $db);
-$row = mysql_fetch_assoc($result);
+
+$testQuestionsDAO = new TestsQuestionsDAO();
+$row = $testQuestionsDAO->get($_GET['qid']);
 
 $_letters = array(_AT('A'), _AT('B'), _AT('C'), _AT('D'), _AT('E'), _AT('F'), _AT('G'), _AT('H'), _AT('I'), _AT('J'));
 $_colours = array('#FF9900', '#00FF00', '#0000FF', '#F23AA3', '#9999CC', '#990026', '#0099CC', '#22C921', '#007D48', '#00248F');
@@ -51,7 +54,7 @@ for ($i=0; $i < 10; $i++) {
        <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $myLang->getCharacterSet(); ?>" />
        <meta name="Generator" content="Transformable - Copyright 2010 by http://atutor.ca" />
        <base href="<?php echo TR_BASE_HREF . $content_base_href; ?>" />
-       <script type="text/javascript" src="<?php echo TR_BASE_HREF; ?>include/jscripts/jquery.js"></script>
+       <script type="text/javascript" src="<?php echo TR_BASE_HREF; ?>include/jscripts/infusion/InfusionAll.js"></script>
        <script type="text/javascript" src="<?php echo TR_BASE_HREF; ?>include/jscripts/interface.js"></script>
        <script type="text/javascript" src="<?php echo TR_BASE_HREF; ?>include/jscripts/wz_jsgraphics.js"></script>
        <link rel="stylesheet" href="<?php echo TR_BASE_HREF; ?>themes/default/styles.css" type="text/css" />
index 36e4908..4c9f7ec 100644 (file)
@@ -14,69 +14,51 @@ $page = 'tests';
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/ContentTestsAssocDAO.class.php');
+
+global $_course_id;
 
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
        
-       if (isset($_POST['submit_no'])) {
-               $msg->addFeedback('CANCELLED');
-               header('Location: index.php');
-               exit;
-       } else if (isset($_POST['submit_yes'])) {
-               
-               $tid = intval($_POST['tid']);
-
-               $sql    = "DELETE FROM ".TABLE_PREFIX."tests WHERE test_id=$tid AND course_id=$_SESSION[course_id]";
-               $result = mysql_query($sql, $db);
-
-               if (mysql_affected_rows($db) == 1) {
-                       $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$tid";
-                       $result = mysql_query($sql, $db);
-
-                       //delete test content association as well
-                       $sql    = "DELETE FROM ".TABLE_PREFIX."content_tests_assoc WHERE test_id=$tid";
-                       $result = mysql_query($sql, $db);
+$testsDAO = new TestsDAO();
 
-                       /* it has to delete the results as well... */
-                       $sql    = "SELECT result_id FROM ".TABLE_PREFIX."tests_results WHERE test_id=$tid";
-                       $result = mysql_query($sql, $db);
-                       if ($row = mysql_fetch_array($result)) {
-                               $result_list = '('.$row['result_id'];
-
-                               while ($row = mysql_fetch_array($result)) {
-                                       $result_list .= ','.$row['result_id'];
-                               }
-                               $result_list .= ')';
-                       }
-
-                       if ($result_list != '') {
-                               $sql    = "DELETE FROM ".TABLE_PREFIX."tests_answers WHERE result_id IN $result_list";
-                               $result = mysql_query($sql, $db);
+if (isset($_POST['submit_no'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index.php?_course_id='.$_course_id);
+       exit;
+} else if (isset($_POST['submit_yes'])) {
+       
+       $tid = intval($_POST['tid']);
 
+       if ($testsDAO->Delete($tid)) {
+               $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
+               $testsQuestionsAssocDAO->DeleteByTestID($tid);
 
-                               $sql    = "DELETE FROM ".TABLE_PREFIX."tests_results WHERE test_id=$tid";
-                               $result = mysql_query($sql, $db);
-                       }
-               }
+               //delete test content association as well
+               $contentTestsAssocDAO = new ContentTestsAssocDAO();
+               $contentTestsAssocDAO->DeleteByTestID($tid);
+       }
 
-               $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
-               header('Location: '.TR_BASE_HREF.'tests/index.php');
-               exit;
+       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+       header('Location: '.TR_BASE_HREF.'tests/index.php?_course_id='.$_course_id);
+       exit;
 
-       } /* else: */
+} /* else: */
 
-       require_once(TR_INCLUDE_PATH.'header.inc.php');
+require_once(TR_INCLUDE_PATH.'header.inc.php');
 
-       $_GET['tid'] = intval($_GET['tid']);
+$_GET['tid'] = intval($_GET['tid']);
 
-       $sql    = "SELECT title FROM ".TABLE_PREFIX."tests WHERE test_id=$_GET[tid] AND course_id=$_SESSION[course_id]";
-       $result = mysql_query($sql, $db);
-       $row    = mysql_fetch_array($result);
+$row = $testsDAO->get($_GET['tid']);
 
-       unset($hidden_vars);
-       $hidden_vars['tid'] = $_GET['tid'];
+unset($hidden_vars);
+$hidden_vars['tid'] = $_GET['tid'];
+$hidden_vars['_course_id'] = $_course_id;
 
-       $msg->addConfirm(array('DELETE_TEST', $row['title']), $hidden_vars);
-       $msg->printConfirm();
+$msg->addConfirm(array('DELETE_TEST', $row['title']), $hidden_vars);
+$msg->printConfirm();
 
-       require_once(TR_INCLUDE_PATH.'footer.inc.php');
+require_once(TR_INCLUDE_PATH.'footer.inc.php');
 ?>
\ No newline at end of file
index 872d996..aee7b09 100644 (file)
@@ -19,8 +19,6 @@ global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 $testsQuestionsDAO = new TestsQuestionsDAO();
 
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
-
 $qid = intval($_GET['qid']);
 if ($qid == 0){
        $qid = intval($_POST['qid']);
index a9c7e63..016fa65 100644 (file)
@@ -20,8 +20,6 @@ global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 $testsQuestionsDAO = new TestsQuestionsDAO();
 
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
-
 // for matching test questions
 $_letters = array(_AT('a'), _AT('b'), _AT('c'), _AT('d'), _AT('e'), _AT('f'), _AT('g'), _AT('h'), _AT('i'), _AT('j'));
 
index 2bf9518..559c35e 100644 (file)
@@ -20,8 +20,6 @@ global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 $testsQuestionsDAO = new TestsQuestionsDAO();
 
-require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');
-
 $qid = intval($_GET['qid']);
 if ($qid == 0){
        $qid = intval($_POST['qid']);
index e9a9857..99cb756 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
+global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$testsDAO = new TestsDAO();
 
 $tid = intval($_GET['tid']);
 
 /* Retrieve the content_id of this test */
-$sql = "SELECT title, random, num_questions, instructions FROM ".TABLE_PREFIX."tests WHERE test_id=$tid";
-$result        = mysql_query($sql, $db); 
-if (!($test_row = mysql_fetch_assoc($result))) {
+if (!($test_row = $testsDAO->get($tid))) {
        $msg->addError('ITEM_NOT_FOUND');
-       header(url_rewrite('tests/index.php', TR_PRETTY_URL_IS_HEADER));
+       header('Location: index.php?_course_id='.$_course_id);
        exit;
 }
 
index 62f38d3..50975c9 100644 (file)
@@ -58,6 +58,7 @@ if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
        <base href="<?php echo TR_BASE_HREF; ?>" />\r
        <script src="<?php echo $_base_path; ?>include/jscripts/infusion/InfusionAll.js" type="text/javascript"></script>\r
+       <script src="<?php echo $_base_path; ?>include/jscripts/transformable.js" type="text/javascript"></script>\r
 </head>\r
 \r
 <body <?php echo $onload; ?> >\r
@@ -104,17 +105,17 @@ function init() {
 <script type="text/javascript">\r
 <!--\r
 function insertTo(field) {\r
-               if (window.opener.document.getElementById(field)) {\r
-                       //use the following if we want to apply absolute path.  -harris.\r
-                       //window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent({format : 'raw'});\r
-                       window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent();\r
-               }\r
+  if (window.opener.document.getElementById(field)) {\r
+    //use the following if we want to apply absolute path.     -harris.\r
+    alert(tinyMCE.activeEditor.getContent());\r
+    //window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent({format : 'raw'});\r
+    window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent();\r
+  }\r
 }\r
 -->\r
 </script>\r
 \r
-\r
-<iframe src="<?php echo $_base_path; ?>mods/_core/file_manager/index.php?framed=1<?php echo SEP; ?>popup=1" name="filemanager" width="98%" height="480">\r
+<iframe src="<?php echo $_base_path; ?>file_manager/index.php?framed=1<?php echo SEP; ?>popup=1<?php echo SEP; ?>_course_id=<?php echo $_course_id; ?>" name="filemanager" width="98%" height="480">\r
 </iframe>\r
 \r
 </body>\r
index a479f84..f8525d1 100644 (file)
@@ -21,7 +21,6 @@ if (!isset($_GET['category_id'])) {
        // Suppress warnings\r
        $_GET['category_id'] = -1;\r
 }\r
-//require_once(TR_INCLUDE_PATH.'../tests/lib/test_result_functions.inc.php');\r
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');\r
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsCategoriesDAO.class.php');\r
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');\r
@@ -32,11 +31,9 @@ $testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
 \r
 $cats = array();\r
 if ($_GET['category_id'] >= 0) {\r
-       $row = $testsQuestionsCategoriesDAO->get($_GET[category_id]);\r
-//     $sql    = "SELECT * FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] AND category_id=$_GET[category_id] ORDER BY title";\r
+       $category_row = $testsQuestionsCategoriesDAO->get($_GET[category_id]);\r
 } else {\r
-       $rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);\r
-//     $sql    = "SELECT * FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] ORDER BY title";\r
+       $category_rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);\r
 }\r
 \r
 //$result      = mysql_query($sql, $db);\r
@@ -44,14 +41,14 @@ if ($_GET['category_id'] <= 0) {
        $cats[] = array('title' => _AT('cats_uncategorized'), 'category_id' => 0);\r
 }\r
 \r
-if (is_array($rows)) {\r
-       foreach ($rows as $row) $cats[] = $row;\r
+if (is_array($category_rows)) {\r
+       foreach ($category_rows as $row) $cats[] = $row;\r
 }\r
-else if (isset($row)) {\r
-       $cats[] = $row;\r
+else if (isset($category_row)) {\r
+       $cats[] = $category_row;\r
 }\r
 \r
-       $cols = 3;\r
+$cols = 3;\r
 ?>\r
 \r
        <div class="input-form" style="width:90%;">\r
@@ -76,7 +73,7 @@ else if (isset($row)) {
        </div>\r
 \r
 <?php if ($tid): ?>\r
-       <form method="post" action="tests/add_test_questions_confirm.php" name="form">\r
+       <form method="post" action="tests/add_test_questions_confirm.php?_course_id=<?php echo $_course_id; ?>" name="form">\r
 <?php else: ?>\r
        <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">\r
 <?php endif; ?>\r
index a0d18ca..e62ef63 100644 (file)
@@ -12,9 +12,9 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'lib/qti.inc.php'); 
 require_once(TR_INCLUDE_PATH.'lib/pclzip.lib.php');
 require_once(TR_INCLUDE_PATH.'lib/pclzip_callback.lib.php');
+require_once(TR_INCLUDE_PATH.'lib/qti.inc.php'); 
 require_once(TR_INCLUDE_PATH.'classes/QTI/QTIImport.class.php');
 require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
@@ -196,29 +196,30 @@ if (!$overwrite){
 $coursesDAO = new CoursesDAO();
 $q_row = $coursesDAO->get($_course_id);
 
-if ($q_row['max_quota'] == TR_COURSESIZE_UNLIMITED) return;
-else $zip_size_limit = $MaxCourseSize;
-
-$totalBytes   = FileUtility::dirsize($import_path);
-
-$total_after  = $zip_size_limit - $totalBytes;
-
-if (is_dir(TR_CONTENT_DIR . $course_id.'/')) 
-{
-       $course_total = FileUtility::dirsize(TR_CONTENT_DIR . $course_id.'/');
-       $total_after  -= $course_total;
-}
-
-if ($total_after < 0) {
-       /* remove the content dir, since there's no space for it */
-       $errors = array('NO_CONTENT_SPACE', number_format(-1*($total_after/TR_KBYTE_SIZE), 2 ) );
-       $msg->addError($errors);
+if ($q_row['max_quota'] != TR_COURSESIZE_UNLIMITED) {
+       $zip_size_limit = $MaxCourseSize;
        
-       // Clean up import path and inserted course row
-       FileUtility::clr_dir($import_path);
-
-       header('Location: index.php?_course_id='.$_course_id);
-       exit;
+       $totalBytes   = FileUtility::dirsize($import_path);
+       
+       $total_after  = $zip_size_limit - $totalBytes;
+       
+       if (is_dir(TR_CONTENT_DIR . $_course_id.'/')) 
+       {
+               $course_total = FileUtility::dirsize(TR_CONTENT_DIR . $_course_id.'/');
+               $total_after  -= $course_total;
+       }
+       
+       if ($total_after < 0) {
+               /* remove the content dir, since there's no space for it */
+               $errors = array('NO_CONTENT_SPACE', number_format(-1*($total_after/TR_KBYTE_SIZE), 2 ) );
+               $msg->addError($errors);
+               
+               // Clean up import path and inserted course row
+               FileUtility::clr_dir($import_path);
+       
+               header('Location: index.php?_course_id='.$_course_id);
+               exit;
+       }
 }
 
 $ims_manifest_xml = @file_get_contents($import_path.'imsmanifest.xml');
@@ -329,7 +330,7 @@ foreach ($qids as $order=>$qid){
 //                     "VALUES ($tid, $qid, $weight, $new_order, 0)";
 //     $result = mysql_query($sql, $db);
        $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
-       $testsQuestionsAssocDAO->Create($tid, $qid, $weight, $new_order, 0);
+       $testsQuestionsAssocDAO->Create($tid, $qid, $weight, $new_order);
 }
 //debug('imported test');
 if (!$msg->containsErrors()) {
index 4dc198c..e271f1e 100644 (file)
@@ -17,34 +17,25 @@ require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
 
 global $_course_id;
-
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 
 if (isset($_GET['edit'], $_GET['id'])) {
        header('Location: edit_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
        exit;
 } else if (isset($_GET['preview'], $_GET['id'])) {
-       header('Location: preview.php?tid='.$_GET['id'].'_course_id='.$_course_id);
+       header('Location: preview.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
        exit;
 } else if (isset($_GET['questions'], $_GET['id'])) {
-       header('Location: questions.php?tid='.$_GET['id'].'_course_id='.$_course_id);
-       exit;
-} else if (isset($_GET['submissions'], $_GET['id'])) {
-       header('Location: results.php?tid='.$_GET['id'].'_course_id='.$_course_id);
-       exit;
-} else if (isset($_GET['statistics'], $_GET['id'])) {
-       header('Location: results_all_quest.php?tid='.$_GET['id'].'_course_id='.$_course_id);
+       header('Location: questions.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
        exit;
 } else if (isset($_GET['delete'], $_GET['id'])) {
-       header('Location: delete_test.php?tid='.$_GET['id'].'_course_id='.$_course_id);
+       header('Location: delete_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
        exit;
 } else if (isset($_GET['export'], $_GET['id'])){
-       header('Location: export_test.php?tid='.$_GET['id'].'_course_id='.$_course_id);
+       header('Location: export_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
 } else if (isset($_GET['edit']) 
                || isset($_GET['preview']) 
                || isset($_GET['questions']) 
-               || isset($_GET['submissions']) 
-               || isset($_GET['statistics']) 
                || isset($_GET['delete'])
                || isset($_GET['export'])) {
 
diff --git a/docs/tests/lib/test_question_queries.inc.php b/docs/tests/lib/test_question_queries.inc.php
deleted file mode 100644 (file)
index f06b0bb..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?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.                        */
-/************************************************************************/
-
-//Question for multiple choice.
-define('TR_SQL_QUESTION_MULTI', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (  NULL, %d, %d, 1, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '', '', '', '', '', '', '', '', '', '', 5, 0)");
-
-//Question for True/False
-define('TR_SQL_QUESTION_TRUEFALSE', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (      NULL, %d, %d, 2, '%s', '%s', 
-                                                       '', '', '', '', '', '', '', '', '', '', 
-                                                       %s, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-                                                       '', '', '', '', '', '', '', '', '', '', 5, 0)");
-
-
-//Question for Open ended
-define('TR_SQL_QUESTION_LONG', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (   NULL, %d, %d, 3, '%s', '%s', 
-                                                       '', '', '', '', '', '', '', '', '', '', 
-                                                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-                                                       '', '', '', '', '', '', '', '', '', '', %s, 0)");
-
-//Question for Likert
-define('TR_SQL_QUESTION_LIKERT', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES ( NULL, %d, %d, 4, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '', '', '', '', '', '', '', '', '', '', 0, 0)");
-
-//Question for Ordering
-define('TR_SQL_QUESTION_ORDERING', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (       NULL, %d, %d, 6, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '', '', '', '', '', '', '', '', '', '', 0, 0)");
-
-//Question for MultiAnswer
-define('TR_SQL_QUESTION_MULTIANSWER', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (    NULL, %d, %d, 7, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '', '', '', '', '', '', '', '', '', '', 0, 0)");
-
-//Question for Matching Simple
-define('TR_SQL_QUESTION_MATCHING', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (       NULL, %d, %d, 5, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0, 0)");
-
-//Question for Matching Graphical
-define('TR_SQL_QUESTION_MATCHINGDD', "INSERT INTO ".TABLE_PREFIX."tests_questions VALUES (     NULL, %d, %d, 8, '%s', '%s', 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 
-                                                       %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 
-                                                       '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0, 0)");
-
-define('TR_SQL_TEST', "INSERT INTO ".TABLE_PREFIX."tests " .
-                                          "(test_id,
-                                        course_id,
-                                        title,
-                                        description,
-                                        `format`,
-                                        start_date,
-                                        end_date,
-                                        randomize_order,
-                                        num_questions,
-                                        instructions,
-                                        content_id,
-                                        passscore,
-                                        passpercent,
-                                        passfeedback,
-                                        failfeedback,
-                                        result_release,
-                                        random,
-                                        difficulty,
-                                        num_takes,
-                                        anonymous,
-                                        out_of,
-                                        guests,
-                                        display) " .
-                                          "VALUES 
-                                               (NULL, %d, '%s', '%s', %d, '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s', '%s', %s, %d, %d, %d, %s, '', %d, %d)");
-
-?>
\ No newline at end of file
diff --git a/docs/tests/lib/test_result_functions.inc.php b/docs/tests/lib/test_result_functions.inc.php
deleted file mode 100644 (file)
index 5777733..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-<?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; }
-
-// if a valid user, then can come from the DB, otherwise
-// this might come from _POST or even _SESSION
-function get_test_result_id($test_id, &$max_pos) {
-       global $db;
-
-       if ($_SESSION['member_id']) {
-               $sql    = "SELECT result_id, max_pos FROM ".TABLE_PREFIX."tests_results WHERE test_id=$test_id AND member_id='{$_SESSION['member_id']}' AND status=0";
-       } else if ($_SESSION['test_result_id']) {
-               // guest with on-going test
-               $sql    = "SELECT result_id, max_pos FROM ".TABLE_PREFIX."tests_results WHERE test_id=$test_id AND result_id={$_SESSION['test_result_id']} AND status=0";
-       } else {
-               return 0; // new guest
-       }
-
-       $result = mysql_query($sql, $db);
-       if ($row = mysql_fetch_assoc($result)) {
-               $max_pos = $row['max_pos'];
-               return $row['result_id'];
-       }
-
-       return 0;
-}
-
-function init_test_result_questions($test_id, $is_random, $num_questions, $mid) {
-       global $db;
-
-       $sql    = "INSERT INTO ".TABLE_PREFIX."tests_results VALUES (NULL, $test_id, '".$mid."', NOW(), '', 0, NOW(), 0)";
-       $result = mysql_query($sql, $db);
-       $result_id = mysql_insert_id($db);
-
-       if ($is_random) {
-               // Retrieve 'num_questions' question_id randomly from those who are related to this test_id
-
-               $non_required_questions = array();
-               $required_questions     = array();
-
-               $sql    = "SELECT question_id, required FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$test_id";
-               $result = mysql_query($sql, $db);
-       
-               while ($row = mysql_fetch_assoc($result)) {
-                       if ($row['required'] == 1) {
-                               $required_questions[] = $row['question_id'];
-                       } else {
-                               $non_required_questions[] = $row['question_id'];
-                       }
-               }
-       
-               $num_required = count($required_questions);
-               if ($num_required < max(1, $num_questions)) {
-                       shuffle($non_required_questions);
-                       $required_questions = array_merge($required_questions, array_slice($non_required_questions, 0, $num_questions - $num_required));
-               }
-
-               $random_id_string = implode(',', $required_questions);
-
-               $sql = "SELECT TQ.*, TQA.* FROM ".TABLE_PREFIX."tests_questions TQ INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA USING (question_id) WHERE TQ.course_id={$_SESSION['course_id']} AND TQA.test_id=$test_id AND TQA.question_id IN ($random_id_string) ORDER BY TQ.question_id";
-       } else {
-               $sql = "SELECT TQ.*, TQA.* FROM ".TABLE_PREFIX."tests_questions TQ INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA USING (question_id) WHERE TQ.course_id={$_SESSION['course_id']} AND TQA.test_id=$test_id ORDER BY TQA.ordering, TQA.question_id";
-       }
-
-       // $sql either gets a random set of questions (if $test_row['random']) ordered by 'question_id'
-       // or the set of all questions for this test (sorted by 'ordering').
-       $result = mysql_query($sql, $db);
-       while ($row = mysql_fetch_assoc($result)) {
-               $sql    = "INSERT INTO ".TABLE_PREFIX."tests_answers VALUES ($result_id, {$row['question_id']}, {$_SESSION['member_id']}, '', '', '')";
-               mysql_query($sql, $db);
-       }
-
-       return $result_id;
-}
-
-// $num_questions must be greater than or equal to $row_required['cnt'] + $row_optional['cnt']
-function get_total_weight($tid, $num_questions = null) {
-       global $db;
-    $sql = "SELECT SUM(weight) AS weight, COUNT(*) AS cnt FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$tid AND required = '1' GROUP BY required";
-    $result = mysql_query($sql, $db);
-    $row_required = mysql_fetch_assoc($result);
-
-    $sql = "SELECT SUM(weight) AS weight, COUNT(*) AS cnt FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$tid AND required = '0' GROUP BY required";
-    $result = mysql_query($sql, $db);
-       $row_optional = mysql_fetch_assoc($result);
-       
-       $total_weight = 0;
-
-       if ($num_questions == null) {
-               $total_weight = $row_required['weight'] + $row_optional['weight'];
-       } else if ($row_optional['cnt'] > 0) {
-               $total_weight = $row_required['weight'] + ($row_optional['weight'] / $row_optional['cnt']) * min($num_questions - $row_required['cnt'], $row_optional['cnt']);
-       }
-
-       return $total_weight;
-}
-
-// returns T/F whether or not this member can view this test:
-function authenticate_test($tid) {
-       if (authenticate(TR_PRIV_ADMIN, TR_PRIV_RETURN)) {
-               return TRUE;
-       }
-       if (!$_SESSION['enroll']) {
-               return FALSE;
-       }
-       global $db;
-
-       $sql    = "SELECT approved FROM ".TABLE_PREFIX."course_enrollment WHERE member_id=$_SESSION[member_id] AND course_id=$_SESSION[course_id] AND approved='y'";
-       $result = mysql_query($sql, $db);
-       if (!($row = mysql_fetch_assoc($result))) {
-               return FALSE;
-       }
-
-       $sql    = "SELECT group_id FROM ".TABLE_PREFIX."tests_groups WHERE test_id=$tid";
-       $result = mysql_query($sql, $db);
-       if (mysql_num_rows($result) == 0) {
-               // not limited to any group; everyone has access:
-               return TRUE;
-       }
-       while ($row = mysql_fetch_assoc($result)) {
-               $sql     = "SELECT * FROM ".TABLE_PREFIX."groups_members WHERE group_id=$row[group_id] AND member_id=$_SESSION[member_id]";
-               $result2 = mysql_query($sql, $db);
-
-               if ($row2 = mysql_fetch_assoc($result2)) {
-                       return TRUE;
-               }
-       }
-
-       //Check assistants privileges
-       $sql = "SELECT privileges FROM TR_course_enrollment a WHERE member_id=$_SESSION[member_id] AND course_id=$_SESSION[course_id]";
-       $result = mysql_query($sql, $db);
-       if ($result){
-               list($privileges) = mysql_fetch_array($result);
-               if (query_bit($privileges, TR_PRIV_GROUPS) && query_bit($privileges, TR_PRIV_TESTS)){
-                       return TRUE;
-               }
-
-       }
-
-       return FALSE;
-}
-
-function print_question_cats($cTR_id = 0) {    
-
-       global $db;
-
-       echo '<option value="0"';
-       if ($cTR_id == 0) {
-               echo ' selected="selected"';
-       }
-       echo '>'._AT('cats_uncategorized').'</option>' . "\n";
-
-       $sql    = 'SELECT * FROM '.TABLE_PREFIX.'tests_questions_categories WHERE course_id='.$_SESSION['course_id'].' ORDER BY title';
-       $result = mysql_query($sql, $db);
-
-       while ($row = mysql_fetch_array($result)) {
-               echo '<option value="'.$row['category_id'].'"';
-               if ($row['category_id'] == $cTR_id) {
-                       echo ' selected="selected"';
-               }
-               echo '>'.$row['title'].'</option>'."\n";
-       }
-}
-
-function print_VE ($area) {
-?>
-       <script type="text/javascript" language="javascript">
-               document.writeln('<a href="#" onclick="javascript:window.open(\'<?php echo TR_BASE_HREF; ?>tests/form_editor.php?area=<?php echo $area; ?>\',\'newWin1\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=640,height=480\'); return false;" style="cursor: pointer; text-decoration: none" ><?php echo _AT('use_visual_editor'); ?></a>');
-       </script>
-
-<?php
-       //possibley add a <noscript> link to filemanager with target="_blank"
-}
-
-function get_random_outof($test_id, $result_id) {      
-       global $db;
-       $total = 0;
-
-       $sql    = 'SELECT SUM(Q.weight) AS weight FROM '.TABLE_PREFIX.'tests_questions_assoc Q, '.TABLE_PREFIX.'tests_answers A WHERE Q.test_id='.$test_id.' AND Q.question_id=A.question_id AND A.result_id='.$result_id;
-
-       $result = mysql_query($sql, $db);
-
-       if ($row = mysql_fetch_assoc($result)) {
-               return $row['weight'];
-       }
-
-       return 0;
-}
-
-// return the next guest id
-function get_next_guest_id()
-{
-       global $db;
-       
-       $sql = "SELECT max(cast(substring(guest_id,3) as unsigned))+1 next_guest_id FROM ".TABLE_PREFIX."guests";
-       $result = mysql_query($sql, $db);
-       $row = mysql_fetch_assoc($result);
-
-       if ($row["next_guest_id"] == "")  // first guest id
-               return "G_0";
-       else
-               return "G_". $row["next_guest_id"];
-}
-?>
\ No newline at end of file
index 0405577..b11328e 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
 
+global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
-$_letters = array(_AT('A'), _AT('B'), _AT('C'), _AT('D'), _AT('E'), _AT('F'), _AT('G'), _AT('H'), _AT('I'), _AT('J'));
+$testsDAO = new TestsDAO();
+$testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
+
+$_letters = array(_AT('a'), _AT('b'), _AT('c'), _AT('d'), _AT('e'), _AT('f'), _AT('g'), _AT('h'), _AT('i'), _AT('j'));
 
 if ($_POST['back']) {
-       header('Location: index.php');
+       header('Location: index.php?_course_id='.$_course_id);
        exit;
 } 
 
@@ -33,74 +39,19 @@ require_once(TR_INCLUDE_PATH.'header.inc.php');
 
 $tid = intval($_GET['tid']);
 
-/* Retrieve the content_id of this test */
-$sql = "SELECT title, random, num_questions, instructions FROM ".TABLE_PREFIX."tests WHERE test_id=$tid";
-$result        = mysql_query($sql, $db); 
-if (!($test_row = mysql_fetch_assoc($result))) {
+// check that the test_id is correct
+if (!($test_row = $testsDAO->get($tid))) {
        $msg->printErrors('ITEM_NOT_FOUND');
        require (TR_INCLUDE_PATH.'footer.inc.php');
        exit;
 }
-$num_questions = $test_row['num_questions'];
-$rand_err = false;
-
-if ($row['random']) {
-       /* !NOTE! this is a really awful way of randomizing questions !NOTE! */
 
-       /* Retrieve 'num_questions' question_id randomly choosed from  
-       those who are related to this content_id*/
-       $sql    = "SELECT question_id FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$tid";
-       $result = mysql_query($sql, $db); 
-       $i = 0;
-       $row2 = mysql_fetch_assoc($result);
-       /* Store all related question in cr_questions */
-       while ($row2['question_id'] != '') {
-               $cr_questions[$i] = $row2['question_id'];
-               $row2 = mysql_fetch_assoc($result);
-               $i++;
-       }
-       if ($i < $num_questions) {
-               /* this if-statement is misleading. */
-               /* one should still be able to preview a test before all its questions have been added. */
-               /* ie. preview as questions are added. */
-               /* bug # 0000615 */
-               $rand_err = true;
-       } else {
-               /* Randomly choose only 'num_question' question */
-               $random_idx = rand(0, $i-1);
-               $random_id_string = $cr_questions[$random_idx];
-               $j = 0;
-               $extracted[$j] = $random_idx;
-               $j++;
-               $num_questions--;
-               while ($num_questions > 0) {
-                       $done = false;
-                       while (!$done) {
-                               $random_idx = rand(0, $i-1);
-                               $done = true;
-                               for ($k=0;$k<$j;$k++) {
-                                       if ($extracted[$k]== $random_idx) {
-                                               $done = false;
-                                               break;
-                                       }
-                               }
-                       }
-                       $extracted[$j] = $random_idx;
-                       $j++;
-                       $random_id_string = $random_id_string.','.$cr_questions[$random_idx];
-                       $num_questions--;
-               }
-               $sql = "SELECT TQ.*, TQA.* FROM ".TABLE_PREFIX."tests_questions TQ INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA USING (question_id) WHERE TQ.course_id=$_SESSION[course_id] AND TQA.test_id=$tid AND TQA.question_id IN ($random_id_string) ORDER BY TQA.ordering, TQA.question_id";
-       }
-} else {
-       $sql    = "SELECT TQ.*, TQA.* FROM ".TABLE_PREFIX."tests_questions TQ INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA USING (question_id) WHERE TQ.course_id=$_SESSION[course_id] AND TQA.test_id=$tid ORDER BY TQA.ordering, TQA.question_id";
-}
-$result        = mysql_query($sql, $db);
+$rows = $testsQuestionsAssocDAO->getByTestID($tid);
 $count = 1;
-echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="preview">';
+?>
+<form method="post" action="<?php echo $_SERVER['PHP_SELF'].'?_course_id='.$_course_id; ?>" name="preview">
 
-if (($row = mysql_fetch_assoc($result)) && !$rand_err) {
-       ?>
+<?php if (is_array($rows)) {?>
        <div class="input-form" style="width:80%">
        <div class="row"><h2><?php echo $test_row['title']; ?></h2></div>
 
@@ -113,17 +64,17 @@ if (($row = mysql_fetch_assoc($result)) && !$rand_err) {
        <?php endif; ?>
        
        <?php
-       do {
+       foreach ($rows as $row) {
                $o = TestQuestions::getQuestion($row['type']);
                $o->display($row);
-       } while ($row = mysql_fetch_assoc($result));
+       }
        ?>
        <div class="row buttons">
                <input type="submit" value="<?php echo _AT('back'); ?>" name="back" />
        </div>
 
        </div>
-       </form>
+</form>
 <script type="text/javascript">
 //<!--
 function iframeSetHeight(id, height) {
index c2f7030..f29b872 100644 (file)
@@ -12,7 +12,7 @@
 \r
 define('TR_INCLUDE_PATH', '../include/');\r
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');\r
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');\r
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');\r
 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');\r
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');\r
 \r
index 7de7e66..ab4905b 100644 (file)
@@ -12,7 +12,7 @@
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
 
 global $_course_id;
index 17193ba..04f5bd7 100644 (file)
 
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
-require_once(TR_INCLUDE_PATH.'../mods/imsqti/lib/qti.inc.php');
-require_once(TR_INCLUDE_PATH.'classes/pclzip.lib.php');
-//require_once(TR_INCLUDE_PATH.'classes/QTI/QTIParser.class.php');     
-require_once(TR_INCLUDE_PATH.'../mods/imsqti/classes/QTIImport.class.php');
+require_once(TR_INCLUDE_PATH.'lib/pclzip.lib.php');
+require_once(TR_INCLUDE_PATH.'lib/pclzip_callback.lib.php');
+require_once(TR_INCLUDE_PATH.'lib/qti.inc.php'); 
+require_once(TR_INCLUDE_PATH.'classes/QTI/QTIImport.class.php');
+require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
+
+global $_course_id;
 
 /* to avoid timing out on large files */
 @set_time_limit(0);
@@ -32,7 +35,7 @@ if (isset($_POST['submit_yes'])){
        $overwrite = true;
 } elseif (isset($_POST['submit_no'])){
        $msg->addFeedback('IMPORT_CANCELLED');
-       header('Location: question_db.php');
+       header('Location: question_db.php?_course_id='.$_course_id);
        exit;
 }
 
@@ -89,7 +92,7 @@ if (!$overwrite){
                $errors = array('FILE_MAX_SIZE', ini_get('post_max_size'));
                $msg->addError($errors);
 
-               header('Location: ./question_db.php');
+               header('Location: ./question_db.php?_course_id='.$_course_id);
                exit;
        } 
 
@@ -138,11 +141,7 @@ if (!$overwrite){
 }
 
 if ($msg->containsErrors()) {
-       if (isset($_GET['tile'])) {
-               header('Location: '.$_base_path.'tile/index.php');
-       } else {
-               header('Location: question_db.php');
-       }
+       header('Location: question_db.php?_course_id='.$_course_id);
        exit;
 }
 
@@ -156,10 +155,10 @@ if (!is_dir($import_path)) {
        }
 }
 
-$import_path .= $_SESSION['course_id'].'/';
+$import_path .= $_course_id.'/';
 if (!$overwrite){
        if (is_dir($import_path)) {
-               clr_dir($import_path);
+               FileUtility::clr_dir($import_path);
        }
 
        if (!@mkdir($import_path, 0700)) {
@@ -173,39 +172,39 @@ if (!$overwrite){
                                                        PCLZIP_CB_PRE_EXTRACT,  'preImportCallBack') == 0) {
                $msg->addError('IMPORT_FAILED');
                echo 'Error : '.$archive->errorInfo(true);
-               clr_dir($import_path);
-               header('Location: question_db.php');
+               FileUtility::clr_dir($import_path);
+               header('Location: question_db.php?_course_id='.$_course_id);
                exit;
        }
        error_reporting(TR_ERROR_REPORTING);
 }
 
 /* get the course's max_quota */
-$sql   = "SELECT max_quota FROM ".TABLE_PREFIX."courses WHERE course_id=$_SESSION[course_id]";
-$result = mysql_query($sql, $db);
-$q_row = mysql_fetch_assoc($result);
+$coursesDAO = new CoursesDAO();
+$q_row = $coursesDAO->get($_course_id);
 
 if ($q_row['max_quota'] != TR_COURSESIZE_UNLIMITED) {
-
-       if ($q_row['max_quota'] == TR_COURSESIZE_DEFAULT) {
-               $q_row['max_quota'] = $MaxCourseSize;
+       $zip_size_limit = $MaxCourseSize;
+       
+       $totalBytes   = FileUtility::dirsize($import_path);
+       
+       $total_after  = $zip_size_limit - $totalBytes;
+       
+       if (is_dir(TR_CONTENT_DIR . $_course_id.'/')) 
+       {
+               $course_total = FileUtility::dirsize(TR_CONTENT_DIR . $_course_id.'/');
+               $total_after  -= $course_total;
        }
-       $totalBytes   = dirsize($import_path);
-       $course_total = dirsize(TR_CONTENT_DIR . $_SESSION['course_id'].'/');
-       $total_after  = $q_row['max_quota'] - $course_total - $totalBytes + $MaxCourseFloat;
-
+       
        if ($total_after < 0) {
                /* remove the content dir, since there's no space for it */
                $errors = array('NO_CONTENT_SPACE', number_format(-1*($total_after/TR_KBYTE_SIZE), 2 ) );
                $msg->addError($errors);
                
-               clr_dir($import_path);
-
-               if (isset($_GET['tile'])) {
-                       header('Location: '.$_base_path.'tile/index.php');
-               } else {
-                       header('Location: question_db.php');
-               }
+               // Clean up import path and inserted course row
+               FileUtility::clr_dir($import_path);
+       
+               header('Location: question_db.php?_course_id='.$_course_id);
                exit;
        }
 }
@@ -219,13 +218,9 @@ if ($ims_manifest_xml === false) {
                $msg->addError('NO_IMS_BACKUP');
        }
 
-       clr_dir($import_path);
+       FileUtility::clr_dir($import_path);
 
-       if (isset($_GET['tile'])) {
-               header('Location: '.$_base_path.'tile/index.php');
-       } else {
-               header('Location: question_db.php');
-       }
+       header('Location: question_db.php?_course_id='.$_course_id);
        exit;
 }
 
@@ -277,8 +272,6 @@ $existing_files = isQTIFileExist($attributes);
 if (!$overwrite && !empty($existing_files)){
        $existing_files = implode('<br/>', $existing_files);
        require_once(TR_INCLUDE_PATH.'header.inc.php');
-//     $msg->addConfirm(array('MEDIA_FILE_EXISTED', $existing_files));
-//     $msg->printConfirm();
        echo '<form action="" method="POST">';
        echo '<div class="input-form">';
        echo '<div class="row">';
@@ -305,11 +298,11 @@ $qti_import = new QTIImport($import_path);
 $qti_import->importQuestions($attributes);
 
 //debug('done');
-clr_dir(TR_CONTENT_DIR . 'import/'.$_SESSION['course_id']);
+FileUtility::clr_dir(TR_CONTENT_DIR . 'import/'.$_course_id);
 if (!$msg->containsErrors()) {
        $msg->addFeedback('IMPORT_SUCCEEDED');
 }
 
-header('Location: question_db.php');
+header('Location: question_db.php?_course_id='.$_course_id);
 exit;
 ?>
\ No newline at end of file
index 7b446ce..75ed15b 100644 (file)
@@ -14,7 +14,9 @@ $page = 'tests';
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
 
+global $_course_id;
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 
 $tid = intval($_REQUEST['tid']);
@@ -22,14 +24,13 @@ $qid = intval($_REQUEST['qid']);
 
 if (isset($_POST['submit_no'])) {
        $msg->addFeedback('CANCELLED');
-       header('Location: questions.php?tid=' . $tid);
+       header('Location: questions.php?tid=' . $tid.SEP.'_course_id='.$_course_id);
        exit;
 } else if (isset($_POST['submit_yes'])) {
-       $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc WHERE question_id=$qid AND test_id=$tid";
-       $result = mysql_query($sql, $db);
-               
+       $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
+       $testsQuestionsAssocDAO->Delete($tid, $qid);
        $msg->addFeedback('QUESTION_REMOVED');
-       header('Location: questions.php?tid=' . $tid);
+       header('Location: questions.php?tid=' . $tid.SEP.'_course_id='.$_course_id);
        exit;
 
 } /* else: */
@@ -49,6 +50,7 @@ require_once(TR_INCLUDE_PATH.'header.inc.php');
 unset($hidden_vars);
 $hidden_vars['qid'] = $_GET['qid'];
 $hidden_vars['tid'] = $_GET['tid'];
+$hidden_vars['_course_id'] = $_course_id;
 $msg->addConfirm('REMOVE_TEST_QUESTION', $hidden_vars);
 
 $msg->printConfirm();
index f521e6c..8c070bf 100644 (file)
 $page = 'tests';
 define('TR_INCLUDE_PATH', '../include/');
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
-require_once(TR_INCLUDE_PATH.'../tests/classes/testQuestions.class.php');
+require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');
 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsCategoriesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
+
+global $_course_id;
 
 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+$testsDAO = new TestsDAO();
+$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
+$testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
 
 $_pages['tests/questions.php']['title_var']    = 'questions';
 $_pages['tests/questions.php']['parent']   = 'tests/index.php';
-$_pages['tests/questions.php']['children'] = array('tests/add_test_questions.php?tid='.$_GET['tid']);
+$_pages['tests/questions.php']['children'] = array('tests/add_test_questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id);
 
-$_pages['tests/add_test_questions.php?tid='.$_GET['tid']]['title_var']    = 'add_questions';
-$_pages['tests/add_test_questions.php?tid='.$_GET['tid']]['parent']   = 'tests/questions.php?tid='.$_GET['tid'];
+$_pages['tests/add_test_questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id]['title_var']    = 'add_questions';
+$_pages['tests/add_test_questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id]['parent']   = 'tests/questions.php?tid='.$_GET['tid'].'&_course_id='.$_course_id;
 
 $_pages['tests/questions.php']['guide']    = 'instructor/?p=add_questions.php';
 
-
 $tid = intval($_REQUEST['tid']);
 
 if (isset($_POST['submit'])) {
-       $sql    = "SELECT test_id, random, num_questions FROM ".TABLE_PREFIX."tests WHERE test_id=$tid AND course_id=$_SESSION[course_id]";
-       $result = mysql_query($sql, $db);
-       if (!($row = mysql_fetch_assoc($result))) { exit; }
-
-       // #1760
-       // for each question that isn't required
-       if ($row['random']) {
-               foreach ($_POST['weight'] as $qid => $weight) {
-                       if ($_POST['required'][$qid]) { continue; }
-                       if (!$current_weight) { $current_weight = $weight; }
-
-                       if ($current_weight != $weight) {
-                               // the weights aren't the same.
-                               $msg->addError('RAND_TEST_Q_WEIGHT');
-                               break;
-                       }
-               }
+       $count = 1;
+       foreach ($_POST['weight'] as $qid => $weight) {
+               $qid    = intval($qid);
+               $weight = intval($weight);
+
+               $orders = $_POST['ordering'];
+               asort($orders);
+               $orders = array_keys($orders);
+
+               foreach ($orders as $k => $id)
+                       $orders[$k] = intval($id);
+                       
+               $orders = array_flip($orders);
+               
+               $testsQuestionsAssocDAO->Update($tid, $qid, $weight, $orders[$qid]+1);
+               $count++;
        }
 
-       if (!$msg->containsErrors()) {
-               //update the weights & order
-               $total_weight = 0;
-               $total_required_weight = 0;
-               $total_required_num = 0;
-               $optional_weight = 0;
-               $count = 1;
-               foreach ($_POST['weight'] as $qid => $weight) {
-                       $qid    = intval($qid);
-                       $weight = intval($weight);
-                       if ($_POST['required'][$qid]) {
-                               $required = 1;
-                       } else {
-                               $required = 0;
-                       }
-
-                       if ($row['random']) {
-                               if ($required) {
-                                       $total_required_weight += $weight;
-                                       $total_required_num++;
-                               } else {
-                                       $optional_weight = $weight; // what each optional question weights.
-                               }
-                       } else {
-                               $total_weight += $weight; // not random, so just sum the weights
-                       }
-                               
-                       if (!$row['random']) {
-                               $orders = $_POST['ordering'];
-                               asort($orders);
-                               $orders = array_keys($orders);
-
-                               foreach ($orders as $k => $id)
-                                       $orders[$k] = intval($id);
-                                       
-                               $orders = array_flip($orders);
-                               $sql    = "UPDATE ".TABLE_PREFIX."tests_questions_assoc SET weight=$weight, required=$required, ordering=".($orders[$qid]+1)." WHERE question_id=$qid AND test_id=".$tid;
-                       } else {
-                               $sql    = "UPDATE ".TABLE_PREFIX."tests_questions_assoc SET weight=$weight, required=$required, ordering=$count WHERE question_id=$qid AND test_id=".$tid;
-                       }
-
-                       $result = mysql_query($sql, $db);
-                       $count++;
-               }
-
-               $num_questions_sql = '';
-               if ($row['random']) {
-                       $row['num_questions'] -= $total_required_num;
-                       if ($row['num_questions'] > 0) {
-                               // how much do the optional questions add up to: (assume they all weight the same)
-                               $total_weight = $total_required_weight + $optional_weight * $row['num_questions'];
-                       } else {
-                               $total_weight = $total_required_weight; // there are no more optional questions
-                               $num_questions_sql = ', num_questions='.$total_required_num;
-                       }
-               }
-
-
-               $sql    = "UPDATE ".TABLE_PREFIX."tests SET out_of='$total_weight' $num_questions_sql WHERE test_id=$tid";
-               $result = mysql_query($sql, $db);
-
-               $total_weight = 0;
-               $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
-               header('Location: '.$_SERVER['PHP_SELF'] .'?tid='.$tid);
-               exit;
+       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+       header('Location: '.$_SERVER['PHP_SELF'] .'?tid='.$tid.'&_course_id='.$_course_id);
+       exit;
+}
+
+$cats    = array();
+$cats[0] = _AT('cats_uncategorized');
+$cat_rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);
+if (is_array($cat_rows)) {
+       foreach ($cat_rows as $cat_row) {
+               $cats[$cat_row['category_id']] = $cat_row['title'];
        }
 }
 
 require_once(TR_INCLUDE_PATH.'header.inc.php');
 
-$sql   = "SELECT title, random FROM ".TABLE_PREFIX."tests WHERE test_id=$tid";
-$result        = mysql_query($sql, $db);
-$row   = mysql_fetch_assoc($result);
+$row = $testsDAO->get($tid);
 echo '<h3>'._AT('questions_for').' '.AT_print($row['title'], 'tests.title').'</h3>';
-$random = $row['random'];
 
-$sql   = "SELECT count(*) as cnt FROM ".TABLE_PREFIX."tests_questions_assoc QA, ".TABLE_PREFIX."tests_questions Q WHERE QA.test_id=$tid AND QA.weight=0 AND QA.question_id=Q.question_id AND Q.type<>4";
-$result        = mysql_query($sql, $db);
-$row = mysql_fetch_array($result);
-if ($row['cnt']) {
+$rows = $testsQuestionsAssocDAO->getZeroWeightRowsByTestID($tid);
+if (is_array($rows)) {
        $msg->printWarnings('QUESTION_WEIGHT');
 }
 
 $msg->printAll();
 
-$sql   = "SELECT * FROM ".TABLE_PREFIX."tests_questions Q, ".TABLE_PREFIX."tests_questions_assoc TQ WHERE Q.course_id=$_SESSION[course_id] AND Q.question_id=TQ.question_id AND TQ.test_id=$tid ORDER BY TQ.ordering";
-$result        = mysql_query($sql, $db);
-
-?>
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>?tid=<?php echo $tid; ?>" method="post" name="form">
-<input type="hidden" name="tid" value="<?php echo $tid; ?>" />
-<table class="data static" summary="" rules="rows">
-<thead>
-<tr>
-       <th scope="col"><?php echo _AT('num');      ?></th>
-       <th scope="col"><?php echo _AT('points');   ?></th>
-       <th scope="col"><?php echo _AT('order'); ?></th>
-       <th scope="col"><?php echo _AT('question'); ?></th>
-       <th scope="col"><?php echo _AT('type');     ?></th>
-       <th scope="col"><?php echo _AT('category'); ?></th>
-       <?php if ($random): ?>
-               <th scope="col"><?php echo _AT('required'); ?></th>
-       <?php endif; ?>
-       <th scope="col">&nbsp;</th>
-</tr>
-</thead>
-<?php
-if ($row = mysql_fetch_assoc($result)) {
-       $sql    = "SELECT title, category_id FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=".$_SESSION['course_id'];
-       $cTR_result     = mysql_query($sql, $db);
-       $cats    = array();
-       $cats[0] = _AT('cats_uncategorized');
-       while ($cTR_row = mysql_fetch_assoc($cTR_result)) {
-               $cats[$cTR_row['category_id']] = $cTR_row['title'];
-       }
-
-       do {
-               $count++;
-               echo '<tr>';
-               echo '<td class="row1" align="center"><strong>'.$count.'</strong></td>';
-               echo '<td class="row1" align="center">';
-               
-               if (isset($_POST['submit'])) {
-                       $row['weight'] = $_POST['weight'][$row['question_id']];
-                       $row['required'] = (isset($_POST['required'][$row['question_id']]) ? 1 : 0);
-               }
-
-               if ($row['type'] == 4) {
-                       echo ''._AT('na').'';
-                       echo '<input type="hidden" value="0" name="weight['.$row['question_id'].']" />';
-               } else {
-                       echo '<input type="text" value="'.$row['weight'].'" name="weight['.$row['question_id'].']" size="2" />';
-               }
-               echo '</td>';
-
-               if ($random) {
-                       echo '<td class="row1" align="center">'._AT('na').'</td>';
-               } else {
-                       echo '<td class="row1" align="center"><input type="text" name="ordering['.$row['question_id'].']" value="'.$row['ordering'].'" size="2" /></td>';
-               }
-
-               echo '<td class="row1">';
-               if ($strlen($row['question']) > 45) {
-                       echo htmlspecialchars(AT_print($substr($row['question'], 0, 43), 'tests_questions.question'), ENT_COMPAT, "UTF-8") . '...';
-               } else {
-                       echo AT_print(htmlspecialchars($row['question'], ENT_COMPAT, "UTF-8"), 'tests_questions.question');
-               }
-
-               echo '</td>';
-               echo '<td nowrap="nowrap">';
-               $o = TestQuestions::getQuestion($row['type']);
-               echo $o->printName();
-               echo '</td>';
-
-               $link = 'tests/edit_question_'.$o->getPrefix().'.php?tid='.$tid.SEP.'qid='.$row['question_id'];
-
-               echo '<td align="center">'.$cats[$row['category_id']].'</td>';
-
-               if ($random) {
-                       echo '<td align="center" nowrap="nowrap"><input type="checkbox" name="required['.$row['question_id'].']" value="1"';
-                       if ($row['required']) {
-                               echo ' checked="checked"';
-                       }
-                       echo ' id="q'.$row['question_id'].'" /><label for="q'.$row['question_id'].'">'._AT('required').'</label></td>';
-               }
-
-               echo '<td nowrap="nowrap">';
-               echo '<a href="' . $link . '">' . _AT('edit').'</a> | ';
-               echo '<a href="tests/question_remove.php?tid=' . $tid . SEP . 'qid=' . $row['question_id'] . '">' . _AT('remove') . '</a>';
-               echo '</td>';
-
-               echo '</tr>';
-       } while ($row = mysql_fetch_assoc($result));
-
-       //total weight
-       echo '<tfoot>';
-       echo '<tr><td>&nbsp;</td>';
-       echo '<td colspan="';
-       if ($random) {
-               echo 7;
-       } else {
-               echo 6;
-       }
-
-       echo '" align="left" nowrap="nowrap">';
-       echo '<input type="submit" value="'._AT('update').'" name="submit" /> </td>';
-       echo '</tr>';
-       echo '</tfoot>';
-} else {
-       echo '<tr><td colspan="';
-       if ($random) {
-               echo 7;
-       } else {
-               echo 6;
-       }
-
-       echo '" >'._AT('none_found').'</td></tr>';
-}
+$rows = $testsQuestionsAssocDAO->getByTestID($tid);
 
-echo '</table><br /></form>';
+$savant->assign('cats', $cats);
+$savant->assign('rows', $rows);
+$savant->assign('tid', $tid);
+$savant->assign('course_id', $_course_id);
+$savant->display('tests/questions.tmpl.php');
 
-require_once(TR_INCLUDE_PATH.'footer.inc.php');
-?>
\ No newline at end of file
+require_once(TR_INCLUDE_PATH.'footer.inc.php');?>
index a1e1a80..ddd44c7 100644 (file)
@@ -124,17 +124,4 @@ else {
 </fieldset>
 </div>
 
-<script type="text/javascript">
-//var Trans = Trans || {};
-//Trans.course = Trans.course || {};
-namespace('Trans.course'); 
-/**
-* Add the course into "My Courses" list
-*/
-Trans.course.addCourse = function (course_id) {
-       alert(course_id);
-       return false;
-};
-</script>
-
 <?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
index 4b4d56a..b130d88 100644 (file)
@@ -7,7 +7,7 @@ $compact_title = str_replace(' ', '', $this->title);
 
 <br />
 <script language="javascript" type="text/javascript">
-       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'); ?>");
 </script>
 
 <div class="box" id="menu_<?php echo $compact_title ?>">
@@ -15,7 +15,7 @@ $compact_title = str_replace(' ', '', $this->title);
 </div>
 
 <script language="javascript" type="text/javascript">
-if (getcookie("m_<?php echo $this->title; ?>") == "0")
+if (trans.utility.getcookie("m_<?php echo $this->title; ?>") == "0")
 {
        jQuery("#menu_<?php echo $compact_title; ?>").hide();
 }
diff --git a/docs/themes/default/include/fm_footer.tmpl.php b/docs/themes/default/include/fm_footer.tmpl.php
new file mode 100644 (file)
index 0000000..7e8815c
--- /dev/null
@@ -0,0 +1,17 @@
+<?php \r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+\r
+?>\r
+<!-- //end popup filemaneger div // -->\r
+</div>\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/docs/themes/default/include/fm_header.tmpl.php b/docs/themes/default/include/fm_header.tmpl.php
new file mode 100644 (file)
index 0000000..771a251
--- /dev/null
@@ -0,0 +1,60 @@
+<?php\r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+\r
+if (!defined('TR_INCLUDE_PATH')) { exit; }\r
+\r
+/* available header.tmpl.php variables:\r
+ *\r
+ * ======================================\r
+ * top_level_pages           array(array('url', 'title'))     the top level pages. ATutor default creates tabs.\r
+ * section_title             string                           the name of the current section. either name of the course, administration, my start page, etc.\r
+ * page_title                string                           the title of the current page.\r
+ * path                      array(array('url', 'title'))     the path to the current page.\r
+ * back_to_page              array('url', 'title')            the link back to the part of the current page, if needed.\r
+ * current_top_level_page    string                           full url to the current top level page in "top_leve_pages"\r
+ * current_sub_level_page    string                           full url to the current sub level page in the "sub_level_pages"\r
+ * sub_level_pages           array(array('url', 'title'))     the sub level pages.\r
+ */\r
+\r
+// will have to be moved to the header.inc.php\r
+global $system_courses;\r
+\r
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $this->lang_code; ?>"> \r
+\r
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo DEFAULT_LANGUAGE_CODE; ?>" lang="<?php echo DEFAULT_LANGUAGE_CODE; ?>"> \r
+\r
+<head>\r
+       <title><?php echo SITE_NAME; ?> : <?php echo $this->page_title; ?></title>\r
+       <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $this->lang_charset; ?>" />\r
+       <meta name="Generator" content="Transformable - Copyright 2009 by ATRC http://atrc.utoronto.ca/" />\r
+       <meta name="keywords" content="Transformable,free, open source, accessibility checker, accessibility reviewer, accessibility evaluator, accessibility evaluation, WCAG evaluation, 508 evaluation, BITV evaluation, evaluate accessibility, test accessibility, review accessibility, ATRC, WCAG 2, STANCA, BITV, Section 508." />\r
+       <meta name="description" content="Transformable is a Web accessibility evalution tool designed to help Web content developers and Web application developers ensure their Web content is accessible to everyone regardless to the technology they may be using, or their abilities or disabilities." />\r
+       <base href="<?php echo $this->content_base_href; ?>" />\r
+       <link rel="shortcut icon" href="<?php echo $this->base_path; ?>images/favicon.ico" type="image/x-icon" />\r
+       <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/forms.css" type="text/css" />\r
+       <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/styles.css" type="text/css" />\r
+<?php echo $this->rtl_css; ?>\r
+       <script src="<?php echo $this->base_path; ?>include/jscripts/infusion/InfusionAll.js" type="text/javascript"></script>\r
+       <script src="<?php echo $this->base_path; ?>jscripts/infusion/jquery.autoHeight.js" type="text/javascript"></script>\r
+       <script src="<?php echo $this->base_path; ?>include/jscripts/handleAjaxResponse.js" type="text/javascript"></script>\r
+       <script src="<?php echo $this->base_path; ?>include/jscripts/transformable.js" type="text/javascript"></script>\r
+<?php echo $this->custom_css; ?>\r
+</head>\r
+\r
+<body onload="<?php echo $this->onload; ?>"><div class="input-form"><div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>\r
+<br /><div align="right"><a href="javascript:window.close()"><?php echo _AT('close_file_manager'); ?></a></div>\r
+<a name="content" title="<?php echo _AT("content_start"); ?>"></a>\r
+<div id="rtn-msg">\r
+</div>\r
+\r
+<?php global $msg; $msg->printAll(); ?>
\ No newline at end of file
index cc02f0e..3d5fae0 100644 (file)
@@ -213,7 +213,7 @@ foreach ($this->top_level_pages as $page) {
        </div>
 
        <?php if (isset($this->guide)) {?>
-               <a href="<?php echo $this->guide; ?>" id="guide" onclick="poptastic('<?php echo $this->guide; ?>'); return false;" target="_new"><em><?php echo $this->page_title; ?></em></a>
+               <a href="<?php echo $this->guide; ?>" id="guide" onclick="trans.utility.poptastic('<?php echo $this->guide; ?>'); return false;" target="_new"><em><?php echo $this->page_title; ?></em></a>
        <?php } ?>
 </div>
 !-->
@@ -229,7 +229,7 @@ foreach ($this->top_level_pages as $page) {
     <div id="leftcolumn">
       <script type="text/javascript">
       //<![CDATA[
-      var state = getcookie("side-menu");
+      var state = trans.utility.getcookie("side-menu");
       if (state && (state == 'none')) {
           document.writeln('<a name="menu"></a><div style="display:none;" id="side-menu">');
       } else {
@@ -259,12 +259,12 @@ foreach ($this->top_level_pages as $page) {
         <?php if ($this->course_id > 0): ?>
         <script type="text/javascript" language="javascript">
         //<![CDATA[
-        var state = getcookie("side-menu");
+        var state = trans.utility.getcookie("side-menu");
         if (state && (state == 'none')) {
-            showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
+               trans.utility.showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
         } else {
             document.getElementById('contentcolumn').id="contentcolumn_shiftright";
-            showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "hide");
+            trans.utility.showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "hide");
         }
         //]]>
         </script>
index aaee9cf..7d3a9e3 100644 (file)
@@ -44,8 +44,8 @@ include(TR_INCLUDE_PATH.'header.inc.php');
 \r
 <tbody>\r
 <?php foreach ($this->rows as $row) {?>\r
-       <tr onmousedown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; rowselect(this);" \r
-           onkeydown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; rowselect(this);"\r
+       <tr onmousedown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; trans.utility.rowselect(this);" \r
+           onkeydown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; trans.utility.rowselect(this);"\r
            id="r_<?php echo $row["language_code"]."_".$row["charset"]; ?>">\r
                <td><input type="radio" name="id" value="<?php echo $row["language_code"]."_".$row["charset"]; ?>" id="m<?php echo $row['language_code']."_".$row["charset"]; ?>" \r
                           onmouseup="this.checked=!this.checked" onkeyup="this.checked=!this.checked" /></td>\r
index 2bde8e7..1c9d6a7 100644 (file)
@@ -58,7 +58,7 @@
        <tbody>\r
 \r
        <?php foreach ($this->rows as $row) { ?>\r
-               <tr onmousedown="document.form['t<?php echo $row['test_id']; ?>'].checked = true;rowselect(this);" id="r_<?php echo $row['test_id']; ?>">\r
+               <tr onmousedown="document.form['t<?php echo $row['test_id']; ?>'].checked = true;trans.utility.rowselect(this);" id="r_<?php echo $row['test_id']; ?>">\r
                        <td><input type="radio" name="id" value="<?php echo $row['test_id']; ?>" id="t<?php echo $row['test_id']; ?>" /></td>\r
                        <td><label for="t<?php echo $row['test_id']; ?>"><?php echo $row['title']; ?></label></td>\r
                        <td><?php echo $row['description']; ?></td>\r
index 1a9ee8a..88984e9 100644 (file)
@@ -29,7 +29,7 @@
        </fieldset>\r
 \r
        <fieldset class="group_form" style="width:43%;float:left;clear:right;height:18em;min-width:18em;"><legend class="group_form"><?php echo _AT('import_question'); ?></legend>\r
-               <form method="post" action="<?php echo 'tests/question_import.php'; ?>" enctype="multipart/form-data" > <label for="to_file"><?php echo _AT('upload_question'); ?></label><br />\r
+               <form method="post" action="<?php echo 'tests/question_import.php?_course_id='.$this->course_id; ?>" enctype="multipart/form-data" >    <label for="to_file"><?php echo _AT('upload_question'); ?></label><br />\r
                        <input type="file" name="file" id="to_file" />\r
                        <div class="row buttons">\r
                        <input type="submit" name="submit_import" value="<?php echo _AT('import'); ?>" />\r
diff --git a/docs/themes/default/tests/questions.tmpl.php b/docs/themes/default/tests/questions.tmpl.php
new file mode 100644 (file)
index 0000000..e07fd85
--- /dev/null
@@ -0,0 +1,87 @@
+<?php\r
+/************************************************************************/\r
+/* Transformable                                                        */\r
+/************************************************************************/\r
+/* Copyright (c) 2009                                                   */\r
+/* Adaptive Technology Resource Centre / University of Toronto          */\r
+/*                                                                      */\r
+/* This program is free software. You can redistribute it and/or        */\r
+/* modify it under the terms of the GNU General Public License          */\r
+/* as published by the Free Software Foundation.                        */\r
+/************************************************************************/\r
+global $strlen, $substr;\r
+\r
+?>\r
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>?tid=<?php echo $this->tid.SEP; ?>_course_id=<?php echo $this->course_id;?>" method="post" name="form">\r
+<input type="hidden" name="tid" value="<?php echo $this->tid; ?>" />\r
+<input type="hidden" name="_course_id" value="<?php echo $this->course_id; ?>" />\r
+<table class="data static" summary="" rules="rows">\r
+<thead>\r
+<tr>\r
+       <th scope="col"><?php echo _AT('num');      ?></th>\r
+       <th scope="col"><?php echo _AT('points');   ?></th>\r
+       <th scope="col"><?php echo _AT('order'); ?></th>\r
+       <th scope="col"><?php echo _AT('question'); ?></th>\r
+       <th scope="col"><?php echo _AT('type');     ?></th>\r
+       <th scope="col"><?php echo _AT('category'); ?></th>\r
+       <th scope="col">&nbsp;</th>\r
+</tr>\r
+</thead>\r
+<?php\r
+if (is_array($this->rows)) {\r
+       foreach ($this->rows as $row) {\r
+               $count++;\r
+\r
+               if (isset($_POST['submit'])) {\r
+                       $row['weight'] = $_POST['weight'][$row['question_id']];\r
+                       $row['required'] = (isset($_POST['required'][$row['question_id']]) ? 1 : 0);\r
+               }\r
+?>\r
+       <tr>\r
+               <td class="row1" align="center"><strong><?php echo $count; ?></strong></td>\r
+               <td class="row1" align="center">\r
+               \r
+               <?php if ($row['type'] == 4) {?>\r
+                       <?php echo _AT('na'); ?>\r
+                       <input type="hidden" value="0" name="weight[<?php echo $row['question_id']; ?>]" />\r
+               <?php } else {?>\r
+                       <input type="text" value="<?php echo $row['weight']; ?>" name="weight[<?php echo $row['question_id']; ?>]" size="2" />\r
+               <?php }?>\r
+               </td>\r
+\r
+               <td class="row1" align="center"><input type="text" name="ordering[<?php echo $row['question_id']; ?>]" value="<?php echo $row['ordering']; ?>" size="2" /></td>\r
+\r
+               <td class="row1">\r
+               <?php if ($strlen($row['question']) > 45) {\r
+                       echo htmlspecialchars(AT_print($substr($row['question'], 0, 43), 'tests_questions.question'), ENT_COMPAT, "UTF-8") . '...';\r
+               } else {\r
+                       echo AT_print(htmlspecialchars($row['question'], ENT_COMPAT, "UTF-8"), 'tests_questions.question');\r
+               }?>\r
+\r
+               </td>\r
+               <td nowrap="nowrap">\r
+               <?php $o = TestQuestions::getQuestion($row['type']); echo $o->printName();\r
+               $link = 'tests/edit_question_'.$o->getPrefix().'.php?tid='.$this->tid.SEP.'qid='.$row['question_id'].SEP.'_course_id='.$this->course_id;?>\r
+               </td>\r
+\r
+               <td align="center"><?php echo $this->cats[$row['category_id']]; ?></td>\r
+\r
+               <td nowrap="nowrap">\r
+               <a href="<?php echo $link; ?>"><?php echo _AT('edit'); ?></a> |\r
+               <a href="tests/question_remove.php?tid=<?php echo $this->tid . SEP; ?>qid=<?php echo $row['question_id'].SEP; ?>_course_id=<?php echo $this->course_id; ?>"><?php echo _AT('remove'); ?></a>\r
+               </td>\r
+\r
+               </tr>\r
+       <?php } ?>\r
+\r
+       <tfoot>\r
+       <tr><td>&nbsp;</td>\r
+       <td colspan="6" align="left" nowrap="nowrap"><input type="submit" value="<?php echo _AT('update'); ?>" name="submit" /></td>\r
+       </tr>\r
+       </tfoot>\r
+<?php } else {?>\r
+       <tr><td colspan="6" ><?php echo _AT('none_found'); ?></td></tr>\r
+<?php }?>\r
+\r
+</table><br />\r
+</form>\r
index db589ff..be6baf9 100644 (file)
@@ -6,4 +6,4 @@
 <?php for ($i=0; $i < $this->num_choices; $i++): ?>
        <input type="hidden" name="answers[<?php echo $this->row['question_id']; ?>][<?php echo $i; ?>]" id="<?php echo $this->row['question_id']; ?>q<?php echo $i; ?>" value="<?php echo $this->response[$i]; ?>"/>
 <?php endfor; ?>
-<iframe id="qframe<?php echo $this->row['question_id']; ?>" src="<?php echo $this->base_href; ?>mods/_standard/tests/dd.php?qid=<?php echo $this->row['question_id'].SEP; ?>response=<?php echo $tmp_response; ?>" height="200" width="100%" frameborder="0"></iframe>
\ No newline at end of file
+<iframe id="qframe<?php echo $this->row['question_id']; ?>" src="<?php echo $this->base_href; ?>tests/dd.php?_course_id=<?php echo $this->row['course_id'].SEP; ?>qid=<?php echo $this->row['question_id'].SEP; ?>response=<?php echo $tmp_response; ?>" height="200" width="100%" frameborder="0"></iframe>
\ No newline at end of file
index b541663..d8360e7 100644 (file)
@@ -50,7 +50,7 @@ require(TR_INCLUDE_PATH.'header.inc.php');
 </tfoot>\r
 <tbody>\r
 <?php foreach ($this->patch_rows as $row) { ?>\r
-               <tr onmousedown="document.form['m<?php echo $row['myown_patch_id']; ?>'].checked = true; rowselect(this);" onkeydown="document.form['m<?php echo $row['myown_patch_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['myown_patch_id']; ?>">\r
+               <tr onmousedown="document.form['m<?php echo $row['myown_patch_id']; ?>'].checked = true; trans.utility.rowselect(this);" onkeydown="document.form['m<?php echo $row['myown_patch_id']; ?>'].checked = true; trans.utility.rowselect(this);" id="r_<?php echo $row['myown_patch_id']; ?>">\r
                        <td width="10"><input type="radio" name="myown_patch_id" value="<?php echo $row['myown_patch_id']; ?>" id="m<?php echo $row['myown_patch_id']; ?>" <?php if ($row['myown_patch_id']==$_POST['myown_patch_id']) echo 'checked'; ?> /></td>\r
                        <td><label for="m<?php echo $row['myown_patch_id']; ?>"><span id="<?php echo 'system_patch_id-'.$row['myown_patch_id']; ?>" class="inlineEdits"><?php echo $row['system_patch_id']; ?></span></label></td>\r
                        <td><span id="<?php echo 'applied_version-'.$row['myown_patch_id']; ?>" class="inlineEdits"><?php echo $row['applied_version']; ?></span></td>\r
index f0e4af5..dc9b3be 100644 (file)
@@ -110,7 +110,7 @@ include(TR_INCLUDE_PATH.'header.inc.php');
        <div class="row">\r
                <h2>\r
                        <img src="images/arrow-closed.png" alt="<?php echo _AT("expand_add_privileges"); ?>" title="<?php echo _AT("expand_add_privileges"); ?>" id="toggle_image" border="0" />\r
-                       <a href="javascript:toggleDiv('div_add_privs')"><?php echo _AT("add_privileges"); ?></a>\r
+                       <a href="javascript:trans.utility.toggleDiv('div_add_privs')"><?php echo _AT("add_privileges"); ?></a>\r
                </h2>\r
        </div>\r
        \r
index c52732f..9e8bc5c 100644 (file)
@@ -35,7 +35,7 @@ function print_patch_row($patch_row, $row_id, $enable_radiotton)
        else\r
                $description = $patch_row["description"] . _AT('update_dependent_update_not_installed') . "<span style='color: red'>" . $dependent_patches . "</span>";\r
 ?>\r
-       <tr <?php if ($enable_radiotton) echo 'onkeydown="document.form[\'m'. $row_id.'\'].checked = true; rowselect(this);" onmousedown="document.form[\'m'. $row_id.'\'].checked = true; rowselect(this);" id="r_'. $row_id .'"'; ?>>\r
+       <tr <?php if ($enable_radiotton) echo 'onkeydown="document.form[\'m'. $row_id.'\'].checked = true; trans.utility.rowselect(this);" onmousedown="document.form[\'m'. $row_id.'\'].checked = true; trans.utility.rowselect(this);" id="r_'. $row_id .'"'; ?>>\r
                <td><input type="radio" name="id" value="<?php echo $row_id; ?>" id="m_<?php echo $patch_row["system_patch_id"]; ?>" <?php if (!$enable_radiotton) echo 'disabled="disabled" '; if (strcmp($row_id, $id) == 0 || strcmp($row_id, $patch_id) == 0) echo "checked "?> /></td>\r
                <td><label for="m_<?php echo $patch_row["system_patch_id"]; ?>"><?php echo $patch_row["system_patch_id"]; ?></label></td>\r
                <td><?php echo $description; ?></td>\r