Package omeroweb :: Package webclient :: Module views
[hide private]
[frames] | no frames]

Module views

source code

A view functions is simply a Python function that takes a Web request and returns a Web response. This response can be the HTML contents of a Web page, or a redirect, or the 404 and 500 error, or an XML document, or an image... or anything.

Functions [hide private]
 
getIntOrDefault(request, name, default) source code
 
login(request)
Webclient Login - Also can be used by other Apps to log in to OMERO.
source code
 
keepalive_ping(request, conn=None, **kwargs)
Keeps the OMERO session alive by pinging the server
source code
 
feed(request, conn=None, **kwargs)
Viewing this page doesn't perform any action.
source code
 
index_last_imports(request, conn=None, **kwargs)
Gets the most recent imports - Used in an AJAX call by home page.
source code
 
index_most_recent(request, conn=None, **kwargs)
Gets the most recent 'shares' and 'share' comments.
source code
 
index_tag_cloud(request, conn=None, **kwargs)
Gets the most used Tags.
source code
 
change_active_group(request, conn=None, url=None, **kwargs)
Simply changes the request.session['active_group'] which is then used by the @login_required decorator to configure conn for any group-based queries.
source code
 
switch_active_group(request, active_group=None)
Simply changes the request.session['active_group'] which is then used by the @login_required decorator to configure conn for any group-based queries.
source code
 
logout(request, conn=None, **kwargs)
Logout of the session and redirects to the homepage (will redirect to login first)
source code
 
load_template(request, menu, conn=None, url=None, **kwargs)
This view handles most of the top-level pages, as specified by 'menu' E.g.
source code
 
load_data(request, o1_type=None, o1_id=None, o2_type=None, o2_id=None, o3_type=None, o3_id=None, conn=None, **kwargs)
This loads data for the tree, via AJAX calls.
source code
 
load_chgrp_target(request, group_id, target_type, conn=None, **kwargs)
Loads a tree for user to pick target Project, Dataset or Screen
source code
 
load_searching(request, form=None, conn=None, **kwargs)
Handles AJAX calls to search
source code
 
load_data_by_tag(request, o_type=None, o_id=None, conn=None, **kwargs)
Loads data for the tag tree and center panel.
source code
 
open_astex_viewer(request, obj_type, obj_id, conn=None, **kwargs)
Opens the Open Astex Viewer applet, to display volume masks in a couple of formats: - mrc.map files that are attached to images.
source code
 
load_metadata_details(request, c_type, c_id, conn=None, share_id=None, **kwargs)
This page is the right-hand panel 'general metadata', first tab only.
source code
 
load_metadata_preview(request, c_type, c_id, conn=None, share_id=None, **kwargs)
This is the image 'Preview' tab for the right-hand panel.
source code
 
load_metadata_hierarchy(request, c_type, c_id, conn=None, **kwargs)
This loads the ancestors of the specified object and displays them in a static tree.
source code
 
load_metadata_acquisition(request, c_type, c_id, conn=None, share_id=None, **kwargs)
The acquisition tab of the right-hand panel.
source code
 
getObjects(request, conn=None)
Prepare objects for use in the annotation forms.
source code
 
getIds(request)
Used by forms to indicate the currently selected objects prepared above
source code
 
batch_annotate(request, conn=None, **kwargs)
This page gives a form for batch annotation.
source code
 
annotate_file(request, conn=None, **kwargs)
On 'POST', This handles attaching an existing file-annotation(s) and/or upload of a new file to one or more objects Otherwise it generates the form for choosing file-annotations & local files.
source code
 
annotate_comment(request, conn=None, **kwargs)
Handle adding Comments to one or more objects Unbound instance of Comment form not available.
source code
 
annotate_tags(request, conn=None, **kwargs)
This handles creation AND submission of Tags form, adding new AND/OR existing tags to one or more objects
source code
 
edit_channel_names(request, imageId, conn=None, **kwargs)
Edit and save channel names
source code
 
