Exemple #1
0
 def browse_libraries(self, trans, **kwd):
     if 'operation' in kwd:
         operation = kwd['operation'].lower()
         if operation == "browse":
             return trans.response.send_redirect(
                 web.url_for(controller='library_common',
                             action='browse_library',
                             cntrller='library',
                             **kwd))
     if 'f-free-text-search' in kwd:
         search_term = kwd["f-free-text-search"]
         if trans.app.config.enable_lucene_library_search:
             indexed_search_enabled = True
             search_url = trans.app.config.config_dict.get(
                 "fulltext_url", "")
             if search_url:
                 indexed_search_enabled = True
                 status, message, lddas = lucene_search(
                     trans, 'library', search_term, search_url, **kwd)
         elif trans.app.config.enable_whoosh_library_search:
             indexed_search_enabled = True
             status, message, lddas = whoosh_search(trans, 'library',
                                                    search_term, **kwd)
         else:
             indexed_search_enabled = False
         if indexed_search_enabled:
             comptypes = get_comptypes(trans)
             show_deleted = util.string_as_bool(
                 kwd.get('show_deleted', False))
             use_panels = util.string_as_bool(kwd.get('use_panels', False))
             return trans.fill_template(
                 '/library/common/library_dataset_search_results.mako',
                 cntrller='library',
                 search_term=search_term,
                 comptypes=comptypes,
                 lddas=lddas,
                 current_user_roles=trans.get_current_user_roles(),
                 show_deleted=show_deleted,
                 use_panels=use_panels,
                 message=message,
                 status=status)
     # Render the list view
     return self.library_list_grid(trans, **kwd)
 def browse_libraries(self, trans, **kwd):
     if "operation" in kwd:
         operation = kwd["operation"].lower()
         if operation == "browse":
             return trans.response.send_redirect(
                 web.url_for(controller="library_common", action="browse_library", cntrller="library", **kwd)
             )
     if "f-free-text-search" in kwd:
         search_term = kwd["f-free-text-search"]
         if trans.app.config.enable_lucene_library_search:
             indexed_search_enabled = True
             search_url = trans.app.config.config_dict.get("fulltext_url", "")
             if search_url:
                 indexed_search_enabled = True
                 status, message, lddas = lucene_search(trans, "library", search_term, search_url, **kwd)
         elif trans.app.config.enable_whoosh_library_search:
             indexed_search_enabled = True
             status, message, lddas = whoosh_search(trans, "library", search_term, **kwd)
         else:
             indexed_search_enabled = False
         if indexed_search_enabled:
             comptypes = get_comptypes(trans)
             show_deleted = util.string_as_bool(kwd.get("show_deleted", False))
             use_panels = util.string_as_bool(kwd.get("use_panels", False))
             return trans.fill_template(
                 "/library/common/library_dataset_search_results.mako",
                 cntrller="library",
                 search_term=search_term,
                 comptypes=comptypes,
                 lddas=lddas,
                 current_user_roles=trans.get_current_user_roles(),
                 show_deleted=show_deleted,
                 use_panels=use_panels,
                 message=message,
                 status=status,
             )
     # Render the list view
     return self.library_list_grid(trans, **kwd)
 def browse_libraries(self, trans, **kwd):
     if 'operation' in kwd:
         operation = kwd['operation'].lower()
         if operation == "browse":
             return trans.response.send_redirect(
                 web.url_for(controller='library_common',
                             action='browse_library',
                             cntrller='library_admin',
                             **kwd))
         elif operation == "delete":
             return self.delete_library(trans, **kwd)
         elif operation == "undelete":
             return self.undelete_library(trans, **kwd)
     self.library_list_grid.operations = []
     if 'f-deleted' in kwd:
         if kwd['f-deleted'] != 'All':
             if galaxy.util.string_as_bool(kwd['f-deleted']):
                 # We're viewing deleted data libraries, so add a GridOperation
                 # enabling one or more of them to be undeleted.
                 self.library_list_grid.operations = [
                     grids.GridOperation(
                         "Undelete",
                         condition=(lambda item: item.deleted),
                         allow_multiple=True,
                         allow_popup=False,
                         url_args=dict(webapp="galaxy"))
                 ]
             else:
                 # We're viewing active data libraries, so add a GridOperation
                 # enabling one or more of them to be deleted.
                 self.library_list_grid.operations = [
                     grids.GridOperation(
                         "Delete",
                         condition=(lambda item: not item.deleted),
                         allow_multiple=True,
                         allow_popup=False,
                         url_args=dict(webapp="galaxy"))
                 ]
     else:
         # We're viewing active data libraries, so add a GridOperation
         # enabling one or more of them to be deleted.
         self.library_list_grid.operations = [
             grids.GridOperation("Delete",
                                 condition=(lambda item: not item.deleted),
                                 allow_multiple=True,
                                 allow_popup=False,
                                 url_args=dict(webapp="galaxy"))
         ]
     if 'f-free-text-search' in kwd:
         search_term = kwd["f-free-text-search"]
         if trans.app.config.enable_lucene_library_search:
             indexed_search_enabled = True
             search_url = trans.app.config.config_dict.get(
                 "fulltext_find_url", "")
             if search_url:
                 status, message, lddas = lucene_search(
                     trans, 'library_admin', search_term, search_url, **kwd)
         elif trans.app.config.enable_whoosh_library_search:
             indexed_search_enabled = True
             status, message, lddas = whoosh_search(trans, 'library_admin',
                                                    search_term, **kwd)
         else:
             indexed_search_enabled = False
         if indexed_search_enabled:
             comptypes = get_comptypes(trans)
             show_deleted = galaxy.util.string_as_bool(
                 kwd.get('show_deleted', False))
             use_panels = galaxy.util.string_as_bool(
                 kwd.get('use_panels', False))
             return trans.fill_template(
                 '/library/common/library_dataset_search_results.mako',
                 cntrller='library_admin',
                 search_term=search_term,
                 comptypes=comptypes,
                 lddas=lddas,
                 show_deleted=show_deleted,
                 use_panels=use_panels,
                 message=escape(message),
                 status=escape(status))
     # Render the list view
     return self.library_list_grid(trans, **kwd)
 def browse_libraries( self, trans, **kwd ):
     if 'operation' in kwd:
         operation = kwd['operation'].lower()
         if operation == "browse":
             return trans.response.send_redirect( web.url_for( controller='library_common',
                                                               action='browse_library',
                                                               cntrller='library_admin',
                                                               **kwd ) )
         elif operation == "delete":
             return self.delete_library( trans, **kwd )
         elif operation == "undelete":
             return self.undelete_library( trans, **kwd )
     self.library_list_grid.operations = []
     if 'f-deleted' in kwd:
         if kwd[ 'f-deleted' ] != 'All':
             if galaxy.util.string_as_bool( kwd[ 'f-deleted' ] ):
                 # We're viewing deleted data libraries, so add a GridOperation
                 # enabling one or more of them to be undeleted.
                 self.library_list_grid.operations = [
                     grids.GridOperation( "Undelete",
                                          condition=( lambda item: item.deleted ),
                                          allow_multiple=True,
                                          allow_popup=False,
                                          url_args=dict( webapp="galaxy" ) )
                 ]
             else:
                 # We're viewing active data libraries, so add a GridOperation
                 # enabling one or more of them to be deleted.
                 self.library_list_grid.operations = [
                     grids.GridOperation( "Delete",
                                          condition=( lambda item: not item.deleted ),
                                          allow_multiple=True,
                                          allow_popup=False,
                                          url_args=dict( webapp="galaxy" ) )
                 ]
     else:
         # We're viewing active data libraries, so add a GridOperation
         # enabling one or more of them to be deleted.
         self.library_list_grid.operations = [
             grids.GridOperation( "Delete",
                                  condition=( lambda item: not item.deleted ),
                                  allow_multiple=True,
                                  allow_popup=False,
                                  url_args=dict( webapp="galaxy" ) )
         ]
     if 'f-free-text-search' in kwd:
         search_term = kwd[ "f-free-text-search" ]
         if trans.app.config.enable_lucene_library_search:
             indexed_search_enabled = True
             search_url = trans.app.config.config_dict.get( "fulltext_find_url", "" )
             if search_url:
                 status, message, lddas = lucene_search( trans, 'library_admin', search_term, search_url, **kwd )
         elif trans.app.config.enable_whoosh_library_search:
             indexed_search_enabled = True
             status, message, lddas = whoosh_search( trans, 'library_admin', search_term, **kwd )
         else:
             indexed_search_enabled = False
         if indexed_search_enabled:
             comptypes = get_comptypes( trans )
             show_deleted = galaxy.util.string_as_bool( kwd.get( 'show_deleted', False ) )
             use_panels = galaxy.util.string_as_bool( kwd.get( 'use_panels', False ) )
             return trans.fill_template( '/library/common/library_dataset_search_results.mako',
                                         cntrller='library_admin',
                                         search_term=search_term,
                                         comptypes=comptypes,
                                         lddas=lddas,
                                         show_deleted=show_deleted,
                                         use_panels=use_panels,
                                         message=message,
                                         status=status )
     # Render the list view
     return self.library_list_grid( trans, **kwd )