def index(): # if not request.user_agent()['is_mobile']: # session.flash = T("Welcome to OpenStudio!") if auth.user.login_start == 'profile': redirect(URL('profile', 'index')) if auth.user.login_start == 'selfcheckin': redirect(URL('selfcheckin', 'index')) user_helpers = User_helpers() if user_helpers.check_read_permission('pinboard', auth.user.id): redirect(URL('pinboard', 'index')) else: redirect(URL('blank'))
def ep_menu(): user_helpers = User_helpers() menu= [] # Home menu.append([( # I(_class='fa fa-home'), SPAN(T('Home'))), False, URL('ep', 'index', extension='')]) # Monthly Classes menu.append([( # I(_class='fa fa-graduation-cap'), SPAN(T('My Classes'))), False, URL('ep', 'my_classes', extension='')]) # My Payments / Staffpayments menu.append([( # I(_class='fa fa-home'), SPAN(T('My Payments'))), False, URL('ep', 'my_payments', extension='')]) menu.append([( # I(_class='fa fa-home'), SPAN(T('Back end'))), False, URL('pinboard', 'index', extension='')]) return menu
def get_backend_menu(): user_helpers = User_helpers() default_class = '' pinboard_class = '' tasks_class = '' customers_class = '' classes_class = '' employees_class = '' workshops_class = '' sp_class = '' reports_class = '' finance_class = '' shop_class = '' settings_class = '' jumpto_class = '' active_class = 'active' if not request.is_scheduler and not request.is_shell: if request.controller == 'default': default_class = active_class elif request.controller == 'pinboard': pinboard_class = active_class elif request.controller == 'tasks': tasks_class = active_class elif request.controller == 'customers': customers_class = active_class elif request.controller == 'classes': classes_class = active_class elif request.controller == 'staff': classes_class = active_class elif request.controller == 'workshops': workshops_class = active_class elif request.controller == 'school_properties' or request.controller == 'teachers': sp_class = active_class elif request.controller == 'reports': reports_class = active_class elif request.controller == 'finance': finance_class = active_class elif request.controller == 'shop': shop_class = active_class elif request.controller == 'settings': settings_class = active_class if not auth.user is None: user_id = auth.user.id menu = [] # Pinboard if user_helpers.check_read_permission('pinboard', user_id): menu.append( ((I(_class='fa fa-comments-o'), SPAN(T('Pinboard'))), False, URL('pinboard', 'index'))) # tasks if user_helpers.check_read_permission('tasks', user_id): menu += [((I(_class='fa fa-check-square-o'), SPAN(T('Tasks'))), False, URL('tasks', 'index', extension=''))] # customers # if user_helpers.check_read_permission('auth_user', user_id): # menu += [ ((I(_class='fa fa-users'), # SPAN(T('Customers'))), # False, # URL('customers', 'index', extension='')) ] # Customers if user_helpers.check_read_permission('auth_user', user_id): submenu = [] if user_helpers.check_read_permission('auth_user', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('List customers'))), False, URL('customers', 'index', extension=''))) if user_helpers.check_read_permission( 'customers_subscriptions_credits', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Subscription credits'))), False, URL('customers', 'subscription_credits_month', extension=''))) menu += [((I(_class='fa fa-users'), SPAN(T('Customers')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('classes', 'schedule', extension=''), submenu)] # Schedule ( classes & employees ) if (user_helpers.check_read_permission('classes', user_id) or user_helpers.check_read_permission('shifts', user_id)): submenu = [] if user_helpers.check_read_permission('classes', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Classes'))), False, URL('classes', 'schedule', extension=''))) #TODO: enable as soon as find a sub is released if user_helpers.check_read_permission('classes_open', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Classes sub teachers'))), False, URL('classes_sub_teachers', 'index', extension=''))) if user_helpers.check_read_permission('shifts', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Studio staff'))), False, URL('staff', 'schedule', extension=''))) menu += [((I(_class='fa fa-calendar'), SPAN(T('Schedule')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('classes', 'schedule', extension=''), submenu)] # Events if user_helpers.check_read_permission('workshops', user_id): menu += [((I(_class='fa fa-ticket'), SPAN(T('Events'))), False, URL('events', 'index', extension=''))] # school properties if user_helpers.check_read_permission('schoolproperties', user_id): submenu = [] if user_helpers.check_read_permission('teachers', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Teachers')), ), False, URL('teachers', 'index', extension=''))) if user_helpers.check_read_permission('employees', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Employees')), ), False, URL('school_properties', 'employees', extension=''))) if user_helpers.check_read_permission('school_memberships', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Memberships')), ), False, URL('school_properties', 'memberships', extension=''))) if user_helpers.check_read_permission('school_subscriptions', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Subscriptions')), ), False, URL('school_properties', 'subscriptions', extension=''))) if user_helpers.check_read_permission('school_classcards', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Class cards')), ), False, URL('school_properties', 'classcards', extension=''))) if user_helpers.check_read_permission('school_clastypes', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Class types')), ), False, URL('school_properties', 'classtypes', extension=''))) if user_helpers.check_read_permission('school_locations', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Locations')), ), False, URL('school_properties', 'locations', extension=''))) if user_helpers.check_read_permission('school_shifts', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Shifts')), ), False, URL('school_properties', 'shifts', extension=''))) if user_helpers.check_read_permission('school_holidays', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Holidays')), ), False, URL('schedule', 'holidays', extension=''))) if user_helpers.check_read_permission('school_languages', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Languages')), ), False, URL('school_properties', 'languages', extension=''))) if user_helpers.check_read_permission('school_levels', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Practice levels')), ), False, URL('school_properties', 'levels', extension=''))) if user_helpers.check_read_permission('school_discovery', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Discovery')), ), False, URL('school_properties', 'discovery', extension=''))) if user_helpers.check_read_permission('schoolproperties_keys', user_id): submenu.append((( I(_class='fa fa-caret-right'), SPAN(T('Keys')), ), False, URL('school_properties', 'list_keys', extension=''))) menu += [((I(_class='fa fa-graduation-cap'), SPAN(T('School')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('school_properties', 'index', extension=''), submenu)] # reports submenu = [] if user_helpers.check_read_permission('reports_customers', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Inactive customers'))), False, URL('reports', 'customers_inactive', extension=''))) if user_helpers.check_read_permission('reports_classcards', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Class cards'))), False, URL('reports', 'classcards', extension=''))) if user_helpers.check_read_permission('reports_subscriptions', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Subscriptions'))), False, URL('reports', 'subscriptions_overview', extension=''))) if user_helpers.check_read_permission('reports_dropinclasses', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Drop in classes'))), False, URL('reports', 'dropinclasses', extension=''))) if user_helpers.check_read_permission('reports_trialclasses', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Trial'))), False, URL('reports', 'trialclasses', extension=''))) if user_helpers.check_read_permission( 'reports_classtypes', user_id) or auth.has_membership(group_id='Admins'): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Attendance'))), False, URL('reports', 'attendance_classes', extension=''))) if user_helpers.check_read_permission('reports_retention', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Attendance retention'))), False, URL('reports', 'retention_rate', extension=''))) if user_helpers.check_read_permission('reports_teacherclasses', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Teacher classes'))), False, URL('reports', 'teacher_classes', extension=''))) if user_helpers.check_read_permission('reports_revenue', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Revenue'))), False, URL('reports', 'revenue', extension=''))) if user_helpers.check_read_permission('reports_tax_summary', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Tax summary'))), False, URL('reports_tax_summary', 'index', extension=''))) if user_helpers.check_read_permission('reports_discovery', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Discovery'))), False, URL('reports', 'discovery', extension=''))) if user_helpers.check_read_permission('reports_geography', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Geography'))), False, URL('reports', 'geography', extension=''))) if user_helpers.check_read_permission('reports', user_id): menu += [((I(_class='fa fa-bar-chart'), ' ', SPAN(T('Reports')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('#', extension=''), submenu)] # Finance if user_helpers.check_read_permission('finance', user_id): finance_text = T('Finance') submenu = [] if user_helpers.check_read_permission('invoices', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Invoices'))), False, URL('finance', 'invoices', extension=''))) if user_helpers.check_read_permission('receipts', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Receipts'))), False, URL('finance', 'receipts', extension=''))) if user_helpers.check_read_permission('accounting_cashbooks', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Cash book'))), False, URL('finance_cashbook', 'index', extension=''))) if user_helpers.check_read_permission('accounting_expenses', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Expenses'))), False, URL('finance_expenses', 'index', extension=''))) if user_helpers.check_read_permission('teachers_payment_classes', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Teacher payments'))), False, URL('finance', 'teacher_payment_classes', vars={'status': 'not_verified'}, extension=''))) if user_helpers.check_read_permission('employee_claims', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Employee expenses'))), False, URL('finance', 'employee_expenses', extension=''))) if user_helpers.check_read_permission('payment_batches', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Batch collections'))), False, URL('finance', 'batches_index', vars={'export': 'collection'}, extension=''))) submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Batch payments'))), False, URL('finance', 'batches_index', vars={'export': 'payment'}, extension=''))) if user_helpers.check_read_permission('reports_direct_debit_extra', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Direct debit extra'))), False, URL('reports', 'direct_debit_extra', extension=''))) menu += [((I(_class=finance_class + ' fa fa-bank', _title=T('Finance')), SPAN(T('Finance')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('finance', 'invoices', extension=''), submenu)] # Shop if user_helpers.check_read_permission('shop_manage', user_id): shop_text_text = T('Shop') submenu = [] # Workflow if user_helpers.check_read_permission('settings', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Workflow'))), False, URL('shop_manage', 'workflow', extension=''))) # Orders if user_helpers.check_read_permission('customers_orders', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Orders'))), False, URL('orders', 'index', extension=''))) # Catalog if user_helpers.check_read_permission('shop_products', user_id): submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Catalog'))), False, URL('shop_manage', 'products', extension=''))) menu += [((I(_class=finance_class + ' fa fa-shopping-bag', _title=T('Shop')), SPAN(T('Shop')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('#', extension=''), submenu)] # settings if user_helpers.check_read_permission('settings', user_id): submenu = [] submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('System'))), False, URL('settings', 'system_general', extension=''))) if user_helpers.check_read_permission('settings_finance', user_id): submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Finance'))), False, URL('settings', 'financial_currency', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Access'))), False, URL('settings', 'access_groups', extension=''))) # submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Point of Sale'))), # False, # URL('settings_pos', 'index', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Shop'))), False, URL('settings', 'shop_settings', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Self check-in'))), False, URL('settings', 'selfcheckin', extension=''))) submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Integration'))), False, URL('settings_integration', 'mailchimp', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Mail'))), False, URL('settings_mail', 'mailing_lists', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('Branding'))), False, URL('settings_branding', 'logos', extension=''))) submenu.append( ((I(_class='fa fa-caret-right'), SPAN(T('About'))), False, URL('about', 'about', extension=''))) if auth.user.id == 1: submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Sysadmin'))), False, URL('settings', 'admin_redis_cache', extension=''))) menu += [((I(_class=settings_class + ' fa fa-cog', _title=T('Settings')), SPAN(T('Settings')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('#', extension=''), submenu)] # automated tasks if user_helpers.check_read_permission('automated_tasks', user_id): submenu = [] submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Customer subscriptions'))), False, URL('automation_customer_subscriptions', 'index', extension=''))) submenu.append(((I(_class='fa fa-caret-right'), SPAN(T('Customer memberships'))), False, URL('automation_customer_memberships', 'index', extension=''))) menu += [((I(_class=settings_class + ' fa fa-magic', _title=T('Automation')), SPAN(T('Automation')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('#', extension=''), submenu)] # Go to submenu = [ ('', False, A((os_gui.get_fa_icon('fa-caret-right'), SPAN(T('Shop'))), _href=URL('shop', 'index', extension=''), _target='_blank')), ] if user_helpers.check_read_permission('selfcheckin', user_id): submenu.insert(0, ('', False, A((os_gui.get_fa_icon('fa-caret-right'), SPAN(T('Self check-in'))), _href=URL('selfcheckin', 'index', extension=''), _target="_blank"))) if user_helpers.check_read_permission('employee_portal', user_id): submenu.insert(0, ('', False, A((os_gui.get_fa_icon('fa-caret-right'), SPAN(T('Employee portal'))), _href=URL('ep', 'index', extension='')))) if user_helpers.check_read_permission('pos', user_id): submenu.insert(0, ('', False, A((os_gui.get_fa_icon('fa-caret-right'), SPAN(T('Point of Sale'))), _href=URL('pos', 'index', extension='')))) menu += [((I(_class=jumpto_class + ' fa fa-flash', _title=T('Go to')), SPAN(T('Go to')), SPAN(I(_class='fa fa-angle-left pull-right'), _class="pull-right-container")), False, URL('selfcheckin', 'index', extension=''), submenu)] # help # cannot contain more items yet.. in this version of web2py drop down menu items are forced to load in the same window # https://groups.google.com/forum/#!topic/web2py/9S34_LHW2qQ # menu += [ # (SPAN('', False, # A((I(_class='fa fa-question-circle', _title=T("Help")), # SPAN(T('Quick start'))), # _href='http://www.openstudioproject.com/content/manual', # _target="_blank")))] return menu