2015-04-25 17:26:12 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the Doodle3D project (http://doodle3d.com).
|
|
|
|
*
|
|
|
|
* Copyright (c) 2013, Doodle3D
|
|
|
|
* This software is licensed under the terms of the GNU GPL v2 or later.
|
|
|
|
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
function SketchAPI() {
|
2015-05-01 19:12:05 +02:00
|
|
|
var className = 'SketchAPI';
|
2015-04-25 17:26:12 +02:00
|
|
|
|
2015-06-02 14:38:55 +02:00
|
|
|
function load(id,success,fail) {
|
|
|
|
API.get('sketch/?id='+id,{},success,fail);
|
2015-04-25 17:26:12 +02:00
|
|
|
}
|
|
|
|
|
2015-06-02 14:38:55 +02:00
|
|
|
function list(success,fail) {
|
|
|
|
API.get('sketch/list',{},success,fail);
|
|
|
|
}
|
|
|
|
|
|
|
|
function save(data,success,fail) {
|
2015-05-01 19:12:05 +02:00
|
|
|
console.log(className,'saving sketch',data);
|
2015-04-28 12:47:44 +02:00
|
|
|
API.post('sketch',{data:data},success,fail);
|
|
|
|
}
|
|
|
|
|
2015-06-02 14:38:55 +02:00
|
|
|
function del(id,success,fail) {
|
|
|
|
console.log(className,'deleting sketch',id);
|
|
|
|
API.post('sketch/delete',{id:id},success,fail);
|
|
|
|
}
|
|
|
|
|
|
|
|
function status(success,fail) {
|
|
|
|
API.get('sketch/status',{},success,fail);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
load: load,
|
|
|
|
list: list,
|
|
|
|
save: save,
|
|
|
|
status: status,
|
|
|
|
del: del,
|
|
|
|
}
|
|
|
|
|
2015-04-25 17:26:12 +02:00
|
|
|
}
|