Beispiel #1
0
def reports(request):
    '''
    The main graphs/reports page.  If 'bldg_id' is the building to be selected;
    if None, the first building in the list is selected.
    '''

    # get the html for the list of building groups and the ID of the selected 
    # group.
    group_html, group_id_selected = view_util.group_list_html(0)

    # get the html for the list of buildings and the ID of the a selected building
    # (the first building)
    bldgs_html, bldg_id_selected = view_util.bldg_list_html(0, group_id_selected, None)

    # get the html for the list of charts, selecting the first one.  Returns the actual ID
    # of the chart selected.  The org_id of 0 indicates all organizations are being shown.
    chart_list_html, chart_id_selected = view_util.chart_list_html(0, bldg_id_selected)

    # get the option item html for the list of sensors associated with this building,
    # selecting the first sensor.
    sensor_list_html = view_util.sensor_list_html(bldg_id_selected)

    ctx = base_context()
    ctx.update({'groups_html': group_html,
                'bldgs_html': bldgs_html,
                'chart_list_html': chart_list_html,
                'sensor_list_html': sensor_list_html,
                'curtime': int(time.time())})
    
    return render_to_response('bmsapp/reports.html', ctx)
Beispiel #2
0
def reports(request, bldg_id=None):
    '''
    The main graphs/reports page.  If 'bldg_id' is the building to be selected;
    if None, the first building in the list is selected.
    '''

    # get the html for the list of building groups and the ID of the selected
    # group.
    group_html, group_id_selected = view_util.group_list_html()

    # get the html for the list of buildings and the ID of the a selected building
    # (the first building)
    bldgs_html, bldg_id_selected = view_util.bldg_list_html(
        group_id_selected, view_util.to_int(bldg_id))

    # get the html for the list of charts, selecting the first one.  Returns the actual ID
    # of the chart selected.  The group_id of 0 indicates all buildings are being shown.
    chart_list_html, chart_id_selected = view_util.chart_list_html(
        0, bldg_id_selected)

    # get the option item html for the list of sensors associated with this building,
    # selecting the first sensor.
    sensor_list_html = view_util.sensor_list_html(bldg_id_selected)

    ctx = base_context()
    ctx.update({
        'groups_html': group_html,
        'bldgs_html': bldgs_html,
        'chart_list_html': chart_list_html,
        'sensor_list_html': sensor_list_html,
        'curtime': int(time.time())
    })

    return render_to_response('bmsapp/reports.html', ctx)
Beispiel #3
0
def bldg_list(request, org_id, group_id):
    '''Returns a list of buildings in the organization identified by 'org_id'
    and the group identified by the primary key ID of 'group_id'. 

    The return value is an html snippet of option elements, one for each building.
    '''

    bldgs_html, _ = view_util.bldg_list_html(int(org_id), int(group_id))

    return HttpResponse(bldgs_html)
Beispiel #4
0
def bldg_list(request, group_id):
    '''
    Returns a list of buildings in the group identified by the primary key
    ID of 'group_id'. The 'selected_group' value of 0 means no group
    selected, so return all buildings.

    The return value is an html snippet of option elements, one for each building.
    '''

    bldgs_html, id_selected = view_util.bldg_list_html(int(group_id))

    return HttpResponse(bldgs_html)
Beispiel #5
0
def bldg_list(request, group_id):
    '''
    Returns a list of buildings in the group identified by the primary key
    ID of 'group_id'. The 'selected_group' value of 0 means no group
    selected, so return all buildings.

    The return value is an html snippet of option elements, one for each building.
    '''

    bldgs_html, id_selected = view_util.bldg_list_html(int(group_id))

    return HttpResponse(bldgs_html)