aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/coreioapi.js64
-rwxr-xr-xjs/io/system/fileio.js4
-rw-r--r--js/io/system/ninjalibrary.js2
-rw-r--r--js/io/templates/descriptor.json9
-rwxr-xr-xjs/io/templates/files/html.txt4
-rw-r--r--js/io/templates/files/xml.txt1
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.html2
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.html6
-rwxr-xr-xjs/io/ui/file-picker/picker-navigator.reel/picker-navigator.html34
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html10
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html14
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.html12
12 files changed, 119 insertions, 43 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index a06f45c6..1e6518fe 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -193,6 +193,23 @@ exports.CoreIoApi = Montage.create(Component, {
193 this._fileServiceURL = value; 193 this._fileServiceURL = value;
194 } 194 }
195 }, 195 },
196 ////////////////////////////////////////////////////////////////////
197 //File service API URL
198 _webServiceURL: {
199 enumerable: false,
200 value: '/web'
201 },
202 ////////////////////////////////////////////////////////////////////
203 //
204 webServiceURL: {
205 enumerable: false,
206 get: function() {
207 return String(this.rootUrl+this._webServiceURL);
208 },
209 set: function(value) {
210 this._webServiceURL = value;
211 }
212 },
196 //////////////////////////////////////////////////////////////////// 213 ////////////////////////////////////////////////////////////////////
197 //Directory service API URL 214 //Directory service API URL
198 _directoryServiceURL: { 215 _directoryServiceURL: {
@@ -647,6 +664,53 @@ exports.CoreIoApi = Montage.create(Component, {
647 } 664 }
648 }, 665 },
649 //////////////////////////////////////////////////////////////////// 666 ////////////////////////////////////////////////////////////////////
667 // Reads an external file (cross-domain)
668 // Parameters:
669 // the file parameter must contain the following properties
670 // url: string value containing the full file path/URL i.e. "http://google.com/motorola.html"
671 // binary parameter is optional if the content is to be binary
672 // Return values:
673 // returns an object with two properties
674 // success: boolean indicating if the call succeeded or failed
675 // content: string containing the file contents
676 // status: int indicating the request HTTP status code
677 // 200 - the file was read and its contents were returned
678 // 404 - the file does not exist
679 // 500 - unknown server error occurred
680 readExternalFile: {
681 enumerable: false,
682 value: function(file) {
683 //
684 var retValue = {success:null, content:null, status:null};
685 //
686 if(file && file.url && file.url.length) {
687 try {
688 var serviceURL = this._prepareServiceURL(this.webServiceURL, ''),
689 xhr = new XMLHttpRequest();
690 //
691 xhr.open("GET", serviceURL+"?url="+file.url, false);
692 if (file.binary) xhr.setRequestHeader("return-type", "binary");
693 xhr.setRequestHeader("Content-Type", "text/plain");
694 xhr.send();
695 //
696 if (xhr.readyState === 4) {
697 retValue.status = xhr.status;
698 if(xhr.status == 200) {
699 retValue.content = xhr.response;
700 }
701 retValue.success = true;
702 }
703 }
704 catch(error) {
705 xhr = null;
706 retValue.success = false;
707 }
708 }
709 //
710 return retValue;
711 }
712 },
713 ////////////////////////////////////////////////////////////////////
650 // Create a new directory/folder 714 // Create a new directory/folder
651 // Parameters: 715 // Parameters:
652 // the dir parameter must contain the following properties 716 // the dir parameter must contain the following properties
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index f78ad173..1680ca7f 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -146,7 +146,7 @@ exports.FileIo = Montage.create(Component, {
146 } 146 }
147 }, 147 },
148 //////////////////////////////////////////////////////////////////// 148 ////////////////////////////////////////////////////////////////////
149 // 149 //TODO: Add functionality
150 deleteFile: { 150 deleteFile: {
151 enumerable: true, 151 enumerable: true,
152 value: function() { 152 value: function() {
@@ -159,7 +159,7 @@ exports.FileIo = Montage.create(Component, {
159 } 159 }
160 }, 160 },
161 //////////////////////////////////////////////////////////////////// 161 ////////////////////////////////////////////////////////////////////
162 // 162 //TODO: Add functionality
163 copyFile: { 163 copyFile: {
164 enumerable: true, 164 enumerable: true,
165 value: function() { 165 value: function() {
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index 201598fc..78bdbe53 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -213,7 +213,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
213 xhr.responseType = "arraybuffer"; 213 xhr.responseType = "arraybuffer";
214 xhr.send(); 214 xhr.send();
215 //Checking for status 215 //Checking for status
216 if (xhr.readyState === 4) { //TODO: add check for mime type 216 if (xhr.readyState === 4) {
217 //Creating new file from loaded content 217 //Creating new file from loaded content
218 this.chromeApi.fileNew('/'+tocopylibs[i].name+'/'+tocopylibs[i].file, xhr.response, function (status) {if(status) this.libraryCopied()}.bind(this)); 218 this.chromeApi.fileNew('/'+tocopylibs[i].name+'/'+tocopylibs[i].file, xhr.response, function (status) {if(status) this.libraryCopied()}.bind(this));
219 } else { 219 } else {
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
index acc03979..21c4b58c 100644
--- a/js/io/templates/descriptor.json
+++ b/js/io/templates/descriptor.json
@@ -6,7 +6,7 @@
6 "name":"Blank File", 6 "name":"Blank File",
7 "uri":"/", 7 "uri":"/",
8 "type":"directory", 8 "type":"directory",
9 "children":["js/io/templates/files/html.txt", "js/io/templates/files/js.txt", "js/io/templates/files/css.txt", "js/io/templates/files/json.txt", "js/io/templates/files/php.txt", "js/io/templates/files/pl.txt", "js/io/templates/files/py.txt", "js/io/templates/files/rb.txt"] 9 "children":["js/io/templates/files/html.txt", "js/io/templates/files/js.txt", "js/io/templates/files/css.txt", "js/io/templates/files/json.txt", "js/io/templates/files/php.txt", "js/io/templates/files/pl.txt", "js/io/templates/files/py.txt", "js/io/templates/files/rb.txt", "js/io/templates/files/xml.txt"]
10 }, 10 },
11 "js/io/templates/files/html.txt":{ 11 "js/io/templates/files/html.txt":{
12 "name":"HTML", 12 "name":"HTML",
@@ -64,6 +64,13 @@
64 "fileExtension":".rb", 64 "fileExtension":".rb",
65 "children":["defaultTemplate"] 65 "children":["defaultTemplate"]
66 }, 66 },
67 "js/io/templates/files/xml.txt":{
68 "name":"XML",
69 "uri":"js/io/templates/files/xml.txt",
70 "type":"file",
71 "fileExtension":".xml",
72 "children":["defaultTemplate"]
73 },
67 "defaultTemplate":{ 74 "defaultTemplate":{
68 "name": "Basic", 75 "name": "Basic",
69 "uri": "defaultTemplate", 76 "uri": "defaultTemplate",
diff --git a/js/io/templates/files/html.txt b/js/io/templates/files/html.txt
index 15641348..4e42267e 100755
--- a/js/io/templates/files/html.txt
+++ b/js/io/templates/files/html.txt
@@ -9,6 +9,10 @@
9 <meta name="generator" content="Motorola Mobility Ninja"> 9 <meta name="generator" content="Motorola Mobility Ninja">
10 10
11 <style type="text/css"> 11 <style type="text/css">
12 html, body {
13 width: 100%;
14 height: 100%;
15 }
12 </style> 16 </style>
13 17
14 </head> 18 </head>
diff --git a/js/io/templates/files/xml.txt b/js/io/templates/files/xml.txt
new file mode 100644
index 00000000..8906a78b
--- /dev/null
+++ b/js/io/templates/files/xml.txt
@@ -0,0 +1 @@
<!-- Created with Motorola Mobility Ninja --> \ No newline at end of file
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.html b/js/io/ui/cloudpopup.reel/cloudpopup.html
index a75266a3..753597e7 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.html
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.html
@@ -28,7 +28,7 @@
28 28
29 <body> 29 <body>
30 30
31 <div id="cloud_popup" class="cloud_popup"> 31 <div data-montage-id="cloud_popup" class="cloud_popup">
32 <div class="content"> 32 <div class="content">
33 33
34 <h3>Cloud Service Dialog</h3> 34 <h3>Cloud Service Dialog</h3>
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
index 9113eb80..c3209654 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
@@ -30,9 +30,9 @@
30 </script> 30 </script>
31</head> 31</head>
32<body> 32<body>
33<div id="fileInputField" class="fileInputField"> 33<div data-montage-id="fileInputField" class="fileInputField">
34 <input type="search" id="newFileDirectory" class="nj-skinned newFileDirectory" /> 34 <input type="search" data-montage-id="newFileDirectory" class="nj-skinned newFileDirectory" />
35 <span id="findDirectory" class="findDirectory"></span> 35 <span data-montage-id="findDirectory" class="findDirectory"></span>
36</div> 36</div>
37</body> 37</body>
38</html> \ No newline at end of file 38</html> \ No newline at end of file
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html
index 7100a738..34d6b53a 100755
--- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html
+++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.html
@@ -38,41 +38,41 @@
38 38
39</head> 39</head>
40<body> 40<body>
41