Esempio n. 1
0
function show_template($row_play)
{
    global $xerte_toolkits_site;
    $string_for_flash = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";
    $xmlfile = $string_for_flash . "data.xml";
    $xmlFixer = new XerteXMLInspector();
    $xmlFixer->loadTemplateXML($xmlfile);
    if (strlen($xmlFixer->getName()) > 0) {
        $title = $xmlFixer->getName();
    } else {
        $title = SITE_PREVIEW_TITLE;
    }
    $string_for_flash_xml = $xmlfile . "?time=" . time();
    $template_path_string = "modules/site/parent_templates/" . $row_play['template_name'] . "/";
    list($x, $y) = explode("~", get_template_screen_size($row_play['template_name'], $row_play['template_framework']));
    _load_language_file("/modules/site/preview.inc");
    // $engine is assumed to be html5 if flash is NOT set
    $page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row_play['template_framework'] . "/player_html5/rloObject.htm");
    $page_content = str_replace("%TITLE%", $title, $page_content);
    $page_content = str_replace("%TEMPLATEPATH%", $template_path_string, $page_content);
    $page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
    $page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);
    echo $page_content;
}
/**
*
* Function scorm html page create
* This function creates a scorm HTML page for export
* @param string $name - name of the template
* @param string $type - type of template this is
* @version 1.0
* @author Patrick Lockley
*/
function scorm_html_page_create($name, $type, $rlo_file, $lo_name, $language)
{
    global $xerte_toolkits_site, $dir_path, $delete_file_array, $zipfile;
    $scorm_html_page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $type . "/player/rloObject.htm");
    $temp = get_template_screen_size($name, $type);
    $new_temp = explode("~", $temp);
    $scorm_html_page_content = str_replace("%WIDTH%", $new_temp[0], $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%HEIGHT%", $new_temp[1], $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%TITLE%", $lo_name, $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%RLOFILE%", $rlo_file, $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%XMLPATH%", "", $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%JSDIR%", "", $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%XMLFILE%", "template.xml", $scorm_html_page_content);
    $scorm_html_page_content = str_replace("%SITE%", $xerte_toolkits_site->site_url, $scorm_html_page_content);
    $tracking = "<script type=\"text/javascript\" src=\"apiwrapper_1.2.js\"></script>\n";
    $tracking .= "<script type=\"text/javascript\" src=\"xttracking_scorm1.2.js\"></script>\n";
    $tracking .= "<script type=\"text/javascript\" src=\"languages/js/en-GB/xttracking_scorm1.2.js\"></script>\n";
    if (file_exists($dir_path . "languages/js/" . $language . "/xttracking_scorm1.2.js")) {
        $tracking .= "<script type=\"text/javascript\" src=\"languages/js/" . $language . "/xttracking_scorm1.2.js\"></script>";
    }
    $scorm_html_page_content = str_replace("%TRACKING_SUPPORT%", $tracking, $scorm_html_page_content);
    $file_handle = fopen($dir_path . "scormRLO.htm", 'w');
    fwrite($file_handle, $scorm_html_page_content, strlen($scorm_html_page_content));
    fclose($file_handle);
    $zipfile->add_files("scormRLO.htm");
    array_push($delete_file_array, $dir_path . "scormRLO.htm");
}
function show_preview_code2($row, $row_username)
{
    global $xerte_toolkits_site, $youtube_api_key;
    _load_language_file("/modules/xerte/preview.inc");
    $template_dir = $xerte_toolkits_site->users_file_area_full . $row['template_id'] . "-" . $row['username'] . "-" . $row['template_name'] . "/";
    /*
     * Format the XML strings to provide data to the engine
     */
    if (!file_exists($template_dir . '/preview.xml')) {
        $buffer = file_get_contents($template_dir . "/data.xml");
        $fp = fopen($template_dir . "/preview.xml", "x");
        fwrite($fp, $buffer);
        fclose($fp);
    }
    $string_for_flash = $xerte_toolkits_site->users_file_area_short . $row['template_id'] . "-" . $row_username['username'] . "-" . $row['template_name'] . "/";
    $xmlfile = $string_for_flash . "preview.xml";
    $xmlFixer = new XerteXMLInspector();
    $xmlFixer->loadTemplateXML($xmlfile);
    if (strlen($xmlFixer->getName()) > 0) {
        $title = $xmlFixer->getName();
    } else {
        $title = XERTE_PREVIEW_TITLE;
    }
    $string_for_flash_xml = $xmlfile . "?time=" . time();
    $flash_js_dir = "modules/" . $row['template_framework'] . "/";
    $template_path = "modules/" . $row['template_framework'] . "/parent_templates/" . $row['template_name'] . "/";
    $rlo_file = $template_path . $row['template_name'] . ".rlt";
    list($x, $y) = explode("~", get_template_screen_size($row['template_name'], $row['template_framework']));
    // determine the correct engine to use
    $engine = 'flash';
    $extra_flags = explode(";", $row['extra_flags']);
    foreach ($extra_flags as $flag) {
        $parameter = explode("=", $flag);
        switch ($parameter[0]) {
            case 'engine':
                $engine = $parameter[1];
                break;
        }
    }
    // If given as a parameter, force this engine
    // If given as a parameter, force this engine
    if (isset($_REQUEST['engine'])) {
        if ($_REQUEST['engine'] == 'other') {
            if ($engine == 'flash') {
                $engine = 'javascript';
            } else {
                $engine = 'flash';
            }
        } else {
            $engine = $_REQUEST['engine'];
        }
    }
    if ($engine == 'flash') {
        $page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/player/rloObject.htm");
        $page_content = str_replace("%WIDTH%", $x, $page_content);
        $page_content = str_replace("%HEIGHT%", $y, $page_content);
        $page_content = str_replace("%TITLE%", $title, $page_content);
        $page_content = str_replace("%RLOFILE%", $rlo_file, $page_content);
        $page_content = str_replace("%JSDIR%", $flash_js_dir, $page_content);
        $page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
        $page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);
        $page_content = str_replace("%SITE%", $xerte_toolkits_site->site_url, $page_content);
        $tracking = "<script type=\"text/javascript\" src=\"" . $flash_js_dir . "js/xttracking_noop.js\"></script>";
        $page_content = str_replace("%TRACKING_SUPPORT%", $tracking, $page_content);
    } else {
        // $engine is assumed to be html5 if flash is NOT set
        $page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/player_html5/rloObject.htm");
        $page_content = str_replace("%TITLE%", $title, $page_content);
        $page_content = str_replace("%TEMPLATEPATH%", $template_path, $page_content);
        $page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
        $page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);
        $page_content = str_replace("%THEMEPATH%", $xerte_toolkits_site->site_url . "themes/" . $row['template_name'] . "/", $page_content);
        // Handle offline variables
        $page_content = str_replace("%OFFLINESCRIPTS%", "", $page_content);
        $page_content = str_replace("%OFFLINEINCLUDES%", "", $page_content);
        $page_content = str_replace("%MATHJAXPATH%", "//cdn.mathjax.org/mathjax/latest/", $page_content);
        $tracking = "<script type=\"text/javascript\" src=\"" . $template_path . "common_html5/js/xttracking_noop.js\"></script>";
        $page_content = str_replace("%TRACKING_SUPPORT%", $tracking, $page_content);
        $page_content = str_replace("%YOUTUBEAPIKEY%", $youtube_api_key, $page_content);
    }
    echo $page_content;
}
Esempio n. 4
0
/**
 *
 * Function output_editor_code
 * This function outputs the xerte editor code
 * @param array $row_edit - the mysql query for this folder
 * @param number $xerte_toolkits_site - a number to make sure that we enter and leave each folder correctly
 * @param bool $read_status - a read only flag for this template
 * @param number $version_control - a setting to handle the delettion of lock files when the window is closed
 * @version 1.0
 * @author Patrick Lockley
 */
