Skip to content

Commit

Permalink
Remove debugger statements
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Jun 30, 2022
1 parent eef9492 commit fc6c61c
Show file tree
Hide file tree
Showing 23 changed files with 181 additions and 35 deletions.
6 changes: 3 additions & 3 deletions editor/js/toolbox.js
Expand Up @@ -3685,8 +3685,8 @@ var EDITOR = (function ($, parent) {
});
if (options.extraCheckBoxLabel !== undefined && options.extraCheckBoxLabel.length > 0)
{
// It is rather difficult to add an element after anoth that is noyt yet in DOM
// So create a dummy element, add eveerything to it and than get rid of it again
// It is rather difficult to add an element after another that is not yet in DOM
// So create a dummy element, add everything to it and than get rid of it again
// Ref: https://stackoverflow.com/questions/10489328/jquerys-after-method-not-working-with-newly-created-elements
var div = $('<div>');
html.attr("name", id);
Expand All @@ -3695,7 +3695,7 @@ var EDITOR = (function ($, parent) {
.attr("for", name)
.append(options.extraCheckBoxLabel);
div.append(label);
html = div.html();
html = div;
}
break;
case 'combobox':
Expand Down
31 changes: 23 additions & 8 deletions modules/site/duplicate_template.php
Expand Up @@ -107,21 +107,28 @@ function duplicate_template_site($folder_name_id,$id_to_copy,$tutorial_id_from_p
/*
* Get the id of the folder we are looking to copy into
*/

$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/";
$newusername = get_template_creator_username($folder_name_id);
$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $newusername . "-" . $tutorial_id_from_post . "/";

if(mkdir($new_path)){

if(@chmod($new_path,0777)){

if(create_folder_loop_site($dir_path, $new_path)){

if(file_exists($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt")){

unlink($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt");

if(file_exists($new_path . "lockfile.txt")){
unlink($new_path . "lockfile.txt");
}
// Remove oai-pmh consent flag if present from
if (file_exists($new_path . "preview.xml"))
{
change_copied_xml_site($new_path . "preview.xml");
}
// Remove oai-pmh consent flag if present from
if (file_exists($new_path . "data.xml"))
{
change_copied_xml_site($new_path . "data.xml");
}


return true;

Expand Down Expand Up @@ -149,4 +156,12 @@ function duplicate_template_site($folder_name_id,$id_to_copy,$tutorial_id_from_p

}

?>
function change_copied_xml_site($xmlfile)
{
$xml = simplexml_load_file($xmlfile);
if ((string)$xml['oaiPmhAgree'] === 'true')
{
$xml['oaiPmhAgree'] = 'false';
}
$xml->asXML($xmlfile);
}
2 changes: 2 additions & 0 deletions modules/site/parent_templates/site/common/js/application.js
Expand Up @@ -1422,6 +1422,8 @@ function x_CheckBanner(index){
{
return;
}
// Remove introtext if visible
$("#x_clickableWrapper").remove();
const banner = $(data).find('page').eq(index).attr('headerBanner');
if(banner == "fullscreen"){
$(".jumbotron").addClass("x_scale");
Expand Down
2 changes: 2 additions & 0 deletions modules/site/parent_templates/site/wizards/en-GB/data.xwd
Expand Up @@ -73,6 +73,7 @@
</wcagGroup>

<meta type="group" label="Meta data" optional="true">
<explanation label="Note: to share this project using oai-pmh, you need to give your assent and the fields 'Category' and 'Education level' need to be filled in." type="info" condition="oai_pmh_available" mandatory="true"/>
<course label="Course" type="Course" wysiwyg="false" defaultValue="" optional="true" tooltip="Label indicating the course this learning object is part of, used to create meta data in SCORM objects. This is also stored in xAPI events."/>
<module label="Module" type="TextInput" wysiwyg="false" defaultValue="" optional="true" tooltip="Label indicating the module/subject of this learning object, used to create meta data in SCORM objects. This is also stored in xAPI events."/>
<metaCategory label="Category" type="Category" optional="true" tooltip="Label indicating the category of this learning object (i.e. Maths), stored in xAPI events, to be used for categorising in xAPI reports"/>
Expand All @@ -82,6 +83,7 @@
<metaAuthorInclude type="CheckBox" label="Include author when harvesting" defaultValue="true" optional="true" tooltip="Whether the author name is included in the metadata record when publishing the meta data as oai-pmh (optional functionality)"/>
<metaEducation type="EducationLevelList" label="Education level" defaultValue="" optional="true" tooltip="The level of the eduction."/>
<metaThumbnail type="media" label="Thumbnail" defaultValue="Choose Image" optional="true" tooltip="The thumbnail to publish with the metadata"/>
<oaiPmhAgree label="Assent" extraCheckBoxLabel="I agree to share this project through oai-pmh and I confirm that there are no copyrighted materials used in this project." type="CheckBox" mandatory="true" defaultValue="false" tooltip="The project will only be shared if checked" condition="oai_pmh_available"/>
</meta>

<print type="CheckBox" label="Print Button" defaultValue="true" optional="true" tooltip="Add a print button to the navigation bar. Pages can still be printed via browser controls if button is not added"/>
Expand Down
31 changes: 24 additions & 7 deletions modules/xerte/duplicate_template.php
Expand Up @@ -107,21 +107,30 @@ function duplicate_template_xerte($folder_name_id,$id_to_copy,$tutorial_id_from_
/*
* Get the id of the folder we are looking to copy into
*/

$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/";
$newusername = get_template_creator_username($folder_name_id);
$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $newusername . "-" . $tutorial_id_from_post . "/";

if(mkdir($new_path)){

if(@chmod($new_path,0777)){

if(create_folder_loop_xerte($dir_path, $new_path)){

if(file_exists($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt")){

unlink($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt");

// Remove lockfile in new folder
if(file_exists($new_path . "lockfile.txt")){
unlink($new_path . "lockfile.txt");
}

// Remove oai-pmh consent flag if present from
if (file_exists($new_path . "preview.xml"))
{
change_copied_xml_xerte($new_path . "preview.xml");
}
// Remove oai-pmh consent flag if present from
if (file_exists($new_path . "data.xml"))
{
change_copied_xml_xerte($new_path . "data.xml");
}

return true;

Expand Down Expand Up @@ -149,4 +158,12 @@ function duplicate_template_xerte($folder_name_id,$id_to_copy,$tutorial_id_from_

}

?>
function change_copied_xml_xerte($xmlfile)
{
$xml = simplexml_load_file($xmlfile);
if ((string)$xml['oaiPmhAgree'] === 'true')
{
$xml['oaiPmhAgree'] = 'false';
}
$xml->asXML($xmlfile);
}
Expand Up @@ -187,7 +187,9 @@ this.resizeEmbededMedia = function($video, {ratio = 16 / 9, width, height}) {

var w = ww < hw ? ww : hw;
var h = ww < hw ? wh : hh;

console.log("width,height,ww,wh,hh,hw,w,h="+(width?width:"UNDEF")+","+(height?height:"UNDEF")+","+ww+","+wh+","+hh+","+hw+","+w+","+h);
console.log("aspect = " + ($video[0].getAttribute("aspect")?$video[0].getAttribute("aspect"):"UNDEF"));
console.log("mainMedia = " + ($video[0].getAttribute("mainMedia")?$video[0].getAttribute("mainMedia"):"UNDEF"));
if(!$video[0].getAttribute("aspect") && !$video.hasClass("mainMedia"))
{
w = "100%";
Expand All @@ -196,6 +198,7 @@ this.resizeEmbededMedia = function($video, {ratio = 16 / 9, width, height}) {
"height": "100%"
});
}
console.log("width,height,ww,wh,hh,hw,w,h="+(width?width:"UNDEF")+","+(height?height:"UNDEF")+","+ww+","+wh+","+hh+","+hw+","+w+","+h);

$video.css({
"width": width ? width : w,
Expand Down
Expand Up @@ -3262,7 +3262,6 @@
$(".panel .legend p").css("font-size", "1.75vmin");

$(".html2pdf__page-break").each(function (index){
debugger
$(this).css({'height' : canvasWidthHeights[index].parentHeight, 'padding' : "20px"})
$(this).find('.graph').css({'width': canvasWidthHeights[index].width, 'height' : canvasWidthHeights[index].height})
$(this).find('.container-print').removeClass('container-print');
Expand Down
Expand Up @@ -155,7 +155,6 @@
if ($hs.hasClass("hsGroup")) {
$hs.children()
.each(function(){
debugger
if(x_currentPageXML.getAttribute("link") == "false" || x_currentPageXML.getAttribute("link") == undefined){
annotatedDiagram.drawLine($(this), $this, shape);
}else{
Expand All @@ -164,7 +163,6 @@

});
} else {
debugger
if(x_currentPageXML.getAttribute("link") == "false" || x_currentPageXML.getAttribute("link") == undefined){
annotatedDiagram.drawLine($hs, $this, shape);
}else{
Expand Down Expand Up @@ -217,7 +215,6 @@
x_pageLoaded();
}

debugger
if(x_currentPageXML.getAttribute("link") == "true"){
$("#listHolder").css("display", "none")
}
Expand Down Expand Up @@ -565,7 +562,6 @@
}

this.drawLineToText = function ($hs, shape){
debugger
var align = x_browserInfo.mobile == true ? "Top" : x_currentPageXML.getAttribute("align");
var $panel = $("#panel");
var startX = $hs.offset().left - $(context.canvas).offset().left + ($hs.width() / 2);
Expand Down
Expand Up @@ -773,7 +773,6 @@
var form = document.createElement("form");
form.method = 'post';
form.target = 'displayjson';
debugger
form.action = (typeof x_downloadURL != 'undefined') ? x_downloadURL : 'download.php';

$('<input type="hidden">') // IE compatibility
Expand Down
46 changes: 46 additions & 0 deletions modules/xerte/parent_templates/Nottingham/models_html5/grid.html
Expand Up @@ -311,6 +311,22 @@
$("#feedback").remove();
}

if (x_currentPageXML.getAttribute("align") == "top") {
$("#gridHolder")
.appendTo($pageContents)

$("#feedback").appendTo($pageContents);
$("#btnHolder").appendTo($pageContents);
} else if (x_currentPageXML.getAttribute("align") == "right") {
$("#gridHolder")
.addClass("x_floatLeft")
} else if (x_currentPageXML.getAttribute("align") == "left") {
$("#gridHolder")
.addClass("x_floatRight")
$("#btnHolder").appendTo($pageContents)
}


var $grid = $("#grid");
var $text = $("#otherContent");
var gridSize = x_currentPageXML.getAttribute("gridSize");
Expand Down Expand Up @@ -406,6 +422,36 @@
x_pageLoaded();
}


/*this.gridSize = function (size){
var $grid = $("#grid"), $ul, $holder, row;
var $text = $("#otherContent");
var $content = $("#content");
if(x_currentPageXML.getAttribute("gridSize") == "small"){
$grid.width(size);
$text.css("max-width", "75%");
}else if(x_currentPageXML.getAttribute("gridSize") == "medium"){
$grid.width(size * 2);
$text.css("max-width", "50%");
}else if(x_currentPageXML.getAttribute("gridSize") == "large"){
$grid.width(size * 3);
$text.css("max-width", "25%");
}else{
$text.remove()
}
if(x_currentPageXML.getAttribute("align") == "left"){
$content.css("flex-direction", "row")
}else if(x_currentPageXML.getAttribute("align") == "right"){
$content.css("flex-direction", "row-reverse")
}else{
$content.css("flex-direction", "column")
}
}*/



this.sortData = function(data) {

var $grid = $("#grid"), $ul, $holder, row,
Expand Down
Expand Up @@ -400,7 +400,6 @@
"groupInfo": groupInfo,
"subGroups": subGroups
});
//debugger;
this.setUpInteraction();

x_pageLoaded();
Expand Down
Expand Up @@ -313,7 +313,14 @@
);
});

$.each(currentAnswers, function (index, value) {
let answers = $pageContents.data('answeredValues');
let selected = -1;
if (answers[currentQuestion] !== undefined)
{
selected = (currentAnswers.length-1) * answers[currentQuestion]/100;
}

$.each(currentAnswers, function (index, value) {
var $thisOptionGroup, $thisOption, $thisOptionTxt;

if (index != 0) {
Expand Down Expand Up @@ -341,12 +348,19 @@
opinion.checkButtonState();
});
$thisOption[0].score = index;

$thisOptionTxt
.attr("for", "option" + currentQuestion + "_" + index)
.data("option", $thisOption)
.html(x_addLineBreaks(value.text));
});

if (selected != -1)
{
let $thisOptions = $optionHolder.find("input");
$($thisOptions[selected]).prop('checked', true);
}

name = $thisQ.getAttribute("prompt");

if ($thisQ.getAttribute("name")) {
Expand Down Expand Up @@ -763,6 +777,8 @@
$textHolder.append('<img class="opinionImg" src="' + x_evalURL(x_currentPageXML.getAttribute("img")) + '"' + tip +'>');
}

var backBtnText = "Back";

var submitBtnText = x_currentPageXML.getAttribute("submitBtnText");
if (submitBtnText == undefined)
{
Expand All @@ -784,6 +800,23 @@
"onCompletionText" :onCompletionText,
});

// BackBtn

$("#backBtn")
.button({
label:backBtnText
})
.click(function(){
debugger;
let pageSize = $pageContents.data('pageSize');
let currentQuestion = $pageContents.data('currentQuestion');
if (currentQuestion >= pageSize)
{
currentQuestion -= pageSize;
$pageContents.data('currentQuestion', currentQuestion);
opinion.loadQuestions();
}
});
// submit button
$("#checkBtn")
.button({
Expand Down Expand Up @@ -908,6 +941,7 @@ <h3 id="qNo" aria-live="polite"></h3>
<div id="buttonHolder">
<button id="printBtn"></button>
<button id="resetBtn"></button>
<button id="backBtn"></button>
<button id="checkBtn"></button>
</div>
</div>
Expand Down
Expand Up @@ -36,7 +36,6 @@
};

this.init = function() {
//debugger;
/*
$script('https://rss2json.com/gfapi.js', function () {
rssdownload.begin();
Expand Down
Expand Up @@ -608,7 +608,6 @@
label: downloadBtnLabel
})
.click(function() {
debugger;
textHighlight.postData($("#pageContents").data("docData"));
})
.prop('disabled', true)
Expand Down

0 comments on commit fc6c61c

Please sign in to comment.