aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/io/system/coreioapi.js58
-rwxr-xr-xjs/io/system/fileio.js8
-rwxr-xr-xjs/io/templates/files/_bin/template.css (renamed from js/io/templates/files/template.css)0
-rwxr-xr-xjs/io/templates/files/_bin/template.html (renamed from js/io/templates/files/template.html)0
-rwxr-xr-xjs/io/templates/files/_bin/template.js (renamed from js/io/templates/files/template.js)0
-rwxr-xr-xjs/io/templates/files/_bin/template.json (renamed from js/io/templates/files/template.json)0
-rwxr-xr-xjs/io/templates/files/_bin/template.php (renamed from js/io/templates/files/template.php)0
-rwxr-xr-xjs/io/templates/files/_bin/template.pl (renamed from js/io/templates/files/template.pl)0
-rwxr-xr-xjs/io/templates/files/_bin/template.py (renamed from js/io/templates/files/template.py)0
-rwxr-xr-xjs/io/templates/files/_bin/template.rb (renamed from js/io/templates/files/template.rb)0
-rwxr-xr-xjs/io/templates/files/_bin/template.xml (renamed from js/io/templates/files/template.xml)0
-rwxr-xr-xjs/io/templates/files/_bin/xml.txt (renamed from js/io/templates/files/xml.txt)0
-rwxr-xr-xjs/io/templates/files/css.txt2
-rwxr-xr-xjs/io/templates/files/html.txt19
-rwxr-xr-xjs/io/templates/files/js.txt1
-rwxr-xr-xjs/io/templates/files/php.txt3
-rwxr-xr-xjs/io/templates/files/pl.txt1
-rwxr-xr-xjs/io/templates/files/py.txt1
-rwxr-xr-xjs/io/templates/files/rb.txt1
19 files changed, 79 insertions, 15 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index a10063f5..33c7bc28 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -24,7 +24,7 @@ exports.CoreIoApi = Montage.create(Component, {
24 //Getting URL from local storage 24 //Getting URL from local storage
25 this.rootUrl = window.localStorage['ioRootUrl']; 25 this.rootUrl = window.localStorage['ioRootUrl'];
26 //Checks for IO API to be active 26 //Checks for IO API to be active
27 this.ioServiceDetected = this.isIoServiceActive(); 27 this.ioServiceDetected = this.cloudAvailable();
28 // 28 //
29 console.log('FileIO: localStorage URL detected | IO Service Detected: '+ this.ioServiceDetected); 29 console.log('FileIO: localStorage URL detected | IO Service Detected: '+ this.ioServiceDetected);
30 // 30 //
@@ -32,7 +32,7 @@ exports.CoreIoApi = Montage.create(Component, {
32 //TODO: Remove, automatically prompt user on welcome 32 //TODO: Remove, automatically prompt user on welcome
33 this.rootUrl = 'http://localhost:16380'; 33 this.rootUrl = 'http://localhost:16380';
34 //TODO: Changed to false, welcome screen prompts user 34 //TODO: Changed to false, welcome screen prompts user
35 this.ioServiceDetected = this.isIoServiceActive(); 35 this.ioServiceDetected = this.cloudAvailable();
36 // 36 //
37 console.log('FileIO: localStorage URL NOT detected | IO Service Detected: '+ this.ioServiceDetected); 37 console.log('FileIO: localStorage URL NOT detected | IO Service Detected: '+ this.ioServiceDetected);
38 // 38 //
@@ -41,13 +41,16 @@ exports.CoreIoApi = Montage.create(Component, {
41 }, 41 },
42 //////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////
43 //Method to check status of I/O API, will return false if not active 43 //Method to check status of I/O API, will return false if not active
44 isIoServiceActive: { 44 cloudAvailable: {
45 enumerable: false, 45 enumerable: false,
46 value: function () { 46 value: function () {
47 //Doing a directory root check, a 200 status means running 47 //
48 if (this.getDirectoryContents({uri:'/'}).status === 200) { 48 if (this.getCloudStatus().status === 200) {
49 //Active
49 return true; 50 return true;
50 } else { 51 } else {
52 //Inactive
53 //TODO: Logic to prompt the user for cloud, otherwise return false
51 return false; 54 return false;
52 } 55 }
53 } 56 }
@@ -83,22 +86,21 @@ exports.CoreIoApi = Montage.create(Component, {
83 return this._rootUrl; 86 return this._rootUrl;
84 }, 87 },
85 set: function(value) { 88 set: function(value) {
86 this._rootUrl = value; 89 this._rootUrl = window.localStorage["ioRootUrl"] = value;
87 window.localStorage["ioRootUrl"] = value;
88 } 90 }
89 }, 91 },
90 //////////////////////////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////
91 //API service URL 93 //API service URL
92 _apiServiceURL: { 94 _apiServiceURL: {
93 enumerable: false, 95 enumerable: false,
94 value: '/' 96 value: '/cloudstatus'
95 }, 97 },
96 //////////////////////////////////////////////////////////////////// 98 ////////////////////////////////////////////////////////////////////
97 // 99 //
98 apiServiceURL: { 100 apiServiceURL: {
99 enumerable: false, 101 enumerable: false,
100 get: function() { 102 get: function() {
101 return this.rootUrl+this._apiServiceURL; 103 return String(this.rootUrl+this._apiServiceURL);
102 }, 104 },
103 set: function(value) { 105 set: function(value) {
104 this._apiServiceURL = value; 106 this._apiServiceURL = value;
@@ -115,7 +117,7 @@ exports.CoreIoApi = Montage.create(Component, {
115 fileServiceURL: { 117 fileServiceURL: {
116 enumerable: false, 118 enumerable: false,
117 get: function() { 119 get: function() {
118 return this.rootUrl+this._fileServiceURL; 120 return String(this.rootUrl+this._fileServiceURL);
119 }, 121 },
120 set: function(value) { 122 set: function(value) {
121 this._fileServiceURL = value; 123 this._fileServiceURL = value;
@@ -132,7 +134,7 @@ exports.CoreIoApi = Montage.create(Component, {
132 directoryServiceURL: { 134 directoryServiceURL: {
133 enumerable: false, 135 enumerable: false,
134 get: function() { 136 get: function() {
135 return this.rootUrl+this._directoryServiceURL; 137 return String(this.rootUrl+this._directoryServiceURL);
136 }, 138 },
137 set: function(value) { 139 set: function(value) {
138 this._directoryServiceURL = value; 140 this._directoryServiceURL = value;
@@ -921,10 +923,38 @@ exports.CoreIoApi = Montage.create(Component, {
921 } 923 }
922 return retValue; 924 return retValue;
923 } 925 }
926 },
927 ////////////////////////////////////////////////////////////////////
928 //
929 getCloudStatus: {
930 enumerable: false,
931 writable:false,
932 value: function() {
933 //
934 var retValue = {success:null, status:null};
935 //
936 try {
937 var serviceURL = this._prepareServiceURL(this.apiServiceURL, '/'),
938 xhr = new XMLHttpRequest();
939 //
940 xhr.open("GET", serviceURL, false);
941 xhr.send();
942 //
943 if (xhr.readyState === 4) {
944 retValue.status = xhr.status;
945 retValue.success = true;
946 }
947 }
948 catch(error) {
949 xhr = null;
950 retValue.success = false;
951 }
952 //
953 return retValue;
954 }
924 } 955 }
925 956 ////////////////////////////////////////////////////////////////////
926 957 ////////////////////////////////////////////////////////////////////
927
928}); 958});
929//////////////////////////////////////////////////////////////////////// 959////////////////////////////////////////////////////////////////////////
930//////////////////////////////////////////////////////////////////////// \ No newline at end of file 960//////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index b3158a68..38ab05e8 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -28,7 +28,7 @@ exports.FileIo = Montage.create(Object.prototype, {
28 enumerable: true, 28 enumerable: true,
29 value: function(file) { 29 value: function(file) {
30 //Checking for API to be available 30 //Checking for API to be available
31 if (!CoreIoApi.isIoServiceActive()) { 31 if (!CoreIoApi.cloudAvailable()) {
32 //API not available, no IO action taken 32 //API not available, no IO action taken
33 return null; 33 return null;
34 } 34 }
@@ -78,6 +78,12 @@ exports.FileIo = Montage.create(Object.prototype, {
78 value: function() { 78 value: function() {
79 // 79 //
80 } 80 }
81 },
82 infoFile: {
83 enumerable: true,
84 value: function() {
85 //
86 }
81 } 87 }
82 88
83 89
diff --git a/js/io/templates/files/template.css b/js/io/templates/files/_bin/template.css
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.css
+++ b/js/io/templates/files/_bin/template.css
diff --git a/js/io/templates/files/template.html b/js/io/templates/files/_bin/template.html
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.html
+++ b/js/io/templates/files/_bin/template.html
diff --git a/js/io/templates/files/template.js b/js/io/templates/files/_bin/template.js
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.js
+++ b/js/io/templates/files/_bin/template.js
diff --git a/js/io/templates/files/template.json b/js/io/templates/files/_bin/template.json
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.json
+++ b/js/io/templates/files/_bin/template.json
diff --git a/js/io/templates/files/template.php b/js/io/templates/files/_bin/template.php
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.php
+++ b/js/io/templates/files/_bin/template.php
diff --git a/js/io/templates/files/template.pl b/js/io/templates/files/_bin/template.pl
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.pl
+++ b/js/io/templates/files/_bin/template.pl
diff --git a/js/io/templates/files/template.py b/js/io/templates/files/_bin/template.py
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.py
+++ b/js/io/templates/files/_bin/template.py
diff --git a/js/io/templates/files/template.rb b/js/io/templates/files/_bin/template.rb
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.rb
+++ b/js/io/templates/files/_bin/template.rb
diff --git a/js/io/templates/files/template.xml b/js/io/templates/files/_bin/template.xml
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/template.xml
+++ b/js/io/templates/files/_bin/template.xml
diff --git a/js/io/templates/files/xml.txt b/js/io/templates/files/_bin/xml.txt
index e69de29b..e69de29b 100755
--- a/js/io/templates/files/xml.txt
+++ b/js/io/templates/files/_bin/xml.txt
diff --git a/js/io/templates/files/css.txt b/js/io/templates/files/css.txt
index e69de29b..07da1f8a 100755
--- a/js/io/templates/files/css.txt
+++ b/js/io/templates/files/css.txt
@@ -0,0 +1,2 @@
1@charset "UTF-8";
2/* Created with Motorola Mobility Ninja */
diff --git a/js/io/templates/files/html.txt b/js/io/templates/files/html.txt
index e69de29b..15641348 100755
--- a/js/io/templates/files/html.txt
+++ b/js/io/templates/files/html.txt
@@ -0,0 +1,19 @@
1<html>
2
3 <head>