function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $version_control)
{
    require_once "config.php";
    require_once "website_code/php/language_library.php";
    _load_language_file("/modules/xerte/edit.inc");
    $row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row_edit['user_id']));
    if (empty($row_username)) {
        die("Invalid user id ?");
    }
    /**
     * create the preview xml used for editing
     */
    $preview_filename = "preview.xml";
    $rlo_path = $xerte_toolkits_site->users_file_area_full . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'];
    $media_path = $rlo_path . "/media/";
    $preview = $rlo_path . "/preview.xml";
    $data = $rlo_path . "/data.xml";
    if (!file_exists($preview) && file_exists($data)) {
        copy($data, $preview);
        chmod($preview, 0777);
    }
    $preview_url = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/" . $preview_filename;
    $data_url = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/data.xml";
    $rlo_url = $xerte_toolkits_site->site_url . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'];
    $xwd_url = "modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
    $xwd_path = $xerte_toolkits_site->root_file_path . "/modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
    if (file_exists($xwd_path . "wizards/" . $_SESSION['toolkits_language'] . "/data.xwd")) {
        $xwd_file_url = $xwd_url . "wizards/" . $_SESSION['toolkits_language'] . "/data.xwd";
    } else {
        if (file_exists($xwd_path . "wizards/en-GB/data.xwd")) {
            $xwd_file_url = $xwd_url . "wizards/en-GB/data.xwd";
        } else {
            if (file_exists($xwd_path . "data.xwd")) {
                $xwd_file_url = $xwd_url . "data.xwd";
            }
        }
    }
    $module_url = "modules/" . $row_edit['template_framework'] . "/";
    $jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-en.js";
    $jqgridlangcode = strtolower($_SESSION['toolkits_language']);
    if (file_exists($xerte_toolkits_site->root_file_path . "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js")) {
        $jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js";
    } else {
        $jqgridlangcode = substr($jqgridlangcode, 0, 2);
        if (file_exists($xerte_toolkits_site->root_file_path . "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js")) {
            $jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js";
        }
    }
    /**
     * build an array of available themes for this template
     */
    $theme_folder = $xerte_toolkits_site->root_file_path . "themes/" . $row_edit['template_name'] . "/";
    $ThemeList = array();
    // Add default theme
    $ThemeList[] = array('name' => "default", 'display_name' => "Xerte Online Toolkits", 'description' => "Xerte Online Toolkits", 'preview' => "");
    if (file_exists($theme_folder)) {
        $d = opendir($theme_folder);
        while ($f = readdir($d)) {
            if (is_dir($theme_folder . $f)) {
                if (file_exists($theme_folder . $f . "/" . $f . ".info")) {
                    $info = file($theme_folder . $f . "/" . $f . ".info", FILE_SKIP_EMPTY_LINES);
                    $themeProperties = new StdClass();
                    foreach ($info as $line) {
                        $attr_data = explode(":", $line, 2);
                        if (empty($attr_data) || sizeof($attr_data) != 2) {
                            continue;
                        }
                        switch (trim(strtolower($attr_data[0]))) {
                            case "name":
                                $themeProperties->name = trim($attr_data[1]);
                                break;
                            case "display name":
                                $themeProperties->display_name = trim($attr_data[1]);
                                break;
                            case "description":
                                $themeProperties->description = trim($attr_data[1]);
                                break;
                            case "enabled":
                                $themeProperties->enabled = strtolower(trim($attr_data[1]));
                                break;
                            case "preview":
                                $themeProperties->preview = $xerte_toolkits_site->site_url . "themes/" . $row_edit['template_name'] . "/" . $f . "/" . trim($attr_data[1]);
                                break;
                        }
                    }
                    if (substr($themeProperties->enabled, 0, 1) == "y") {
                        $ThemeList[] = array('name' => $themeProperties->name, 'display_name' => $themeProperties->display_name, 'description' => $themeProperties->description, 'preview' => $themeProperties->preview);
                    }
                }
            }
        }
    }
    /**
     * sort of the screen sies required for the preview window
     */
    $temp = explode("~", get_template_screen_size($row_edit['template_name'], $row_edit['template_framework']));
    //$edit_site_logo = $xerte_toolkits_site->site_logo;
    //$pos = strrpos($edit_site_logo, '/') + 1;
    //$edit_site_logo = substr($edit_site_logo,0,$pos) . "edit_" . substr($edit_site_logo,$pos);
    //$edit_organisational_logo = $xerte_toolkits_site->organisational_logo;
    //$pos = strrpos($edit_organisational_logo, '/') + 1;
    //$edit_organisational_logo = substr($edit_organisational_logo,0,$pos) . "edit_" . substr($edit_organisational_logo,$pos);
    /**
     * set up the onunload function used in version control
     */
    ?>
