Skip to content

Commit

Permalink
Version 2
Browse files Browse the repository at this point in the history
git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/branches/1.9@435 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
pgogy committed Sep 17, 2012
1 parent 973a691 commit b4d4c35
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 261 deletions.
46 changes: 26 additions & 20 deletions modules/simile/preview.php
Expand Up @@ -37,21 +37,7 @@ function show_preview_code($row, $row_username){
}


if(isset($_POST)){

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?PHP echo SIMILE_EDIT_TITLE; ?></title>
<link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
<script src="http://static.simile.mit.edu/timeline/api-2.3.0/timeline-api.js?bundle=true" type="text/javascript"></script>
</head>

<body>
<p><a href="edit.php?template_id=<?PHP echo $row['template_id']; ?>">Return to editor</a></p>
<?PHP
if(isset($_POST['save_path'])){

$data = array();

Expand Down Expand Up @@ -167,15 +153,35 @@ function show_preview_code($row, $row_username){
$counter++;

}


}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?PHP echo SIMILE_EDIT_TITLE; ?></title>
<link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
<script src="http://static.simile.mit.edu/timeline/api-2.3.0/timeline-api.js?bundle=true" type="text/javascript"></script>
</head>

<body>
<?PHP

if(isset($_POST)){
if(isset($_POST['save_path'])){

?><p><a href="edit.php?template_id=<?PHP echo $row['template_id']; ?>">Return to editor</a></p><?PHP

file_put_contents($_POST['save_path'] . "/preview.inc", serialize($data));
file_put_contents($_POST['save_path'] . "/preview.inc", serialize($data));

display_timeline($data);

}
display_timeline($data);

}else{

display_timeline(unserialize(file_get_contents($xerte_toolkits_site->users_file_area_short . $row['template_id'] . "-" . $row_username['username'] . "-" . $row['template_name'] . "/preview.inc")));

}

}
Expand Down
6 changes: 5 additions & 1 deletion modules/simile/templates/timeline/timeline.info
@@ -1,2 +1,6 @@
display name: Simile Timeline
description: Allows a user to create a simile timeline
description: Allows a user to create a simile timeline
editor size: *
preview size: *
preview filename: preview.inc
public filename: data.inc
192 changes: 192 additions & 0 deletions modules/xerte/module_functions.php
Expand Up @@ -52,4 +52,196 @@ function dont_show_template(){

}

$folder_id_array = array();
$folder_array = array();
$file_array = array();
$delete_file_array = array();
$delete_folder_array = array();
$zipfile = "";

