diff options
author | Jose Antonio Marquez Russo | 2012-02-18 19:40:43 -0800 |
---|---|---|
committer | Jose Antonio Marquez Russo | 2012-02-18 19:40:43 -0800 |
commit | c466bcf61351b50f678100ca14096f71a0a71bd0 (patch) | |
tree | 4ac283e0e7724e5ede21c1a1e97d121033578c72 /js | |
parent | e23708721a71ca4c71365f5f8e8ac7d6113926db (diff) | |
parent | 8fdce771bfcf662cf1acc16d45e4361ffd06c53e (diff) | |
download | ninja-c466bcf61351b50f678100ca14096f71a0a71bd0.tar.gz |
Merge pull request #10 from ananyasen/FileIO
FileIO branch pull request
Diffstat (limited to 'js')
19 files changed, 81 insertions, 52 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1f339fe7..57289448 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -118,8 +118,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
118 | //TODO: Check for appropiate structures | 118 | //TODO: Check for appropiate structures |
119 | handleExecuteSave: { | 119 | handleExecuteSave: { |
120 | value: function(event) { | 120 | value: function(event) { |
121 | //Text and HTML document classes should return the same save object for fileSave | 121 | if(!!this.activeDocument){ |
122 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | 122 | //Text and HTML document classes should return the same save object for fileSave |
123 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | ||
124 | } | ||
123 | } | 125 | } |
124 | }, | 126 | }, |
125 | //////////////////////////////////////////////////////////////////// | 127 | //////////////////////////////////////////////////////////////////// |
@@ -459,5 +461,5 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
459 | value: function() { | 461 | value: function() { |
460 | return "userDocument_" + (this._iframeCounter++); | 462 | return "userDocument_" + (this._iframeCounter++); |
461 | } | 463 | } |
462 | } | 464 | } |
463 | }); | 465 | }); |
diff --git a/js/document/text-document.js b/js/document/text-document.js index 3e20e1f6..1132ba65 100755 --- a/js/document/text-document.js +++ b/js/document/text-document.js | |||
@@ -27,7 +27,7 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
27 | // PRIVATE MEMBERS | 27 | // PRIVATE MEMBERS |
28 | _codeEditor: { | 28 | _codeEditor: { |
29 | value: { | 29 | value: { |
30 | "editor": { value: null, enumerable: false }, | 30 | "editor": { value: null, enumerable: false } |
31 | 31 | ||
32 | } | 32 | } |
33 | }, | 33 | }, |
@@ -192,5 +192,17 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
192 | value: function() { | 192 | value: function() { |
193 | // Have the XHR here? | 193 | // Have the XHR here? |
194 | } | 194 | } |
195 | }, | ||
196 | |||
197 | markEdited:{ | ||
198 | value: function() { | ||
199 | this.dirtyFlag = true; | ||
200 | } | ||
201 | }, | ||
202 | |||
203 | markUnedited:{ | ||
204 | value: function() { | ||
205 | this.dirtyFlag = false; | ||
206 | } | ||
195 | } | 207 | } |
196 | }); \ No newline at end of file | 208 | }); \ No newline at end of file |
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index a75b59bb..2051da43 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -1096,37 +1096,6 @@ exports.CoreIoApi = Montage.create(Component, { | |||
1096 | } | 1096 | } |
1097 | return status; | 1097 | return status; |
1098 | } | 1098 | } |
1099 | }, | ||
1100 | |||
1101 | //////////////////////////////////////////////////////////////////// | ||
1102 | /*** | ||
1103 | * check if the file exists | ||
1104 | */ | ||
1105 | checkFileExists:{ | ||
1106 | value: function(fileName, folderUri, fileType){ | ||
1107 | var uri = "", response=null, status=true; | ||
1108 | |||
1109 | //prepare absolute uri | ||
1110 | if(/[^/\\]$/g.test(folderUri)){ | ||
1111 | folderUri = folderUri + "/"; | ||
1112 | } | ||
1113 | |||
1114 | if(!!fileType && (fileName.lastIndexOf(fileType) !== (fileName.length - fileType.length))){ | ||
1115 | fileName = fileName+fileType; | ||
1116 | } | ||
1117 | |||
1118 | uri = ""+folderUri+fileName; | ||
1119 | |||
1120 | response = this.fileExists({"uri":uri}); | ||
1121 | if(!!response && response.success && (response.status === 204)){ | ||
1122 | status = true; | ||
1123 | }else if(!!response && response.success && (response.status === 404)){ | ||
1124 | status = false; | ||
1125 | }else{ | ||
1126 | status = false; | ||
1127 | } | ||
1128 | return status; | ||
1129 | } | ||
1130 | } | 1099 | } |
1131 | //////////////////////////////////////////////////////////////////// | 1100 | //////////////////////////////////////////////////////////////////// |
1132 | }); | 1101 | }); |
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.css b/js/io/ui/file-picker/file-input-field.reel/file-input-field.css index 91e412f8..91e412f8 100755 --- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.css +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.css | |||
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.html b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html index 46dd5c69..2fcaa075 100755 --- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.html +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html | |||
@@ -11,7 +11,7 @@ | |||
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "owner":{ | 13 | "owner":{ |
14 | "module": "js/components/ui/FilePicker/file-input-field.reel", | 14 | "module": "js/io/ui/file-picker/file-input-field.reel", |
15 | "name": "FileInputField", | 15 | "name": "FileInputField", |
16 | "properties": { | 16 | "properties": { |
17 | "element": {"#": "fileInputField"}, | 17 | "element": {"#": "fileInputField"}, |
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 235be8ad..235be8ad 100755 --- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js | |||
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 0ff20cc8..129bebad 100755 --- a/js/components/ui/FilePicker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js | |||
@@ -6,8 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | 7 | ||
8 | var Montage = require("montage/core/core").Montage, | 8 | var Montage = require("montage/core/core").Montage, |
9 | pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, | 9 | pickerNavigatorReel = require("js/io/ui/file-picker/picker-navigator.reel").PickerNavigator, |
10 | filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), | 10 | filePickerModelModule = require("js/io/ui/file-picker/file-picker-model"), |
11 | Popup = require("montage/ui/popup/popup.reel").Popup; | 11 | Popup = require("montage/ui/popup/popup.reel").Popup; |
12 | 12 | ||
13 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data | 13 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data |
diff --git a/js/components/ui/FilePicker/file-picker-model.js b/js/io/ui/file-picker/file-picker-model.js index d9cf02ed..09c3ae9c 100755 --- a/js/components/ui/FilePicker/file-picker-model.js +++ b/js/io/ui/file-picker/file-picker-model.js | |||
@@ -4,7 +4,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var filePickerControllerModule = require("js/components/ui/FilePicker/file-picker-controller"); | 7 | var filePickerControllerModule = require("js/io/ui/file-picker/file-picker-controller"); |
8 | 8 | ||
9 | //this is per file picker instance | 9 | //this is per file picker instance |
10 | exports.FilePickerModel = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, { | 10 | exports.FilePickerModel = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, { |
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.css index 796c283f..796c283f 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.css | |||
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html index 20cb0c68..f46068ec 100755 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html | |||
@@ -7,11 +7,11 @@ | |||
7 | <html> | 7 | <html> |
8 | <head> | 8 | <head> |
9 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | 9 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
10 | <link rel="stylesheet" type="text/css" href="pickerNavigator.css"> | 10 | <link rel="stylesheet" type="text/css" href="picker-navigator.css"> |
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "owner":{ | 13 | "owner":{ |
14 | "module": "js/components/ui/FilePicker/pickerNavigator.reel", | 14 | "module": "js/io/ui/file-picker/picker-navigator.reel", |
15 | "name":"PickerNavigator", | 15 | "name":"PickerNavigator", |
16 | "properties":{ | 16 | "properties":{ |
17 | "element": {"#": "picker"}, | 17 | "element": {"#": "picker"}, |
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 411386f9..411386f9 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | |||
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html index 8c0327eb..7340251c 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html | |||
@@ -51,7 +51,7 @@ | |||
51 | }, | 51 | }, |
52 | 52 | ||
53 |