Skip to content

Commit

Permalink
Jeliot with Online Visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
susobhang70 committed Nov 15, 2015
1 parent 37cc549 commit b742d9f
Show file tree
Hide file tree
Showing 29 changed files with 2,297 additions and 0 deletions.
22 changes: 22 additions & 0 deletions source/jeliot/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Jeliot activity for moodle
--------------------------

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.


Requirements
------------
* Clients should have a working Java Web Start installation.
* Server should be able to serve jnlp files properly.

Installing the activity
-----------------------

Tested in Moodle 1.8.2 (should work in newer versions as well)

1.- If logged in as admin in moodle, log out.
2.- Uncompress the file jeliot.zip to the moodle mod directory (e.g. /usr/share/moodle/mod in ubuntu)
3.- Log in as admin in moodle.
4.- In the admin panel, visit the "Notifications" tab. Tables will be created in your database.
5.- Now Jeliot Activity will be listed in the drop-down box of activities found when designing courses.

37 changes: 37 additions & 0 deletions source/jeliot/WebStartJeliot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php header("Content-Type: application/x-java-jnlp-file"); ?>
<?php
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$codebase=$_GET['codebase'];
$sourcefile = $_GET['sourcefile'];
$userID = $_GET['userID'];
$sessionID = $_GET['sessionID'];
$questions = $_GET['questions'];
$parameters = "?codebase=".$codebase."&sourcefile=".$sourcefile."&userID=".$userID."&sessionID=".$sessionID."&questions=".$questions;
$href = "WebStartJeliot.php".$parameters;
?>

<jnlp spec="1.0+" codebase="<?php echo "$codebase";?>" href="">
<information>
<title>Jeliot 3</title>
<vendor>University of Joensuu</vendor>
<description>Jeliot 3, the program animation tool</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4+"/>
<jar href="jeliot.jar"/>
</resources>
<application-desc main-class="jeliot.MoodleJeliot">
<?php

echo "<argument>".$sourcefile."</argument>\n";
echo "<argument>".$sessionID."</argument>\n";
echo "<argument>".$userID."</argument>\n";
echo "<argument>".$questions."</argument>\n";
?>
</application-desc>
<!-- <application-desc main-class="jeliot.Jeliot"/> -->
</jnlp>
39 changes: 39 additions & 0 deletions source/jeliot/WebStartJeliot.php.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php header("Content-Type: application/x-java-jnlp-file"); ?>
<?php
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$codebase=$_GET['codebase'];
$sourcefile = $_GET['sourcefile'];
$userID = $_GET['userID'];
$sessionID = $_GET['sessionID'];
$questions = $_GET['questions'];
$parameters = "?codebase=".$codebase."&sourcefile=".$sourcefile."&userID=".$userID."&sessionID=".$sessionID."&questions=".$questions;
$href = "WebStartJeliot.php".$parameters;

echo "$codebase **";
?>

<jnlp spec="1.0+" codebase="<?php echo "$codebase";?>" href="<?php echo "$href"; ?>">
<information>
<title>Jeliot 3</title>
<vendor>University of Joensuu</vendor>
<description>Jeliot 3, the program animation tool</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4+"/>
<jar href="jeliot.jar"/>
</resources>
<application-desc main-class="jeliot.MoodleJeliot">
<?php

echo "<argument>".$sourcefile."</argument>\n";
echo "<argument>".$sessionID."</argument>\n";
echo "<argument>".$userID."</argument>\n";
echo "<argument>".$questions."</argument>\n";
?>
</application-desc>
<!-- <application-desc main-class="jeliot.Jeliot"/> -->
</jnlp>
402 changes: 402 additions & 0 deletions source/jeliot/check_db_syntax.php

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions source/jeliot/classes/event/course_module_viewed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace mod_jeliot\event;

defined('MOODLE_INTERNAL') || die();

/**
* The mod_jeliot course module viewed event class.
*
* @package mod_jeliot
*/
class course_module_viewed extends \core\event\course_module_viewed {

/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'jeliot';
parent::init();
}
}
38 changes: 38 additions & 0 deletions source/jeliot/classes/event/course_module_viewed.php.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace mod_jeliot\event;

defined('MOODLE_INTERNAL') || die();

