Skip to content

Commit

Permalink
merge in all changes from trunk up to r226
Browse files Browse the repository at this point in the history
git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/branches/1.7@229 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
Dave Goodwin committed Nov 8, 2011
1 parent b4cc322 commit 8a12625
Show file tree
Hide file tree
Showing 17 changed files with 422 additions and 1,096 deletions.
31 changes: 15 additions & 16 deletions JMolViewer/jmol.htm
Expand Up @@ -81,33 +81,32 @@

setUpInfo += " set antialiasDisplay true;";

var windowW = str.split(';')[7].split('width=')[1];
var windowH = str.split(';')[8].split('height=')[1];

var modelW = windowW-4;
var modelH = windowH-4;

if (controls == "true") {
modelH = windowH-80;
}

document.write('<style>.holder {width: ' + windowW + 'px; height: ' + (windowH-11) + 'px;}</style>');
</script>

<style type="text/css">
<!--
.style1 {
font-size: 11px;
}

.holder {
width: 370px;
height: 389px;
}

.header {
border: solid 2px white;
background-color: #E6E6E6;
font-size: 13px;
padding: 5px 10px 5px 10px;
}
}

.model {
border: solid 2px white;
background-color: white;
text-align: center;
}

.controls {
.controlBar {
border: solid 2px white;
background-color: #E6E6E6;
padding: 10px;
Expand All @@ -127,7 +126,7 @@
<script type="text/javascript">
jmolInitialize("jmol");
jmolSetAppletColor(bgColour);
jmolApplet([345, 309], setUpInfo);
jmolApplet([modelW, modelH], setUpInfo);
jmolSetButtonCssClass("style1");
jmolSetCheckboxCssClass("style1");
jmolSetMenuCssClass("style1");
Expand All @@ -136,7 +135,7 @@

<script type="text/javascript">
if (controls == "true") {
document.write('<div class="controls">');
document.write('<div class="controlBar">');

jmolHtml("Display: ");
jmolMenu(displayOptions);
Expand Down
17 changes: 6 additions & 11 deletions config.php
Expand Up @@ -2,11 +2,8 @@

//moodle integration (please view moodle_integration_readme.txt before use)
//The require path below is the path to the moodle installation config file
//usually found in the root of the moodle installation
//this needs to be the path from root rather than something like ../../moodle/config.php
//e.g. this might be something like require("/home/yourdomain/public_html/config.php");
//for a xampp/maxos install this should be something like require("/xampp/htdocs/moodle/config.php");
//set and uncomment this path e.g. remove the // in front of require and change the path for your install
//set this same path in moodle_integration.txt also
//require("/xampp/htdocs/moodle/config.php");

Expand Down Expand Up @@ -55,10 +52,11 @@ function _debug($string, $up = 0) {
}

if(!isset($xerte_toolkits_site)) {
if(empty($_SESSION)) {
session_start();
$_SESSION['xertetoolkits'] = true;
}
//check if using external authentication integration and if not start session as usual
if(empty($_SESSION)) {
session_start();
$_SESSION['xertetoolkits'] = true;
}
// create new generic object to hold all our config stuff in....
$xerte_toolkits_site = new StdClass();

Expand All @@ -69,11 +67,10 @@ function _debug($string, $up = 0) {
die("please run /setup");
}

require_once("database.php");
require_once(dirname(__FILE__) . '/database.php');
require_once(dirname(__FILE__) . '/website_code/php/database_library.php');

$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}sitedetails");

if(!$row) {
die("Error talking to database; perhaps it is offline?");
}
Expand All @@ -89,9 +86,7 @@ function _debug($string, $up = 0) {
*/

if($row['integration_config_path']!=""){

require_once($row['integration_config_path']);

}

/**
Expand Down
@@ -1 +1 @@
<PG name="embedDiv"> <SCR name="setup"><![CDATA[pageIcon = icon.parentNode.clip();if (extXML == undefined){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject(); rootIcon.setTitleText(templateData.learningObject[0].name);}if (pageIcon.templateData.embedDiv[0].narration != undefined){ narration = pageIcon.templateData.embedDiv[0].narration; rootIcon.broadcast('showAudio');}]]></SCR> <SCR name="makeDiv"><![CDATA[params = new Object();if (pageIcon.templateData.embedDiv[0].src.substr(0,1) == '<'){ params.type = 'div';} else { params.type = 'iframe';}params.x = '84';params.y = '20';params.width = '760';params.height = '474';params.src = pageIcon.templateData.embedDiv[0].src;params.bgColour = '#FFFFFF';params.borderColour = '#000000';callJS('makePopUp', params);popupActive = true;]]></SCR> </PG>
<PG name="embedDiv"> <SCR name="setup"><![CDATA[pageIcon = icon.parentNode.clip();if (extXML == undefined){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject(); rootIcon.setTitleText(templateData.learningObject[0].name);}if (pageIcon.templateData.embedDiv[0].narration != undefined){ narration = pageIcon.templateData.embedDiv[0].narration; rootIcon.broadcast('showAudio');}]]></SCR> <SCR name="makeDiv"><![CDATA[params = new Object();params.id = "popup0";if (pageIcon.templateData.embedDiv[0].src.substr(0,1) == '<'){ params.type = 'div';} else { params.type = 'iframe';}params.screenSize = rootIcon.sizes.getValue();params.calcW = 95;params.calcH = 79;params.calcX = 2.5;params.calcY = 14;params.width = Stage.width;params.height = Stage.height;params.src = pageIcon.templateData.embedDiv[0].src;params.bgColour = '#FFFFFF';params.borderColour = '#000000';callJS('makePopUp', params);popupActive = true;]]></SCR> </PG>
Expand Down
2 changes: 1 addition & 1 deletion modules/xerte/parent_templates/Nottingham/models/jmol.rlm
@@ -1 +1 @@
<PG name="JMol"> <SCR name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();if (extXML == undefined){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject(); rootIcon.setTitleText(templateData.learningObject[0].name);}if (pageIcon.templateData.jmol[0].narration != undefined){ narration = pageIcon.templateData.jmol[0].narration; rootIcon.broadcast('showAudio');}]]></SCR> <SCR name="JMol"><![CDATA[if (pageIcon.templateData.jmol[0].xyz2 != undefined) { numXYZ = 2; textW = 760; textH = 80; windowH = 389;} else { numXYZ = 1; textW = 340; textH = 474; windowH = 474;}windowW = 370;for (i=0; i<numXYZ; i++) { params = new Object(); params.id = "popup"+i; //params.y = '85'; params.y = 85 * numXYZ; params.width = windowW; params.height = windowH; params.type = 'iframe'; if (i == 0) { myFile = pageIcon.templateData.jmol[0].xyz; } else { myFile = pageIcon.templateData.jmol[0].xyz2; } params.x = 800 - ((windowW+20)*(i+1)); params.src = 'JMolViewer/jmol.htm?xyz=../' + expression(myFile, engine) + ';spin=' + pageIcon.templateData.jmol[0].initSpin + ';controls=' + pageIcon.templateData.jmol[0].controls + ';bgColour=' + pageIcon.templateData.jmol[0].bgColour + ';initLook=' + pageIcon.templateData.jmol[0].initLook + ';cartoonOpt=' + pageIcon.templateData.jmol[0].cartoonOpt + ';backOpt=' + pageIcon.templateData.jmol[0].backOpt; params.bgColour = '#FFFFFF'; params.borderColour = '#FFFFFF'; callJS('makePopUp', params); popupActive = true;}]]></SCR> <DIS scrolling="auto" h="textH" name="text" x="20" y="20" w="textW" type="text"><![CDATA[{pageIcon.templateData.jmol[0].text}]]></DIS> </PG>
<PG name="JMol"> <SCR name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();if (extXML == undefined){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject(); rootIcon.setTitleText(templateData.learningObject[0].name);}if (pageIcon.templateData.jmol[0].narration != undefined){ narration = pageIcon.templateData.jmol[0].narration; rootIcon.broadcast('showAudio');}]]></SCR> <SCR name="JMol"><![CDATA[if (pageIcon.templateData.jmol[0].xyz2 != undefined) { numXYZ = 2; textW = 760; textH = 80;} else { numXYZ = 1; textW = 340; textH = 474;}for (i=0; i<numXYZ; i++) { params = new Object(); params.id = "popup"+i; params.screenSize = rootIcon.sizes.getValue(); params.calcW = 46.25; params.calcH = 65; params.calcX = 2.5; params.calcY = 14 * numXYZ; params.width = Stage.width; params.height = Stage.height; params.type = 'jmol'; if (i == 0) { myFile = pageIcon.templateData.jmol[0].xyz; } else { myFile = pageIcon.templateData.jmol[0].xyz2; } params.src = 'JMolViewer/jmol.htm?xyz=../' + expression(myFile, engine) + ';spin=' + pageIcon.templateData.jmol[0].initSpin + ';controls=' + pageIcon.templateData.jmol[0].controls + ';bgColour=' + pageIcon.templateData.jmol[0].bgColour + ';initLook=' + pageIcon.templateData.jmol[0].initLook + ';cartoonOpt=' + pageIcon.templateData.jmol[0].cartoonOpt + ';backOpt=' + pageIcon.templateData.jmol[0].backOpt; params.bgColour = '#FFFFFF'; params.borderColour = '#FFFFFF'; callJS('makePopUp', params); popupActive = true;}]]></SCR> <DIS scrolling="auto" h="textH" name="text" x="20" y="20" w="textW" type="text"><![CDATA[{pageIcon.templateData.jmol[0].text}]]></DIS> </PG>
Expand Down
15 changes: 8 additions & 7 deletions modules/xerte/play.php
Expand Up @@ -9,17 +9,18 @@

function show_template($row_play){

global $xerte_toolkits_site;

$string_for_flash_xml = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/data.xml?time=" . time();
$string_for_flash_xml = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/data.xml?time=" . time();

$string_for_flash = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";
$string_for_flash = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";

list($x, $y) = explode("~",get_template_screen_size($row_play['template_name'],$row_play['template_framework']));
echo file_get_contents("modules/" . $row_play['template_framework'] . "/preview_" . $row_play['template_framework'] . "_top");
list($x, $y) = explode("~",get_template_screen_size($row_play['template_name'],$row_play['template_framework']));
echo file_get_contents("modules/" . $row_play['template_framework'] . "/preview_" . $row_play['template_framework'] . "_top");

// slightly modified xerte preview code to allow for flash vars
echo "myRLO = new rloObject('" . $x . "','" . $y . "','modules/" . $row_play['template_framework'] . "/parent_templates/" . $row_play['template_name'] . "/" . $row_play['template_name'] . ".rlt','$string_for_flash', '$string_for_flash_xml', '$xerte_toolkits_site->site_url')";
// slightly modified xerte preview code to allow for flash vars
echo "myRLO = new rloObject('" . $x . "','" . $y . "','modules/" . $row_play['template_framework'] . "/parent_templates/" . $row_play['template_name'] . "/" . $row_play['template_name'] . ".rlt','$string_for_flash', '$string_for_flash_xml', '$xerte_toolkits_site->site_url')";

echo "</script></div><div id=\"popup_parent\"></body></html>";
echo "</script></div><div id=\"popup_parent\"></body></html>";

}
70 changes: 52 additions & 18 deletions modules/xerte/preview_xerte_top
Expand Up @@ -32,33 +32,67 @@ function makePopUp(params)
parent.removeChild(popup);
}

//make the div and style it...
//make the div and style it
var create_div = document.createElement("DIV");

create_div.id = params.id;
create_div.style.height = params.height + "px";
create_div.style.width = params.width + "px";
create_div.style.position = "absolute";

create_div.style.left = params.x + "px";
create_div.style.top = params.y + "px";
create_div.style.background = params.bgColour;
create_div.style.border = "1px solid " + params.borderColour;

//if we make a div, set the innerHTML
if (params.type == 'div'){
create_div.innerHTML = params.src;
if (params.borderColour != "none") {
create_div.style.border = "1px solid " + params.borderColour;
}
else if (params.type == 'iframe')
{
var iframe_create_div = document.createElement("IFRAME");

var stageW = params.width;
var stageH = params.height;
var divNum = Number(params.id.substring(5, params.id.length));
if (params.screenSize == "full screen" || params.screenSize == "fill window" || (params.width == 1600 && params.height == 1200)) {
if (document.body && document.body.offsetWidth) {
stageW = document.body.offsetWidth;
stageH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) {
stageW = document.documentElement.offsetWidth;
stageH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
stageW = window.innerWidth;
stageH = window.innerHeight;
}

if (params.screenSize == "full screen" && stageH / stageW != 0.75) {
var ratio = stageH / stageW;
if (ratio > 0.75) {
stageH = stageW * 0.75;
} else {
stageW = stageH / 0.75;
}
}

}

var divW = stageW / 100 * params.calcW;
var divH = stageH / 100 * params.calcH;
var divX = stageW - ((divW + (stageW / 100 * params.calcX) ) * (divNum + 1));
var divY = stageH / 100 * params.calcY;

create_div.style.width = divW + "px";
create_div.style.height = divH + "px";
create_div.style.left = divX + "px";
create_div.style.top = divY + "px";

if (params.type == 'div'){
create_div.innerHTML = params.src;
} else {
var iframe_create_div = document.createElement("IFRAME");
iframe_create_div.src = params.src;
iframe_create_div.style.height = params.height + "px";
iframe_create_div.style.width = params.width + "px";
if (params.type == 'jmol') {
iframe_create_div.src += ';width=' + divW + ';height=' + divH;
}
iframe_create_div.style.height = divH + "px";
iframe_create_div.style.width = divW + "px";
iframe_create_div.frameBorder='no';
create_div.appendChild(iframe_create_div);

}

//finally append the div
parent.appendChild(create_div);
}
Expand Down
Binary file modified modules/xerte/scorm/MainPreloader.swf
Binary file not shown.
5 changes: 3 additions & 2 deletions moodle_integration.txt
@@ -1,10 +1,9 @@
<?php
////moodle integration (please view moodle_integration_readme.txt before use)
//the following line sets a session variable so that the separate config file doesn't restart session_start and kill the moodle session
//if demo.php or switch.php is used then this session isn't set so the installation works fine without moodle integration
//if demo.php or switch.php is used then this session isn't set so the installation works fine without moodle integration
$_SESSION['integrate_with_moodle'] = true;

//moodle integration (please view moodle_integration_readme.txt before use)
//The require path below is the path to the moodle installation config file
//usually found in the root of the moodle installation
//this needs to be the path from root rather than something like ../../moodle/config.php
Expand Down Expand Up @@ -104,6 +103,8 @@ echo logged_in_page_format_middle(file_get_contents($xerte_toolkits_site->websit

list_blank_templates();

echo "&nbsp;&nbsp;&nbsp;Logged in as " .$_SESSION['toolkits_firstname'] ." " .$_SESSION['toolkits_surname'];

echo file_get_contents($xerte_toolkits_site->website_code_path . "management_bottom");

?>
Expand Down
54 changes: 54 additions & 0 deletions moodle_integration_readme.txt
@@ -0,0 +1,54 @@
moodle patch for Xerte toolkits updated for use with 1.7+
updated 2/11/11
Author: Ron Mitchell
Use at your own risk - no responsibility accepted etc etc

This patch has been tested with the latest versions of XOT and enables authentication integration with the moodle installation on the same server. Specifically it enables integration with the moodle authentication system allowing seamless login from moodle to toolkits. This is achieved by using the moodle session data so at the moment this will not work if moodle and toolkits are installed on separate servers.

/////////////////////////////////////////////////////
How this works
Once applied and configured this patch works in the following ways:

1. A user logs in to moodle and then follows a link from that moodle to an installation of toolkits on the same server. The user is automatically logged in to their own workspace in toolkits seeing any previous LO's they have created. If this is their first visit to the toolkits installation their firstname, lastname and username are added to the xerte toolkits database. (This then also allows other users to share learning objects with the new toolkits user via properties > shared settings or to give learning objects via properties > give this project ) This also means that any existing moodle user, or new users registering on moodle, also has access to the linked toolkits installation.

2. A user visits the toolkits installation without first logging in to moodle. They are automatically redirected to login to moodle.

If the toolkits installation is installed as a subdirectory of the moodle directory the user is then automatically redirected back to their own workspace in toolkits.

If the toolkits installation is installed in a separate directory to the moodle directory the user will not be automatically directed back to toolkits but can follow a link to toolkits from the moodle installation or revisit the toolkits url with the same browser to be automatically logged in.

/////////////////////////////////////////////////////
Installation
Please follow these steps carefully.

Step 1.
Test your XOT installation before trying to use the moodle integration e.g. install toolkits and use demo.txt or switch.txt to make sure everything is working - creating, viewing, exporting an LO etc

Step 2.
Edit the top of moodle_integration.txt and config.php and add the path to your moodle config file so that it points to the config.php in your moodle directory
This needs to be the path from root rather than something like ../../moodle/config.php
e.g. this might be something like the following:
require("/home/youraccountname/public_html/config.php");
For a xampp/maxos install this should be something like:
require("/xampp/htdocs/moodle/config.php");

Step 3 rename moodle_integration.txt to moodle_integration.php

Step 4. view http://yourmoodle/yourxot/moodle_integration.php and ensure everything still works. You should be forced to login to Moodle and then returned back to XOT if installed inside the moodle directory. (see how this works above)

Step 5. If everything is working rename or remove demo.php or switch.php used in step 1

Step 6. If you are only using moodle for authentication you may wish to rename moodle_integration.php to index.php so that you can just use http://yourmoodle/yourxot/

/////////////////////////////////////////////////////
After installation/configuration
You can verify you have configured the moodle path correctly by visiting your toolkits installation which should redirect you to login to moodle. (see the 'how this works' info above)

Notes:

moodle_integration.txt in this patch can be used in place of the ldap enabled index.php. To restore ldap access replace index.php with your original index.php

/////////////////////////////////////////////////////

Bugs/feedback
Please send reports of bugs, success or any other feedback to the Xerte mailing list: xerte@lists.nottingham.ac.uk

0 comments on commit 8a12625

Please sign in to comment.