Example #1
0
def get_context(context):
    app = frappe.form_dict.app
    url = frappe.get_value("Wechat App", app, "user_defined_5")
    if not url:
        throw(_("User Defined 5 URL not defined"))
    context.no_cache = 1
    check_wechat_binding(redirect_url=url)
def get_context(context):
	context.no_cache = 1

	url = "/desk#List/Tickets Ticket"
	if frappe.form_dict.name:
		url = url + "/" + frappe.form_dict.name
	check_wechat_binding(redirect_url=url)
Example #3
0
def get_context(context):
    context.no_cache = 1

    url = "/cell_station_list"
    if is_webui_installed():
        url = "/S_Station_List"
    check_wechat_binding(redirect_url=url)
Example #4
0
def get_context(context):
    context.no_cache = 1
    context.show_sidebar = True

    try:
        app = check_wechat_binding()

        if frappe.session.user == 'Guest':
            frappe.local.flags.redirect_location = "/login"
            raise frappe.Redirect

        context.filter = frappe.form_dict.filter or "all"

        context.language = frappe.db.get_value("User", frappe.session.user,
                                               ["language"])
        context.csrf_token = frappe.local.session.data.csrf_token

        if 'Company Admin' in frappe.get_roles():
            context.isCompanyAdmin = True

        userdevices = devices_list_array(context.filter) or []
        context.userdevices = userdevices
        context.dev_lens = int(ceil(len(userdevices) * 0.1))

        context.wechat_app = app or frappe.form_dict.app
        context.title = _('Wechat Devices')

    except Exception as ex:
        frappe.logger(__name__).exception(ex)
        raise ex
Example #5
0
def get_context(context):
    app = check_wechat_binding()

    if frappe.session.user == 'Guest':
        frappe.local.flags.redirect_location = "/login"
        raise frappe.Redirect

    context.no_cache = 1
    context.show_sidebar = True

    context.language = frappe.db.get_value("User", frappe.session.user,
                                           ["language"])
    context.csrf_token = frappe.local.session.data.csrf_token

    if 'Company Admin' in frappe.get_roles(frappe.session.user):
        context.isCompanyAdmin = True

    context.wechat_openid = frappe.db.get_value("Wechat Binding", {
        "user": frappe.session.user,
        "app": app
    }, "openid")

    context.user_id = frappe.session.user
    context.wechat_app = app
    context.title = _('Wechat Unbind')
Example #6
0
def get_context(context):
    app = check_wechat_binding()
    context.no_cache = 1

    homepage = frappe.get_doc('Wechat Homepage', app)

    context.title = homepage.title or homepage.company

    context.homepage = homepage
def get_context(context):
    context.no_cache = 1

    check_wechat_binding(redirect_url="/me")
def get_context(context):
    wc_rurl = frappe.form_dict.wc_rurl or "wechat_home"
    context.no_cache = 1

    check_wechat_binding(redirect_url=wc_rurl)
Example #9
0
def get_context(context):
    context.no_cache = 1

    check_wechat_binding(redirect_url="/iot_devices")