<!DOCTYPE html>
<html lang="<?php 
    echo $_SESSION['toolkits_language'];
    ?>
">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Xerte Online Toolkits Editor</title>

    <link rel="stylesheet" href="editor/css/jquery-ui.css">
    <link rel="stylesheet" href="editor/js/vendor/themes/default/style.css" />
    <link rel="stylesheet" type="text/css" href="website_code/styles/xerte_buttons.css" />
    <link rel="stylesheet" type="text/css" href="editor/css/complex.css" />
    <link rel="stylesheet" type="text/css" href="editor/js/vendor/featherlight/featherlight.min.css" />
    <link rel="stylesheet" type="text/css" href="editor/js/vendor/imgareaselect/imgareaselect-default.css" />
    <link rel="stylesheet" type="text/css" href="editor/js/vendor/jqgrid/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" href="editor/js/vendor/ckeditor/plugins/codemirror/css/codemirror.min.css" />
    <link rel="stylesheet" type="text/css" href="modules/xerte/parent_templates/Nottingham/common_html5/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="modules/xerte/parent_templates/Nottingham/common_html5/font-awesome-4.3.0/css/font-awesome.min.css">
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

    <script src="website_code/scripts/template_management.js"></script>
    <!--[if lte IE 7]>
    <style type="text/css"> body { font-size: 85%; } </style>
    <![endif]-->

