def GetDefaultConfig(request):
    response = HttpResponse()
    vUser = CommonUtils.Current(response, request)
    curTheme = ParameterService.GetParameter(vUser, "User", vUser.Id,
                                             "WebTheme")
    curPageSize = ParameterService.GetParameter(vUser, "User", vUser.Id,
                                                "WebPageSize")
    curNavType = ParameterService.GetParameter(vUser, "User", vUser.Id,
                                               "NavType")

    if curTheme:
        if ParameterService.GetServiceConfig(
                CommonUtils.Current(response, request),
                'LoginProvider') == 'Cookie':
            response.set_signed_cookie(
                'theme',
                curTheme,
                max_age=int(
                    ParameterService.GetServiceConfig(
                        CommonUtils.Current(response, request),
                        'CookieMaxAge')),
                salt=ParameterService.GetServiceConfig(
                    CommonUtils.Current(response, request), 'LoginUserKey'))

    outJson = "{"
    if curTheme:
        outJson = outJson + "\"theme\":{\"title\":\"默认皮肤\",\"name\":\"" + curTheme + "\",\"selected\":true}"
    else:
        outJson = outJson + "\"theme\":{\"title\":\"默认皮肤\",\"name\":\"default\",\"selected\":true}"

    if curPageSize:
        outJson = outJson + ",\"gridRows\":" + curPageSize
    else:
        outJson = outJson + ",\"gridRows\":20"

    if curNavType:
        outJson = outJson + ",\"navType\":\"" + curNavType + "\"}"
    else:
        outJson = outJson + ",\"navType\":\"AccordionTree\"}"

    response.content = outJson
    return response
Beispiel #2
0
    def Theme(response, request):
        tmpTheme = "default"
        vUser = CommonUtils.Current(response, request)
        if vUser:
            tmpTheme = ParameterService.GetParameter(
                CommonUtils.Current(response, request), 'User', vUser.Id,
                'WebTheme')
        if not tmpTheme:
            tmpTheme = 'default'

        request.session['theme'] = tmpTheme
        response.set_signed_cookie(
            'theme',
            tmpTheme,
            max_age=int(
                ParameterService.GetServiceConfig(
                    CommonUtils.Current(response, request), 'CookieMaxAge')),
            salt=ParameterService.GetServiceConfig(
                CommonUtils.Current(response, request), 'LoginUserKey'))
        return tmpTheme
Beispiel #3
0
    def UIStyle(userInfo, response, request):
        tmpUIStyle = "AccordionTree"
        vUser = CommonUtils.Current(response, request)
        if userInfo:
            try:
                tmpUIStyle = ParameterService.GetParameter(
                    CommonUtils.Current(response, request), 'User',
                    userInfo.Id, 'NavType')
            except:
                tmpUIStyle = 'AccordionTree'
        else:
            tmpUIStyle = 'AccordionTree'

        request.session['UIStyle'] = tmpUIStyle
        response.set_signed_cookie(
            'UIStyle',
            tmpUIStyle,
            max_age=int(
                ParameterService.GetServiceConfig(
                    CommonUtils.Current(response, request), 'CookieMaxAge')),
            salt=ParameterService.GetServiceConfig(
                CommonUtils.Current(response, request), 'LoginUserKey'))
        return tmpUIStyle