galaxy-commits
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions

commit/galaxy-central: greg: A couple of fixes in the manage_repository.mako template.
by Bitbucket 02 Aug '11
by Bitbucket 02 Aug '11
02 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/58ace2b0883a/
changeset: 58ace2b0883a
user: greg
date: 2011-08-02 20:35:24
summary: A couple of fixes in the manage_repository.mako template.
affected #: 1 file (72 bytes)
--- a/templates/webapps/community/repository/manage_repository.mako Tue Aug 02 14:19:38 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Aug 02 14:35:24 2011 -0400
@@ -5,6 +5,7 @@
<%
from galaxy.web.framework.helpers import time_ago
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
@@ -17,6 +18,7 @@
browse_label = 'Browse or delete repository files'
else:
browse_label = 'Browse repository files'
+ can_set_malicious = metadata and can_set_metadata and is_admin
%><%!
@@ -140,7 +142,7 @@
<label>Times downloaded:</label>
${repository.times_downloaded}
</div>
- %if trans.user_is_admin():
+ %if is_admin:
<div class="form-row"><label>Location:</label>
${repository.repo_path}
@@ -399,7 +401,7 @@
</div>
%endif
<p/>
-%if not is_new and trans.user_is_admin():
+%if can_set_malicious:
<p/><div class="toolForm"><div class="toolFormTitle">Malicious repository tip</div>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

