make the test preview page a public page, not restricted to be only accessible by...
authorCindy Li <cli@ocad.ca>
Wed, 9 Jun 2010 20:12:00 +0000 (20:12 -0000)
committerCindy Li <cli@ocad.ca>
Wed, 9 Jun 2010 20:12:00 +0000 (20:12 -0000)
docs/home/classes/ContentManager.class.php
docs/include/page_constants.inc.php
docs/tests/preview.php

index a25b351..cb15784 100644 (file)
@@ -1297,7 +1297,7 @@ initContentMenu();
                
                $row = $this->contentDAO->get($content_id);
                
-               if ($row['allow_test_export'] == 1 || Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE)){
+               if ($row['allow_test_export'] == 1 || Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE, false)){
                        return true;
                }
                return false;
index fabb287..91bf7a9 100644 (file)
@@ -98,6 +98,10 @@ $_pages['documentation/web_service_api.php']['parent'] = TR_NAV_PUBLIC;
 $_pages['documentation/oauth_server_api.php']['title_var'] = 'oauth_server_api';\r
 $_pages['documentation/oauth_server_api.php']['parent'] = TR_NAV_PUBLIC;\r
 \r
+$_pages['tests/preview.php']['title_var'] = 'preview_questions';\r
+$_pages['tests/preview.php']['parent']    = TR_NAV_PUBLIC;\r
+$_pages['tests/preview.php']['guide']     = 'TR_HELP_PREVIEW';\r
+\r
 // home pages\r
 if (array_key_exists(TR_PRIV_HOME, $privs) && Utility::authenticate($privs[TR_PRIV_HOME]))\r
 {\r
@@ -321,10 +325,6 @@ if (array_key_exists(TR_PRIV_MANAGE_TESTS, $privs) && Utility::authenticate($pri
        $_pages['tests/edit_test.php']['parent']    = 'tests/index.php';\r
        $_pages['tests/edit_test.php']['guide']     = 'TR_HELP_CREATE_TEST';\r
        \r
-       $_pages['tests/preview.php']['title_var'] = 'preview_questions';\r
-       $_pages['tests/preview.php']['parent']    = 'tests/index.php';\r
-       $_pages['tests/preview.php']['guide']     = 'TR_HELP_PREVIEW';\r
-       \r
        $_pages['tests/preview_question.php']['title_var'] = 'preview';\r
        $_pages['tests/preview_question.php']['parent']    = 'tests/question_db.php';\r
        \r
index 757a1c7..44e1b2c 100644 (file)
@@ -18,7 +18,7 @@ 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);
+//Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
 $testsDAO = new TestsDAO();
 $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
 
@@ -68,11 +68,13 @@ $count = 1;
                $o = TestQuestions::getQuestion($row['type']);
                $o->display($row);
        }
-       ?>
+       
+       // "back" button only appears when the request is from index page of "tests" module
+       if (stripos($_SERVER['HTTP_REFERER'], 'tests/index.php')) { ?>
        <div class="row buttons">
                <input type="submit" value="<?php echo _AT('back'); ?>" name="back" />
        </div>
-
+       <?php }?>
        </div>
 </form>
 <script type="text/javascript">