manage_action_containers(request, action, o_type=None, o_id=None, conn=None, **kwargs)
Handles many different actions on various objects.
source code
 
get_original_file(request, fileId, conn=None, **kwargs)
Returns the specified original file as an http response.
source code
 
image_as_map(request, imageId, conn=None, **kwargs)
Converts OMERO image into mrc.map file (using tiltpicker utils) and returns the file
source code
 
download_annotation(request, annId, conn=None, **kwargs)
Returns the file annotation as an http response for download
source code
 
download_orig_metadata(request, imageId, conn=None, **kwargs)
Downloads the 'Original Metadata' as a text file
source code
 
load_public(request, share_id=None, conn=None, **kwargs)
Loads data for the tree in the 'public' main page.
source code
 
basket_action(request, action=None, conn=None, **kwargs)
Various actions for creating a 'share' or 'discussion' (no images).
source code
 
empty_basket(request, **kwargs)
Empty the basket of images
source code
 
update_basket(request, **kwargs)
Add or remove images to the set in the basket
source code
 
load_calendar(request, year=None, month=None, conn=None, **kwargs)
Loads the calendar which is displayed in the left panel of the history page.
source code
 
load_history(request, year, month, day, conn=None, **kwargs)
The data for a particular date that is loaded into the center panel
source code
 
getObjectUrl(conn, obj)
This provides a url to browse to the specified omero.model.ObjectI P/D/I, S/P, FileAnnotation etc.
source code
 
activities(request, conn=None, **kwargs)
This refreshes callback handles (delete, scripts, chgrp etc) and provides html to update Activities window & Progressbar.
source code
 
activities_update(request, action, **kwargs)
If the above 'action' == 'clean' then we clear jobs from request.session['callback'] either a single job (if 'jobKey' is specified in POST) or all jobs (apart from those in progress)
source code
 
avatar(request, oid=None, conn=None, **kwargs)
Returns the experimenter's photo
source code
 
image_viewer(request, iid, share_id=None, **kwargs)
Delegates to webgateway, using share connection if appropriate
source code
 
list_scripts(request, conn=None, **kwargs)
List the available scripts - Just officical scripts for now
source code
 
script_ui(request, scriptId, conn=None, **kwargs)
Generates an html form for the parameters of a defined script.
source code
 
figure_script(request, scriptName, conn=None, **kwargs)
Show a UI for running figure scripts
source code
 
chgrp(request, conn=None, **kwargs)
Moves data to a new group, using the chgrp queue.
source code
 
script_run(request, scriptId, conn=None, **kwargs)
Runs a script using values in a POST
source code
 
ome_tiff_script(request, imageId, conn=None, **kwargs)
Uses the scripting service (Batch Image Export script) to generate OME-TIFF for an image and attach this as a file annotation to the image.
source code
 
run_script(request, conn, sId, inputMap, scriptName='Script')
Starts running a script, adding details to the request.session so that it shows up in the webclient Activities panel and results are available there etc.
source code
 
ome_tiff_info(request, imageId, conn=None, **kwargs)
Query to see if we have an OME-TIFF attached to the image (assume only 1, since Batch Image Export will delete old ones)
source code
Variables [hide private]
  logger = logging.getLogger(__name__)

