aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/document-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/document/document-controller.js')
-rwxr-xr-xjs/io/document/document-controller.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index dd62b40b..7cc0eeeb 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -15,7 +15,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
15var Montage = require("montage/core/core").Montage, 15var Montage = require("montage/core/core").Montage,
16 Component = require("montage/ui/component").Component, 16 Component = require("montage/ui/component").Component,
17 Uuid = require("montage/core/uuid").Uuid, 17 Uuid = require("montage/core/uuid").Uuid,
18 nj= require("js/lib/NJUtils.js").NJUtils,
19 HTMLDocument = require("js/io/document/html-document").HTMLDocument, 18 HTMLDocument = require("js/io/document/html-document").HTMLDocument,
20 TextDocument = require("js/io/document/text-document").TextDocument; 19 TextDocument = require("js/io/document/text-document").TextDocument;
21 20
@@ -123,7 +122,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
123 } 122 }
124 123
125 //console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n"); 124 //console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n");
126 filename = nj.getFileNameFromPath(uri); 125 filename = this.getFileNameFromPath(uri);
127 if(uri.indexOf('.') != -1){ 126 if(uri.indexOf('.') != -1){
128 fileType = uri.substr(uri.lastIndexOf('.') + 1); 127 fileType = uri.substr(uri.lastIndexOf('.') + 1);
129 } 128 }
@@ -430,5 +429,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
430 value: function() { 429 value: function() {
431 return "userDocument_" + (this._iframeCounter++); 430 return "userDocument_" + (this._iframeCounter++);
432 } 431 }
433 } 432 },
433
434 ///// Return the last part of a path (e.g. filename)
435 getFileNameFromPath : {
436 value: function(path) {
437 path = path.replace(/[/\\]$/g,"");
438 path = path.replace(/\\/g,"/");
439 return path.substr(path.lastIndexOf('/') + 1);
440 }
441 }
434}); \ No newline at end of file 442}); \ No newline at end of file