Esempio n. 1
0
def experiments_json(request, instrument):
    """
         Ajax call to get all the possible experiments (retrieved from ICAT)
         @param request: request object
         @param instrument: instrument name
         @param ipts: experiment id
    """ 
    experiment_list = get_experiments_as_json(instrument)
    
    for exp in experiment_list:
        ipts = exp['value']
        if users_view_util.is_experiment_member(request, instrument, ipts ) is False:
            experiment_list.remove(exp)
    
    # TODO: Filter permissions
    response = HttpResponse(json.dumps(experiment_list), content_type="application/json")
    return response
Esempio n. 2
0
def experiment_run_list(request, instrument, ipts):
    """
        Return a list of runs for a given experiment with the reduce link.
        The reduce link will generate a JQuery Dialog unique per instrument
        The configuration of the Dialog Box are in <instrument_name>.__init__.py
        under the funtion get_reduction_dialog_settings(ipts, run)
        @param request: request object
        @param instrument: instrument name
        @param ipts: experiment name
    """
    
    logger.debug("Catalog: %s : instrument = %s, IPTS = %s"%(inspect.stack()[0][3],instrument,ipts))
    
    
    
    breadcrumbs = Breadcrumbs("home", reverse('catalog'))
    breadcrumbs.append_experiment_list(instrument)
    breadcrumbs.append(ipts.lower())
        
    template_values = {'instrument': instrument,
                       'experiment': ipts,
                       'title': '%s %s' % (instrument.upper(), ipts.upper()),
                       'breadcrumbs': breadcrumbs}

    if users_view_util.is_experiment_member(request, instrument, ipts) is False:
        template_values['user_alert'] = ["You do not have access to this experiment data."]
    else:
        runs = get_ipts_runs(instrument.upper(), ipts)
        template_values['run_data'] = runs
        if len(runs) == 0:
            template_values['user_alert'] = ['No runs were found for instrument %s experiment %s' % (instrument, ipts)]
    # Fill in Fermi auth values, login info,
    template_values = remote_view_util.fill_template_values(request, **template_values)
    template_values = catalog_view_util.fill_template_values(request, **template_values)
    template_values = users_view_util.fill_template_values(request, **template_values)
    return render_to_response('catalog/experiment_run_list.html', template_values)