Imports: sys, copy, re, os, calendar, cStringIO, datetime, httplib, Ice, locale, logging, traceback, shutil, zipfile, time, start_new_thread, omero_version, omero, settings, SessionStore, template_loader, cache, Http404, HttpResponse, HttpResponseRedirect, HttpResponseServerError, HttpResponseForbidden, render_to_response, Context, simplejson, urlencode, page_not_found, server_error, debug, reverse, _, smart_str, FileWrapper, OmeroWebGateway, HttpJavascriptRedirect, HttpJavascriptResponse, HttpLoginRedirect, _formatReport, _purgeCallback, ShareForm, BasketShareForm, ContainerForm, ContainerNameForm, ContainerDescriptionForm, CommentAnnotationForm, TagsAnnotationForm, UsersForm, ActiveGroupForm, MetadataFilterForm, MetadataDetectorForm, MetadataChannelForm, MetadataEnvironmentForm, MetadataObjectiveForm, MetadataObjectiveSettingsForm, MetadataStageLabelForm, MetadataLightSourceForm, MetadataDichroicForm, MetadataMicroscopeForm, FilesAnnotationForm, WellIndexForm, BaseController, BaseIndex, BaseBasket, BaseContainer, BaseHelp, BaseCalendar, BaseImpexp, BaseSearch, BaseShare, Server, LoginForm, toBoolean, upgradeCheck, webgateway_views, handlerInternalError, login_required, render_response, Connector, ConnCleaningHttpResponse


Function Details [hide private]

login(request)

source code 

Webclient Login - Also can be used by other Apps to log in to OMERO. Uses the 'server' id from request to lookup the server-id (index), host and port from settings. E.g. "localhost", 4064. Stores these details, along with username, password etc in the request.session. Resets other data parameters in the request.session. Tries to get connection to OMERO and if this works, then we are redirected to the 'index' page or url specified in REQUEST. If we can't connect, the login page is returned with appropriate error messages.

keepalive_ping(request, conn=None, **kwargs)

source code 

Keeps the OMERO session alive by pinging the server

Decorators:
  • @login_required(ignore_login_fail= True)

feed(request, conn=None, **kwargs)

source code 

Viewing this page doesn't perform any action. All we do here is assemble various data for display. Last imports, tag cloud etc are retrived via separate AJAX calls.

Decorators:
  • @login_required()
  • @render_response()

index_last_imports(request, conn=None, **kwargs)

source code 

Gets the most recent imports - Used in an AJAX call by home page.

Decorators:
  • @login_required()
  • @render_response()

index_most_recent(request, conn=None, **kwargs)

source code 

Gets the most recent 'shares' and 'share' comments. Used by the homepage via AJAX call

Decorators:
  • @login_required()
  • @render_response()

index_tag_cloud(request, conn=None, **kwargs)

source code 

Gets the most used Tags. Used by the homepage via AJAX call

Decorators:
  • @login_required()
  • @render_response()

change_active_group(request, conn=None, url=None, **kwargs)

source code 

Simply changes the request.session['active_group'] which is then used by the @login_required decorator to configure conn for any group-based queries. Finally this redirects to the 'url'.

Decorators:
  • @login_required()

logout(request, conn=None, **kwargs)

source code 

Logout of the session and redirects to the homepage (will redirect to login first)

Decorators:
  • @login_required(login_redirect= 'webindex')

load_template(request, menu, conn=None, url=None, **kwargs)

source code 

This view handles most of the top-level pages, as specified by 'menu' E.g. userdata, usertags, history, search etc. Query string 'path' that specifies an object to display in the data tree is parsed. We also prepare the list of users in the current group, for the switch-user form. Change-group form is also prepared.

Decorators:
  • @login_required()
  • @render_response()

load_data(request, o1_type=None, o1_id=None, o2_type=None, o2_id=None, o3_type=None, o3_id=None, conn=None, **kwargs)

source code 

This loads data for the tree, via AJAX calls. The template is specified by query string. E.g. icon, table, tree. By default this loads Projects and Datasets. E.g. /load_data?view=tree provides data for the tree as <li>.

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

load_chgrp_target(request, group_id, target_type, conn=None, **kwargs)

source code 

Loads a tree for user to pick target Project, Dataset or Screen

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

load_searching(request, form=None, conn=None, **kwargs)

source code 

Handles AJAX calls to search

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

load_data_by_tag(request, o_type=None, o_id=None, conn=None, **kwargs)

source code 

