function FreebaseLoadingDialog() {
this._createDialog();
}
FreebaseLoadingDialog.prototype._createDialog = function() {
var self = this;
var frame = DialogSystem.createDialog();
frame.width("800px");
var header = $('
').addClass("dialog-header").text('Load Data into Freebase').appendTo(frame);
var body = $('').addClass("dialog-body").appendTo(frame);
var footer = $(
''
).appendTo(frame);
this._elmts = DOM.bind(frame);
var left_footer = this._elmts.left;
var center_footer = this._elmts.center;
var right_footer = this._elmts.right;
var cancel_button = $('').text("Cancel").click(function() {
self._dismiss();
}).appendTo(left_footer);
var authorization = $('
').addClass("freebase-loading-authorization").hide().appendTo(center_footer);
var selector = $('').addClass("freebase-loading-graph-selector").html("Load this data into " +
'' +
''
).buttonset().appendTo(right_footer);
var load_button = $('').text("Load").appendTo(right_footer);
var provider = "www.freebase.com";
var check_authorization = function(autoload) {
$.get("/command/check-authorization/" + provider, function(data) {
if ("status" in data && data.status == "200 OK") {
authorization.html('Signed in as: ' + data.username + ' | Sign Out').show();
DOM.bind(authorization).signout.click(function() {
Sign.signout(check_authorization,provider);
});
if (autoload) {
self._load();
} else {
load_button.unbind().click(function() {
self._load();
});
}
} else {
authorization.html("").hide();
load_button.unbind().click(function() {
Sign.signin(function() {
check_authorization(true);
},provider);
});
}
},"json");
};
$.post(
"/command/export-rows",
{
project: theProject.id,
format : "tripleloader"
},
function(data) {
if (data == null || data == "") {
body.html(
'
'+
'
This dataset has no triples
' +
'
Have you aligned it with the Freebase schemas yet?