diff options
author | Jose Antonio Marquez | 2012-02-13 22:43:48 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-13 22:43:48 -0800 |
commit | ef5142d5426309bca6b4ef0aeee437e3ebe838fc (patch) | |
tree | 937245a734a3eef972187dc8fdd1d01ecde64f42 /js/controllers/document-controller.js | |
parent | 5b6c62b7164cbde2845a3f7af810568e5ba53a6a (diff) | |
parent | 91822817e23f43aa61e901867369a33d7db1964c (diff) | |
download | ninja-ef5142d5426309bca6b4ef0aeee437e3ebe838fc.tar.gz |
Merge branch 'refs/heads/AnanyaFileIO' into FileIO
Diffstat (limited to 'js/controllers/document-controller.js')
-rwxr-xr-x | js/controllers/document-controller.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 21445214..84b994ce 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -104,9 +104,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
104 | handleExecuteSave: { | 104 | handleExecuteSave: { |
105 | value: function(event) { | 105 | value: function(event) { |
106 | //Text and HTML document classes should return the same save object for fileSave | 106 | //Text and HTML document classes should return the same save object for fileSave |
107 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save()); | 107 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.clearDocumentDirtyFlag.bind(this)); |
108 | } | 108 | } |
109 | }, | 109 | }, |
110 | |||
111 | clearDocumentDirtyFlag:{ | ||
112 | value: function(){ | ||
113 | this.activeDocument.dirtyFlag = false; | ||
114 | } | ||
115 | }, | ||
110 | //////////////////////////////////////////////////////////////////// | 116 | //////////////////////////////////////////////////////////////////// |
111 | 117 | ||
112 | 118 | ||
@@ -135,8 +141,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
135 | openNewFileCallback:{ | 141 | openNewFileCallback:{ |
136 | value:function(doc){ | 142 | value:function(doc){ |
137 | var response = doc || null;//default just for testing | 143 | var response = doc || null;//default just for testing |
138 | if(!!response && response.success && !!response.uri){ | 144 | if(!!response && response.success && (response.status!== 500) && !!response.uri){ |
139 | this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); | 145 | this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); |
146 | }else if(!!response && !response.success){ | ||
147 | //Todo: restrict directory path to the sandbox, in the dialog itself | ||
148 | alert("Unable to create file.\n [Error: Forbidden directory]"); | ||
140 | } | 149 | } |
141 | } | 150 | } |
142 | }, | 151 | }, |