added remix functionality

pull/89/head
Bernat Romagosa 2018-12-17 12:41:10 +01:00
rodzic ba62f758f1
commit 99815dd547
3 zmienionych plików z 10 dodań i 25 usunięć

Wyświetl plik

@ -413,7 +413,8 @@ Cloud.prototype.saveProject = function (ide, onSuccess, onError) {
xml: xml,
media: ide.hasChangedMedia ?
ide.serializer.mediaXML(ide.projectName) : null,
thumbnail: thumbnail
thumbnail: thumbnail,
remixID: ide.stage.remixID
};
ide.serializer.isCollectingMedia = false;
ide.serializer.flushMedia();
@ -711,25 +712,6 @@ Cloud.prototype.unpublishProject = function (
);
};
Cloud.prototype.remixProject = function (
projectName,
username,
onSuccess,
onError
) {
this.withCredentialsRequest(
'POST',
'/projects/' +
encodeURIComponent(username) +
'/' +
encodeURIComponent(projectName) +
'/remix',
onSuccess,
onError,
'Could not remix project'
);
};
Cloud.prototype.updateNotes = function (
projectName,
notes,

Wyświetl plik

@ -4361,7 +4361,8 @@ IDE_Morph.prototype.rawOpenCloudDataString = function (str) {
this.serializer.openProject(
this.serializer.loadProjectModel(
model.childNamed('project'),
this
this,
model.attributes.remixID
),
this
);
@ -4374,7 +4375,8 @@ IDE_Morph.prototype.rawOpenCloudDataString = function (str) {
this.serializer.openProject(
this.serializer.loadProjectModel(
model.childNamed('project'),
this
this,
model.attributes.remixID
),
this
);

Wyświetl plik

@ -316,7 +316,7 @@ SnapSerializer.prototype.load = function (xmlString, ide) {
return this.loadProjectModel(this.parse(xmlString), ide);
};
SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide) {
SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide, remixID) {
// public - answer a new Project represented by the given XML top node
// show a warning if the origin apps differ
@ -331,10 +331,10 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide) {
'\n\nand may be incompatible or fail to load here.'
);
}
return this.rawLoadProjectModel(xmlNode);
return this.rawLoadProjectModel(xmlNode, remixID);
};
SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode, remixID) {
// private
var myself = this,
project = {sprites: {}},
@ -376,6 +376,7 @@ SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
model.stage = model.project.require('stage');
StageMorph.prototype.frameRate = 0;
project.stage = new StageMorph(project.globalVariables);
project.stage.remixID = remixID;
if (Object.prototype.hasOwnProperty.call(
model.stage.attributes,
'id'