kopia lustrzana https://github.com/backface/turtlestitch
remove old upload
rodzic
4fae408dcc
commit
cdc7bca25c
|
@ -1019,105 +1019,6 @@ IDE_Morph.prototype.setProjectName = function (string) {
|
|||
this.controlBar.updateLabel();
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.uploadMe = function () {
|
||||
var myself = this,
|
||||
world = this.world();
|
||||
myself.prompt('Upload as ...', function (name) {
|
||||
myself.upload(name);
|
||||
}, null, 'upload');
|
||||
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.upload = function (name) {
|
||||
var request = new XMLHttpRequest(),
|
||||
myself = this,
|
||||
world = this.world();
|
||||
|
||||
if (name) this.setProjectName(name);
|
||||
data = this.serializer.serialize(this.stage);
|
||||
|
||||
tStitch.debug_msg("uploading points... sending SAVE with num points= " + tStitch.stitches.x.length, true);
|
||||
params = {
|
||||
"x[]": tStitch.stitches.x,
|
||||
"y[]":tStitch.stitches.y,
|
||||
"j[]":tStitch.stitches.jump,
|
||||
"name":name,
|
||||
"project_data": data
|
||||
};
|
||||
|
||||
if (tStitch.stitches.x.length <= 1 || tStitch.stitches.y <= 1) {
|
||||
new DialogBoxMorph().inform(
|
||||
'Upload Error',
|
||||
'No stitches to upload, please (re)generate a drawing first!',
|
||||
world);
|
||||
|
||||
} else {
|
||||
|
||||
$.post(
|
||||
"/upload",
|
||||
data = params,
|
||||
successCallback = function (data) {
|
||||
if (data.slice(0,2) == "OK") {
|
||||
fid = data.slice(3);
|
||||
window.open('http://' + window.location.hostname + '/view/'+fid, 'TurtleStitch file preview');
|
||||
} else {
|
||||
new DialogBoxMorph().inform(
|
||||
'Upload Error',
|
||||
'Sorry! Upload failed for an unknown reason',
|
||||
world);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* replace jquery (not yet working)
|
||||
params =
|
||||
"x="+ tStitch.stitches.x +
|
||||
"&y[]="+tStitch.stitches.y +
|
||||
"&j[]="+tStitch.stitches.jump +
|
||||
"&name="+name +
|
||||
"&project_data="+data;
|
||||
|
||||
try {
|
||||
console.log("post");
|
||||
request.open("POST", '/upload',true);
|
||||
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
request.setRequestHeader("Content-length", params.length);
|
||||
request.setRequestHeader("Connection", "close");
|
||||
|
||||
request.onreadystatechange = function () {
|
||||
if (request.readyState === 4) {
|
||||
if (request.responseText) {
|
||||
if (request.responseText.slice(0,2) == "OK") {
|
||||
fid = request.responseText.slice(3);
|
||||
window.open('http://' + window.location.hostname + '/view/'+fid, 'TurtleStitch file preview');
|
||||
} else {
|
||||
console.log(request.responseText);
|
||||
new DialogBoxMorph().inform(
|
||||
'Upload Error',
|
||||
'Sorry! Upload failed for some reasons on the server ',
|
||||
world);
|
||||
}
|
||||
} else {
|
||||
new DialogBoxMorph().inform(
|
||||
'Upload Error',
|
||||
'Sorry! Upload failed for an unknown reason',
|
||||
world);
|
||||
}
|
||||
}
|
||||
};
|
||||
request.send(params);
|
||||
} catch (err) {
|
||||
new DialogBoxMorph().inform(
|
||||
'Upload Error',
|
||||
err.toString(),
|
||||
world);
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
IDE_Morph.prototype.createSpriteBar = function () {
|
||||
// assumes that the categories pane has already been created
|
||||
|
|
Ładowanie…
Reference in New Issue