Refactored grid code to (a) generalize numerous column types and (b) fully support multiple, arbitrary, multi-column categorical and free-text queries. Python code provides support for TextColumn and TagColumn objects, and grids_common.mako provides support for programmatically creating free text and categorical filtering UIs. History and HDA grids have been updated to use the refactored code.

This commit is contained in:
Jeremy Goecks
2009-11-06 19:04:13 -05:00
parent 8879adc01e
commit fbf5616dbc
12 changed files with 394 additions and 304 deletions
+89 -3
View File
@@ -295,6 +295,66 @@ jQuery.extend(WYMeditor, {
});
/*
Galaxy code that integrates into the WYM Editor.
*/
var Galaxy =
{
/*
Galaxy constants for WYM Editor:
TOOLS - A string replaced by the galaxy toolbar's HTML.
TOOLS_ITEMS - A string replaced by the galaxy toolbar items.
INSERT_HISTORY - Command: open the insert history dialog.
INSERT_DATASET - Command: open the insert dataset dialog.
DIALOG_HISTORY - A dialog to insert a history.
DIALOG_DATASET - A dialog to insert a dataset.
*/
TOOLS : "{Galaxy_Tools}",
TOOLS_ITEMS : "{Galaxy_Tools_Items}",
INSERT_HISTORY : "InsertHistory",
INSERT_DATASET : "InsertDataset",
DIALOG_HISTORY : "DialogHistory",
DIALOG_DATASET : "DialogDataset",
// Tool items overview.
toolsItems: [
{'name': "InsertHistory", 'title': 'History', 'css': 'galaxy_tools_insert_history_link'},
{'name': "InsertDataset", 'title': 'Dataset', 'css': 'galaxy_dataset'}
],
// Tools HTML.
toolsHtml: "<div class='wym_tools wym_section'>"
+ "<h2>" + this.TOOLS + "</h2>"
+ "<ul>"
+ this.TOOLS_ITEMS
+ "</ul>"
+ "</div>",
// Insert history dialog.
dialogHistoryHtml: "<body class='wym_dialog wym_dialog_history'"
+ " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+ ">"
+ "<form>"
+ "<fieldset>"
+ "<input type='hidden' class='wym_dialog_type' value='"
+ this.DIALOG_HISTORY
+ "' />"
+ "<legend>{Link}</legend>"
+ "<div class='row'>"
+ "<label>{Title}</label>"
+ "<input type='text' class='wym_title' value='' size='40' />"
+ "</div>"
+ "<div class='row row-indent'>"
+ "<input class='wym_submit' type='button'"
+ " value='{Add}' />"
+ "<input class='wym_cancel' type='button'"
+ "value='{Cancel}' />"
+ "</div>"
+ "</fieldset>"
+ "</form>"
+ "</body>",
};
/********** JQUERY **********/
@@ -354,6 +414,7 @@ jQuery.fn.wymeditor = function(options) {
+ "<div class='wym_area_right'>"
+ WYMeditor.CONTAINERS
+ WYMeditor.CLASSES
+ Galaxy.TOOLS
+ "</div>"
+ "<div class='wym_area_main'>"
+ WYMeditor.HTML
@@ -384,6 +445,8 @@ jQuery.fn.wymeditor = function(options) {
+ "<h2>{Tools}</h2>"
+ "<ul>"
+ WYMeditor.TOOLS_ITEMS
// Add Galaxy Tools.
+ Galaxy.TOOLS_ITEMS
+ "</ul>"
+ "</div>",
@@ -758,6 +821,7 @@ WYMeditor.editor.prototype.init = function() {
boxHtml = h.replaceAll(boxHtml, WYMeditor.LOGO, this._options.logoHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS, this._options.toolsHtml);
boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS, Galaxy.toolsHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS,this._options.containersHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES, this._options.classesHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.HTML, this._options.htmlHtml);
@@ -781,6 +845,24 @@ WYMeditor.editor.prototype.init = function() {
}
boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools);
// Construct Galaxy tools list.
var galaxyTools = eval(Galaxy.toolsItems);
sTools = "";
for(var i = 0; i < galaxyTools.length; i++) {
var galaxyTool = galaxyTools[i];
if(galaxyTool.name && galaxyTool.title) {
var sTool = this._options.toolsItemHtml;
var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, galaxyTool.name);
sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft
+ galaxyTool.title
+ this._options.stringDelimiterRight);
sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, galaxyTool.css);
sTools += sTool;
}
}
boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS_ITEMS, sTools);
//construct classes list
var aClasses = eval(this._options.classesItems);
@@ -947,6 +1029,10 @@ WYMeditor.editor.prototype.exec = function(cmd) {
this.dialog(WYMeditor.PREVIEW, this._options.dialogFeaturesPreview);
break;
case Galaxy.INSERT_HISTORY:
this.dialog(Galaxy.DIALOG_HISTORY);
break;
default:
this._exec(cmd);
break;
@@ -1153,7 +1239,6 @@ WYMeditor.editor.prototype.update = function() {
* @description Opens a dialog box
*/
WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHtml ) {
var features = dialogFeatures || this._wym._options.dialogFeatures;
var wDialog = window.open('', 'dialog', features);
@@ -1178,11 +1263,13 @@ WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHt
case(WYMeditor.PREVIEW):
sBodyHtml = this._options.dialogPreviewHtml;
break;
case(Galaxy.DIALOG_HISTORY):
sBodyHtml = Galaxy.dialogHistoryHtml;
break;
default:
sBodyHtml = bodyHtml;
}
var h = WYMeditor.Helper;
//construct the dialog
@@ -1197,7 +1284,6 @@ WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHt
dialogHtml = h.replaceAll(dialogHtml, WYMeditor.INDEX, this._index);
dialogHtml = this.replaceStrings(dialogHtml);
var doc = wDialog.document;
doc.write(dialogHtml);
doc.close();