Loads data for the tag tree and center panel. Either get the P/D/I etc under tags, or the images etc under a tagged Dataset or Project. @param o_type 'tag' or 'project', 'dataset'.

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

open_astex_viewer(request, obj_type, obj_id, conn=None, **kwargs)

source code 

Opens the Open Astex Viewer applet, to display volume masks in a couple of formats:
- mrc.map files that are attached to images. obj_type = 'file'
- Convert OMERO image to mrc on the fly. obj_type = 'image_8bit' or 'image'
    In this case, we may use 'scipy' to scale the image volume. 

Decorators:
  • @login_required()
  • @render_response()

load_metadata_details(request, c_type, c_id, conn=None, share_id=None, **kwargs)

source code 

This page is the right-hand panel 'general metadata', first tab only. Shown for Projects, Datasets, Images, Screens, Plates, Wells, Tags etc. The data and annotations are loaded by the manager. Display of appropriate data is handled by the template.

Decorators:
  • @login_required()
  • @render_response()

load_metadata_preview(request, c_type, c_id, conn=None, share_id=None, **kwargs)

source code 

This is the image 'Preview' tab for the right-hand panel. Currently this doesn't do much except launch the view-port plugin using the image Id (and share Id if necessary)

Decorators:
  • @login_required()
  • @render_response()

load_metadata_hierarchy(request, c_type, c_id, conn=None, **kwargs)

source code 

This loads the ancestors of the specified object and displays them in a static tree. Used by an AJAX call from the metadata_general panel.

Decorators:
  • @login_required()
  • @render_response()

load_metadata_acquisition(request, c_type, c_id, conn=None, share_id=None, **kwargs)

source code 

The acquisition tab of the right-hand panel. Only loaded for images. TODO: urls regex should make sure that c_type is only 'image' OR 'well'

Decorators:
  • @login_required()
  • @render_response()

getObjects(request, conn=None)

source code 

Prepare objects for use in the annotation forms. These objects are required by the form superclass to populate hidden fields, so we know what we're annotating on submission

batch_annotate(request, conn=None, **kwargs)

source code 

This page gives a form for batch annotation. Local File form and Comment form are loaded. Other forms are loaded via AJAX

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

annotate_file(request, conn=None, **kwargs)

source code 

On 'POST', This handles attaching an existing file-annotation(s) and/or upload of a new file to one or more objects Otherwise it generates the form for choosing file-annotations & local files.

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

annotate_comment(request, conn=None, **kwargs)

source code 

Handle adding Comments to one or more objects Unbound instance of Comment form not available. If the form has been submitted, a bound instance of the form is created using request.POST

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

annotate_tags(request, conn=None, **kwargs)

source code 

This handles creation AND submission of Tags form, adding new AND/OR existing tags to one or more objects

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

edit_channel_names(request, imageId, conn=None, **kwargs)

source code 

Edit and save channel names

Decorators:
  • @login_required()
  • @render_response()

manage_action_containers(request, action, o_type=None, o_id=None, conn=None, **kwargs)

source code 

Handles many different actions on various objects.

Parameters:
  • action - "addnewcontainer", (creates a new Project, Dataset, Screen) "editname", "savename", "editdescription", "savedescription", (used as GET and POST for in-line editing) "paste", "move", "remove", "removefromshare", (tree P/D/I moving etc) "delete", "deletemany" (delete objects)
  • o_type - "dataset", "project", "image", "screen", "plate", "acquisition", "well","comment", "file", "tag", "tagset","share", "sharecomment"
Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

get_original_file(request, fileId, conn=None, **kwargs)

source code 

Returns the specified original file as an http response. Used for displaying text or png/jpeg etc files in browser

Decorators:
  • @login_required(doConnectionCleanup= False)

image_as_map(request, imageId, conn=None, **kwargs)

source code 

Converts OMERO image into mrc.map file (using tiltpicker utils) and returns the file

Decorators:
  • @login_required()

download_annotation(request, annId, conn=None, **kwargs)