02 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/2b954f70db10/
changeset: 2b954f70db10
user: greg
date: 2011-08-02 20:19:38
summary: Add a malicious flag to the tool shed's repository metadata - if true, downloading is restricted to only those users that can write to the repository. Fix a bug in determining if a user can write to a repository, and a bit of miscellaneous cleanup.
affected #: 15 files (9.6 KB)
--- a/lib/galaxy/webapps/community/controllers/common.py Tue Aug 02 13:52:02 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Aug 02 14:19:38 2011 -0400
@@ -33,6 +33,9 @@
# States for passing messages
SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
+malicious_error = " This changeset cannot be downloaded because it potentially produces malicious behavior or contains inappropriate content."
+malicious_error_can_push = " Correct this changeset as soon as possible, it potentially produces malicious behavior or contains inappropriate content."
+
class ItemRatings( UsesItemRatings ):
"""Overrides rate_item method since we also allow for comments"""
def rate_item( self, trans, user, item, rating, comment='' ):
@@ -263,6 +266,12 @@
if str( ctx ) == change_set_revision:
return ctx
return None
+def change_set_is_malicious( trans, id, change_set_revision, **kwd ):
+ """Check the malicious flag in repository metadata for a specified change set"""
+ repository_metadata = get_repository_metadata( trans, id, change_set_revision )
+ if repository_metadata:
+ return repository_metadata.malicious
+ return False
def copy_sample_loc_file( trans, filename ):
"""Copy xxx.loc.sample to ~/tool-data/xxx.loc"""
sample_loc_file = os.path.split( filename )[1]
--- a/lib/galaxy/webapps/community/controllers/repository.py Tue Aug 02 13:52:02 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Aug 02 14:19:38 2011 -0400
@@ -427,10 +427,12 @@
current_working_dir = os.getcwd()
# Update repository files for browsing.
update_for_browsing( trans, repository, current_working_dir, commit_message=commit_message )
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
repo=repo,
repository=repository,
commit_message=commit_message,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -506,10 +508,12 @@
else:
message = "Select at least 1 file to delete from the repository before clicking <b>Delete selected files</b>."
status = "error"
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
repo=repo,
repository=repository,
commit_message=commit_message,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -550,6 +554,13 @@
metadata = repository_metadata.metadata
else:
metadata = None
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
+ if is_malicious:
+ if trans.app.security_agent.can_push( trans.user, repository ):
+ message += malicious_error_can_push
+ else:
+ message += malicious_error
+ status = 'error'
return trans.fill_template( '/webapps/community/repository/view_repository.mako',
repo=repo,
repository=repository,
@@ -558,6 +569,7 @@
display_reviews=display_reviews,
num_ratings=num_ratings,
alerts_check_box=alerts_check_box,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -669,8 +681,17 @@
repository_metadata = get_repository_metadata( trans, id, repository.tip )
if repository_metadata:
metadata = repository_metadata.metadata
+ is_malicious = repository_metadata.malicious
else:
metadata = None
+ is_malicious = False
+ if is_malicious:
+ if trans.app.security_agent.can_push( trans.user, repository ):
+ message += malicious_error_can_push
+ else:
+ message += malicious_error
+ status = 'error'
+ malicious_check_box = CheckboxField( 'malicious', checked=is_malicious )
categories = get_categories( trans )
selected_categories = [ rca.category_id for rca in repository.categories ]
return trans.fill_template( '/webapps/community/repository/manage_repository.mako',
@@ -688,6 +709,8 @@
display_reviews=display_reviews,
num_ratings=num_ratings,
alerts_check_box=alerts_check_box,
+ malicious_check_box=malicious_check_box,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -713,9 +736,11 @@
'parent' : ctx.parents()[0] }
# Make sure we'll view latest changeset first.
changesets.insert( 0, change_dict )
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
return trans.fill_template( '/webapps/community/repository/view_changelog.mako',
repository=repository,
changesets=changesets,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -740,6 +765,7 @@
diffs = []
for diff in patch.diff( repo, node1=ctx_parent.node(), node2=ctx.node() ):
diffs.append( self.to_html_escaped( diff ) )
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
return trans.fill_template( '/webapps/community/repository/view_changeset.mako',
repository=repository,
ctx=ctx,
@@ -752,6 +778,7 @@
ignored=ignored,
clean=clean,
diffs=diffs,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -781,12 +808,14 @@
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) )
rra = self.get_user_item_rating( trans.sa_session, trans.user, repository, webapp_model=trans.model )
+ is_malicious = change_set_is_malicious( trans, id, repository.tip )
return trans.fill_template( '/webapps/community/repository/rate_repository.mako',
repository=repository,
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
rra=rra,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
@@ -829,12 +858,27 @@
@web.expose
@web.require_login( "set repository metadata" )
def set_metadata( self, trans, id, ctx_str, **kwd ):
- message, status = set_repository_metadata( trans, id, ctx_str, **kwd )
- if not message:
- message = "Metadata for change set revision '%s' has been reset." % str( ctx_str )
+ malicious = kwd.get( 'malicious', '' )
+ if kwd.get( 'malicious_button', False ):
+ repository_metadata = get_repository_metadata( trans, id, ctx_str )
+ malicious_checked = CheckboxField.is_checked( malicious )
+ repository_metadata.malicious = malicious_checked
+ trans.sa_session.add( repository_metadata )
+ trans.sa_session.flush()
+ if malicious_checked:
+ message = "The repository tip has been defined as malicious."
+ else:
+ message = "The repository tip has been defined as <b>not</b> malicious."
+ status = 'done'
+ else:
+ # The set_metadata_button was clicked
+ message, status = set_repository_metadata( trans, id, ctx_str, **kwd )
+ if not message:
+ message = "Metadata for change set revision '%s' has been reset." % str( ctx_str )
return trans.response.send_redirect( web.url_for( controller='repository',
action='manage_repository',
id=id,
+ malicious=malicious,
message=message,
status=status ) )
@web.expose
@@ -903,12 +947,14 @@
id=repository_id,
message=message,
status=status ) )
+ is_malicious = change_set_is_malicious( trans, repository_id, repository.tip )
return trans.fill_template( '/webapps/community/repository/add_tool_data_table_entry.mako',
name_attr=name_attr,
repository=repository,
comment_char=comment_char,
loc_filename=loc_filename,
column_fields=column_fields,
+ is_malicious=is_malicious,
message=message,
status=status )
def __get_column_fields( self, **kwd ):
@@ -938,10 +984,12 @@
try:
tool = load_tool( trans, os.path.abspath( tool_config ) )
tool_state = self.__new_state( trans )
+ is_malicious = change_set_is_malicious( trans, repository_id, repository.tip )
return trans.fill_template( "/webapps/community/repository/tool_form.mako",
repository=repository,
tool=tool,
tool_state=tool_state,
+ is_malicious=is_malicious,
message=message,
status=status )
except Exception, e:
@@ -977,10 +1025,12 @@
metadata = tool_metadata_dict
tool = load_tool( trans, os.path.abspath( metadata[ 'tool_config' ] ) )
break
+ is_malicious = change_set_is_malicious( trans, repository_id, repository.tip )
return trans.fill_template( "/webapps/community/repository/view_tool_metadata.mako",
repository=repository,
tool=tool,
metadata=metadata,
+ is_malicious=is_malicious,
message=message,
status=status )
@web.expose
--- a/lib/galaxy/webapps/community/model/__init__.py Tue Aug 02 13:52:02 2011 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Tue Aug 02 14:19:38 2011 -0400
@@ -153,10 +153,11 @@
fp.close()
class RepositoryMetadata( object ):
- def __init__( self, repository_id=None, changeset_revision=None, metadata=None ):
+ def __init__( self, repository_id=None, changeset_revision=None, metadata=None, malicious=False ):
self.repository_id = repository_id
self.changeset_revision = changeset_revision
self.metadata = metadata or dict()
+ self.malicious = malicious
class ItemRatingAssociation( object ):
def __init__( self, id=None, user=None, item=None, rating=0, comment='' ):
--- a/lib/galaxy/webapps/community/model/mapping.py Tue Aug 02 13:52:02 2011 -0400
+++ b/lib/galaxy/webapps/community/model/mapping.py Tue Aug 02 14:19:38 2011 -0400
@@ -117,7 +117,8 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "repository_id", Integer, ForeignKey( "repository.id" ), index=True ),
Column( "changeset_revision", TrimmedString( 255 ), index=True ),
- Column( "metadata", JSONType, nullable=True ) )
+ Column( "metadata", JSONType, nullable=True ),
+ Column( "malicious", Boolean, default=False ) )
RepositoryRatingAssociation.table = Table( "repository_rating_association", metadata,
Column( "id", Integer, primary_key=True ),
--- a/lib/galaxy/webapps/community/security/__init__.py Tue Aug 02 13:52:02 2011 -0400
+++ b/lib/galaxy/webapps/community/security/__init__.py Tue Aug 02 14:19:38 2011 -0400
@@ -6,6 +6,7 @@
from galaxy.util.bunch import Bunch
from galaxy.util import listify
from galaxy.model.orm import *
+from mercurial import hg, ui
log = logging.getLogger(__name__)
@@ -155,17 +156,8 @@
for group in groups:
self.associate_components( user=user, group=group )
def can_push( self, user, repository ):
- # TODO: handle this via the mercurial api.
- if not user:
- return False
- # Read the repository's hgrc file
- hgrc_file = os.path.abspath( os.path.join( repository.repo_path, ".hg", "hgrc" ) )
- config = ConfigParser.ConfigParser()
- config.read( hgrc_file )
- for option in config.options( "web" ):
- if option == 'allow_push':
- allowed = config.get( "web", option )
- return user.username in allowed
+ if user:
+ return user.username in listify( repository.allow_push )
return False
def get_permitted_actions( filter=None ):
--- a/templates/webapps/community/repository/add_tool_data_table_entry.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/add_tool_data_table_entry.mako Tue Aug 02 14:19:38 2011 -0400
@@ -6,6 +6,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_set_metadata = not is_new
can_rate = not is_new and trans.user and repository.user != trans.user
@@ -43,6 +44,8 @@
%endif
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
+ %endif
+ %if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
--- a/templates/webapps/community/repository/browse_repository.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/browse_repository.mako Tue Aug 02 14:19:38 2011 -0400
@@ -9,6 +9,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_rate = trans.user and repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
@@ -80,9 +81,11 @@
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div>
%endif
</ul>
@@ -94,6 +97,12 @@
%if can_browse_contents:
<div class="toolForm"><div class="toolFormTitle">Browse ${repository.name}</div>
+ %if can_download:
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div>
+ %endif
%if can_push:
<form name="select_files_to_delete" id="select_files_to_delete" action="${h.url_for( controller='repository', action='select_files_to_delete', id=trans.security.encode_id( repository.id ))}" method="post" ><div class="form-row" >
--- a/templates/webapps/community/repository/manage_repository.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Aug 02 14:19:38 2011 -0400
@@ -8,6 +8,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_set_metadata = not is_new
can_rate = not is_new and trans.user and repository.user != trans.user
@@ -80,6 +81,8 @@
%endif
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
+ %endif
+ %if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
@@ -96,10 +99,12 @@
<div class="toolFormTitle">${repository.name}</div><div class="toolFormBody"><form name="edit_repository" id="edit_repository" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
- <div class="form-row">
- <label>Clone this repository:</label>
- ${render_clone_str( repository )}
- </div>
+ %if can_download:
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div>
+ %endif
<div class="form-row"><label>Name:</label><input name="repo_name" type="textfield" value="${repo_name}" size="40"/>
@@ -304,7 +309,7 @@
%endif
<p/><div class="toolForm">
- <div class="toolFormTitle">User access</div>
+ <div class="toolFormTitle">Grant authority to upload or push changes</div><div class="toolFormBody"><table class="grid"><tr>
@@ -394,3 +399,24 @@
</div>
%endif
<p/>
+%if not is_new and trans.user_is_admin():
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">Malicious repository tip</div>
+ <div class="toolFormBody">
+ <form name="malicious" id="malicious" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=repository.tip )}" method="post">
+ <div class="form-row">
+ <label>Define repository tip as malicious:</label>
+ ${malicious_check_box.get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ Check the box and click <b>Save</b> to define this repository's tip as malicious, restricting it from being download-able.
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="malicious_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+ </div>
+%endif
+<p/>
--- a/templates/webapps/community/repository/rate_repository.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/rate_repository.mako Tue Aug 02 14:19:38 2011 -0400
@@ -1,5 +1,6 @@
<%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/community/common/common.mako" import="*" />
+<%namespace file="/webapps/community/repository/common.mako" import="*" /><%
from galaxy.web.framework.helpers import time_ago
@@ -8,6 +9,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_rate = repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
@@ -86,9 +88,11 @@
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div>
%endif
</ul>
@@ -96,6 +100,12 @@
%if repository.user != trans.user:
<div class="toolForm"><div class="toolFormTitle">${repository.name}</div>
+ %if can_download:
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div>
+ %endif
<div class="toolFormBody"><div class="form-row"><label>Description:</label>
--- a/templates/webapps/community/repository/tool_form.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/tool_form.mako Tue Aug 02 14:19:38 2011 -0400
@@ -11,6 +11,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_rate = trans.user and repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
@@ -130,9 +131,11 @@
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div>
%endif
</ul>
--- a/templates/webapps/community/repository/view_changelog.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/view_changelog.mako Tue Aug 02 14:19:38 2011 -0400
@@ -12,6 +12,7 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_rate = trans.user and repository.user != trans.user
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
if can_push:
browse_label = 'Browse or delete repository files'
else:
@@ -55,9 +56,11 @@
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div></ul>
@@ -65,18 +68,26 @@
${render_msg( message, status )}
%endif
-<div class="toolForm">
- <div class="toolFormTitle">${repository.name}</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>Clone this repository:</label>
- ${render_clone_str( repository )}
+%if can_download:
+ <div class="toolForm">
+ <div class="toolFormTitle">${repository.name}</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div></div></div>
-</div>
-<p/>
+ <p/>
+%endif
<div class="toolForm">
- <div class="toolFormTitle">Changesets</div>
+ <%
+ if can_download:
+ title_str = 'Changesets'
+ else:
+ title_str = '%s changesets' % repository.name
+ %>
+ <div class="toolFormTitle">${title_str}</div><% test_date = None %><div class="toolFormBody"><table class="grid">
--- a/templates/webapps/community/repository/view_changeset.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/view_changeset.mako Tue Aug 02 14:19:38 2011 -0400
@@ -13,6 +13,7 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_view_change_log = not is_new
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
if can_push:
browse_label = 'Browse or delete repository files'
else:
@@ -59,9 +60,11 @@
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div></ul>
@@ -69,18 +72,26 @@
${render_msg( message, status )}
%endif
-<div class="toolForm">
- <div class="toolFormTitle">${repository.name}</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>Clone this repository:</label>
- ${render_clone_str( repository )}
+%if can_download:
+ <div class="toolForm">
+ <div class="toolFormTitle">${repository.name}</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div></div></div>
-</div>
-<p/>
+ <p/>
+%endif
<div class="toolForm">
- <div class="toolFormTitle">Changeset ${ctx}</div>
+ <%
+ if can_download:
+ title_str = 'Changeset %s' % ctx
+ else:
+ title_str = '%s changeset %s' % ( repository.name, ctx )
+ %>
+ <div class="toolFormTitle">${title_str}</div><div class="toolFormBody"><table class="grid">
%if modified:
@@ -155,14 +166,19 @@
%endif
%for diff in diffs:
<%
- # Read the first line of diff
- line = diff.split( '\n' )[0]
+ # Read at most the first 10 lines of diff to determine the anchor
+ ctr = 0
+ lines = diff.split( '\n' )
diff = diff.replace( '\n', '<br/>' )
anchor_str = ''
- for anchor in anchors:
- if line.find( anchor ) >= 0:
- anchor_str = '<a name="%s">%s</a>' % ( anchor, anchor )
+ for line in lines:
+ if ctr > 9:
break
+ for anchor in anchors:
+ if line.find( anchor ) >= 0:
+ anchor_str = '<a name="%s">%s</a>' % ( anchor, anchor )
+ break
+ ctr += 1
%><tr><td bgcolor="#E0E0E0">${anchor_str}</td></tr><tr><td>${diff}</td></tr>
--- a/templates/webapps/community/repository/view_repository.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Tue Aug 02 14:19:38 2011 -0400
@@ -9,6 +9,7 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_rate = not is_new and trans.user and repository.user != trans.user
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_view_change_log = not is_new
if can_push:
@@ -79,6 +80,8 @@
%endif
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
+ %endif
+ %if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
@@ -94,10 +97,12 @@
<div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody">
- <div class="form-row">
- <label>Clone this repository:</label>
- ${render_clone_str( repository )}
- </div>
+ %if can_download:
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div>
+ %endif
<div class="form-row"><label>Name:</label>
%if can_browse_contents:
--- a/templates/webapps/community/repository/view_tool_metadata.mako Tue Aug 02 13:52:02 2011 -0400
+++ b/templates/webapps/community/repository/view_tool_metadata.mako Tue Aug 02 14:19:38 2011 -0400
@@ -10,6 +10,7 @@
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
+ can_download = not is_new and ( not is_malicious or can_push )
can_browse_contents = not is_new
can_rate = repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
@@ -50,9 +51,11 @@
%if can_browse_contents:
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ %endif
</div>
%endif
</ul>
@@ -61,25 +64,21 @@
${render_msg( message, status )}
%endif
-<div class="toolForm">
- <div class="toolFormTitle">${repository.name}</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>Clone this repository:</label>
- ${render_clone_str( repository )}
+%if can_download:
+ <div class="toolForm">
+ <div class="toolFormTitle">${repository.name}</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>Clone this repository:</label>
+ ${render_clone_str( repository )}
+ </div></div></div>
-</div>
+%else:
+ <b>Repository name:</b><br/>
+ ${repository.name}
+%endif
%if metadata:
-## "{"tools":
-## [{"description": "data on any column using simple expressions",
-## "id": "Filter1",
-## "name": "Filter",
-## "requirements": [],
-## "tests": [{
-## "inputs": [["input", "1.bed", {"children": [], "value": "1.bed"}], ["cond", "c1=='chr22'", {"children": [], "value": "c1=='chr22'"}]], "name": "Test-1",
-## "outputs": [["out_file1", "filter1_test1.bed", {"compare": "diff", "delta": 10000, "extra_files": [], "lines_diff": 0, "sort": false}]],
-## "required_files": [["1.bed", {"children": [], "value": "1.bed"}]]}, {"inputs": [["input", "7.bed", {"children": [], "value": "7.bed"}], ["cond", "c1=='chr1' and c3-c2>=2000 and c6=='+'", {"children": [], "value": "c1=='chr1' and c3-c2>=2000 and c6=='+'"}]], "name": "Test-2", "outputs": [["out_file1", "filter1_test2.bed", {"compare": "diff", "delta": 10000, "extra_files": [], "lines_diff": 0, "sort": false}]], "required_files": [["7.bed", {"children": [], "value": "7.bed"}]]}], "tool_config": "database/community_files/000/repo_1/filtering.xml", "version": "1.0.1", "version_string_cmd": null}], "workflows": [{"a_galaxy_workflow": "true", "annotation": "", "format-version": "0.1", "name": "Workflow constructed from history 'Unnamed history'", "steps": {"0": {"annotation": "", "id": 0, "input_connections": {}, "inputs": [{"description": "", "name": "Input Dataset"}], "name": "Input dataset", "outputs": [], "position": {"left": 10, "top": 10}, "tool_errors": null, "tool_id": null, "tool_state": "{\\"name\\": \\"Input Dataset\\"}", "tool_version": null, "type": "data_input", "user_outputs": []}, "1": {"annotation": "", "id": 1, "input_connections": {"input": {"id": 0, "output_name": "output"}}, "inputs": [], "name": "Filter", "outputs": [{"name": "out_file1", "type": "input"}], "position": {"left": 230, "top": 10}, "post_job_actions": {}, "tool_errors": null, "tool_id": "Filter1", "tool_state": "{\\"__page__\\": 0, \\"cond\\": \\"\\\\\\"c1=='chr1'\\\\\\"\\", \\"chromInfo\\": \\"\\\\\\"/Users/gvk/workspaces_2008/central_051111/tool-data/shared/ucsc/chrom/?.len\\\\\\"\\", \\"input\\": \\"null\\"}", "tool_version": null, "type": "tool", "user_outputs": []}, "2": {"annotation": "", "id": 2, "input_connections": {"input1": {"id": 0, "output_name": "output"}, "input2": {"id": 1, "output_name": "out_file1"}}, "inputs": [], "name": "Subtract Whole Dataset", "outputs": [{"name": "output", "type": "input"}], "position": {"left": 450, "top": 10}, "post_job_actions": {}, "tool_errors": null, "tool_id": "subtract_query1", "tool_state": "{\\"input2\\": \\"null\\", \\"__page__\\": 0, \\"end_col\\": \\"{\\\\\\"__class__\\\\\\": \\\\\\"UnvalidatedValue\\\\\\", \\\\\\"value\\\\\\": \\\\\\"None\\\\\\"}\\", \\"begin_col\\": \\"{\\\\\\"__class__\\\\\\": \\\\\\"UnvalidatedValue\\\\\\", \\\\\\"value\\\\\\": \\\\\\"None\\\\\\"}\\", \\"input1\\": \\"null\\", \\"chromInfo\\": \\"\\\\\\"/Users/gvk/workspaces_2008/central_051111/tool-data/shared/ucsc/chrom/?.len\\\\\\"\\"}", "tool_version": null, "type": "tool", "user_outputs": []}}}]}"
<p/><div class="toolForm"><div class="toolFormTitle">${metadata[ 'name' ]} tool metadata</div>
@@ -89,26 +88,34 @@
<a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=metadata[ 'tool_config' ] )}">${metadata[ 'name' ]}</a><div style="clear: both"></div></div>
- <div class="form-row">
- <label>Description:</label>
- ${metadata[ 'description' ]}
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Id:</label>
- ${metadata[ 'id' ]}
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Version:</label>
- ${metadata[ 'version' ]}
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Version command string:</label>
- ${metadata[ 'version_string_cmd' ]}
- <div style="clear: both"></div>
- </div>
+ %if 'description' in metadata:
+ <div class="form-row">
+ <label>Description:</label>
+ ${metadata[ 'description' ]}
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ %if 'id' in metadata:
+ <div class="form-row">
+ <label>Id:</label>
+ ${metadata[ 'id' ]}
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ %if 'version' in metadata:
+ <div class="form-row">
+ <label>Version:</label>
+ ${metadata[ 'version' ]}
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ %if 'version_string_cmd' in metadata:
+ <div class="form-row">
+ <label>Version command string:</label>
+ ${metadata[ 'version_string_cmd' ]}
+ <div style="clear: both"></div>
+ </div>
+ %endif
<div class="form-row"><label>Command:</label><pre>${tool.command}</pre>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: jgoecks: Trackster: refactor post-draw actions into their own methods.
by Bitbucket 02 Aug '11
by Bitbucket 02 Aug '11
02 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/5feafa125856/
changeset: 5feafa125856
user: jgoecks
date: 2011-08-02 19:52:02
summary: Trackster: refactor post-draw actions into their own methods.
affected #: 1 file (396 bytes)
--- a/static/scripts/trackster.js Tue Aug 02 12:16:22 2011 -0400
+++ b/static/scripts/trackster.js Tue Aug 02 13:52:02 2011 -0400
@@ -2021,7 +2021,8 @@
var tile_index = Math.floor( low / resolution / DENSITY );
// A list of tiles drawn/retrieved.
var drawn_tiles = [];
- var tile_count = 0
+ var tile_count = 0;
+ // Draw or fetch and show tiles.
while ( ( tile_index * DENSITY * resolution ) < high ) {
// Check in cache
var key = gen_key(width, w_scale, tile_index);
@@ -2029,7 +2030,7 @@
var tile_low = tile_index * DENSITY * this.view.resolution;
var tile_high = tile_low + DENSITY * this.view.resolution;
if (!force && cached) {
- drawn_tiles[drawn_tiles.length] = cached;
+ drawn_tiles.push(cached);
this.show_tile(cached, parent_element, w_scale);
} else {
this.delayed_draw(force, key, tile_index, resolution, parent_element, w_scale, drawn_tiles);
@@ -2039,128 +2040,14 @@
}
//
- // Post-draw actions:
+ // Use interval to check if tiles have been drawn. When all tiles are drawn, call post-draw actions.
//
var track = this;
var intervalId = setInterval(function() {
if (drawn_tiles.length === tile_count) {
// All tiles have been drawn.
clearInterval(intervalId);
-
- // Clear tiles?
- if (clear_after) {
- // Clear out track content in order to show the most recent content.
- // Most recent content is the div with children (tiles) most recently appended to track.
- // However, do not delete recently-appended empty content as calls to draw() may still be active
- // and using these divs.
- var track_content = track.content_div.children();
- var remove = false;
- for (var i = track_content.length-1, len = 0; i >= len; i--) {
- var child = $(track_content[i]);
- if (remove) {
- child.remove();
- }
- else if (child.children().length !== 0) {
- // Found most recent content with tiles: set remove to start removing old elements.
- remove = true;
- }
- }
- }
-
- //
- // If mode is Histogram and tiles do not share max, redraw tiles as necessary using new max.
- //
- // HACK: use track type b/c LineTrack histograms are different; what's needed is different
- // post-draw actions for different line tracks.
- if (track instanceof FeatureTrack && track.mode == "Histogram") {
- // Get global max.
- var global_max = -1;
- for (var i = 0; i < drawn_tiles.length; i++) {
- var cur_max = drawn_tiles[i].max_val;
- if (cur_max > global_max) {
- global_max = cur_max;
- }
- }
-
- for (var i = 0; i < drawn_tiles.length; i++) {
- if (drawn_tiles[i].max_val !== global_max) {
- var tile = drawn_tiles[i];
- tile.canvas.remove();
- track.delayed_draw(true, gen_key(width, w_scale, tile.index), tile.index,
- tile.resolution, parent_element, w_scale, [], { max: global_max });
- }
- }
- }
-
- //
- // Update filter attributes, UI.
- //
-
- // Update filtering UI.
- if (track.filters_manager) {
- var filters = track.filters_manager.filters;
- for (var f = 0; f < filters.length; f++) {
- filters[f].update_ui_elt();
- }
-
- // Determine if filters are available; this is based on the tiles' data.
- var filters_available = false,
- example_feature;
- for (var i = 0; i < drawn_tiles.length; i++) {
- if (drawn_tiles[i].data.length) {
- example_feature = drawn_tiles[i].data[0];
- for (var f = 0; f < filters.length; f++) {
- if (filters[f].applies_to(example_feature)) {
- filters_available = true;
- break;
- }
- }
- }
- }
-
- // If filter availability changed, hide filter div if necessary and update menu.
- if (track.filters_available !== filters_available) {
- track.filters_available = filters_available;
- if (!track.filters_available) {
- track.filters_div.hide();
- }
- track.make_name_popup_menu();
- }
- }
-
- //
- // If some tiles have messages, set padding of tiles without messages
- // so features and rows align.
- //
- var messages_to_show = false;
- for (var tile_index = 0; tile_index < drawn_tiles.length; tile_index++) {
- if (drawn_tiles[tile_index].message) {
- messages_to_show = true;
- break;
- }
- }
- if (messages_to_show) {
- for (var tile_index = 0; tile_index < drawn_tiles.length; tile_index++) {
- tile = drawn_tiles[tile_index];
- if (!tile.message) {
- // Need to align with other tile(s) that have message(s).
- tile.canvas.css("padding-top", ERROR_PADDING);
- }
- }
- }
-
- // Store initial canvas in case we need to use it for overview
- /* This is completely broken, just saves the first tile it sees
- regardless of if it should be the overview
- if (!track.initial_canvas && !window.G_vmlCanvasManager) {
- track.initial_canvas = $(tile_element).clone();
- var src_ctx = tile_element.get(0).getContext("2d");
- var tgt_ctx = track.initial_canvas.get(0).getContext("2d");
- var data = src_ctx.getImageData(0, 0, src_ctx.canvas.width, src_ctx.canvas.height);
- tgt_ctx.putImageData(data, 0, 0);
- track.set_overview();
- }
- */
+ track.postdraw_actions(drawn_tiles, clear_after);
}
}, 50);
@@ -2170,7 +2057,51 @@
for (var i = 0; i < this.child_tracks.length; i++) {
this.child_tracks[i].draw(force, clear_after);
}
- },
+ },
+ /**
+ * Actions to be taken after draw has been completed. Draw is completed when all tiles have been
+ * drawn/fetched and shown.
+ */
+ postdraw_actions: function(tiles, clear_after) {
+ var track = this;
+
+ //
+ // If some tiles have messages, set padding of tiles without messages
+ // so features and rows align.
+ //
+ var messages_to_show = false;
+ for (var tile_index = 0; tile_index < tiles.length; tile_index++) {
+ if (tiles[tile_index].message) {
+ messages_to_show = true;
+ break;
+ }
+ }
+ if (messages_to_show) {
+ for (var tile_index = 0; tile_index < tiles.length; tile_index++) {
+ tile = tiles[tile_index];
+ if (!tile.message) {
+ // Need to align with other tile(s) that have message(s).
+ tile.canvas.css("padding-top", ERROR_PADDING);
+ }
+ }
+ }
+
+ // Store initial canvas in case we need to use it for overview
+ /* This is completely broken, just saves the first tile it sees
+ regardless of if it should be the overview
+ if (!track.initial_canvas && !window.G_vmlCanvasManager) {
+ track.initial_canvas = $(tile_element).clone();
+ var src_ctx = tile_element.get(0).getContext("2d");
+ var tgt_ctx = track.initial_canvas.get(0).getContext("2d");
+ var data = src_ctx.getImageData(0, 0, src_ctx.canvas.width, src_ctx.canvas.height);
+ tgt_ctx.putImageData(data, 0, 0);
+ track.set_overview();
+ }
+ */
+ },
+ /**
+ * Do actual tile drawing.
+ */
delayed_draw: function(force, key, tile_index, resolution, parent_element, w_scale, drawn_tiles, more_tile_data) {
var track = this,
tile_low = tile_index * DENSITY * resolution,
@@ -2187,7 +2118,7 @@
return;
}
track.show_tile(tile, parent_element, w_scale);
- drawn_tiles[drawn_tiles.length] = tile;
+ drawn_tiles.push(tile);
};
// Put a 50ms delay on drawing so that if the user scrolls fast, we don't load extra data
var id = setTimeout(function() {
@@ -2196,7 +2127,7 @@
var tile = (force ? undefined : track.tile_cache.get(key));
if (tile) {
track.show_tile(tile, parent_element, w_scale);
- drawn_tiles[drawn_tiles.length] = tile;
+ drawn_tiles.push(tile);
}
else {
//
@@ -2585,6 +2516,94 @@
this.painter = painters.LinkedFeaturePainter;
};
extend(FeatureTrack.prototype, TiledTrack.prototype, {
+ /**
+ * Actions to be taken after draw has been completed. Draw is completed when all tiles have been
+ * drawn/fetched and shown.
+ */
+ postdraw_actions: function(tiles, clear_after) {
+ TiledTrack.prototype.postdraw_actions.call(this, tiles, clear_after);
+
+ var track = this;
+
+ // Clear tiles?
+ if (clear_after) {
+ // Clear out track content in order to show the most recent content.
+ // Most recent content is the div with children (tiles) most recently appended to track.
+ // However, do not delete recently-appended empty content as calls to draw() may still be active
+ // and using these divs.
+ var track_content = track.content_div.children();
+ var remove = false;
+ for (var i = track_content.length-1, len = 0; i >= len; i--) {
+ var child = $(track_content[i]);
+ if (remove) {
+ child.remove();
+ }
+ else if (child.children().length !== 0) {
+ // Found most recent content with tiles: set remove to start removing old elements.
+ remove = true;
+ }
+ }
+ }
+
+ //
+ // If mode is Histogram and tiles do not share max, redraw tiles as necessary using new max.
+ //
+ if (track.mode == "Histogram") {
+ // Get global max.
+ var global_max = -1;
+ for (var i = 0; i < tiles.length; i++) {
+ var cur_max = tiles[i].max_val;
+ if (cur_max > global_max) {
+ global_max = cur_max;
+ }
+ }
+
+ for (var i = 0; i < tiles.length; i++) {
+ if (tiles[i].max_val !== global_max) {
+ var tile = tiles[i];
+ tile.canvas.remove();
+ track.delayed_draw(true, gen_key(width, w_scale, tile.index), tile.index,
+ tile.resolution, parent_element, w_scale, [], { max: global_max });
+ }
+ }
+ }
+
+ //
+ // Update filter attributes, UI.
+ //
+
+ // Update filtering UI.
+ if (track.filters_manager) {
+ var filters = track.filters_manager.filters;
+ for (var f = 0; f < filters.length; f++) {
+ filters[f].update_ui_elt();
+ }
+
+ // Determine if filters are available; this is based on the tiles' data.
+ var filters_available = false,
+ example_feature;
+ for (var i = 0; i < tiles.length; i++) {
+ if (tiles[i].data.length) {
+ example_feature = tiles[i].data[0];
+ for (var f = 0; f < filters.length; f++) {
+ if (filters[f].applies_to(example_feature)) {
+ filters_available = true;
+ break;
+ }
+ }
+ }
+ }
+
+ // If filter availability changed, hide filter div if necessary and update menu.
+ if (track.filters_available !== filters_available) {
+ track.filters_available = filters_available;
+ if (!track.filters_available) {
+ track.filters_div.hide();
+ }
+ track.make_name_popup_menu();
+ }
+ }
+ },
update_auto_mode: function( mode ) {
if ( this.mode == "Auto" ) {
if ( mode == "no_detail" ) {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: dan: Fix for 2 comments in templates/dataset/security_common.mako.
by Bitbucket 02 Aug '11
by Bitbucket 02 Aug '11
02 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/f60dfcc77165/
changeset: f60dfcc77165
user: dan
date: 2011-08-02 18:16:22
summary: Fix for 2 comments in templates/dataset/security_common.mako.
affected #: 1 file (2 bytes)
--- a/templates/dataset/security_common.mako Tue Aug 02 08:55:57 2011 -0400
+++ b/templates/dataset/security_common.mako Tue Aug 02 12:16:22 2011 -0400
@@ -109,8 +109,8 @@
%for k, v in permitted_actions:
%if k not in do_not_render:
<div class="form-row">
- # LIBRARY_ACCESS is a special case because we need to render all roles instead of
- # roles derived from the roles associated with LIBRARY_ACCESS.
+ ## LIBRARY_ACCESS is a special case because we need to render all roles instead of
+ ## roles derived from the roles associated with LIBRARY_ACCESS.
<% render_all_roles = k == 'LIBRARY_ACCESS' %>
%if render_all_roles:
${render_select( current_actions, k, v, all_roles )}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: dan: Update EuPathDB datasource configuration file. Contributed by Mark Heiges.
by Bitbucket 02 Aug '11
by Bitbucket 02 Aug '11
02 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/9cae773f70ed/
changeset: 9cae773f70ed
user: dan
date: 2011-08-02 14:55:57
summary: Update EuPathDB datasource configuration file. Contributed by Mark Heiges.
affected #: 1 file (1.2 KB)
--- a/tools/data_source/eupathdb.xml Mon Aug 01 17:35:18 2011 -0400
+++ b/tools/data_source/eupathdb.xml Tue Aug 02 08:55:57 2011 -0400
@@ -1,30 +1,10 @@
-<!--
- If the value of 'URL_method' is 'get', the request will consist of the value of 'URL' coming back in
- the initial response. If value of 'URL_method' is 'post', any additional params coming back in the
- initial response ( in addition to 'URL' ) will be encoded and appended to URL and a post will be performed.
--->
-<tool name="EuPathDB" id="eupathdb" tool_type="data_source">
+<tool name="EuPathDB" id="eupathdb" tool_type="data_source" url_method="post"><description>server</description><command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
- <inputs action="http://eupathdb.org/eupathdb/queries_tools.jsp" check_values="false" method="post">
+ <inputs action="http://eupathdb.org/eupathdb/queries_tools.jsp" check_values="false" method="get"><display>go to EuPathDB server $GALAXY_URL</display><param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=eupathdb" /></inputs>
- <request_param_translation>
- <request_param galaxy_name="URL_method" remote_name="URL_method" missing="post" />
- <request_param galaxy_name="URL" remote_name="URL" missing="">
- <append_param separator="&" first_separator="?" join="=">
- <value name="dbkey" missing="?" />
- <value name="wdk_history_id" missing="" />
- <value name="wdkReportFormat" missing="tabular" />
- <value name="selectedFields" missing="" />
- <value name="includeHeader" missing="yes" />
- <value name="downloadType" missing="plain" />
- </append_param>
- </request_param>
- <request_param galaxy_name="format" remote_name="wdkReportFormat" missing="tabular" />
- <request_param galaxy_name="dbkey" remote_name="dbkey" missing="?" />
- </request_param_translation><uihints minwidth="800"/><outputs><data name="output" format="txt" />
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/2573ac2b9c58/
changeset: 2573ac2b9c58
user: kanwei
date: 2011-08-01 23:35:18
summary: LibraryDataset Parameter:
- Now allows multiple dataset selection instead of just one. As a result, the ValueWrapper is now an iterator that iterates over each selected library dataset.
- Move #templates method to become an attribute of LDDAs instead of a helper method in ValueWrapper.
affected #: 5 files (1.6 KB)
--- a/lib/galaxy/model/__init__.py Fri Jul 29 14:33:34 2011 -0400
+++ b/lib/galaxy/model/__init__.py Mon Aug 01 17:35:18 2011 -0400
@@ -4,7 +4,9 @@
Naming: try to use class names that have a distinct plural form so that
the relationship cardinalities are obvious (e.g. prefer Dataset to Data)
"""
-
+import pkg_resources
+pkg_resources.require( "simplejson" )
+import simplejson
import galaxy.datatypes
from galaxy.util.bunch import Bunch
from galaxy import util
@@ -1415,6 +1417,22 @@
else:
return template.get_widgets( trans.user )
return []
+ def templates_dict( self ):
+ """
+ Returns a dict of template info
+ """
+ template_data = {}
+ for temp_info in self.info_association:
+ template = temp_info.template
+ content = temp_info.info.content
+ tmp_dict = {}
+ for field in template.fields:
+ tmp_dict[field['label']] = content[field['name']]
+ template_data[template.name] = tmp_dict
+ return template_data
+ def templates_json( self ):
+ return simplejson.dumps( self.templates_dict() )
+
def get_display_name( self ):
"""
LibraryDatasetDatasetAssociation name can be either a string or a unicode object.
--- a/lib/galaxy/tools/__init__.py Fri Jul 29 14:33:34 2011 -0400
+++ b/lib/galaxy/tools/__init__.py Mon Aug 01 17:35:18 2011 -0400
@@ -1,7 +1,7 @@
"""
Classes encapsulating galaxy tools and tool configuration.
"""
-import pkg_resources;
+import pkg_resources
pkg_resources.require( "simplejson" )
@@ -2026,21 +2026,16 @@
self.input = input
self.value = value
self._other_values = other_values
+ self.counter = 0
def __str__( self ):
- return self.value.name
- def templates( self ):
- """ Returns JSON dict of templates => data """
- if not self.value:
- return None
- template_data = {}
- for temp_info in self.value.info_association:
- template = temp_info.template
- content = temp_info.info.content
- tmp_dict = {}
- for field in template.fields:
- tmp_dict[field['label']] = content[field['name']]
- template_data[template.name] = tmp_dict
- return simplejson.dumps( template_data )
+ return self.value
+ def __iter__( self ):
+ return self
+ def next( self ):
+ if self.counter >= len(self.value):
+ raise StopIteration
+ self.counter += 1
+ return self.value[self.counter-1]
def __getattr__( self, key ):
return getattr( self.value, key )
--- a/lib/galaxy/tools/parameters/basic.py Fri Jul 29 14:33:34 2011 -0400
+++ b/lib/galaxy/tools/parameters/basic.py Mon Aug 01 17:35:18 2011 -0400
@@ -725,7 +725,7 @@
dynamic options, we need to check whether the other parameters which
determine what options are valid have been set. For the old style
dynamic options which do not specify dependencies, this is always true
- (must valiate at runtime).
+ (must validate at runtime).
"""
# Option list is statically defined, never need late validation
if not self.is_dynamic:
@@ -804,7 +804,7 @@
Select list that sets the last used genome build for the current history
as "selected".
- >>> # Create a mock transcation with 'hg17' as the current build
+ >>> # Create a mock transaction with 'hg17' as the current build
>>> from galaxy.util.bunch import Bunch
>>> trans = Bunch( history=Bunch( genome_build='hg17' ), db_builds=util.dbnames )
@@ -1539,20 +1539,26 @@
def from_html( self, value, trans, other_values={} ):
if not value:
return None
- elif isinstance( value, trans.app.model.LibraryDatasetDatasetAssociation ):
+ elif isinstance( value, list ):
return value
else:
- return trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( value ) )
+ decoded_lst = []
+ for encoded_id in value.split("||"):
+ decoded_lst.append( trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( encoded_id ) ) )
+ return decoded_lst
def to_string( self, value, app ):
if not value:
- return None
- return value.id
+ return value
+ return [ldda.id for ldda in value]
def to_python( self, value, app ):
if not value:
return value
- return app.model.context.query( app.model.LibraryDatasetDatasetAssociation ).get( value )
+ lddas = []
+ for ldda_id in value:
+ lddas.append( app.model.context.query( app.model.LibraryDatasetDatasetAssociation ).get( ldda_id ) )
+ return lddas
# class RawToolParameter( ToolParameter ):
# """
--- a/lib/galaxy/web/form_builder.py Fri Jul 29 14:33:34 2011 -0400
+++ b/lib/galaxy/web/form_builder.py Mon Aug 01 17:35:18 2011 -0400
@@ -656,17 +656,17 @@
class LibraryField( BaseField ):
def __init__( self, name, value=None, trans=None ):
self.name = name
- self.ldda = value
+ self.lddas = value
self.trans = trans
def get_html( self, prefix="", disabled=False ):
- if not self.ldda:
- ldda = ""
- text = "Choose a library dataset"
+ if not self.lddas:
+ ldda_ids = ""
+ text = "Select library dataset(s)"
else:
- ldda = self.trans.security.encode_id(self.ldda.id)
- text = self.ldda.name
+ ldda_ids = "||".join( [ self.trans.security.encode_id( ldda.id ) for ldda in self.lddas ] )
+ text = "<br />".join( [ "%s. %s" % (i+1, ldda.name) for i, ldda in enumerate(self.lddas)] )
return '<a href="javascript:void(0);" class="add-librarydataset">%s</a> \
- <input type="hidden" name="%s%s" value="%s">' % ( text, prefix, self.name, escape( str(ldda), quote=True ) )
+ <input type="hidden" name="%s%s" value="%s">' % ( text, prefix, self.name, escape( str(ldda_ids), quote=True ) )
def get_display_text(self):
if self.ldda:
--- a/templates/tool_form.mako Fri Jul 29 14:33:34 2011 -0400
+++ b/templates/tool_form.mako Mon Aug 01 17:35:18 2011 -0400
@@ -79,12 +79,18 @@
hide_modal();
},
"Select": function() {
+ var names = [];
+ var ids = [];
+ counter = 1;
$('input[name=ldda_ids]:checked').each(function() {
var name = $.trim( $(this).siblings("div").find("a").text() );
var id = $(this).val();
- link.text(name);
- link.siblings("input[type=hidden]").val(id);
+ names.push( counter + ". " + name );
+ counter += 1;
+ ids.push(id);
});
+ link.html( names.join("<br/>") );
+ link.siblings("input[type=hidden]").val( ids.join("||") );
hide_modal();
}
}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: greg: Tool shed template fixes: replace 1/2 template somehow removed in change set 5830, fix pop-up menu code for tools.
by Bitbucket 29 Jul '11
by Bitbucket 29 Jul '11
29 Jul '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/dc8f4f649a43/
changeset: dc8f4f649a43
user: greg
date: 2011-07-29 20:33:34
summary: Tool shed template fixes: replace 1/2 template somehow removed in change set 5830, fix pop-up menu code for tools.
affected #: 4 files (1.5 KB)
--- a/templates/webapps/community/repository/common.mako Fri Jul 29 11:26:09 2011 -0400
+++ b/templates/webapps/community/repository/common.mako Fri Jul 29 14:33:34 2011 -0400
@@ -50,4 +50,39 @@
onActivate: function(dtnode) {
var cell = $("#file_contents");
var selected_value;
-
\ No newline at end of file
+ if (dtnode.data.key == 'root') {
+ selected_value = "${repository.repo_path}/";
+ } else {
+ selected_value = dtnode.data.key;
+ };
+ if (selected_value.charAt(selected_value.length-1) != '/') {
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='repository', action='get_file_contents' )}",
+ dataType: "json",
+ data: { file_path: selected_value },
+ success : function ( data ) {
+ cell.html( '<label>'+data+'</label>' )
+ }
+ });
+ } else {
+ cell.html( '' );
+ };
+ },
+ });
+ });
+ </script>
+</%def>
+
+<%def name="render_clone_str( repository )">
+ <%
+ protocol, base = trans.request.base.split( '://' )
+ if trans.user:
+ username = '%s@' % trans.user.username
+ else:
+ username = ''
+ clone_str = '%s://%s%s/repos/%s/%s' % ( protocol, username, base, repository.user.username, repository.name )
+ %>
+ hg clone <a href="${clone_str}">${clone_str}</a>
+</%def>
--- a/templates/webapps/community/repository/manage_repository.mako Fri Jul 29 11:26:09 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Fri Jul 29 14:33:34 2011 -0400
@@ -177,12 +177,12 @@
%for tool_dict in tool_dicts:
<tr><td>
- <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ]}-popup">
+ <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"><a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">
${tool_dict[ 'name' ]}
</a></div>
- <div popupmenu="tool-${tool_dict[ 'id' ]}-popup">
+ <div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"><a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a></div></td>
--- a/templates/webapps/community/repository/view_repository.mako Fri Jul 29 11:26:09 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Fri Jul 29 14:33:34 2011 -0400
@@ -170,12 +170,12 @@
%for tool_dict in tool_dicts:
<tr><td>
- <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${repository.id}-popup">
+ <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"><a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">
${tool_dict[ 'name' ]}
</a></div>
- <div popupmenu="tool-${repository.id}-popup">
+ <div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"><a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a></div></td>
--- a/templates/webapps/community/repository/view_tool_metadata.mako Fri Jul 29 11:26:09 2011 -0400
+++ b/templates/webapps/community/repository/view_tool_metadata.mako Fri Jul 29 14:33:34 2011 -0400
@@ -111,7 +111,7 @@
</div><div class="form-row"><label>Command:</label>
- ${tool.command}
+ <pre>${tool.command}</pre><div style="clear: both"></div></div><div class="form-row">
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: greg: Mke message stating how much disk space was cleaned up in the Galaxy reposrts prettier. Fixes issue # 618.
by Bitbucket 29 Jul '11
by Bitbucket 29 Jul '11
29 Jul '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/de94796f92b7/
changeset: de94796f92b7
user: greg
date: 2011-07-29 17:26:09
summary: Mke message stating how much disk space was cleaned up in the Galaxy reposrts prettier. Fixes issue # 618.
affected #: 1 file (6 bytes)
--- a/lib/galaxy/webapps/reports/controllers/system.py Fri Jul 29 11:05:55 2011 -0400
+++ b/lib/galaxy/webapps/reports/controllers/system.py Fri Jul 29 11:26:09 2011 -0400
@@ -112,7 +112,7 @@
except:
pass
message = str( dataset_count ) + " datasets were deleted more than " + str( deleted_datasets_days ) + \
- " days ago, but have not yet been purged, disk space: " + str( disk_space ) + "."
+ " days ago, but have not yet been purged, disk space: " + nice_size( disk_space ) + "."
else:
message = "Enter the number of days."
return str( deleted_datasets_days ), message
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/bb51baa20151/
changeset: bb51baa20151
user: greg
date: 2011-07-29 17:05:55
summary: Fix bug discovered by Glen Beane in rendering roles on the permissions page for data libraries. In the data library hierarchy, rendered roles are all derived from roles associated with the LIBRARY_ACCESS permission, but roles rendered for that permission itself must be handled as a special case, which now is the case in that all legitimate roles not associated are listed.
affected #: 4 files (701 bytes)
--- a/lib/galaxy/security/__init__.py Thu Jul 28 11:50:56 2011 -0400
+++ b/lib/galaxy/security/__init__.py Fri Jul 29 11:05:55 2011 -0400
@@ -90,6 +90,8 @@
raise "Unimplemented Method"
def get_permissions( self, library_dataset ):
raise "Unimplemented Method"
+ def get_all_roles( self, trans, cntrller ):
+ raise "Unimplemented Method"
def get_legitimate_roles( self, trans, item, cntrller ):
raise "Unimplemented Method"
def derive_roles_from_access( self, trans, item_id, cntrller, library=False, **kwd ):
@@ -120,6 +122,50 @@
def sa_session( self ):
"""Returns a SQLAlchemy session"""
return self.model.context
+ def sort_by_attr( self, seq, attr ):
+ """
+ Sort the sequence of objects by object's attribute
+ Arguments:
+ seq - the list or any sequence (including immutable one) of objects to sort.
+ attr - the name of attribute to sort by
+ """
+ # Use the "Schwartzian transform"
+ # Create the auxiliary list of tuples where every i-th tuple has form
+ # (seq[i].attr, i, seq[i]) and sort it. The second item of tuple is needed not
+ # only to provide stable sorting, but mainly to eliminate comparison of objects
+ # (which can be expensive or prohibited) in case of equal attribute values.
+ intermed = map( None, map( getattr, seq, ( attr, ) * len( seq ) ), xrange( len( seq ) ), seq )
+ intermed.sort()
+ return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
+ def get_all_roles( self, trans, cntrller ):
+ admin_controller = cntrller in [ 'library_admin' ]
+ roles = set()
+ if not trans.user:
+ return trans.sa_session.query( trans.app.model.Role ) \
+ .filter( and_( self.model.Role.table.c.deleted==False,
+ self.model.Role.table.c.type != self.model.Role.types.PRIVATE,
+ self.model.Role.table.c.type != self.model.Role.types.SHARING ) ) \
+ .order_by( self.model.Role.table.c.name )
+ if admin_controller:
+ # The library is public and the user is an admin, so all roles are legitimate
+ for role in trans.sa_session.query( trans.app.model.Role ) \
+ .filter( self.model.Role.table.c.deleted==False ) \
+ .order_by( self.model.Role.table.c.name ):
+ roles.add( role )
+ else:
+ # Add the current user's private role
+ roles.add( self.get_private_user_role( trans.user ) )
+ # Add the current user's sharing roles
+ for role in self.get_sharing_roles( trans.user ):
+ roles.add( role )
+ # Add all remaining non-private, non-sharing roles
+ for role in trans.sa_session.query( trans.app.model.Role ) \
+ .filter( and_( self.model.Role.table.c.deleted==False,
+ self.model.Role.table.c.type != self.model.Role.types.PRIVATE,
+ self.model.Role.table.c.type != self.model.Role.types.SHARING ) ) \
+ .order_by( self.model.Role.table.c.name ):
+ roles.add( role )
+ return self.sort_by_attr( [ role for role in roles ], 'name' )
def get_legitimate_roles( self, trans, item, cntrller ):
"""
Return a sorted list of legitimate roles that can be associated with a permission on
@@ -140,51 +186,10 @@
for the current user's private role, will be excluded.
"""
admin_controller = cntrller in [ 'library_admin' ]
- def sort_by_attr( seq, attr ):
- """
- Sort the sequence of objects by object's attribute
- Arguments:
- seq - the list or any sequence (including immutable one) of objects to sort.
- attr - the name of attribute to sort by
- """
- # Use the "Schwartzian transform"
- # Create the auxiliary list of tuples where every i-th tuple has form
- # (seq[i].attr, i, seq[i]) and sort it. The second item of tuple is needed not
- # only to provide stable sorting, but mainly to eliminate comparison of objects
- # (which can be expensive or prohibited) in case of equal attribute values.
- intermed = map( None, map( getattr, seq, ( attr, ) * len( seq ) ), xrange( len( seq ) ), seq )
- intermed.sort()
- return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
roles = set()
if ( isinstance( item, self.model.Library ) and self.library_is_public( item ) ) or \
( isinstance( item, self.model.Dataset ) and self.dataset_is_public( item ) ):
- if not trans.user:
- return trans.sa_session.query( trans.app.model.Role ) \
- .filter( and_( self.model.Role.table.c.deleted==False,
- self.model.Role.table.c.type != self.model.Role.types.PRIVATE,
- self.model.Role.table.c.type != self.model.Role.types.SHARING ) ) \
- .order_by( self.model.Role.table.c.name )
- if admin_controller:
- # The library is public and the user is an admin, so all roles are legitimate
- for role in trans.sa_session.query( trans.app.model.Role ) \
- .filter( self.model.Role.table.c.deleted==False ) \
- .order_by( self.model.Role.table.c.name ):
- roles.add( role )
- return sort_by_attr( [ role for role in roles ], 'name' )
- else:
- # Add the current user's private role
- roles.add( self.get_private_user_role( trans.user ) )
- # Add the current user's sharing roles
- for role in self.get_sharing_roles( trans.user ):
- roles.add( role )
- # Add all remaining non-private, non-sharing roles
- for role in trans.sa_session.query( trans.app.model.Role ) \
- .filter( and_( self.model.Role.table.c.deleted==False,
- self.model.Role.table.c.type != self.model.Role.types.PRIVATE,
- self.model.Role.table.c.type != self.model.Role.types.SHARING ) ) \
- .order_by( self.model.Role.table.c.name ):
- roles.add( role )
- return sort_by_attr( [ role for role in roles ], 'name' )
+ return self.get_all_roles( trans, cntrller )
# If item has roles associated with the access permission, we need to start with them.
access_roles = item.get_access_roles( trans )
for role in access_roles:
@@ -205,7 +210,7 @@
for ura in user.roles:
if admin_controller or self.ok_to_display( trans.user, ura.role ):
roles.add( ura.role )
- return sort_by_attr( [ role for role in roles ], 'name' )
+ return self.sort_by_attr( [ role for role in roles ], 'name' )
def ok_to_display( self, user, role ):
"""
Method for checking if:
--- a/lib/galaxy/web/controllers/library_common.py Thu Jul 28 11:50:56 2011 -0400
+++ b/lib/galaxy/web/controllers/library_common.py Fri Jul 29 11:05:55 2011 -0400
@@ -246,12 +246,14 @@
message=util.sanitize_text( message ),
status='done' ) )
roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller )
+ all_roles = trans.app.security_agent.get_all_roles( trans, cntrller )
return trans.fill_template( '/library/common/library_permissions.mako',
cntrller=cntrller,
use_panels=use_panels,
library=library,
current_user_roles=current_user_roles,
roles=roles,
+ all_roles=all_roles,
show_deleted=show_deleted,
message=message,
status=status )
--- a/templates/dataset/security_common.mako Thu Jul 28 11:50:56 2011 -0400
+++ b/templates/dataset/security_common.mako Fri Jul 29 11:05:55 2011 -0400
@@ -1,11 +1,11 @@
-<%def name="render_select( current_actions, action_key, action, all_roles )">
+<%def name="render_select( current_actions, action_key, action, roles )"><%
import sets
in_roles = sets.Set()
for a in current_actions:
if a.action == action.action:
in_roles.add( a.role )
- out_roles = filter( lambda x: x not in in_roles, all_roles )
+ out_roles = filter( lambda x: x not in in_roles, roles )
%><p><b>${action.action}:</b> ${action.description}
@@ -37,7 +37,7 @@
</%def>
## Any permission ( e.g., 'DATASET_ACCESS' ) included in the do_not_render param will not be rendered on the page.
-<%def name="render_permission_form( obj, obj_name, form_url, all_roles, do_not_render=[] )">
+<%def name="render_permission_form( obj, obj_name, form_url, roles, do_not_render=[], all_roles=[] )"><%
if isinstance( obj, trans.app.model.User ):
current_actions = obj.default_permissions
@@ -109,7 +109,14 @@
%for k, v in permitted_actions:
%if k not in do_not_render:
<div class="form-row">
- ${render_select( current_actions, k, v, all_roles )}
+ # LIBRARY_ACCESS is a special case because we need to render all roles instead of
+ # roles derived from the roles associated with LIBRARY_ACCESS.
+ <% render_all_roles = k == 'LIBRARY_ACCESS' %>
+ %if render_all_roles:
+ ${render_select( current_actions, k, v, all_roles )}
+ %else:
+ ${render_select( current_actions, k, v, roles )}
+ %endif
</div>
%endif
%endfor
--- a/templates/library/common/library_permissions.mako Thu Jul 28 11:50:56 2011 -0400
+++ b/templates/library/common/library_permissions.mako Fri Jul 29 11:05:55 2011 -0400
@@ -14,5 +14,5 @@
%endif
%if ( trans.user_is_admin() and cntrller == 'library_admin' ) or trans.app.security_agent.can_manage_library_item( current_user_roles, library ):
- ${render_permission_form( library, library.name, h.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, id=trans.security.encode_id( library.id ), show_deleted=show_deleted ), roles )}
+ ${render_permission_form( library, library.name, h.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, id=trans.security.encode_id( library.id ), show_deleted=show_deleted ), roles, do_not_render=[], all_roles=all_roles )}
%endif
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: jgoecks: Fix bug in 3d2fd67bc0ca that prevented autocomplete from working in dataset attributes editing page.
by Bitbucket 28 Jul '11
by Bitbucket 28 Jul '11
28 Jul '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/9ece46045d15/
changeset: 9ece46045d15
user: jgoecks
date: 2011-07-28 17:50:56
summary: Fix bug in 3d2fd67bc0ca that prevented autocomplete from working in dataset attributes editing page.
affected #: 1 file (0 bytes)
--- a/templates/dataset/edit_attributes.mako Thu Jul 28 11:41:01 2011 -0400
+++ b/templates/dataset/edit_attributes.mako Thu Jul 28 11:50:56 2011 -0400
@@ -10,8 +10,8 @@
<%def name="javascripts()">
${parent.javascripts()}
+ ${message_ns.javascripts()}
${h.js( "galaxy.base", "jquery.autocomplete", "autocomplete_tagging" )}
- ${message_ns.javascripts()}
</%def><%def name="datatype( dataset, datatypes )">
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0