Permalink
Browse files

jquery address history test

  • Loading branch information...
1 parent e42562b commit bb72405d0790f0292aaa48f4869de7c13fb7d369 @koopa committed Oct 22, 2012
@@ -6,30 +6,30 @@ require("courseheader.php");
<div id="coursenavigation">
<ol class="tree">
- <li class="file"><a href="#" onClick="selectPart('default')">Introduction</a></li>
+ <li class="file"><a data-contentid="default" href="#/course/General/Introduction">Introduction</a></li>
<li>
<label for="theory">Theory</label><input type="checkbox" checked id="theory" />
<ol>
- <li class="file"><a href="#" onClick="selectPart('chapter1')">Chapter 1</a></li>
+ <li class="file"><a data-contentid="chapter1" href="#/course/General/Chapter+1">Chapter 1</a></li>
*** add more chapter links here ***
</ol>
</li>
<li>
<label for="exercises">Exercises</label> <input type="checkbox" checked id="exercises" />
<ol>
- <li class="file"><a href="#" onClick="selectPart('exercise1')">Exercise 1</a></li>
+ <li class="file"><a data-contentid="exercise1" href="#/course/General/Exercise+1">Exercise 1</a></li>
*** add more exercise links here ***
</ol>
</li>
- <li class="file"><a href="#" onClick="selectPart('examn')">Exam</a></li>
+ <li class="file"><a data-contentid="examn" href="#/course/General/Exam">Exam</a></li>
</ol>
</div>
<div id="coursecontent">
<div id="default">
Default
- <p class="center"><a href="#" onClick="selectPart('chapter1')">>> Next Chapter >></a></p>
+ <p class="center"><a href="#/course/General/[nextChapterName]">>> Next Chapter >></a></p>
</div>
<div id="chapter1">
View
@@ -27,8 +27,9 @@
// Description: Load the course file specified by the GET variable 'id'
//
- $courseid = isset($_GET['id']) ? $_GET['id'] : 0;
- $errorstring = "<p class=\"center\"><img alt=\"Y U NO GIVE ID\" src=\"images/yuno.png\" /><br /><br />No active course, select a valid course from the overview!</p>";
+ $errorstring = "<p class=\"center\"><img alt=\"Y U NO GIVE ID\" src=\"images/yuno.png\" /><br /><br />No active course, select a valid course from the
+ <a href=\"#\" onclick=\"$('#tabs').tabs('select', 0);\">overview!
+ </p>";
$filename = "courses/course".$courseid.".php";
$mincourseid = 0;
$maxcourseid = 100000;
@@ -38,9 +39,40 @@
else
{
if(is_readable($filename))
- include($filename);
- else
- echo $errorstring;
+ $courseData = include($filename);
+// else
+// echo $errorstring;
}
+
+ echo '<div id="coursenavigation">
+ <ol class="tree">';
+
+ foreach($categories as $id => $name){
+ echo '<li><label for="'.urlencode($name).'">'.$name.'</label>
+ <input type="checkbox" checked id="'.urlencode($name).'" />
+ <ol>';
+ foreach($tree[$id] as $courses){
+ foreach($courses as $course){
+ echo '<li><label for="'.urlencode($name).'">'.$name.'</label>
+ <input type="checkbox" checked id="'.urlencode($name).'" />
+ <ol>';
+ if($course['id'] == $courseid){
+ echo '<li class="file"><a data-contentid="default"
+ href="#/course/'.urlencode($name).'">
+ '.$name.'
+ </a></li>';
+ }
+ }
+ echo '</ol>
+ </li>';
+ }
+ echo '</ol>
+ </li>';
+ }
+ echo '</ol><!-- end ol class tree -->
+ </div><!-- end div id="coursenavigation" -->';
+
?>
+
+
</div>
@@ -20,25 +20,21 @@
// //
///////////////////////////////////////////////////////////////////////////////////
-require("../getsmfuser.php");
+require_once("../getsmfuser.php");
$notloggedintext = "<p class=\"warning\">Warning: You aren't logged in to the Hackits forum, submitting this exam will only count if you are logged in!</p>";
+$courseid = isset($_GET['id']) ? $_GET['id'] : 0;
?>
<script type="text/javascript">
-
- // shows the specified div and hides all others
- function selectPart(part){ $("#"+part).show().siblings().hide(); }
-
// when the examn form is submitted, show the results in a dialog window
$(document).ready(function(){
$("#examnform").submit( function () {
$.post(
'examnhandler.php?id=<? echo $courseid; ?>',
$(this).serialize(),
function(data){
- $("#examnresult").empty().append( data );
- $("#examnresult").dialog("open");
+ $("#examnresult").empty().append(data).dialog("open");
}
);
return false;
@@ -51,4 +47,4 @@ function(data){
</script>
-<div id="examnresult" title="Exam Results"></div>
+<div id="examnresult" title="Exam Results"></div>
Oops, something went wrong.

0 comments on commit bb72405

Please sign in to comment.