</head>
<body>
<img id="loader" src="editor/img/loading16.gif" />
<div class="hide ui-layout-west">

    <div class="header"></div>

    <div class="content"></div>

    <div class="footer"></div>

</div>

<div class="hide ui-layout-east">

    <div class="header"><div id="optional_title">Optional parameters</div></div>

    <div id="optionalParams" class="content">
        <p>...</p>
    </div>

	<div class="footer"></div>
</div>


<div class="hide ui-layout-north">
    <div class="content" id="#header_images">
        <?php 
    if (file_exists($xerte_toolkits_site->root_file_path . "branding/logo_left.png")) {
        echo "<img src=\"branding/logo_left.png\" style=\"float:left\" />";
    } else {
        echo "<img src=\"website_code/images/logo.png\" style=\"float:left\" />";
    }
    if (file_exists($xerte_toolkits_site->root_file_path . "branding/logo_right.png")) {
        echo "<img src=\"branding/logo_right.png\" style=\"float:right\" />";
    } else {
        echo "<img src=\"website_code/images/apereoLogo.png\" style=\"float:right\" />";
    }
    ?>
    </div>
</div>


<div class="hide ui-layout-south">
    <div class="header">Options</div>
    <div class="content"></div>
</div>


    <div id="mainContent" class="hide ui-layout-center pane pane-center ui-layout-pane ui-layout-pane-center">
        <div class="header"></div>
        <div id="content" class="content">
            <div id="mainPanel"></div>
            <div id="languagePanel" style="display:none">
                <hr>
            </div>
            <div id="insert_subnodes">

            </div>
            <div class="nodeInfo" id="info">

            </div>
        </div>
        <div id="main_footer" class="footer">
            <div id="checkbox_outer"><table><tr><td id="checkbox_holder"></td></tr></table></div>
        </div>
    </div>

<div id="shadow" class="dark" class="hide"></div>
<div id="insert_menu" class="hide"></div>

<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="editor/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<?php 
    if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
        ?>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<?php 
    } else {
        ?>
<script type="text/javascript" src="editor/js/vendor/jquery.ui-1.10.4.js"></script>
<?php 
    }
    ?>
<script type="text/javascript" src="editor/js/vendor/jquery.layout-1.3.0-rc30.79.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/modernizr-latest.js"></script>
<script type="text/javascript" src="editor/js/vendor/jstree.js"></script>
<!-- <script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>  -->
<script type="text/javascript" src="editor/js/vendor/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="editor/js/vendor/jscolor.js"></script>
<script type="text/javascript" src="editor/js/vendor/xml2json.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/featherlight/featherlight.js"></script>
<script type="text/javascript" src="editor/js/vendor/imgareaselect/jquery.imgareaselect.js"></script>
<script type="text/javascript" src="editor/js/vendor/jqgrid/js/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="<?php 
    echo $jqgridlangfile;
    ?>
"></script>
<script type="text/javascript" src="editor/js/vendor/jqgrid/js/jquery.jqGrid.min.js"></script>

<!-- load exactly the same codemirror scripts as needed by ckeditor -->
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/codemirror.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/codemirror.addons.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/beautify.min.js"></script>
<script type="text/javascript" src="editor/js/vendor/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js"></script>

<script>
    <?php 
    echo "previewxmlurl=\"" . $preview_url . "\";\n";
    echo "dataxmlurl=\"" . $data_url . "\";\n";
    echo "mediavariable=\"" . $media_path . "\";\n";
    echo "rlourlvariable=\"" . $rlo_url . "/\";\n";
    echo "rlopathvariable=\"" . $rlo_path . "/\";\n";
    echo "languagecodevariable=\"" . $_SESSION['toolkits_language'] . "\";\n";
    echo "editorlanguagefile=\"" . getWizardfile($_SESSION['toolkits_language']) . "\";\n";
    echo "originalpathvariable=\"" . $xwd_url . "\";\n";
    echo "xwd_file_url=\"" . $xwd_file_url . "\";\n";
    echo "moduleurlvariable=\"" . $module_url . "\";\n";
    echo "template_id=\"" . $row_edit['template_id'] . "\";\n";
    echo "template_height=\"" . $temp[1] . "\";\n";
    echo "template_width=\"" . $temp[0] . "\";\n";
    echo "read_and_write=\"" . $read_status . "\";\n";
    echo "savepath=\"" . $xerte_toolkits_site->flash_save_path . "\";\n";
    echo "upload_path=\"" . $xerte_toolkits_site->flash_upload_path . "\";\n";
    echo "preview_path=\"" . $xerte_toolkits_site->flash_preview_check_path . "\";\n";
    echo "site_url=\"" . $xerte_toolkits_site->site_url . "\";\n";
    echo "theme_list=" . json_encode($ThemeList) . ";\n";
    ?>

    function bunload(){

        path = "<?php 
    echo $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/";
    ?>
";

        if(typeof window_reference==="undefined"){

            window.opener.edit_window_close(path);

        }else{

            window_reference.edit_window_close(path);

        }

    }