function export_template($row, $fullArchive){

global $xerte_toolkits_site, $folder_id_array, $folder_array, $file_array, $delete_file_array, $delete_folder_array, $zipfile;

include "archive.php";
include "scorm_library.php";
include "scorm2004_library.php";
include "../xmlInspector.php";
include "../screen_size_library.php";
include "../user_library.php";
include "../url_library.php";

/*
* Set up the paths
*/
$dir_path = $xerte_toolkits_site->users_file_area_full . $row['template_id'] . "-" . $row['username'] . "-" . $row['template_name'] . "/";
$parent_template_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/parent_templates/" . $row['template_name'] . "/";
$export_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/export/";
$scorm_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/scorm/";
$scorm2004_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/scorm2004/";

/*
* Make the zip
*/
$zipfile = new zip_file("example_zipper_new" . time() . ".zip");
$zipfile->set_options(array('basedir' => $dir_path, 'prepand' => "", 'inmemory' => 1, 'recurse' => 1, 'storepaths' => 1));

/*
* Copy the core files over from the parent folder
*/
copy($dir_path . "data.xml",$dir_path . "template.xml");
$xml = new XerteXMLInspector();
$xml->loadTemplateXML($dir_path . 'template.xml');
if ($fullArchive){
_debug("Full archive");
export_folder_loop($parent_template_path);
}
else /* Only copy used models and the common folder */
{
_debug("Deployment archive");
$models = $xml->getUsedModels();
foreach($models as $model)
{
_debug("copy model " . $parent_template_path . "models/" . $model . ".rlm");
array_push($file_array, $parent_template_path . "models/" . $model . ".rlm");
}
array_push($file_array, $parent_template_path . $row['template_name'] . ".rlt");
export_folder_loop($parent_template_path . "common/");
}
if(isset($_GET['local'])){
if($_GET['local']=="true"){
$string = file_get_contents($dir_path . "/template.xml");
$string = str_replace($xerte_toolkits_site->site_url . $xerte_toolkits_site->users_file_area_short . $row['template_id'] . "-" . $row['username'] . "-" . $row['template_name'] . "/", "", $string);
$fh = fopen($dir_path . "/template.xml", 'w+');
fwrite($fh,$string);
fclose($fh);
}
}
copy_parent_files();

/*
* Language support
*/

export_folder_loop($xerte_toolkits_site->root_file_path . 'languages/', false, '.xml');
copy_extra_files();

/*
* Copy engine and support files
*
* From $export_path
*/
copy($export_path . "rloObject.js", $dir_path . "rloObject.js");
array_push($delete_file_array, $dir_path . "rloObject.js");
copy($export_path . "MainPreloader.swf", $dir_path . "MainPreloader.swf");
array_push($delete_file_array, $dir_path . "MainPreloader.swf");
copy($export_path . "resources.swf", $dir_path . "resources.swf");
array_push($delete_file_array, $dir_path . "resources.swf");
/*
* From root
*/
copy($xerte_toolkits_site->root_file_path . "XMLEngine.swf", $dir_path . "XMLEngine.swf");
array_push($delete_file_array, $dir_path . "XMLEngine.swf");

/*
* If scorm copy the scorm files as well
*/
$scorm=mysql_real_escape_string($_GET['scorm']);
if($scorm=="true"){
export_folder_loop($scorm_path);
copy_scorm_files();
}else if ($scorm=="2004") {
export_folder_loop($scorm2004_path);
copy_scorm2004_files();
}

if($scorm=="true" || $scorm=="2004"){
copy($dir_path . $row['template_name'] . ".rlt", $dir_path . "learningobject.rlo");
unlink($dir_path . $row['template_name'] . ".rlt");
array_push($delete_file_array, $dir_path . "learningobject.rlo");
}else{
copy($dir_path . $row['template_name'] . ".rlt", $dir_path . "learningobject.rlt");
unlink($dir_path . $row['template_name'] . ".rlt");
array_push($delete_file_array, $dir_path . "learningobject.rlt");
}

/*
* if used copy extra folders
*/
/*
* jmol
*/
if ($xml->modelUsed("jmol"))
{
export_folder_loop($xerte_toolkits_site->root_file_path . "JMolViewer/");
copy_extra_files();
}
/*
* mapstraction
*/
if ($xml->modelUsed("mapstraction"))
{
export_folder_loop($xerte_toolkits_site->root_file_path . "mapstraction/");
copy_extra_files();
}
/*
* mediaViewer
*/
if ($xml->mediaIsUsed())
{
export_folder_loop($xerte_toolkits_site->root_file_path . "mediaViewer/");
copy_extra_files();
}

export_folder_loop($dir_path);

/*
* Create scorm manifests or a basic HTML page
*/

if($scorm=="true"){
if(isset($_GET['data'])){
if($_GET['data']==true){

$query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templatesyndication where template_id = " . mysql_real_escape_string($_GET['template_id']);
$query_response_metadata = mysql_query($query);
$metadata = mysql_fetch_array($query_response_metadata);
$query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templaterights, " . $xerte_toolkits_site->database_table_prefix ."logindetails where template_id = " . mysql_real_escape_string($_GET['template_id']) . " and login_id = user_id";
$query_response_users = mysql_query($query);
lmsmanifest_create_rich($row, $metadata, $query_response_users);
}
}else{
lmsmanifest_create($row['zipname']);
}
scorm_html_page_create($row['template_name'],$row['template_framework']);
}else if ($scorm=="2004"){
// Get the name of the learning object

$xml = file_get_contents($dir_path . 'template.xml');
$template_data = simplexml_load_string($xml);
$lo_attrs = $template_data->attributes();
$lo_name = (string)$lo_attrs['name'];

lmsmanifest_2004_create($row['zipname'], $lo_name);
scorm2004_html_page_create($row['template_name'],$row['template_framework'],$lo_name);
}else{
basic_html_page_create($row['template_name'],$row['template_framework']);
}

/*
* Add the files to the zip file, create the archive, then send it to the user
*/

xerte_zip_files($fullArchive, $dir_path);
$zipfile->create_archive();
$zipfile->download_file($row['zipname']);

/*
* remove the files
*/
clean_up_files();
unlink($dir_path . "template.xml");

}

