def index(request):
    if request.path == '/':
        response = redirect('landing')
        return response
    appList = getapplist(request)
    if not request.user.is_authenticated:
        appList = [app for app in appList if app[0] in publicApps]
    context = {}
    context['version'] = appconfig.getversion()
    context['appList'] = appList
    context['labels'] = 'name file'.split(' ')
    context['apptitle'] = TITLE
    context['hostname'] = hostname
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())

    try:
        alert_config = cspace.getConfig(path.join(settings.BASE_DIR, 'config'),
                                        'alert')
        context['ALERT'] = alert_config.get('alert', 'ALERT')
        context['MESSAGE'] = alert_config.get('alert', 'MESSAGE')
    except:
        context['ALERT'] = ''

    return render(request, 'listApps.html', context)
def configure_common_tools(context, request, action, webappconfig):
    context['serverlabel'] = webappconfig.get('info', 'serverlabel')
    context['serverlabelcolor'] = webappconfig.get('info', 'serverlabelcolor')
    context['institution'] = webappconfig.get('info', 'institution')
    context['apptitle'] = webappconfig.get(action, 'apptitle')
    context['version'] = appconfig.getversion()
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())
    context['labels'] = 'name file'.split(' ')
    return context
Example #3
0
def index(request):
    appList = getapplist(request)
    if not request.user.is_authenticated():
        appList = [app for app in appList if app[0] in publicApps]
    context = {}
    context['version'] = appconfig.getversion()
    context['appList'] = appList
    context['labels'] = 'name file'.split(' ')
    context['apptitle'] = TITLE
    context['hostname'] = hostname
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())
    return render(request, 'listApps.html', context)
def index(request):
    appList = getapplist(request)
    if not request.user.is_authenticated():
        appList = [app for app in appList if not app[0] in loginRequiredApps]
    context = {}
    context['version'] = appconfig.getversion()
    context['appList'] = appList
    context['labels'] = 'name file'.split(' ')
    context['apptitle'] = TITLE
    context['hostname'] = hostname
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())
    return render(request, 'listApps.html', context)
def setconstants(request, context, appname):
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())
    context['searchrows'] = range(1, 4)
    context['searchcolumns'] = range(1, 4)
    context['apptitle'] = APPS[appname][0]
    context['appname'] = appname
    context['suggestions'] = suggestions
    context['institution'] = institution
    context['version'] = VERSION
    context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
    context['device'] = devicetype(request)
    # insert a nav bar item to enable user to switch to a different tool
    context['extra_nav'] = {'href': './', 'id': 'switchtool', 'name': 'Switch Tool'}

    return context
Example #6
0
def configure_common_tools(context, request, action, webappconfig):
    context['serverlabel'] = webappconfig.get('info', 'serverlabel')
    context['serverlabelcolor'] = webappconfig.get('info', 'serverlabelcolor')
    context['institution'] = webappconfig.get('info', 'institution')
    context['apptitle'] = webappconfig.get(action, 'apptitle')
    context['version'] = appconfig.getversion()
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())
    context['labels'] = 'name file'.split(' ')
    try:
        alert_config = getConfig(os.path.join(settings.BASE_DIR, 'config'),
                                 'alert')
        context['ALERT'] = alert_config.get('alert', 'ALERT')
        context['MESSAGE'] = alert_config.get('alert', 'MESSAGE')
    except:
        context['ALERT'] = ''
    return context
Example #7
0
def index(request):
    context = {}
    context['version'] = appconfig.getversion()
    context['labels'] = 'name file'.split(' ')
    context['apptitle'] = TITLE
    context['hostname'] = hostname
    context['device'] = devicetype(request)
    context['timestamp'] = time.strftime("%b %d %Y %H:%M:%S", time.localtime())

    html = ''
    topLocs = sorted(locMap.keys())
    for i, l in enumerate(topLocs):
        #cols = int(math.log(objectCounts[l],2)/3)
        cols = makeBin(objectCounts[l])
        if cols == 0: cols = 1
        html += f'<div class="box col{cols}"><div class="show left" data-loc="{l}">{l}</div><div class="right">{objectCounts[l]}</div>'
        #  % (cols,l,objectCounts[l],cols,l)
        sublocs = sorted(locMap[l].keys())
        html += '''<div class="bottom" id="%s" style="display:none">''' % l
        for subloc in sublocs:
            combined = l + ' ' + subloc
            locCount = len(roomCounts[combined])
            html += '''<div class="show bottom" data-loc="%s"> %s %s ''' % (
                combined, subloc, locMap[l][subloc])
            html += '''<div class="locdetail" id="%s" style="display:none;"><i>%s</i>:<br/>%s locs, %s objs</div></div>''' % (
                combined, combined, locCount, locMap[l][subloc])
        html += '</div></div>'
    context['html'] = html

    try:
        alert_config = cspace.getConfig(path.join(settings.BASE_DIR, 'config'),
                                        'alert')
        context['ALERT'] = alert_config.get('alert', 'ALERT')
        context['MESSAGE'] = alert_config.get('alert', 'MESSAGE')
    except:
        context['ALERT'] = ''

    return render(request, 'vp.html', context)