diff --git a/extensions/gdata/module/scripts/index/gdata-source-ui.js b/extensions/gdata/module/scripts/index/gdata-source-ui.js index a940a3e16..9d3656707 100644 --- a/extensions/gdata/module/scripts/index/gdata-source-ui.js +++ b/extensions/gdata/module/scripts/index/gdata-source-ui.js @@ -59,39 +59,21 @@ Refine.GDataSourceUI.prototype.attachUI = function(body) { self._elmts.signinPage.show(); }); - var importURL1 = function(evt) { - if ($.trim(self._elmts.urlInput1[0].value).length === 0) { - window.alert("You must specify a web address (URL) to import."); + this._elmts.urlNextButton.click(function(evt) { + var url = $.trim(self._elmts.urlInput[0].value); + if (url.length === 0) { + window.alert("You must specify a web address (URL) to import."); } else { - var doc={} - doc.docSelfLink = self._elmts.urlInput1[0].value; - if (doc.docSelfLink.contains('spreadsheet')) { // TODO: fragile? - doc.type = 'spreadsheet'; - } else { - doc.type = 'table'; - } - self._controller.startImportingDocument(doc); - } - } - // TODO: Consolidate these two URL input forms - var importURL2 = function(evt) { - if ($.trim(self._elmts.urlInput2[0].value).length === 0) { - window.alert("You must specify a web address (URL) to import."); - } else { - var doc={} - doc.docSelfLink = self._elmts.urlInput2[0].value; - if (doc.docSelfLink.contains('spreadsheet')) { // TODO: fragile? - doc.type = 'spreadsheet'; - } else { - doc.type = 'table'; - } - self._controller.startImportingDocument(doc); - } - } - - this._elmts.urlNextButton1.click(importURL1); - this._elmts.urlNextButton2.click(importURL2); - + var doc = { isPublic: true }; + doc.docSelfLink = url; + if (doc.docSelfLink.contains('spreadsheet')) { // TODO: fragile? + doc.type = 'spreadsheet'; + } else { + doc.type = 'table'; + } + self._controller.startImportingDocument(doc); + } + }); this._body.find('.gdata-page').hide(); this._elmts.signinPage.show(); diff --git a/extensions/gdata/module/scripts/index/import-from-gdata-form.html b/extensions/gdata/module/scripts/index/import-from-gdata-form.html index e0ab296a8..eb69291d1 100644 --- a/extensions/gdata/module/scripts/index/import-from-gdata-form.html +++ b/extensions/gdata/module/scripts/index/import-from-gdata-form.html @@ -1,31 +1,31 @@
-
-

Please - access to your Google data.

-
- - - - - -
Or enter web address (URL) of a public Google Spreadsheet or Fusion Table below and click Next:
+
+

Public Documents

+
+ + + + + +
Import a public Google Spreadsheet or Fusion Table by its URL:
-
-

Retrieving Google Docs documents ...

+ +
+

Authorized Documents

+ +
+

Please + access to your Google data.

+
+
+

Retrieving Google Docs documents ...

+
+
+ + + + + +
with another account
-
- - - - - - - - - - - -
Google Docs documents with another account
Click one of the documents below or enter the web address (URL) of a public Google Spreadsheet or Fusion Table and click "Next":
-
-
\ No newline at end of file diff --git a/extensions/gdata/module/scripts/index/importing-controller.js b/extensions/gdata/module/scripts/index/importing-controller.js index 0ceacb9f5..e941aa2f7 100644 --- a/extensions/gdata/module/scripts/index/importing-controller.js +++ b/extensions/gdata/module/scripts/index/importing-controller.js @@ -57,7 +57,8 @@ Refine.GDataImportingController.prototype.startImportingDocument = function(doc) "controller": "gdata/gdata-importing-controller", "subCommand": "initialize-parser-ui", "docUrl": doc.docSelfLink, - "docType": doc.type + "docType": doc.type, + "isPublic": (doc.isPublic) }), null, function(data2) { diff --git a/extensions/gdata/module/styles/importing-controller.less b/extensions/gdata/module/styles/importing-controller.less index 672f07dd3..2b55a7c90 100644 --- a/extensions/gdata/module/styles/importing-controller.less +++ b/extensions/gdata/module/styles/importing-controller.less @@ -33,6 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @import-less url("theme.less"); +.gdata-panel { + margin-bottom: 2em; +} +.gdata-panel > h1 { + font-size: 130%; + margin-bottom: 0.5em; +} + .gdata-extension-signin-iframe { border: 1px solid #aaa; width: 100%; diff --git a/extensions/gdata/src/com/google/refine/extension/gdata/GDataImportingController.java b/extensions/gdata/src/com/google/refine/extension/gdata/GDataImportingController.java index 9fbc3494d..17f4183b5 100644 --- a/extensions/gdata/src/com/google/refine/extension/gdata/GDataImportingController.java +++ b/extensions/gdata/src/com/google/refine/extension/gdata/GDataImportingController.java @@ -195,10 +195,12 @@ public class GDataImportingController implements ImportingController { HttpServletRequest request, HttpServletResponse response, Properties parameters) throws ServletException, IOException { - String token = TokenCookie.getToken(request); // authorization token, if logged in - String type = parameters.getProperty("docType"); String urlString = parameters.getProperty("docUrl"); + boolean isPublic = "true".equals(parameters.getProperty("isPublic")); + + String token = isPublic ? null : TokenCookie.getToken(request); // authorization token, if logged in + URL url = new URL(urlString); try { JSONObject result = new JSONObject();