?>
6 changes: 5 additions & 1 deletion modules/xerte/templates/Nottingham/Nottingham.info
@@ -1,2 +1,6 @@
display name: Xerte Online Toolkit
description: A flexible template for creating interactive learning objects.
description: A flexible template for creating interactive learning objects.
editor size: 800,665
preview size: 800,665
preview filename: preview.xml
public filename: data.xml
4 changes: 2 additions & 2 deletions website_code/php/display_library.php
Expand Up @@ -182,7 +182,7 @@ function list_files_in_this_folder($folder_id, $sort_type){

global $level, $xerte_toolkits_site;

$query = "select template_name, template_id from " . $xerte_toolkits_site->database_table_prefix . "templatedetails where template_id in ( select " . $xerte_toolkits_site->database_table_prefix . "templaterights.template_id from " . $xerte_toolkits_site->database_table_prefix . "templaterights where user_id =\"" . $_SESSION['toolkits_logon_id'] . "\" and folder=\"" . $folder_id . "\") ";
$query = "select templatedetails.template_name as template_name, template_id, template_framework, originaltemplatesdetails.template_name as name from " . $xerte_toolkits_site->database_table_prefix . "templatedetails,originaltemplatesdetails where template_id in ( select " . $xerte_toolkits_site->database_table_prefix . "templaterights.template_id from " . $xerte_toolkits_site->database_table_prefix . "templaterights where user_id =\"" . $_SESSION['toolkits_logon_id'] . "\" and folder=\"" . $folder_id . "\") and templatedetails.template_type_id = originaltemplatesdetails.template_type_id";

if($sort_type=="alpha_down"){

Expand All @@ -206,7 +206,7 @@ function list_files_in_this_folder($folder_id, $sort_type){

while($row = mysql_fetch_array($query_response)){

echo "<div id=\"file_" . $row['template_id'] . "\" class=\"file\" style=\"padding-left:" . ($level*10) . "px\" onmousedown=\"single_click(this);file_folder_click_pause(event)\" onmouseup=\"file_drag_stop(event,this)\"><img src=\"{$xerte_toolkits_site->site_url}/website_code/images/Icon_Page.gif\" style=\"vertical-align:middle\" />" . str_replace("_", " ", $row['template_name']) . "</div>";
echo "<div id=\"file_" . $row['template_id'] . "\" class=\"file\" preview_size=\"" . $xerte_toolkits_site->learning_objects->{$row['template_framework'] . "_" . $row['name']}->preview_size . "\" editor_size=\"" . $xerte_toolkits_site->learning_objects->{$row['template_framework'] . "_" . $row['name']}->editor_size . "\" style=\"padding-left:" . ($level*10) . "px\" onmousedown=\"single_click(this);file_folder_click_pause(event)\" onmouseup=\"file_drag_stop(event,this)\"><img src=\"{$xerte_toolkits_site->site_url}/website_code/images/Icon_Page.gif\" style=\"vertical-align:middle\" />" . str_replace("_", " ", $row['template_name']) . "</div>";

}

Expand Down

0 comments on commit b4d4c35

Please sign in to comment.