Skip to content

Commit b742d9f

Browse files
committed
Jeliot with Online Visualizer
1 parent 37cc549 commit b742d9f

29 files changed

+2297
-0
lines changed

source/jeliot/README.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Jeliot activity for moodle
2+
--------------------------
3+
4+
By installing this module you can add Jeliot activities to your courses in Moodle. A Jeliot activity is composed of an introduction to the activity and a source file. Students will be presented with the introduction and a Web Start link to start Jeliot 3, which will load the source file from the moodle server.
5+
6+
7+
Requirements
8+
------------
9+
* Clients should have a working Java Web Start installation.
10+
* Server should be able to serve jnlp files properly.
11+
12+
Installing the activity
13+
-----------------------
14+
15+
Tested in Moodle 1.8.2 (should work in newer versions as well)
16+
17+
1.- If logged in as admin in moodle, log out.
18+
2.- Uncompress the file jeliot.zip to the moodle mod directory (e.g. /usr/share/moodle/mod in ubuntu)
19+
3.- Log in as admin in moodle.
20+
4.- In the admin panel, visit the "Notifications" tab. Tables will be created in your database.
21+
5.- Now Jeliot Activity will be listed in the drop-down box of activities found when designing courses.
22+

source/jeliot/WebStartJeliot.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php header("Content-Type: application/x-java-jnlp-file"); ?>
2+
<?php
3+
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
4+
$codebase=$_GET['codebase'];
5+
$sourcefile = $_GET['sourcefile'];
6+
$userID = $_GET['userID'];
7+
$sessionID = $_GET['sessionID'];
8+
$questions = $_GET['questions'];
9+
$parameters = "?codebase=".$codebase."&sourcefile=".$sourcefile."&userID=".$userID."&sessionID=".$sessionID."&questions=".$questions;
10+
$href = "WebStartJeliot.php".$parameters;
11+
?>
12+
13+
<jnlp spec="1.0+" codebase="<?php echo "$codebase";?>" href="">
14+
<information>
15+
<title>Jeliot 3</title>
16+
<vendor>University of Joensuu</vendor>
17+
<description>Jeliot 3, the program animation tool</description>
18+
<offline-allowed/>
19+
</information>
20+
<security>
21+
<all-permissions/>
22+
</security>
23+
<resources>
24+
<j2se version="1.4+"/>
25+
<jar href="jeliot.jar"/>
26+
</resources>
27+
<application-desc main-class="jeliot.MoodleJeliot">
28+
<?php
29+
30+
echo "<argument>".$sourcefile."</argument>\n";
31+
echo "<argument>".$sessionID."</argument>\n";
32+
echo "<argument>".$userID."</argument>\n";
33+
echo "<argument>".$questions."</argument>\n";
34+
?>
35+
</application-desc>
36+
<!-- <application-desc main-class="jeliot.Jeliot"/> -->
37+
</jnlp>

source/jeliot/WebStartJeliot.php.bak

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php header("Content-Type: application/x-java-jnlp-file"); ?>
2+
<?php
3+
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
4+
$codebase=$_GET['codebase'];
5+
$sourcefile = $_GET['sourcefile'];
6+
$userID = $_GET['userID'];
7+
$sessionID = $_GET['sessionID'];
8+
$questions = $_GET['questions'];
9+
$parameters = "?codebase=".$codebase."&sourcefile=".$sourcefile."&userID=".$userID."&sessionID=".$sessionID."&questions=".$questions;
10+
$href = "WebStartJeliot.php".$parameters;
11+
12+
echo "$codebase **";
13+
?>
14+
15+
<jnlp spec="1.0+" codebase="<?php echo "$codebase";?>" href="<?php echo "$href"; ?>">
16+
<information>
17+
<title>Jeliot 3</title>
18+
<vendor>University of Joensuu</vendor>
19+
<description>Jeliot 3, the program animation tool</description>
20+
<offline-allowed/>
21+
</information>
22+
<security>
23+
<all-permissions/>
24+
</security>
25+
<resources>
26+
<j2se version="1.4+"/>
27+
<jar href="jeliot.jar"/>
28+
</resources>
29+
<application-desc main-class="jeliot.MoodleJeliot">
30+
<?php
31+
32+
echo "<argument>".$sourcefile."</argument>\n";
33+
echo "<argument>".$sessionID."</argument>\n";
34+
echo "<argument>".$userID."</argument>\n";
35+
echo "<argument>".$questions."</argument>\n";
36+
?>
37+
</application-desc>
38+
<!-- <application-desc main-class="jeliot.Jeliot"/> -->
39+
</jnlp>

