2010-01-26 06:17:14 +01:00
|
|
|
var theProject;
|
|
|
|
var ui = {};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
var Refine = {
|
2010-10-07 02:14:43 +02:00
|
|
|
refineHelperService: "http://1.refine-helper.stefanomazzocchi.user.dev.freebaseapps.com"
|
2010-02-26 22:56:41 +01:00
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reportException = function(e) {
|
2010-02-26 22:56:41 +01:00
|
|
|
if (window.console) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-04-09 03:48:50 +02:00
|
|
|
function resize() {
|
|
|
|
var header = $("#header");
|
|
|
|
|
2010-04-13 01:48:48 +02:00
|
|
|
var leftPanelWidth = 300;
|
2010-04-09 03:48:50 +02:00
|
|
|
var width = $(window).width();
|
2010-10-02 04:06:01 +02:00
|
|
|
var top = $("#header").outerHeight();
|
2010-04-25 03:41:09 +02:00
|
|
|
var height = $(window).height() - top;
|
2010-04-09 03:48:50 +02:00
|
|
|
|
2010-10-15 06:53:05 +02:00
|
|
|
var leftPanelPaddings = ui.leftPanel.outerHeight(true) - ui.leftPanel.height();
|
2010-10-02 04:06:01 +02:00
|
|
|
ui.leftPanel
|
2010-04-09 03:48:50 +02:00
|
|
|
.css("top", top + "px")
|
2010-10-02 04:06:01 +02:00
|
|
|
.css("left", "0px")
|
2010-10-15 06:53:05 +02:00
|
|
|
.css("height", (height - leftPanelPaddings) + "px")
|
2010-10-02 04:06:01 +02:00
|
|
|
.css("width", leftPanelWidth + "px");
|
2010-02-27 01:16:44 +01:00
|
|
|
|
2010-10-02 04:06:01 +02:00
|
|
|
var leftPanelTabsPaddings = ui.leftPanelTabs.outerHeight(true) - ui.leftPanelTabs.height();
|
2010-10-15 06:53:05 +02:00
|
|
|
ui.leftPanelTabs.height(ui.leftPanel.height() - leftPanelTabsPaddings);
|
2010-10-02 04:06:01 +02:00
|
|
|
|
|
|
|
var rightPanelVPaddings = ui.rightPanel.outerHeight(true) - ui.rightPanel.height();
|
|
|
|
var rightPanelHPaddings = ui.rightPanel.outerWidth(true) - ui.rightPanel.width();
|
|
|
|
ui.rightPanel
|
|
|
|
.css("top", top + "px")
|
|
|
|
.css("left", leftPanelWidth + "px")
|
|
|
|
.css("height", (height - rightPanelVPaddings) + "px")
|
|
|
|
.css("width", (width - leftPanelWidth - rightPanelHPaddings) + "px");
|
|
|
|
|
|
|
|
ui.viewPanel.height((height - ui.toolPanel.outerHeight() - rightPanelVPaddings) + "px");
|
|
|
|
|
2010-04-09 03:48:50 +02:00
|
|
|
var processPanelWidth = 400;
|
|
|
|
ui.processPanel
|
|
|
|
.css("width", processPanelWidth + "px")
|
|
|
|
.css("left", Math.floor((width - processPanelWidth) / 2) + "px");
|
|
|
|
}
|
|
|
|
|
2010-04-13 01:48:48 +02:00
|
|
|
function resizeTabs() {
|
2010-04-17 01:38:49 +02:00
|
|
|
var totalHeight = ui.leftPanel.height();
|
|
|
|
var headerHeight = ui.leftPanelTabs.find(".ui-tabs-nav").outerHeight(true);
|
|
|
|
|
|
|
|
var visibleTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel:not(.ui-tabs-hide)");
|
2010-10-02 04:06:01 +02:00
|
|
|
var paddings = visibleTabPanels.outerHeight(true) - visibleTabPanels.height();
|
2010-04-17 01:38:49 +02:00
|
|
|
|
|
|
|
var allTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel");
|
|
|
|
allTabPanels.height(totalHeight - headerHeight - paddings - 1);
|
2010-04-13 01:48:48 +02:00
|
|
|
}
|
|
|
|
|
2010-04-09 03:48:50 +02:00
|
|
|
function resizeAll() {
|
|
|
|
resize();
|
2010-04-13 01:48:48 +02:00
|
|
|
resizeTabs();
|
2010-10-02 04:06:01 +02:00
|
|
|
ui.extensionBar.resize();
|
2010-04-09 03:48:50 +02:00
|
|
|
ui.browsingEngine.resize();
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.processPanel.resize();
|
|
|
|
ui.historyPanel.resize();
|
2010-04-09 03:48:50 +02:00
|
|
|
ui.dataTableView.resize();
|
2010-01-25 23:51:25 +01:00
|
|
|
}
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-27 01:16:44 +01:00
|
|
|
function initializeUI(uiState) {
|
2010-10-02 04:06:01 +02:00
|
|
|
$("#loading-message").hide();
|
2010-10-14 19:39:41 +02:00
|
|
|
$("#project-title").show();
|
|
|
|
$("#project-controls").show();
|
2010-10-02 04:06:01 +02:00
|
|
|
$("#body").show();
|
|
|
|
|
|
|
|
$('#project-name-button').click(Refine._renameProject);
|
|
|
|
$('#project-permalink-button').mouseenter(function() {
|
|
|
|
this.href = Refine.getPermanentLink();
|
|
|
|
});
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.setTitle();
|
2010-05-17 21:22:58 +02:00
|
|
|
|
2010-10-02 04:06:01 +02:00
|
|
|
ui = DOM.bind($("#body"));
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-10-02 04:06:01 +02:00
|
|
|
ui.extensionBar = new ExtensionBar(ui.extensionBar); // construct the menu first so we can resize everything else
|
|
|
|
ui.exporterManager = new ExporterManager($("#export-button"));
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-04-13 09:08:23 +02:00
|
|
|
ui.leftPanelTabs.tabs({ selected: 0 });
|
2010-03-22 22:48:36 +01:00
|
|
|
resize();
|
2010-04-13 01:48:48 +02:00
|
|
|
resizeTabs();
|
|
|
|
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.summaryBar = new SummaryBar(ui.summaryBar);
|
2010-02-27 01:16:44 +01:00
|
|
|
ui.browsingEngine = new BrowsingEngine(ui.facetPanel, uiState.facets || []);
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.processPanel = new ProcessPanel(ui.processPanel);
|
|
|
|
ui.historyPanel = new HistoryPanel(ui.historyPanel, ui.historyTabHeader);
|
2010-01-29 01:46:15 +01:00
|
|
|
ui.dataTableView = new DataTableView(ui.viewPanel);
|
2010-03-22 22:48:36 +01:00
|
|
|
|
2010-04-13 09:08:23 +02:00
|
|
|
ui.leftPanelTabs.bind('tabsshow', function(event, tabs) {
|
|
|
|
if (tabs.index === 0) {
|
|
|
|
ui.browsingEngine.resize();
|
|
|
|
} else if (tabs.index === 1) {
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.historyPanel.resize();
|
2010-04-13 09:08:23 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-03-22 22:48:36 +01:00
|
|
|
$(window).bind("resize", resizeAll);
|
2010-05-14 21:27:01 +02:00
|
|
|
|
|
|
|
if (uiState.facets) {
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.update({ engineChanged: true });
|
2010-05-14 21:27:01 +02:00
|
|
|
}
|
2010-03-22 22:48:36 +01:00
|
|
|
}
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.setTitle = function(status) {
|
2010-09-23 01:59:57 +02:00
|
|
|
var title = theProject.metadata.name + " - Google Refine";
|
2010-05-01 00:49:59 +02:00
|
|
|
if (status) {
|
|
|
|
title = status + " - " + title;
|
|
|
|
}
|
|
|
|
document.title = title;
|
2010-05-17 21:22:58 +02:00
|
|
|
|
2010-10-02 04:06:01 +02:00
|
|
|
$("#project-name-button").text(theProject.metadata.name);
|
2010-05-01 00:49:59 +02:00
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reinitializeProjectData = function(f) {
|
2010-02-05 00:38:40 +01:00
|
|
|
Ajax.chainGetJSON(
|
2010-08-22 08:16:13 +02:00
|
|
|
"/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
2010-02-05 00:38:40 +01:00
|
|
|
function(data) {
|
|
|
|
theProject.metadata = data;
|
|
|
|
},
|
2010-08-22 08:16:13 +02:00
|
|
|
"/command/core/get-models?" + $.param({ project: theProject.id }), null,
|
2010-02-05 00:38:40 +01:00
|
|
|
function(data) {
|
2010-05-20 07:49:13 +02:00
|
|
|
for (var n in data) {
|
|
|
|
if (data.hasOwnProperty(n)) {
|
|
|
|
theProject[n] = data[n];
|
|
|
|
}
|
2010-02-05 00:38:40 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
f
|
|
|
|
);
|
2010-04-08 21:52:23 +02:00
|
|
|
};
|
2010-02-22 21:25:45 +01:00
|
|
|
|
2010-10-02 04:06:01 +02:00
|
|
|
Refine._renameProject = function() {
|
2010-10-14 19:39:41 +02:00
|
|
|
var name = window.prompt("New project name:", theProject.metadata.name);
|
2010-10-02 04:06:01 +02:00
|
|
|
if (name == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
name = $.trim(name);
|
|
|
|
if (theProject.metadata.name == name || name.length == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "/command/core/rename-project",
|
|
|
|
data: { "project" : theProject.id, "name" : name },
|
|
|
|
dataType: "json",
|
|
|
|
success: function (data) {
|
|
|
|
if (data && typeof data.code != 'undefined' && data.code == "ok") {
|
|
|
|
theProject.metadata.name = name;
|
|
|
|
Refine.setTitle();
|
|
|
|
} else {
|
|
|
|
alert("Failed to rename project: " + data.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
/*
|
|
|
|
* Utility state functions
|
|
|
|
*/
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.createUpdateFunction = function(options, onFinallyDone) {
|
2010-02-26 22:56:41 +01:00
|
|
|
var functions = [];
|
|
|
|
var pushFunction = function(f) {
|
|
|
|
var index = functions.length;
|
|
|
|
functions.push(function() {
|
|
|
|
f(functions[index + 1]);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
pushFunction(function(onDone) {
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.historyPanel.update(onDone);
|
2010-02-26 22:56:41 +01:00
|
|
|
});
|
2010-04-09 03:14:33 +02:00
|
|
|
if (options.everythingChanged || options.modelsChanged || options.columnStatsChanged) {
|
2010-09-23 00:55:28 +02:00
|
|
|
pushFunction(Refine.reinitializeProjectData);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
2010-04-09 03:14:33 +02:00
|
|
|
if (options.everythingChanged || options.modelsChanged || options.rowsChanged || options.rowMetadataChanged || options.cellsChanged || options.engineChanged) {
|
2010-02-26 22:56:41 +01:00
|
|
|
pushFunction(function(onDone) {
|
|
|
|
ui.dataTableView.update(onDone);
|
|
|
|
});
|
|
|
|
pushFunction(function(onDone) {
|
|
|
|
ui.browsingEngine.update(onDone);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
functions.push(onFinallyDone || function() {});
|
|
|
|
|
|
|
|
return functions[0];
|
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.update = function(options, onFinallyDone) {
|
2010-02-26 22:56:41 +01:00
|
|
|
var done = false;
|
|
|
|
var dismissBusy = null;
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.setAjaxInProgress();
|
2010-04-07 23:31:50 +02:00
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.createUpdateFunction(options, function() {
|
|
|
|
Refine.clearAjaxInProgress();
|
2010-04-07 23:31:50 +02:00
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
done = true;
|
|
|
|
if (dismissBusy) {
|
|
|
|
dismissBusy();
|
|
|
|
}
|
|
|
|
if (onFinallyDone) {
|
|
|
|
onFinallyDone();
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
|
|
|
|
window.setTimeout(function() {
|
|
|
|
if (!done) {
|
|
|
|
dismissBusy = DialogSystem.showBusy();
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.postCoreProcess = function(command, params, body, updateOptions, callbacks) {
|
|
|
|
Refine.postProcess("core", command, params, body, updateOptions, callbacks);
|
2010-08-22 08:16:13 +02:00
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.postProcess = function(moduleName, command, params, body, updateOptions, callbacks) {
|
2010-04-09 00:16:12 +02:00
|
|
|
updateOptions = updateOptions || {};
|
|
|
|
callbacks = callbacks || {};
|
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
params = params || {};
|
|
|
|
params.project = theProject.id;
|
|
|
|
|
|
|
|
body = body || {};
|
2010-04-09 00:16:12 +02:00
|
|
|
if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
|
2010-04-29 02:54:48 +02:00
|
|
|
body.engine = JSON.stringify(
|
|
|
|
"engineConfig" in updateOptions ?
|
|
|
|
updateOptions.engineConfig :
|
|
|
|
ui.browsingEngine.getJSON()
|
|
|
|
);
|
2010-04-09 00:16:12 +02:00
|
|
|
}
|
2010-02-26 22:56:41 +01:00
|
|
|
|
|
|
|
var done = false;
|
|
|
|
var dismissBusy = null;
|
|
|
|
|
|
|
|
function onDone(o) {
|
|
|
|
done = true;
|
|
|
|
if (dismissBusy) {
|
|
|
|
dismissBusy();
|
|
|
|
}
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.clearAjaxInProgress();
|
2010-04-07 23:31:50 +02:00
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
if (o.code == "error") {
|
|
|
|
if ("onError" in callbacks) {
|
|
|
|
try {
|
2010-04-09 03:14:33 +02:00
|
|
|
callbacks.onError(o);
|
2010-02-26 22:56:41 +01:00
|
|
|
} catch (e) {
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reportException(e);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
2010-08-01 06:44:21 +02:00
|
|
|
} else {
|
|
|
|
alert(o.message);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ("onDone" in callbacks) {
|
|
|
|
try {
|
2010-04-09 03:14:33 +02:00
|
|
|
callbacks.onDone(o);
|
2010-02-26 22:56:41 +01:00
|
|
|
} catch (e) {
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reportException(e);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (o.code == "ok") {
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.update(updateOptions, callbacks.onFinallyDone);
|
2010-03-23 01:26:28 +01:00
|
|
|
|
|
|
|
if ("historyEntry" in o) {
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.processPanel.showUndo(o.historyEntry);
|
2010-03-23 01:26:28 +01:00
|
|
|
}
|
2010-02-26 22:56:41 +01:00
|
|
|
} else if (o.code == "pending") {
|
|
|
|
if ("onPending" in callbacks) {
|
|
|
|
try {
|
2010-04-09 03:14:33 +02:00
|
|
|
callbacks.onPending(o);
|
2010-02-26 22:56:41 +01:00
|
|
|
} catch (e) {
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reportException(e);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
|
|
|
}
|
2010-10-17 08:23:58 +02:00
|
|
|
ui.processPanel.update(updateOptions, callbacks.onFinallyDone);
|
2010-02-26 22:56:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.setAjaxInProgress();
|
2010-04-07 23:31:50 +02:00
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
$.post(
|
2010-08-22 08:16:13 +02:00
|
|
|
"/command/" + moduleName + "/" + command + "?" + $.param(params),
|
2010-02-26 22:56:41 +01:00
|
|
|
body,
|
|
|
|
onDone,
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
|
|
|
|
window.setTimeout(function() {
|
|
|
|
if (!done) {
|
|
|
|
dismissBusy = DialogSystem.showBusy();
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.setAjaxInProgress = function() {
|
2010-04-07 23:31:50 +02:00
|
|
|
$(document.body).attr("ajax_in_progress", "true");
|
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.clearAjaxInProgress = function() {
|
2010-04-07 23:31:50 +02:00
|
|
|
$(document.body).attr("ajax_in_progress", "false");
|
|
|
|
};
|
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
/*
|
|
|
|
* Utility model functions
|
|
|
|
*/
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.cellIndexToColumn = function(cellIndex) {
|
2010-02-22 21:25:45 +01:00
|
|
|
var columns = theProject.columnModel.columns;
|
|
|
|
for (var i = 0; i < columns.length; i++) {
|
|
|
|
var column = columns[i];
|
2010-02-26 22:56:41 +01:00
|
|
|
if (column.cellIndex == cellIndex) {
|
2010-02-22 21:25:45 +01:00
|
|
|
return column;
|
2010-04-24 03:19:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.columnNameToColumn = function(columnName) {
|
2010-04-24 03:19:13 +02:00
|
|
|
var columns = theProject.columnModel.columns;
|
|
|
|
for (var i = 0; i < columns.length; i++) {
|
|
|
|
var column = columns[i];
|
|
|
|
if (column.name == columnName) {
|
|
|
|
return column;
|
2010-02-22 21:25:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
2010-02-26 22:56:41 +01:00
|
|
|
};
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.columnNameToColumnIndex = function(columnName) {
|
2010-08-07 03:24:48 +02:00
|
|
|
var columns = theProject.columnModel.columns;
|
|
|
|
for (var i = 0; i < columns.length; i++) {
|
|
|
|
var column = columns[i];
|
|
|
|
if (column.name == columnName) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
};
|
2010-02-26 22:56:41 +01:00
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.preparePool = function(pool) {
|
2010-04-23 21:39:12 +02:00
|
|
|
for (var id in pool.recons) {
|
2010-05-05 02:26:26 +02:00
|
|
|
if (pool.recons.hasOwnProperty(id)) {
|
|
|
|
var recon = pool.recons[id];
|
|
|
|
if (recon.m) {
|
|
|
|
recon.m = pool.reconCandidates[recon.m];
|
|
|
|
}
|
|
|
|
if (recon.c) {
|
|
|
|
for (var j = 0; j < recon.c.length; j++) {
|
|
|
|
recon.c[j] = pool.reconCandidates[recon.c[j]];
|
|
|
|
}
|
2010-04-23 21:39:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.fetchRows = function(start, limit, onDone, sorting) {
|
2010-05-21 02:48:36 +02:00
|
|
|
var body = {
|
|
|
|
engine: JSON.stringify(ui.browsingEngine.getJSON())
|
|
|
|
};
|
|
|
|
if (sorting) {
|
|
|
|
body.sorting = JSON.stringify(sorting)
|
|
|
|
}
|
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
$.post(
|
2010-08-22 08:16:13 +02:00
|
|
|
"/command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?",
|
2010-05-21 02:48:36 +02:00
|
|
|
body,
|
2010-02-26 22:56:41 +01:00
|
|
|
function(data) {
|
|
|
|
theProject.rowModel = data;
|
2010-04-23 21:39:12 +02:00
|
|
|
|
|
|
|
// Un-pool objects
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.preparePool(data.pool);
|
2010-04-23 21:39:12 +02:00
|
|
|
for (var r = 0; r < data.rows.length; r++) {
|
|
|
|
var row = data.rows[r];
|
|
|
|
for (var c = 0; c < row.cells.length; c++) {
|
|
|
|
var cell = row.cells[c];
|
|
|
|
if ((cell) && ("r" in cell)) {
|
|
|
|
cell.r = data.pool.recons[cell.r];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-26 22:56:41 +01:00
|
|
|
if (onDone) {
|
|
|
|
onDone();
|
|
|
|
}
|
|
|
|
},
|
2010-07-31 08:51:11 +02:00
|
|
|
"jsonp"
|
2010-02-26 22:56:41 +01:00
|
|
|
);
|
|
|
|
};
|
2010-02-27 01:16:44 +01:00
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.getPermanentLink = function() {
|
2010-02-27 01:16:44 +01:00
|
|
|
var params = [
|
|
|
|
"project=" + escape(theProject.id),
|
|
|
|
"ui=" + escape(JSON.stringify({
|
|
|
|
facets: ui.browsingEngine.getFacetUIStates()
|
|
|
|
}))
|
|
|
|
];
|
2010-06-15 20:37:57 +02:00
|
|
|
return "project?" + params.join("&");
|
2010-02-27 01:16:44 +01:00
|
|
|
};
|
2010-04-09 03:48:50 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Loader
|
|
|
|
*/
|
|
|
|
|
|
|
|
function onLoad() {
|
|
|
|
var params = URL.getParameters();
|
|
|
|
if ("project" in params) {
|
|
|
|
var uiState = {};
|
|
|
|
if ("ui" in params) {
|
|
|
|
try {
|
|
|
|
uiState = JSON.parse(params.ui);
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-23 00:55:28 +02:00
|
|
|
Refine.reinitializeProjectData(function() {
|
2010-04-09 03:48:50 +02:00
|
|
|
initializeUI(uiState);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(onLoad);
|