/**
* The mod_jeliot course module viewed event class.
*
* @package mod_jeliot
*/
class course_module_viewed extends \core\event\course_module_viewed {

/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'jeliot';
}
}
45 changes: 45 additions & 0 deletions source/jeliot/db/install.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/jeliot/db" VERSION="2008051500" COMMENT="XMLDB file for Moodle mod/jeliot"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="jeliot" COMMENT="Main Jeliot WebStart activity (jeliot) table" NEXT="jeliot_accesses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="course"/>
<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"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances" PREVIOUS="course" NEXT="intro"/>
<FIELD NAME="intro" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the jeliot activity" PREVIOUS="name" NEXT="introformat"/>
<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"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="introformat" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="sourcefile"/>
<FIELD NAME ="sourcefile" TYPE="char" LENGTH="512" NOTNULL="true" DEFAULT="/path/to/file" SEQUENCE="false" PREVIOUS="timemodified" NEXT="questions"/>
<FIELD NAME ="questions" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="sourcefile" NEXT="grade"/>
<FIELD NAME ="grade" TYPE="int" LENGTH="4" NOTNULL="false" SEQUENCE="false" PREVIOUS="questions" NEXT="displaysource"/>
<FIELD NAME ="displaysource" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="grade" NEXT="metadata"/>
<FIELD NAME ="metadata" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="displaysource"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES>
</TABLE>
<TABLE NAME="jeliot_accesses" PREVIOUS="jeliot" COMMENT="jeliotaccesses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="jeliotid"/>
<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"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user who accessed the activity" PREVIOUS="jeliotid" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time access happened" PREVIOUS="userid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="activity" UNIQUE="false" FIELDS="jeliotid"/>
</INDEXES>

</TABLE>
</TABLES>
</XMLDB>
13 changes: 13 additions & 0 deletions source/jeliot/db/log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Definition of log events
*
* @package mod
* @subpackage jeliot
*/
defined('MOODLE_INTERNAL') || die();
$logs = array(
array('module'=>'jeliot', 'action'=>'view', 'mtable'=>'newmodule', 'field'=>'name'),
array('module'=>'jeliot', 'action'=>'update', 'mtable'=>'newmodule', 'field'=>'name'),
array('module'=>'jeliot', 'action'=>'add', 'mtable'=>'newmodule', 'field'=>'name'),
);
27 changes: 27 additions & 0 deletions source/jeliot/db/upgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php //$Id: upgrade.php,v 1.2 2007/08/08 22:36:54 stronk7 Exp $

// This file keeps track of upgrades to
// the newmodule module
//
// Sometimes, changes between versions involve
// alterations to database structures and other
// major things that may break installations.
//
// The upgrade function in this file will attempt
// to perform all the necessary actions to upgrade
// your older installtion to the current version.
//
// If there's something it cannot do itself, it
// will tell you what you need to do.
//
// The commands in here will all be database-neutral,
// using the functions defined in lib/ddllib.php

function xmldb_jeliot_upgrade($oldversion=0) {

global $CFG, $THEME, $DB;

return true;
}

?>
Binary file added source/jeliot/icon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions source/jeliot/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php // $Id: index.php,v 1.7 2007/09/03 12:23:36 jamiesensei Exp $
/**
* This page lists all the instances of jeliot in a particular course
*
* @author
* @version $Id: index.php,v 1.7 2007/09/03 12:23:36 jamiesensei Exp $
* @package jeliot
**/


require_once("../../config.php");
require_once("lib.php");

$id = required_param('id', PARAM_INT); // course

if (! $course = $DB->get_record("course", "id", array('id' => $id))) {
error("Course ID is incorrect");
}

require_login($course->id);

add_to_log($course->id, "jeliot", "view all", "index.php?id=$course->id", "");


/// Get all required stringsjeliot

$strjeliots = get_string("modulenameplural", "jeliot");
$strjeliot = get_string("modulename", "jeliot");


/// Print the header

//----------- old code -------------------------
//$navlinks = array();
//$navlinks[] = array('name' => $strjeliots, 'link' => '', 'type' => 'activity');
//$navigation = build_navigation($navlinks);

// print_header_simple("$strjeliots", "", $navigation, "", "", true, "", navmenu($course));

$PAGE->navbar->add($navlinks);
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title(get_string('modulename', 'jeliot').' '.get_string('activities'));
echo $OUTPUT->header();

/// Get all the appropriate data

if (! $jeliots = get_all_instances_in_course("jeliot", $course)) {
notice("There are no jeliots", "../../course/view.php?id=$course->id");
die;
}

/// Print the list of instances (your module will probably extend this)

$timenow = time();
$strname = get_string("name");
$strweek = get_string("week");
$strtopic = get_string("topic");

$table = new html_table();

if ($course->format == "weeks") {
$table->head = array ($strweek, $strname);
$table->align = array ("center", "left");
} else if ($course->format == "topics") {
$table->head = array ($strtopic, $strname);
$table->align = array ("center", "left", "left", "left");
} else {
$table->head = array ($strname);
$table->align = array ("left", "left", "left");
}

foreach ($jeliots as $jeliot) {
if (!$jeliot->visible) {
//Show dimmed if the mod is hidden
$link = "<a class=\"dimmed\" href=\"view.php?id=$jeliot->coursemodule\">$jeliot->name</a>";
} else {
//Show normal if the mod is visible
$link = "<a href=\"view.php?id=$jeliot->coursemodule\">$jeliot->name</a>";
}

if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($jeliot->section, $link);
} else {
$table->data[] = array ($link);
}
}

echo "<br />";

echo html_writer::table($table);

/// Finish the page

print_footer($course);

?>
Loading

0 comments on commit b742d9f

Please sign in to comment.