2010-01-26 06:17:14 +01:00
|
|
|
var theProject;
|
|
|
|
var ui = {};
|
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
function onLoad() {
|
2010-01-26 06:17:14 +01:00
|
|
|
var params = URL.getParameters();
|
|
|
|
if ("project" in params) {
|
|
|
|
theProject = {
|
2010-01-29 01:46:15 +01:00
|
|
|
id: parseInt(params.project)
|
2010-01-26 06:17:14 +01:00
|
|
|
};
|
|
|
|
|
2010-02-05 00:38:40 +01:00
|
|
|
reinitializeProjectData(initializeUI);
|
2010-01-26 06:17:14 +01:00
|
|
|
}
|
2010-01-25 23:51:25 +01:00
|
|
|
}
|
|
|
|
$(onLoad);
|
2010-01-26 06:17:14 +01:00
|
|
|
|
|
|
|
function initializeUI() {
|
2010-02-03 07:23:40 +01:00
|
|
|
document.title = theProject.metadata.name + " - Gridworks";
|
|
|
|
$('<span></span>').text(theProject.metadata.name).appendTo($("#title"));
|
2010-01-26 06:17:14 +01:00
|
|
|
|
|
|
|
var body = $("#body").empty();
|
|
|
|
|
|
|
|
var table = document.createElement("table");
|
|
|
|
$(table).attr("cellspacing", 20).css("width", "100%");
|
|
|
|
body.append(table);
|
|
|
|
|
|
|
|
var tr = table.insertRow(0);
|
|
|
|
|
|
|
|
var tdLeft = tr.insertCell(0);
|
|
|
|
var tdRight = tr.insertCell(1);
|
2010-02-02 02:36:02 +01:00
|
|
|
tdLeft.setAttribute("width", "82%");
|
|
|
|
tdRight.setAttribute("width", "18%");
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-03 02:24:41 +01:00
|
|
|
ui.viewPanel = $('<div></div>').appendTo(tdLeft);
|
2010-01-26 06:17:14 +01:00
|
|
|
ui.facetPanel = $('<div></div>').appendTo(tdRight);
|
2010-01-27 02:48:42 +01:00
|
|
|
ui.historyPanel = $('<div></div>').addClass("history-panel").appendTo(document.body);
|
2010-02-01 04:22:35 +01:00
|
|
|
ui.processPanel = $('<div></div>').addClass("process-panel").appendTo(document.body);
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-01-29 01:46:15 +01:00
|
|
|
ui.browsingEngine = new BrowsingEngine(ui.facetPanel);
|
2010-02-01 04:22:35 +01:00
|
|
|
ui.processWidget = new ProcessWidget(ui.processPanel);
|
2010-01-27 02:48:42 +01:00
|
|
|
ui.historyWidget = new HistoryWidget(ui.historyPanel);
|
2010-01-29 01:46:15 +01:00
|
|
|
ui.dataTableView = new DataTableView(ui.viewPanel);
|
2010-01-26 08:57:11 +01:00
|
|
|
}
|
2010-02-05 00:38:40 +01:00
|
|
|
|
|
|
|
function reinitializeProjectData(f) {
|
|
|
|
Ajax.chainGetJSON(
|
|
|
|
"/command/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
|
|
|
function(data) {
|
|
|
|
theProject.metadata = data;
|
|
|
|
},
|
|
|
|
"/command/get-column-model?" + $.param({ project: theProject.id }), null,
|
|
|
|
function(data) {
|
|
|
|
theProject.columnModel = data;
|
|
|
|
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
|
|
|
|
theProject.columnModel.columns[i].collapsed = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
f
|
|
|
|
);
|
|
|
|
}
|