예제 #1
0
def change_hash_ctype(request):
    if not request.user.is_authenticated() or not request.user.is_active:
        return HttpResponse(simplejson.dumps({'FAIL': True}),
                            mimetype='application/json')

    if request.method == 'GET':
        results = {}
        hashed = request.GET[u'hash']
        ctype = request.GET[u'dim']
        if ctype != '':
            newkey, rtype, d = interpret_hash(hashed)
            d['PHASE_KEY'] = ctype
            h = build_hash(rtype, d)

        else:
            newkey, rtype, d = interpret_hash(hashed)
            del d['PHASE_KEY']
            h = build_hash(rtype, d)
        results['new_hash'] = h
        results['FAIL'] = False
    else:
        results = {'FAIL': True}
    if 'application/json' in request.META.get('HTTP_ACCEPT', ''):
        return HttpResponse(simplejson.dumps(results),
                            mimetype='application/json')
예제 #2
0
def change_hash_ctype(request):
    if not request.user.is_authenticated() or not request.user.is_active:
        return HttpResponse(simplejson.dumps({'FAIL': True}),
                                mimetype='application/json')

    if request.method == 'GET':
        results = {}
        hashed = request.GET[u'hash']
        ctype = request.GET[u'dim']
        if ctype != '':
            newkey, rtype, d = interpret_hash(hashed)
            d['PHASE_KEY'] = ctype
            h = build_hash(rtype, d)

        else:
            newkey, rtype, d = interpret_hash(hashed)
            del d['PHASE_KEY']
            h = build_hash(rtype, d)
        results['new_hash'] = h
        results['FAIL'] = False
    else:
        results = {'FAIL': True}
    if 'application/json' in request.META.get('HTTP_ACCEPT', ''):
        return HttpResponse(simplejson.dumps(results),
                            mimetype='application/json')
예제 #3
0
def resort_board(request):
    if not request.user.is_authenticated() or not request.user.is_active:
        #needs to popup registration dialog instead
        return HttpResponse(simplejson.dumps({'FAIL': True}),
                            mimetype='application/json')

    if request.method == 'POST':
        d_id = request.POST[u'dashboard_id']
        dim = request.POST[u'sort_key']

        dash = DashboardPanel.objects.get(pk=d_id)
        key, rendertype, paramdict = interpret_hash(dash.plank)
        paramdict['DIM_KEY'] = dim
        key = build_hash(rendertype, paramdict, add_domain=False)
        dash.plank = key
        dash.save()

        results = {
            'FAIL': False,
            'dash_id': dash.dashboard_id,
            'plank': dash.plank
        }

        return HttpResponse(simplejson.dumps(results),
                            mimetype='application/json')
예제 #4
0
def change_hash_ctype(request):
    if not request.user.is_authenticated() or not request.user.is_active:
        return HttpResponse(simplejson.dumps({"FAIL": True}), mimetype="application/json")

    if request.method == "GET":
        results = {}
        hashed = request.GET[u"hash"]
        ctype = request.GET[u"dim"]
        if ctype != "":
            newkey, rtype, d = interpret_hash(hashed)
            d["PHASE_KEY"] = ctype
            h = build_hash(rtype, d)

        else:
            newkey, rtype, d = interpret_hash(hashed)
            del d["PHASE_KEY"]
            h = build_hash(rtype, d)
        results["new_hash"] = h
        results["FAIL"] = False
    else:
        results = {"FAIL": True}
    if "application/json" in request.META.get("HTTP_ACCEPT", ""):
        return HttpResponse(simplejson.dumps(results), mimetype="application/json")
예제 #5
0
def resort_board(request):
    if not request.user.is_authenticated()  or not request.user.is_active:
        #needs to popup registration dialog instead
        return HttpResponse(simplejson.dumps({'FAIL': True}),
                                mimetype='application/json')

    if request.method == 'POST':
        d_id = request.POST[u'dashboard_id']
        dim = request.POST[u'sort_key']

        dash = DashboardPanel.objects.get(pk=d_id)
        key, rendertype, paramdict = interpret_hash(dash.plank)
        paramdict['DIM_KEY'] = dim
        key = build_hash(rendertype, paramdict, add_domain=False)
        dash.plank = key
        dash.save()

        results = {'FAIL': False, 'dash_id': dash.dashboard_id, 'plank': dash.plank}

        return HttpResponse(simplejson.dumps(results),
                    mimetype='application/json')