</script>
<script type="text/javascript" src="editor/js/data.js"></script>
<script type="text/javascript" src="editor/js/application.js"></script>
<script type="text/javascript" src="editor/js/toolbox.js"></script>
<script type="text/javascript" src="editor/js/language.js"></script>
<script type="text/javascript" src="editor/js/layout.js"></script>
<script type="text/javascript" src="editor/js/tree.js"></script>
</body>
</html>

<?php 
}
Esempio n. 5
0
/**
 *
 * Function create folder loop
 * This function outputs the xerte editor code
 * @param array $row_edit - the mysql query for this folder
 * @param number $xerte_toolkits_site - a number to make sure that we enter and leave each folder correctly
 * @param bool $read_status - a read only flag for this template
 * @param number $version_control - a setting to handle the delettion of lock files when the window is closed
 * @version 1.0
 * @author Patrick Lockley
 */
function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $version_control)
{
    require_once "config.php";
    _load_language_file("/modules/xerte/edit.inc");
    $row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row_edit['user_id']));
    if (empty($row_username)) {
        die("Invalid user id ?");
    }
    /**
     * create the preview xml used for editing
     */
    $preview = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/preview.xml";
    $data = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/data.xml";
    if (!file_exists($preview) && file_exists($data)) {
        copy($data, $preview);
        chmod($preview, 0777);
    }
    /**
     * set up the strings used in the flash vars
     */
    $string_for_flash_xml = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/preview.xml";
    $string_for_flash_media = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/media/";
    $string_for_flash_xwd = "modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
    /**
     * sort of the screen sies required for the preview window
     */
    $temp = explode("~", get_template_screen_size($row_edit['template_name'], $row_edit['template_framework']));
    $edit_site_logo = $xerte_toolkits_site->site_logo;
    $pos = strrpos($edit_site_logo, '/') + 1;
    $edit_site_logo = substr($edit_site_logo, 0, $pos) . "edit_" . substr($edit_site_logo, $pos);
    $edit_organisational_logo = $xerte_toolkits_site->organisational_logo;
    $pos = strrpos($edit_organisational_logo, '/') + 1;
    $edit_organisational_logo = substr($edit_organisational_logo, 0, $pos) . "edit_" . substr($edit_organisational_logo, $pos);
    /**
     * set up the onunload function used in version control
     */
    ?>
    <!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>
    <title><?php 
    echo XERTE_EDIT_TITLE;
    ?>