source/jeliot/check_db_syntax.php

Lines changed: 402 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace mod_jeliot\event;
18+
19+
defined('MOODLE_INTERNAL') || die();
20+
21+
/**
22+
* The mod_jeliot course module viewed event class.
23+
*
24+
* @package mod_jeliot
25+
*/
26+
class course_module_viewed extends \core\event\course_module_viewed {
27+
28+
/**
29+
* Init method.
30+
*
31+
* @return void
32+
*/
33+
protected function init() {
34+
$this->data['objecttable'] = 'jeliot';
35+
parent::init();
36+
}
37+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace mod_jeliot\event;
18+
19+
defined('MOODLE_INTERNAL') || die();
20+
21+
/**
22+
* The mod_jeliot course module viewed event class.
23+
*
24+
* @package mod_jeliot
25+
*/
26+
class course_module_viewed extends \core\event\course_module_viewed {
27+
28+
/**
29+
* Init method.
30+
*
31+
* @return void
32+
*/
33+
protected function init() {
34+
$this->data['crud'] = 'r';
35+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
36+
$this->data['objecttable'] = 'jeliot';
37+
}
38+
}

source/jeliot/db/install.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<XMLDB PATH="mod/jeliot/db" VERSION="2008051500" COMMENT="XMLDB file for Moodle mod/jeliot"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
5+
>
6+
<TABLES>
7+
<TABLE NAME="jeliot" COMMENT="Main Jeliot WebStart activity (jeliot) table" NEXT="jeliot_accesses">
8+
<FIELDS>
9+
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="course"/>
10+
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Course newmodule activity belongs to" PREVIOUS="id" NEXT="name"/>
11+
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances" PREVIOUS="course" NEXT="intro"/>
12+
<FIELD NAME="intro" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the jeliot activity" PREVIOUS="name" NEXT="introformat"/>
13+
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)" PREVIOUS="intro" NEXT="timecreated"/>
14+
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="introformat" NEXT="timemodified"/>
15+
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="sourcefile"/>
16+
<FIELD NAME ="sourcefile" TYPE="char" LENGTH="512" NOTNULL="true" DEFAULT="/path/to/file" SEQUENCE="false" PREVIOUS="timemodified" NEXT="questions"/>
17+
<FIELD NAME ="questions" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="sourcefile" NEXT="grade"/>
18+
<FIELD NAME ="grade" TYPE="int" LENGTH="4" NOTNULL="false" SEQUENCE="false" PREVIOUS="questions" NEXT="displaysource"/>
19+
<FIELD NAME ="displaysource" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="grade" NEXT="metadata"/>
20+
<FIELD NAME ="metadata" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="displaysource"/>
21+
</FIELDS>
22+
<KEYS>
23+
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
24+
</KEYS>
25+
<INDEXES>
26+
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
27+
</INDEXES>
28+
</TABLE>
29+
<TABLE NAME="jeliot_accesses" PREVIOUS="jeliot" COMMENT="jeliotaccesses">
30+
<FIELDS>
31+
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="jeliotid"/>
32+
<FIELD NAME="jeliotid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="reference to the jeliotws activity" PREVIOUS="id" NEXT="userid"/>
33+
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user who accessed the activity" PREVIOUS="jeliotid" NEXT="timemodified"/>
34+
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time access happened" PREVIOUS="userid"/>
35+
</FIELDS>
36+
<KEYS>
37+
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
38+
</KEYS>
39+
<INDEXES>
40+
<INDEX NAME="activity" UNIQUE="false" FIELDS="jeliotid"/>
41+
</INDEXES>
42+
43+
</TABLE>
44+
</TABLES>
45+
</XMLDB>

source/jeliot/db/log.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/**
3+
* Definition of log events
4+
*
5+
* @package mod
6+
* @subpackage jeliot
7+
*/
8+
defined('MOODLE_INTERNAL') || die();
9+
$logs = array(
10+
array('module'=>'jeliot', 'action'=>'view', 'mtable'=>'newmodule', 'field'=>'name'),
11+
array('module'=>'jeliot', 'action'=>'update', 'mtable'=>'newmodule', 'field'=>'name'),
12+
array('module'=>'jeliot', 'action'=>'add', 'mtable'=>'newmodule', 'field'=>'name'),
13+
);

