Skip to content

Commit

Permalink
#964 Allow import pages in editor for Bootstrap projects
Browse files Browse the repository at this point in the history
  • Loading branch information
FayCross committed Oct 7, 2020
1 parent 4e0f9ab commit b73b05e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions editor/importpages/import-choose.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@
}

$version = getVersion();
$template = $_GET["template"];

$workspace = json_decode(get_users_projects("date_down", true));

$items = array();
$Nottingham = simplexml_load_file("../../modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd");
if ($template == "site") {
$Nottingham = simplexml_load_file("../../modules/site/parent_templates/site/wizards/en-GB/data.xwd");
} else {
$Nottingham = simplexml_load_file("../../modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd");
}

$nodes = $Nottingham->xpath("/wizard/learningObject/newNodes/*");
$pageIcons = array();

foreach($nodes as $node)
{
$name = $node->getName();
Expand All @@ -47,7 +54,7 @@
array_splice($workspace->items, $i, 1);
continue;
}
if ($item->type != "nottingham" && $item->type != "workspace" && $item->type != "folder")
if ((($template == "xerte" && $item->type != "nottingham") || ($template == "site" && $item->type != "site")) && $item->type != "workspace" && $item->type != "folder")
{
unset($workspace->nodes->{$item->id});
array_splice($workspace->items, $i, 1);
Expand Down Expand Up @@ -151,6 +158,7 @@
<script>
jsonData = JSON.parse('<?php echo str_replace("'", "\\'", json_encode($items));?>');
workspace = JSON.parse('<?php echo str_replace("'", "\\'",$workspace_json); ?>');
var x_mergeTemplate = '<?php echo $template?>';
</script>

<?php
Expand Down
2 changes: 1 addition & 1 deletion editor/js/import-choose.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function showPageData(xot_id, data) {
html += "<label><input class=\"allCheck\" type=\"checkbox\" id=\"select-all\" onClick=\"CheckAll()\"/> Select/Deselect All</label>";
}
$.each(data.pages, function(x){
html += "<label><input class=\"pageCheckbox checkAll\" type=\"checkbox\" id=\"page_"+this.index+"\"'>" + '<img class=\"merge_page_icon\" src="modules/xerte/icons/'+this.icon+'.png">' + atob(this.name) + "</label>";
html += "<label><input class=\"pageCheckbox checkAll\" type=\"checkbox\" id=\"page_"+this.index+"\"'>" + '<img class=\"merge_page_icon\" src="modules/'+x_mergeTemplate+'/icons/'+this.icon+'.png">' + atob(this.name) + "</label>";
});
$("#merge").show();
}
Expand Down
3 changes: 2 additions & 1 deletion editor/js/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var EDITOR = (function ($, parent) {
var now = new Date().getTime();
$.ajax({
type: "GET",
data: { template: templateframework },
url: url + "&t=" + now,
dataType: "html",
success: function (data) {
Expand Down Expand Up @@ -126,7 +127,7 @@ var EDITOR = (function ($, parent) {

create_tree_buttons = function() {
var buttons = $('<div />').attr('id', 'top_buttons');
if (templateframework == "xerte") {
if (templateframework == "xerte" || templateframework == "site") {
var button_def =
[
{
Expand Down

0 comments on commit b73b05e

Please sign in to comment.