</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
	<link rel="icon" href="favicon_edit.ico" type="image/x-icon" />
	<link rel="shortcut icon" href="favicon_edit.ico" type="image/x-icon" />
    <script src="modules/xerte/js/swfobject.js"></script>
    <script src="website_code/scripts/opencloseedit.js"></script>
    <script src="website_code/scripts/template_management.js"></script>
    <script src="website_code/scripts/ajax_management.js"></script>
    <script type="text/javascript" language="javascript">

	function getSessionID(){
			var id;
			var auth = '<?php 
    echo strtolower($xerte_toolkits_site->authentication_method);
    ?>
';
			var browser =	(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 'firefox' :
							((navigator.userAgent.toLowerCase().indexOf('safari') > -1) ? 'safari' :
							'other');

			//Pass data to upload (Firefox Flash Cookie Bug) which we are
			//It first checks moodle, then defaults
			if (auth == 'moodle') {

				//Its Moodle integration so we need the whole cookie
				return 'BROWSER=' + browser + '&AUTH=moodle&COOKIE=' + escape(document.cookie);
			}
			else if ((id = document.cookie.match(/PHPSESSID=[^;]+/))) {

				// Its Default authentication so we only need session id
				return 'BROWSER=' + browser + '&AUTH=xerte&' + id;
			}

			return null;
	}

    function setunload(){

        window.onbeforeunload = bunload;

    }

    function hideunload(){

        window.onbeforeunload = function(){};
    }

    window.onbeforeunload = bunload;

    function bunload(){

        path = "<?php 
    echo $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/";
    ?>
";

		template = "<?php 
    echo $row_edit['template_id'];
    ?>
";

		if(typeof window_reference==="undefined"){

			window.opener.edit_window_close(path,template);

		}else{

			window_reference.edit_window_close(path,template);

		}

    }

    function receive_picture(url){

        alert(url);

    }

    </script>
    </head>

    <body>

    <div style="margin:0 auto; width:800px">
        <div class="edit_topbar" style="width:800px">
            <img src="<?php 
    echo $edit_site_logo;
    ?>
" style="margin-left:10px; float:left" />
            <img src="<?php 
    echo $edit_organisational_logo;
    ?>
" style="margin-right:10px; float:right" />
        </div>
    </div>
    <center>
        <div id="flashcontent" style="margin:0 auto">
              This text is replaced by the Flash movie.
        </div>
    </center>
    <script type="text/javascript">
    var so = new SWFObject("modules/xerte/engine/wizard.swf", "mymovie", "800", "600", "8,0,0,0", "#e0e0e0");
    so.addParam("quality", "high");<?php 
    /**
     * set up the flash vars the editor needs.
     */
    echo "so.addVariable(\"xmlvariable\", \"{$string_for_flash_xml}\");";
    echo "\n";
    echo "so.addVariable(\"rlovariable\", \"{$string_for_flash_media}\");";
    echo "\n";
    echo "so.addVariable(\"languagecodevariable\", \"" . $_SESSION['toolkits_language'] . "\");";
    echo "\n";
    echo "so.addVariable(\"originalpathvariable\", \"{$string_for_flash_xwd}\");";
    echo "\n";
    echo "so.addVariable(\"template_id\", \"" . $row_edit['template_id'] . "\");";
    echo "\n";
    echo "so.addVariable(\"template_height\", \"" . $temp[1] . "\");";
    echo "\n";
    echo "so.addVariable(\"template_width\", \"" . $temp[0] . "\");";
    echo "\n";
    echo "so.addVariable(\"read_and_write\", \"" . $read_status . "\");";
    echo "\n";
    echo "so.addVariable(\"savepath\", \"" . $xerte_toolkits_site->flash_save_path . "\");";
    echo "\n";
    echo "so.addVariable(\"upload_path\", \"" . $xerte_toolkits_site->flash_upload_path . "\");";
    echo "\n";
    echo "so.addVariable(\"preview_path\", \"" . $xerte_toolkits_site->flash_preview_check_path . "\");";
    echo "\n";
    echo "so.addVariable(\"flv_skin\", \"" . $xerte_toolkits_site->flash_flv_skin . "\");";
    echo "\n";
    echo "so.addVariable(\"site_url\", \"" . $xerte_toolkits_site->site_url . "\");";
    echo "\n";
    echo "so.addVariable(\"apache\", \"" . $xerte_toolkits_site->apache . "\");";
    echo "\n";
    echo "so.write(\"flashcontent\");";
    echo "\n";
    echo "</script></body></html>";
    echo "\n";
}
Esempio n. 6
0
function show_template($row_play)
{
    global $xerte_toolkits_site;
    $string_for_flash = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";
    $xmlfile = $string_for_flash . "data.xml";
    $xmlFixer = new XerteXMLInspector();
    $xmlFixer->loadTemplateXML($xmlfile);
    $string_for_flash_xml = $xmlfile . "?time=" . time();
    $template_path_string = "modules/xerte/parent_templates/" . $row_play['template_name'];
    list($x, $y) = explode("~", get_template_screen_size($row_play['template_name'], $row_play['template_framework']));
    _load_language_file("/modules/xerte/preview.inc");
    ?>
	<!DOCTYPE html>
	<html xmlns:fb="http://ogp.me/ns/fb#">
		<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta charset="utf-8">
		<title><?php 
    echo XERTE_PREVIEW_TITLE;
    ?>
</title>
		<link rel="icon" href="favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">

		<!--jquery-->
		<script src="<?php 
    echo $template_path_string;
    ?>
/common/js/jquery.js"></script>

		<!--styles -->
		<link href="<?php 
    echo $template_path_string;
    ?>
/common/css/bootstrap.css" rel="stylesheet">
		<link href="<?php 
    echo $template_path_string;
    ?>
/common/css/bootstrap-responsive.css" rel="stylesheet">

		<!--custom styles for this template-->
		<link href="<?php 
    echo $template_path_string;
    ?>
/common/css/custom.css" rel="stylesheet">

		<!--support for IE < 6-8 -->
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>

		<!--media element and initialisation-->
		<script src="<?php 
    echo $template_path_string;
    ?>
/common/mediaelement/mediaelement-and-player.min.js"></script>
		<link rel="stylesheet" href="<?php 
    echo $template_path_string;
    ?>
/common/mediaelement/mediaelementplayer.min.css" />

		<script type="text/javascript">

			var FileLocation = "<?php 
    echo $string_for_flash;
    ?>
";
			var templateLocation = "<?php 
    echo $template_path_string;
    ?>
/";
			var projectXML = "<?php 
    echo $string_for_flash_xml;
    ?>
/"; //this is the file to read, not the xml

		</script>

	</head>

	<body data-twttr-rendered="true" data-spy="scroll" data-target=".bs-docs-sidebar">

		<!--facebookAPI-->
		<div id="fb-root"></div>
		<script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";		  fjs.parentNode.insertBefore(js, fjs);		}(document, 'script', 'facebook-jssdk'));</script>

		<div class="navbar navbar-inverse navbar-fixed-top">
			<div class="navbar-inner">

				<div class="container">

					<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>

					<div class="nav-collapse collapse">
						<ul class="nav"id="nav">
							<!--<li class=""><a href="./index.html">Home</a></li>-->
						</ul>
					</div>
				</div>
			</div>
		</div>

		<!--Learning Object Title-->
		<header class="jumbotron" id="overview">
			<div class="container">
				<h1 id="pageTitle">Learning Object Title</h1>
				<p id="pageSubTitle" class="lead">Overview title for the content below</p>
			</div>
		</header>

		<!--main page content: nav bar and sections-->
		<div class="container">
			<div class="row-fluid">
				<!--navigation-->
				<div class="span3 bs-docs-sidebar">
					<ul class="nav nav-list bs-docs-sidenav affix" id="toc">
						<!--<li><a href="#section1ID">Section 1</a></li>-->
					</ul>
				</div>

				<!--content-->
				<div class="span9" id="mainContent">

				</div>
			</div>
		</div>

		<footer class="footer">
			<div class="container">
				<div class="row-fluid">
					<div class="span12">

						<div class="addthis_toolbox addthis_default_style ">
							<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
							<a class="addthis_button_tweet"></a>
							<a class="addthis_button_google_plusone"></a>
							<a class="addthis_button_linkedin_counter"></a>
							<a class="addthis_button_pinterest_pinit"></a>
							<a class="addthis_counter addthis_pill_style"></a>
						</div>

						<!--<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>-->
						<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50f40a8436e8c4c5"></script>

						<img src="<?php 
    echo $template_path_string;
    ?>
/common/footer/cc-by-nc-sa.png">
						<strong><small>© 2013 The Univeristy of Nottingham</small></strong>

					</div>
				</div>
			</div>
		</footer>

		<!--bootstrap script-->
		<script src="<?php 
    echo $template_path_string;
    ?>
/common/js/bootstrap.min.js"></script>

		<!--initialise the application specific code-->
		<script src="<?php 
    echo $template_path_string;
    ?>
/common/js/application.js"></script>

	<script type="text/javascript" language="JavaScript">


	<?php 
    "</script></body></html>";
}
<?php