source/jeliot/db/upgrade.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php //$Id: upgrade.php,v 1.2 2007/08/08 22:36:54 stronk7 Exp $
2+
3+
// This file keeps track of upgrades to
4+
// the newmodule module
5+
//
6+
// Sometimes, changes between versions involve
7+
// alterations to database structures and other
8+
// major things that may break installations.
9+
//
10+
// The upgrade function in this file will attempt
11+
// to perform all the necessary actions to upgrade
12+
// your older installtion to the current version.
13+
//
14+
// If there's something it cannot do itself, it
15+
// will tell you what you need to do.
16+
//
17+
// The commands in here will all be database-neutral,
18+
// using the functions defined in lib/ddllib.php
19+
20+
function xmldb_jeliot_upgrade($oldversion=0) {
21+
22+
global $CFG, $THEME, $DB;
23+
24+
return true;
25+
}
26+
27+
?>

source/jeliot/icon.gif

1 KB
Loading

source/jeliot/index.php

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php // $Id: index.php,v 1.7 2007/09/03 12:23:36 jamiesensei Exp $
2+
/**
3+
* This page lists all the instances of jeliot in a particular course
4+
*
5+
* @author
6+
* @version $Id: index.php,v 1.7 2007/09/03 12:23:36 jamiesensei Exp $
7+
* @package jeliot
8+
**/
9+
10+
11+
require_once("../../config.php");
12+
require_once("lib.php");
13+
14+
$id = required_param('id', PARAM_INT); // course
15+
16+
if (! $course = $DB->get_record("course", "id", array('id' => $id))) {
17+
error("Course ID is incorrect");
18+
}
19+
20+
require_login($course->id);
21+
22+
add_to_log($course->id, "jeliot", "view all", "index.php?id=$course->id", "");
23+
24+
25+
/// Get all required stringsjeliot
26+
27+
$strjeliots = get_string("modulenameplural", "jeliot");
28+
$strjeliot = get_string("modulename", "jeliot");
29+
30+
31+
/// Print the header
32+
33+
//----------- old code -------------------------
34+
//$navlinks = array();
35+
//$navlinks[] = array('name' => $strjeliots, 'link' => '', 'type' => 'activity');
36+
//$navigation = build_navigation($navlinks);
37+
38+
// print_header_simple("$strjeliots", "", $navigation, "", "", true, "", navmenu($course));
39+
40+
$PAGE->navbar->add($navlinks);
41+
$PAGE->set_heading(format_string($course->fullname));
42+
$PAGE->set_title(get_string('modulename', 'jeliot').' '.get_string('activities'));
43+
echo $OUTPUT->header();
44+
45+
/// Get all the appropriate data
46+
47+
if (! $jeliots = get_all_instances_in_course("jeliot", $course)) {
48+
notice("There are no jeliots", "../../course/view.php?id=$course->id");
49+
die;
50+
}
51+
52+
/// Print the list of instances (your module will probably extend this)
53+
54+
$timenow = time();
55+
$strname = get_string("name");
56+
$strweek = get_string("week");
57+
$strtopic = get_string("topic");
58+
59+
$table = new html_table();
60+
61+
if ($course->format == "weeks") {
62+
$table->head = array ($strweek, $strname);
63+
$table->align = array ("center", "left");
64+
} else if ($course->format == "topics") {
65+
$table->head = array ($strtopic, $strname);
66+
$table->align = array ("center", "left", "left", "left");
67+
} else {
68+
$table->head = array ($strname);
69+
$table->align = array ("left", "left", "left");
70+
}
71+
72+
foreach ($jeliots as $jeliot) {
73+
if (!$jeliot->visible) {
74+
//Show dimmed if the mod is hidden
75+
$link = "<a class=\"dimmed\" href=\"view.php?id=$jeliot->coursemodule\">$jeliot->name</a>";
76+
} else {
77+
//Show normal if the mod is visible
78+
$link = "<a href=\"view.php?id=$jeliot->coursemodule\">$jeliot->name</a>";
79+
}
80+
81+
if ($course->format == "weeks" or $course->format == "topics") {
82+
$table->data[] = array ($jeliot->section, $link);
83+
} else {
84+
$table->data[] = array ($link);
85+
}
86+
}
87+
88+
echo "<br />";
89+
90+
echo html_writer::table($table);
91+
92+
/// Finish the page
93+
94+
print_footer($course);
95+
96+
?>

0 commit comments

Comments
 (0)