aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorKruti Shah2012-06-12 13:09:11 -0700
committerKruti Shah2012-06-12 13:09:11 -0700
commitd648c842905c7c53e0f89b943982493d2b79f56e (patch)
treeeb5585f92061975215f6d19305a8d1b76262e2fc /js/io
parentbedb38e14887b29eae3cdf1c8d435259c920257c (diff)
parentcf3b96822665751dae7a64644db3cb3960733c3d (diff)
downloadninja-d648c842905c7c53e0f89b943982493d2b79f56e.tar.gz
Merge branch 'refs/heads/TimelineUberjd' into TimelineUber
Conflicts: js/controllers/elements/element-controller.js js/document/_toDelete/html-document.js js/panels/Timeline/Layer.reel/Layer.js Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/io')
-rw-r--r--js/io/system/ninjalibrary.js42
-rw-r--r--js/io/system/ninjalibrary.json2
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js5
3 files changed, 29 insertions, 20 deletions
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index 12af5988..0470a166 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -57,35 +57,38 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
57 // 57 //
58 copyLibToCloud: { 58 copyLibToCloud: {
59 value: function (path, libName, callback) { 59 value: function (path, libName, callback) {
60 var libCheck = this.coreApi.directoryExists({uri: path+libName});
60 //Checking for library to exists 61 //Checking for library to exists
61 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { 62 if(libCheck.status === 404) {
62 //Getting contents to begin copying 63 //Getting contents to begin copying
63 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { 64 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) {
64 for (var i in contents) { 65 for (var i in contents) {
65 if (libName === contents[i].name) { 66 if (libName === contents[i].name) {
66 //Getting contents of library to be copied 67 //Getting contents of library to be copied
67 this.chromeApi.directoryContents(contents[i], function (lib) { 68 this.chromeApi.directoryContents(contents[i], function (lib) {
68 //Copying to cloud, adding blocking if no callback specified 69 //Copying to cloud
69 if (!callback) { 70 if (callback) {
70 //TODO: Add blocking logic here 71 this.copyDirectoryToCloud(path, contents[i], path, {total: 0, copied: 0, callback: callback.bind(this)});
71 this.copyDirectoryToCloud(path, contents[i], path); 72 } else {
72 } else { 73 this.copyDirectoryToCloud(path, contents[i], path, {total: 0, copied: 0});
73 this.copyDirectoryToCloud(path, contents[i], path, callback); 74 }
74 }
75 }.bind(this)); 75 }.bind(this));
76 break; 76 break;
77 } 77 }
78 } 78 }
79 }.bind(this)); 79 }.bind(this));
80 } else if (libCheck.status === 204){
81 //Already present, so sending success
82 if (callback) callback(true);
80 } else { 83 } else {
81 //TODO: Add error handling 84 if (callback) callback(false);
82 } 85 }
83 } 86 }
84 }, 87 },
85 //////////////////////////////////////////////////////////////////// 88 ////////////////////////////////////////////////////////////////////
86 // 89 //
87 copyDirectoryToCloud: { 90 copyDirectoryToCloud: {
88 value: function(root, folder, fileRoot, callback) { 91 value: function(root, folder, fileRoot, tracking) {
89 //Setting up directory name 92 //Setting up directory name
90 if (folder.name) { 93 if (folder.name) {
91 var dir; 94 var dir;
@@ -109,19 +112,30 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
109 //Checking for file or directory 112 //Checking for file or directory
110 if (contents[i].isDirectory) { 113 if (contents[i].isDirectory) {
111 //Recursive call if directory 114 //Recursive call if directory
112 this.copyDirectoryToCloud(dir, contents[i], fileRoot); 115 this.copyDirectoryToCloud(dir, contents[i], fileRoot, tracking);
113 } else if (contents[i].isFile){ 116 } else if (contents[i].isFile){
117 //
118 tracking.total++;
114 //Copying file 119 //Copying file
115 this.chromeApi.fileContent(contents[i].fullPath, function (result) { 120 this.chromeApi.fileContent(contents[i].fullPath, function (result) {
116 //Using binary when copying files to allow images and such to work 121 //Using binary when copying files to allow images and such to work
117 this.coreApi.createFile({uri: (fileRoot+result.file.fullPath).replace(/\/\//gi, '/'), contents: result.content}); 122 var file = this.coreApi.createFile({uri: (fileRoot+result.file.fullPath).replace(/\/\//gi, '/'), contents: result.content});
123 //Checking for file copy success
124 if (file.status === 201) {
125 tracking.copied++;
126 } else {
127 //Error
128 tracking.callback(false);
129 }
130 //Checking for all files to be copied to make callback
131 if (tracking.copied === tracking.total && tracking.callback) {
132 tracking.callback(true);
133 }
118 }.bind(this)); 134 }.bind(this));
119 } 135 }
120 } 136 }
121 }.bind(this)); 137 }.bind(this));
122 } 138 }
123 //TODO Add logic for proper callback status(es)
124 if (callback) callback(true);
125 } 139 }
126 }, 140 },
127 //////////////////////////////////////////////////////////////////// 141 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 5c1eb875..e9df5e58 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.10.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.10.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.7.0"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.9.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
index ebe2df61..7227d532 100644
--- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -195,11 +195,6 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
195 } 195 }
196 } 196 }
197 197
198 //disable ok
199 if(!this.okButton.hasAttribute("disabled")){
200 this.okButton.setAttribute("disabled", "true");
201 }
202
203 //save project type selection 198 //save project type selection
204 this.selectedProjectType = {"uri":evt.uri, "element":evt.target}; 199 this.selectedProjectType = {"uri":evt.uri, "element":evt.target};
205 200