source code 

Returns the file annotation as an http response for download

Decorators:
  • @login_required(doConnectionCleanup= False)

download_orig_metadata(request, imageId, conn=None, **kwargs)

source code 

Downloads the 'Original Metadata' as a text file

Decorators:
  • @login_required()

load_public(request, share_id=None, conn=None, **kwargs)

source code 

Loads data for the tree in the 'public' main page.

Decorators:
  • @login_required()
  • @render_response()

basket_action(request, action=None, conn=None, **kwargs)

source code 

Various actions for creating a 'share' or 'discussion' (no images).

Parameters:
  • action - 'toshare', 'createshare' (form to create share and handling the action itself) 'todiscuss', 'createdisc' (form to create discussion and handling the action itself)
Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

empty_basket(request, **kwargs)

source code 

Empty the basket of images

Decorators:
  • @login_required()

update_basket(request, **kwargs)

source code 

Add or remove images to the set in the basket

Decorators:
  • @login_required()

load_calendar(request, year=None, month=None, conn=None, **kwargs)

source code 

Loads the calendar which is displayed in the left panel of the history page. Shows current month by default. Filter by experimenter

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

load_history(request, year, month, day, conn=None, **kwargs)

source code 

The data for a particular date that is loaded into the center panel

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

getObjectUrl(conn, obj)

source code 

This provides a url to browse to the specified omero.model.ObjectI P/D/I, S/P, FileAnnotation etc. used to display results from the scripting service E.g webclient/userdata/?path=image-12601 If the object is a file annotation, try to browse to the parent P/D/I

activities(request, conn=None, **kwargs)

source code 

This refreshes callback handles (delete, scripts, chgrp etc) and provides html to update Activities window & Progressbar. The returned html contains details for ALL callbacks in web session, regardless of their status. We also add counts of jobs, failures and 'in progress' to update status bar.

Decorators:
  • @login_required()
  • @render_response()

activities_update(request, action, **kwargs)

source code 

If the above 'action' == 'clean' then we clear jobs from request.session['callback'] either a single job (if 'jobKey' is specified in POST) or all jobs (apart from those in progress)

Decorators:
  • @login_required()

avatar(request, oid=None, conn=None, **kwargs)

source code 

Returns the experimenter's photo

Decorators:
  • @login_required()

image_viewer(request, iid, share_id=None, **kwargs)

source code 

Delegates to webgateway, using share connection if appropriate

Decorators:
  • @login_required()

list_scripts(request, conn=None, **kwargs)

source code 

List the available scripts - Just officical scripts for now

Decorators:
  • @login_required()
  • @render_response()

script_ui(request, scriptId, conn=None, **kwargs)

source code 

Generates an html form for the parameters of a defined script.

Decorators:
  • @login_required()
  • @render_response()

figure_script(request, scriptName, conn=None, **kwargs)

source code 

Show a UI for running figure scripts

Decorators:
  • @login_required(setGroupContext= True)
  • @render_response()

chgrp(request, conn=None, **kwargs)

source code 

Moves data to a new group, using the chgrp queue. Handles submission of chgrp form: all data in POST. Adds the callback handle to the request.session['callback']['jobId']

Decorators:
  • @login_required()

script_run(request, scriptId, conn=None, **kwargs)

source code 

Runs a script using values in a POST

Decorators:
  • @login_required(setGroupContext= True)

ome_tiff_script(request, imageId, conn=None, **kwargs)

source code 

Uses the scripting service (Batch Image Export script) to generate OME-TIFF for an image and attach this as a file annotation to the image. Script will show up in the 'Activities' for users to monitor and download result etc.

Decorators:
  • @login_required(setGroupContext= True)

ome_tiff_info(request, imageId, conn=None, **kwargs)

source code 

Query to see if we have an OME-TIFF attached to the image (assume only 1, since Batch Image Export will delete old ones)

Decorators:
  • @login_required()
  • @render_response()