/**
 * 
 * screen size template, gets the xml and returns the size for the display of the template
 *
 * @author Patrick Lockley
 * @version 1.0
 * @copyright Copyright (c) 2008,2009 University of Nottingham
 * @package
 */
require_once "../../../config.php";
include "../screen_size_library.php";
if (is_numeric($_POST['tutorial_id'])) {
    $database_id = database_connect("screen size database connect success", "screen size database connect failed");
    $query_for_template_name = "select " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails.template_name, " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails.template_framework from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails, " . $xerte_toolkits_site->database_table_prefix . "templatedetails where " . $xerte_toolkits_site->database_table_prefix . "templatedetails.template_type_id = " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails.template_type_id AND template_id =\"" . mysql_real_escape_string($_POST['tutorial_id']) . "\"";
    $query_name_response = mysql_query($query_for_template_name);
    $row_name = mysql_fetch_array($query_name_response);
    echo get_template_screen_size($row_name['template_name'], $row_name['template_framework']) . "~" . mysql_real_escape_string($_POST['tutorial_id']);
}
Esempio n. 8
0
function show_template_page($row, $datafile = "")
{
    global $xerte_toolkits_site;
    _load_language_file("/modules/xerte/preview.inc");
    $string_for_flash = $xerte_toolkits_site->users_file_area_short . $row['template_id'] . "-" . $row['username'] . "-" . $row['template_name'] . "/";
    if (strlen($datafile) > 0) {
        $xmlfile = $string_for_flash . $datafile;
    } else {
        $xmlfile = $string_for_flash . "data.xml";
    }
    $xmlFixer = new XerteXMLInspector();
    $xmlFixer->loadTemplateXML($xmlfile);
    if (strlen($xmlFixer->getName()) > 0) {
        $title = $xmlFixer->getName();
    } else {
        $title = XERTE_PREVIEW_TITLE;
    }
    $string_for_flash_xml = $xmlfile . "?time=" . time();
    $flash_js_dir = "modules/" . $row['template_framework'] . "/";
    $template_path = "modules/" . $row['template_framework'] . "/parent_templates/" . $row['template_name'] . "/";
    $rlo_file = $template_path . $row['template_name'] . ".rlt";
    list($x, $y) = explode("~", get_template_screen_size($row['template_name'], $row['template_framework']));
    // determine the correct engine to use
    $engine = 'flash';
    $extra_flags = explode(";", $row['extra_flags']);
    foreach ($extra_flags as $flag) {
        $parameter = explode("=", $flag);
        switch ($parameter[0]) {
            case 'engine':
                $engine = $parameter[1];
                break;
        }
    }
    // If given as a parameter, force this engine
    if (isset($_REQUEST['engine'])) {
        if ($_REQUEST['engine'] == 'other') {
            if ($engine == 'flash') {
                $engine = 'javascript';
            } else {
                $engine = 'flash';
            }
        } else {
            $engine = $_REQUEST['engine'];
        }
    }
    if ($engine == 'flash') {
        $page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/player/rloObject.htm");
        $page_content = str_replace("%WIDTH%", $x, $page_content);
        $page_content = str_replace("%HEIGHT%", $y, $page_content);
        $page_content = str_replace("%TITLE%", $title, $page_content);
        $page_content = str_replace("%RLOFILE%", $rlo_file, $page_content);
        $page_content = str_replace("%JSDIR%", $flash_js_dir, $page_content);
        $page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
        $page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);
        $page_content = str_replace("%SITE%", $xerte_toolkits_site->site_url, $page_content);
        $tracking = "<script type=\"text/javascript\" src=\"" . $flash_js_dir . "js/xttracking_noop.js\"></script>";
        $page_content = str_replace("%TRACKING_SUPPORT%", $tracking, $page_content);
    } else {
        if ($engine == 'xml') {
            // Just return the raw xml
            $page_content = file_get_contents($xmlfile);
            // Replace "FileLocation + '" with $xerte_toolkits_site->site_url . $string_for_flash
            // NOTE: also get rid of the closing '
            return preg_replace("#FileLocation\\s*\\+\\s*'([^']+)'#", $xerte_toolkits_site->site_url . $string_for_flash . "\$1", $page_content);
        } else {
            // $engine is assumed to be javascript if flash is NOT set
            $page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/player_html5/rloObject.htm");
            $page_content = str_replace("%TITLE%", $title, $page_content);
            $page_content = str_replace("%TEMPLATEPATH%", $template_path, $page_content);
            $page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
            $page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);
            $tracking = "<script type=\"text/javascript\" src=\"" . $template_path . "common_html5/js/xttracking_noop.js\"></script>";
            $page_content = str_replace("%TRACKING_SUPPORT%", $tracking, $page_content);
        }
    }
    return $page_content;
}
 * additional information regarding copyright ownership.
 * The Apereo Foundation licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * 
 * screen size template, gets the xml and returns the size for the display of the template
 *
 * @author Patrick Lockley
 * @version 1.0
 * @package
 */
require_once "../../../config.php";
include "../screen_size_library.php";
if (is_numeric($_POST['tutorial_id'])) {
    $database_id = database_connect("screen size database connect success", "screen size database connect failed");
    $prefix = $xerte_toolkits_site->database_table_prefix;
    $query_for_template_name = "select {$prefix}originaltemplatesdetails.template_name," . "{$prefix}originaltemplatesdetails.template_framework from {$prefix}originaltemplatesdetails, {$prefix}templatedetails WHERE " . "{$prefix}templatedetails.template_type_id = {$prefix}originaltemplatesdetails.template_type_id AND template_id = ?";
    $params = array($_POST['tutorial_id']);
    $row_name = db_query_one($query_for_template_name, $params);
    echo get_template_screen_size($row_name['template_name'], $row_name['template_framework']) . "~" . $_POST['tutorial_id'];
}