Consolidated the two different forms for public URLs together into one. Made sure we could still import public docs while signed in.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2377 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
c07046f542
commit
39c6ae1b80
@ -59,12 +59,13 @@ Refine.GDataSourceUI.prototype.attachUI = function(body) {
|
||||
self._elmts.signinPage.show();
|
||||
});
|
||||
|
||||
var importURL1 = function(evt) {
|
||||
if ($.trim(self._elmts.urlInput1[0].value).length === 0) {
|
||||
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;
|
||||
var doc = { isPublic: true };
|
||||
doc.docSelfLink = url;
|
||||
if (doc.docSelfLink.contains('spreadsheet')) { // TODO: fragile?
|
||||
doc.type = 'spreadsheet';
|
||||
} else {
|
||||
@ -72,26 +73,7 @@ Refine.GDataSourceUI.prototype.attachUI = function(body) {
|
||||
}
|
||||
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);
|
||||
|
||||
});
|
||||
|
||||
this._body.find('.gdata-page').hide();
|
||||
this._elmts.signinPage.show();
|
||||
|
@ -1,31 +1,31 @@
|
||||
<div>
|
||||
<div bind="publicDocsPanel" class="gdata-panel">
|
||||
<h1>Public Documents</h1>
|
||||
<div class="grid-layout layout-tighter"><table>
|
||||
<tr><td colspan="2">Import a <em>public</em> Google Spreadsheet or Fusion Table by its URL:</td></tr>
|
||||
<tr bind="urlRow">
|
||||
<td><input bind="urlInput" name="download" class="default-importing-web-url" /></td>
|
||||
<td><button bind="urlNextButton" class="button button-primary" type="button">Next »</button></td>
|
||||
</tr>
|
||||
</table></div>
|
||||
</div>
|
||||
|
||||
<div bind="authorizedDocsPanel" class="gdata-panel">
|
||||
<h1>Authorized Documents</h1>
|
||||
|
||||
<div bind="signinPage" class="gdata-page">
|
||||
<p>Please <button class="gdata-signin button button-primary">sign in and authorize</button>
|
||||
access to your Google data.</p></tr>
|
||||
<form bind="form"><div class="grid-layout layout-normal"><table>
|
||||
<tr><td colspan="2">Or enter web address (URL) of a <em>public</em> Google Spreadsheet or Fusion Table below and click Next:</td></tr>
|
||||
<tr bind="urlRow"><td colspan="2"><input bind="urlInput1" name="download" class="default-importing-web-url" /></td></tr>
|
||||
<tr bind="buttons">
|
||||
<td><button bind="urlNextButton1" class="button button-primary" type="button">Next »</button></td>
|
||||
</tr>
|
||||
</table></div></form>
|
||||
access to your Google data.</p>
|
||||
</div>
|
||||
<div bind="progressPage" class="gdata-page">
|
||||
<p><img src="images/large-spinner.gif" /> Retrieving Google Docs documents ...</p>
|
||||
</div>
|
||||
<div bind="listingPage" class="gdata-page grid-layout layout-full layout-normal"><table>
|
||||
<div bind="listingPage" class="gdata-page grid-layout layout-normal"><table>
|
||||
<tr>
|
||||
<td>Google Docs documents</td>
|
||||
<td style="text-align: center;"><button class="gdata-signin button">re-sign in</button> with another account</td>
|
||||
<td style="text-align: right;"><button class="gdata-signout button">sign out</button></td>
|
||||
<td width="%"><button class="gdata-signout button">sign out</button></td>
|
||||
<td><button class="gdata-signin button">re-sign in</button> with another account</td>
|
||||
</tr>
|
||||
<tr><td colspan="2">Click one of the documents below or enter the web address (URL) of a <em>public</em> Google Spreadsheet or Fusion Table and click "Next":</td></tr>
|
||||
<tr bind="urlRow"><td colspan="2">
|
||||
<form bind="form">
|
||||
<input bind="urlInput2" name="download" class="default-importing-web-url" /></td>
|
||||
</form>
|
||||
<td bind="buttons"><button bind="urlNextButton2" class="button button-primary" type="button">Next »</button></td>
|
||||
</tr>
|
||||
<tr><td colspan="3"><div bind="listingContainer" class="grid-layout layout-tight gdata-document-container"></div></td></tr>
|
||||
<tr><td colspan="2"><div bind="listingContainer" class="grid-layout layout-tight gdata-document-container"></div></td></tr>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
@ -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) {
|
||||
|
@ -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%;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user