# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1275671670 14400
# Node ID d01207f24908bc3f6d5323689f0aa46557f4d254
# Parent d285c65c66d3d49f3ddd998fe2d28b60996581f1
Add a temporary fix to grid_common.mako, eliminating the use of the categorical-filter style for grid StateColumns so that the request will not be mangled before it reaches the server. Added several TODOs in the grid Javascript code outlining the problem.
--- a/templates/grid_common.mako
+++ b/templates/grid_common.mako
@@ -1,5 +1,5 @@
<%!
- from galaxy.web.framework.helpers.grids import TextColumn, GridColumnFilter
+ from galaxy.web.framework.helpers.grids import TextColumn, StateColumn, GridColumnFilter
from galaxy.web.framework.helpers import iff
%>
@@ -15,81 +15,110 @@
<td align="left" style="padding-left: 10px">${column_label}:</td>
%endif
<td>
- %if isinstance(column, TextColumn):
- <form class="text-filter-form" column_key="${column.key}" action="${url( dict() )}" method="get" >
- ## Carry forward filtering criteria with hidden inputs.
- %for temp_column in grid.columns:
- %if temp_column.key in cur_filter_dict:
- <% value = cur_filter_dict[ temp_column.key ] %>
- %if value != "All":
+ %if isinstance(column, TextColumn):
+ <form class="text-filter-form" column_key="${column.key}" action="${url( dict() )}" method="get" >
+ ## Carry forward filtering criteria with hidden inputs.
+ %for temp_column in grid.columns:
+ %if temp_column.key in cur_filter_dict:
+ <% value = cur_filter_dict[ temp_column.key ] %>
+ %if value != "All":
+ <%
+ if isinstance( temp_column, TextColumn ):
+ value = h.to_json_string( value )
+ %>
+ <input type="hidden" id="${temp_column.key}" name="f-${temp_column.key}" value='${value}'/>
+ %endif
+ %endif
+ %endfor
+
+ ## Print current filtering criteria and links to delete.
+ <span id="${column.key}-filtering-criteria">
+ %if column.key in cur_filter_dict:
+ <% column_filter = cur_filter_dict[column.key] %>
+ %if isinstance( column_filter, basestring ):
+ %if column_filter != "All":
+ <span class='text-filter-val'>
+ ${cur_filter_dict[column.key]}
+ <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
+ <a href="${url( filter_all.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
+ </span>
+ %endif
+ %elif isinstance( column_filter, list ):
+ %for i, filter in enumerate( column_filter ):
+ %if i > 0:
+ ,
+ %endif
+ <span class='text-filter-val'>${filter}
+ <%
+ new_filter = list( column_filter )
+ del new_filter[ i ]
+ new_column_filter = GridColumnFilter( "", { column.key : h.to_json_string( new_filter ) } )
+ %>
+ <a href="${url( new_column_filter.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
+ </span>
+ %endfor
+ %endif
+ %endif
+ </span>
+ ## Print input field for column.
+ <span>
+ <% value = iff( column.filterable == "standard", column.label.lower(), "") %>
+ <input class="no-padding-or-margin" id="input-${column.key}-filter" name="f-${column.key}" type="text" value="${value}" size="15"/>
+ <input class='submit-image' type='image' src='${h.url_for('/static/images/mag_glass.png')}' alt='Filter'/>
+ </span>
+ </form>
+ ######################
+ ## TODO: eliminate this elif condition when the categorical-filter style in grid_common.mako is fixed to that it no
+ ## longer mangles the request by eliminating parameters from it before it reaches the server. Since the categorical-filter
+ ## style is not used here, paging will not work...
+ ######################
+ %elif isinstance( column, StateColumn ):
+ kwargs: ${kwargs}<br/>
+ <span id="${column.key}-filtering-criteria">
+ %for i, filter in enumerate( column.get_accepted_filters() ):
+ <%
+ # HACK: we know that each filter will have only a single argument, so get that single argument.
+ for key, arg in filter.args.items():
+ filter_key = key
+ filter_arg = arg
+ %>
+ %if i > 0:
+ |
+ %endif
+ %if column.key in cur_filter_dict and column.key in filter.args and cur_filter_dict[column.key] == filter.args[column.key]:
+ <span class="categorical-filter ${column.key}-filter current-filter">${filter.label}</span>
+ %else:
<%
- if isinstance( temp_column, TextColumn ):
- value = h.to_json_string( value )
+ my_dict = {}
+ my_dict.update( kwargs )
+ my_dict.update( filter.get_url_args() )
%>
- <input type="hidden" id="${temp_column.key}" name="f-${temp_column.key}" value='${value}'/>
+ <a href="${url( my_dict )}" filter_key="${filter_key}" filter_val="${filter_arg}">${filter.label}</a>
%endif
- %endif
- %endfor
-
- ## Print current filtering criteria and links to delete.
+ %endfor
+ </span>
+ %else:
<span id="${column.key}-filtering-criteria">
- %if column.key in cur_filter_dict:
- <% column_filter = cur_filter_dict[column.key] %>
- %if isinstance( column_filter, basestring ):
- %if column_filter != "All":
- <span class='text-filter-val'>
- ${cur_filter_dict[column.key]}
- <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
- <a href="${url( filter_all.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
+ %for i, filter in enumerate( column.get_accepted_filters() ):
+ <%
+ # HACK: we know that each filter will have only a single argument, so get that single argument.
+ for key, arg in filter.args.items():
+ filter_key = key
+ filter_arg = arg
+ %>
+ %if i > 0:
+ |
+ %endif
+ %if column.key in cur_filter_dict and column.key in filter.args and cur_filter_dict[column.key] == filter.args[column.key]:
+ <span class="categorical-filter ${column.key}-filter current-filter">${filter.label}</span>
+ %else:
+ <span class="categorical-filter ${column.key}-filter">
+ <a href="${url( filter.get_url_args() )}" filter_key="${filter_key}" filter_val="${filter_arg}">${filter.label}</a></span>
%endif
- %elif isinstance( column_filter, list ):
- %for i, filter in enumerate( column_filter ):
- %if i > 0:
- ,
- %endif
- <span class='text-filter-val'>${filter}
- <%
- new_filter = list( column_filter )
- del new_filter[ i ]
- new_column_filter = GridColumnFilter( "", { column.key : h.to_json_string( new_filter ) } )
- %>
- <a href="${url( new_column_filter.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
- </span>
- %endfor
-
- %endif
- %endif
+ %endfor
</span>
- ## Print input field for column.
- <span>
- <% value = iff( column.filterable == "standard", column.label.lower(), "") %>
- <input class="no-padding-or-margin" id="input-${column.key}-filter" name="f-${column.key}" type="text" value="${value}" size="15"/>
- <input class='submit-image' type='image' src='${h.url_for('/static/images/mag_glass.png')}' alt='Filter'/>
- </span>
- </form>
- %else:
- <span id="${column.key}-filtering-criteria">
- %for i, filter in enumerate( column.get_accepted_filters() ):
- <%
- # HACK: we know that each filter will have only a single argument, so get that single argument.
- for key, arg in filter.args.items():
- filter_key = key
- filter_arg = arg
- %>
- %if i > 0:
- |
- %endif
- %if column.key in cur_filter_dict and column.key in filter.args and cur_filter_dict[column.key] == filter.args[column.key]:
- <span class="categorical-filter ${column.key}-filter current-filter">${filter.label}</span>
- %else:
- <span class="categorical-filter ${column.key}-filter">
- <a href="${url( filter.get_url_args() )}" filter_key="${filter_key}" filter_val="${filter_arg}">${filter.label}</a>
- </span>
- %endif
- %endfor
- </span>
- %endif
+ %endif
</td></tr></%def>
--- a/templates/grid_base.mako
+++ b/templates/grid_base.mako
@@ -161,6 +161,16 @@
});
// Initialize categorical filters.
+ // ####################
+ // TODO: This style is used in grid_common.mako to wrap the links created for certain GridColumn
+ // subclasses ( e.g., DeletedColumn, StateColumn, etc ) where the link labels are generated in the
+ // class's get_accepted_filters() method. The problem is that when the link is clicked, this style
+ // will eliminate all request parameters except for those that are included in the cur_filter_dict
+ // dictionary that is used to build the url_args variable in this template. This process needs to
+ // be corrected so that the only changes made to the request are updating the values of parameters
+ // in the request with the new values obtained from cur_filter_dict, leaving all remaining request
+ // parameters alone. There is another related TODO in the set_categorical_filter() function below.
+ // ####################
$('.categorical-filter > a').each( function() {
$(this).click( function() {
var filter_key = $(this).attr('filter_key');
@@ -397,6 +407,11 @@
}
// Set new value for categorical filter.
+ // ####################
+ // TODO: this function mangles the initial request by eliminating many of the request parameters
+ // before calling update_grid(). This needs to be fixed - see the TODO in the categorical-filter
+ // style above.
+ // ####################
function set_categorical_filter(name, new_value) {
// Update filter hyperlinks to reflect new filter value.
var category_filter = categorical_filters[name];
@@ -423,7 +438,7 @@
$(this).append(t);
}
});
-
+
// Update grid.
url_args["f-" + name] = new_value;
go_page_one();
@@ -498,7 +513,7 @@
var href_parms = href_parms_str.split("&");
var operation = null;
var id = -1;
- var webapp = 'galaxy'
+ var webapp = 'galaxy';
for (var index = 0; index < href_parms.length; index++) {
if (href_parms[index].indexOf('operation') != -1) {
// Found operation parm; get operation value.
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1275658986 14400
# Node ID f22b57fa537f9c2f3c458bf513bce2bd155239d1
# Parent f0c8355714e2b1fc1f70026485a4b24843609b2a
Filter datasets grid so that datasets in deleted histories are not shown.
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -133,8 +133,9 @@ class HistoryDatasetAssociationListGrid(
num_rows_per_page = 50
def apply_query_filter( self, trans, query, **kwargs ):
# To filter HDAs by user, need to join HDA and History table and then filter histories by user. This is necessary because HDAs do not have
- # a user relation.
- return query.select_from( model.HistoryDatasetAssociation.table.join( model.History.table ) ).filter( model.History.user == trans.user )
+ # a user relation. TODO: move the base of this query to build_initial_query.
+ # Summary: filter by user, and deleted==False for both dataset and history
+ return query.select_from( model.HistoryDatasetAssociation.table.join( model.History.table ) ).filter( model.History.user == trans.user ).filter( self.model_class.deleted==False ).filter( model.History.deleted==False)
class DatasetInterface( BaseController, UsesAnnotations, UsesHistoryDatasetAssociation ):
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1275599071 14400
# Node ID d25af565d085e19dccb8f20c857e633397e5da08
# Parent 170e2688d37043c9f1c4349f15d29ce6dd43e88b
Bug fix for importing a history archive.
--- a/lib/galaxy/web/controllers/history.py
+++ b/lib/galaxy/web/controllers/history.py
@@ -454,7 +454,7 @@ class HistoryController( BaseController,
# Security check: make sure that members are relative, not absolute.
for tarinfo in history_archive_file.getmembers():
- if tarinfo.name.startswith("/") or tarinfo.name.startswith(".."):
+ if tarinfo.name.startswith("/") or tarinfo.name.find("..") != -1:
return trans.show_error_message( 'Error importing history archive: archive file is invalid.' )
# Unpack archive in temporary directory.