diff --git a/modules/decision/play.php b/modules/decision/play.php index e348f26437..a19bdbcd09 100644 --- a/modules/decision/play.php +++ b/modules/decision/play.php @@ -56,7 +56,7 @@ function show_template($row_play) $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); - $page_content = str_replace("%THEMEPATH%",$xerte_toolkits_site->site_url . "themes/" . $row_play['template_name'] . "/",$page_content); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row_play['template_name'] . "/",$page_content); $page_content = str_replace("%MATHJAXPATH%", "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/", $page_content); echo $page_content; diff --git a/modules/decision/preview.php b/modules/decision/preview.php index f38f57718a..842cd9f003 100644 --- a/modules/decision/preview.php +++ b/modules/decision/preview.php @@ -60,7 +60,7 @@ function show_preview_code($row){ $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); - $page_content = str_replace("%THEMEPATH%",$xerte_toolkits_site->site_url . "themes/" . $row['template_name'] . "/",$page_content); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row['template_name'] . "/",$page_content); $page_content = str_replace("%MATHJAXPATH%", "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/", $page_content); echo $page_content; diff --git a/modules/site/parent_templates/site/common/js/application.js b/modules/site/parent_templates/site/common/js/application.js index c03063512d..f1babba438 100644 --- a/modules/site/parent_templates/site/common/js/application.js +++ b/modules/site/parent_templates/site/common/js/application.js @@ -214,41 +214,7 @@ function setup(){ // show definition on hover if ($(data).find('learningObject').attr('glossaryHover') == undefined || $(data).find('learningObject').attr('glossaryHover') == "true") { - // add link around all examples of glossary words in text - var insertText = function(node) { - var temp = document.createElement("pre"); - temp.innerHTML = node; - var tempText = temp.innerHTML; - - // check text for glossary words - if found replace with a link - if (glossary.length > 0) { - for (var k=0, len=glossary.length; k]| )(' + glossary[k].word + ')([\\s\\.,!?:;<]|$| )', 'i'); - tempText = tempText.replace(regExp, '$1{|{'+k+'::$2}|}$3'); - } - for (var k=0, len=glossary.length; k]| )(\\{\\|\\{' + k + '::(.*?)\\}\\|\\})([\\s\\.,!?:;<]|$| )', 'i'); - tempText = tempText.replace(regExp, '$1$3$4'); - } - } - - return tempText; - } - - var checkForText = function(data) { - for (var i=0; i .container") @@ -333,6 +299,12 @@ function setup(){ } } + // if project is being viewed as https then force any iframe src to be https too + if (window.location.protocol == "https:") { + + x_checkForText($(data).find('page'), 'iframe'); + + } if (window.location.pathname.substring(window.location.pathname.lastIndexOf("/") + 1, window.location.pathname.length).indexOf("preview") != -1 && $(data).find('learningObject').attr('authorSupport') == 'true' ) { @@ -605,6 +577,49 @@ function setup(){ }, 2000); } +// add link around all examples of glossary words in text +function x_insertGlossaryText(node) { + var temp = document.createElement("pre"); + temp.innerHTML = node; + var tempText = temp.innerHTML; + + if (glossary.length > 0) { + for (var k=0, len=glossary.length; k]| )(' + glossary[k].word + ')([\\s\\.,!?:;<]|$| )', 'i'); + tempText = tempText.replace(regExp, '$1{|{'+k+'::$2}|}$3'); + } + for (var k=0, len=glossary.length; k]| )(\\{\\|\\{' + k + '::(.*?)\\}\\|\\})([\\s\\.,!?:;<]|$| )', 'i'); + tempText = tempText.replace(regExp, '$1$3$4'); + } + } + + return tempText; +} + +// check through text nodes for text that needs replacing with something lese (e.g. glossary) +function x_checkForText(data, type) { + for (var i=0; i' + (languageData.find("errorEmbed")[0] != undefined && languageData.find("errorEmbed")[0].getAttribute('label') != null ? languageData.find("errorEmbed")[0].getAttribute('label') : "You have embedded an XOT project preview. You must make the project public and embed the public facing URL.") + '

' : '', xotWidth = $this.attr('width') != undefined && ($.isNumeric($this.attr('width')) || $.isNumeric($this.attr('width').split('%')[0])) ? $this.attr('width') : '100%', xotHeight = $this.attr('height') != undefined && ($.isNumeric($this.attr('height')) || $.isNumeric($this.attr('height').split('%')[0])) ? $this.attr('height') : 600; diff --git a/modules/site/play.php b/modules/site/play.php index 5f43ddefdb..70e0976eb3 100644 --- a/modules/site/play.php +++ b/modules/site/play.php @@ -59,7 +59,7 @@ function show_template($row_play){ $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); - $page_content = str_replace("%THEMEPATH%",$xerte_toolkits_site->site_url . "themes/" . $row_play['template_name'] . "/",$page_content); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row_play['template_name'] . "/",$page_content); echo $page_content; diff --git a/modules/site/preview.php b/modules/site/preview.php index ba7f2bd4ec..465faea2b9 100644 --- a/modules/site/preview.php +++ b/modules/site/preview.php @@ -60,7 +60,7 @@ function show_preview_code($row) $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); - $page_content = str_replace("%THEMEPATH%",$xerte_toolkits_site->site_url . "themes/" . $row['template_name'] . "/",$page_content); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row['template_name'] . "/",$page_content); echo $page_content; } \ No newline at end of file diff --git a/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js b/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js index 46726e1cf9..d5843f846c 100644 --- a/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js +++ b/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js @@ -2665,6 +2665,17 @@ function x_insertText(node, exclude) { } } + // if project is being viewed as https then force iframe src to be https too + if (window.location.protocol == "https:" && exclude.indexOf("iframe") == -1) { + function changeProtocol(iframe) { + if (/src="http:/.test(iframe)){ + iframe = iframe.replace(/src="http:/g, 'src="https:').replace(/src='http:/g, "src='https:"); + } + return iframe; + } + tempText = tempText.replace(/(.*?<\/iframe>)/g, changeProtocol); + } + // check text for glossary words - if found replace with a link if (x_glossary.length > 0 && exclude.indexOf("glossary") == -1) { for (var k=0, len=x_glossary.length; k'; $iFrameHolder.html(iFrameTag); $iFrameHolder.addClass("centerAlign"); diff --git a/modules/xerte/play.php b/modules/xerte/play.php index 41f5a7d6bb..808d932858 100644 --- a/modules/xerte/play.php +++ b/modules/xerte/play.php @@ -144,7 +144,7 @@ function show_template_page($row, $datafile="") $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); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row['template_name'] . "/",$page_content); // Handle offline variables $page_content = str_replace("%OFFLINESCRIPTS%", "", $page_content); diff --git a/modules/xerte/preview.php b/modules/xerte/preview.php index 26d77c2dcc..bec8709963 100644 --- a/modules/xerte/preview.php +++ b/modules/xerte/preview.php @@ -171,7 +171,7 @@ function show_preview_code2($row, $row_username){ $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); + $page_content = str_replace("%THEMEPATH%", "themes/" . $row['template_name'] . "/",$page_content); // Handle offline variables $page_content = str_replace("%OFFLINESCRIPTS%", "", $page_content);