Example #1
0
vm_enabled = is_vm_enabled()
docker_enabled = is_docker_enabled()
object_store_enabled = is_object_store_enabled()
response.title = request.application
response.google_analytics_id = None

response.top_menu = [(T('Why Baadal?'), False, URL('default', 'about')),
                     (T('FAQ'), False, URL('default', 'faq')),
                     (T('Solutions'), False, URL('default', 'solutions')),
                     (T('Pricing'), False, URL('default', 'pricing')),
                     (T('Client'), False, URL('default', 'client')),
                     (T('Gallery'), False, URL('default', 'gallery')),
                     (T('Contact Us'), False, URL('default', 'contact'))]
if auth.is_logged_in():
    response.user_menu = [
        (H2('USER MENU'), False, dict(_href='#', _id='menu_user')),
        (T('Home'), False, URL('default', 'index')),
        (T('Pending Requests'), False, URL('user', 'list_my_requests')),
        (T('My Tasks'), False, URL('user', 'list_my_task')),
        (T('VPN'), False, URL('user', 'vpn')),
        (T('Mail Admin'), False, URL('user', 'mail_admin'))
    ]

    if docker_enabled:
        response.user_menu.insert(
            2,
            (T('Request Container'), False, URL('user', 'request_container')))
        response.user_menu.insert(
            3, (T('My Containers'), False, URL('user', 'list_my_container')))

    if object_store_enabled:
Example #2
0
def mavc_rheader(r, tabs=None):
    """ Custom rheaders """

    if r.representation != "html":
        return None

    from s3 import s3_rheader_resource, s3_rheader_tabs
    from gluon import A, DIV, H1, H2, TAG

    tablename, record = s3_rheader_resource(r)
    if record is None:
        return None

    T = current.T
    s3db = current.s3db

    if tablename != r.tablename:
        resource = s3db.resource(
            tablename,
            id=record.id if record else None,
        )
    else:
        resource = r.resource

    rheader = ""

    if tablename == "org_organisation":

        # Tabs
        if not tabs:
            INDIVIDUALS = current.deployment_settings.get_hrm_staff_label()

            tabs = [
                (T("About"), None),
                (INDIVIDUALS, "human_resource"),
                (T("Services"), "service_location"),
                (T("Facilities"), "facility"),
                (T("Projects"), "project"),
            ]

        # Use OrganisationRepresent for title to get L10n name if available
        represent = s3db.org_OrganisationRepresent(
            acronym=False,
            parent=False,
        )
        title = represent(record.id)

        # Retrieve details for the rheader
        data = resource.select(
            [
                "organisation_organisation_type.organisation_type_id",
                "country",
                "website",
            ],
            raw_data=True,
            represent=True,
        )
        row = data.rows[0]
        raw = row["_row"]

        # Construct subtitle
        subtitle_fields = (
            "org_organisation_organisation_type.organisation_type_id",
            "org_organisation.country",
        )
        items = []
        for fname in subtitle_fields:
            if raw[fname]:
                items.append(s3_unicode(row[fname]))
        subtitle = ", ".join(items)

        # Website
        website = row["org_organisation.website"]

        # Compile the rheader
        rheader = DIV(
            DIV(
                H1(title),
                H2(subtitle),
                website if record.website else "",
                _class="rheader-details",
            ), )

    if tabs:
        rheader_tabs = s3_rheader_tabs(r, tabs)
        rheader.append(rheader_tabs)

    return rheader
Example #3
0
###################################################################################
from helper import is_moderator, is_faculty, is_orgadmin

response.title = request.application
response.google_analytics_id = None

response.top_menu = [
    (T('About'), False, URL('default', 'index')),
    (T('Blog'), False, URL('default', 'page_under_construction')),
    (T('Photos'), False, URL('default', 'page_under_construction')),
    (T('Team Baadal'), False, URL('default', 'page_under_construction')),
    (T('Contact'), False, URL('default', 'page_under_construction'))
]
if auth.is_logged_in():
    response.user_menu = [
        (H2('USER MENU'), False, dict(_href='#', _id='menu_user')),
        (T('Home'), False, URL('default', 'index')),
        (T('Request VM'), False, URL('user', 'request_vm')),
        (T('My VMs'), False, URL('user', 'list_my_vm')),
        (T('My Tasks'), False, URL('user', 'list_my_task')),
        (T('Mail Admin'), False, URL('default', 'page_under_construction')),
        (T('Report Bug'), False, URL('default', 'page_under_construction'))
    ]

    if (is_moderator() | is_faculty()):
        response.faculty_menu = [
            (H2('FACULTY MENU'), False, dict(_href='#', _id='menu_faculty')),
            (T('Pending Requests {' + str(len(get_pending_requests())) + '} '),
             False, URL('faculty', 'pending_requests'))
        ]
Example #4
0
# -*- coding: utf-8 -*-
###################################################################################
# Added to enable code completion in IDE's.
if 0:
    import gluon
    global auth; auth = gluon.tools.Auth()
    from gluon import T,request,response,URL,H2
    from applications.baadal.models import *  # @UnusedWildImport
###################################################################################

#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################

response.title = request.application
response.google_analytics_id = None

if auth.is_logged_in():
    response.main_menu = [
        (H2('MAIN MENU'),False, dict(_href='#', _id='menu')),
        (T('Task'), False, URL('default','task_list')),
        (T('Testing'), False, URL('default','testing'))
        ]
Example #5
0
def mavc_rheader(r, tabs=None):
    """ Custom rheaders """

    if r.representation != "html":
        return None

    from s3 import s3_rheader_resource, s3_rheader_tabs
    from gluon import A, DIV, H1, H2, TAG

    tablename, record = s3_rheader_resource(r)
    if record is None:
        return None

    T = current.T
    s3db = current.s3db

    if tablename != r.tablename:
        resource = s3db.resource(
            tablename,
            id=record.id if record else None,
        )
    else:
        resource = r.resource

    rheader = ""

    if tablename == "org_organisation":

        # Tabs
        if not tabs:
            INDIVIDUALS = current.deployment_settings.get_hrm_staff_label()

            tabs = [
                (T("About"), None),
                (INDIVIDUALS, "human_resource"),
                (T("Services"), "service_location"),
                (T("Facilities"), "facility"),
                (T("Projects"), "project"),
                (T("Attachments"), "document"),
            ]

        # Use OrganisationRepresent for title to get L10n name if available
        represent = s3db.org_OrganisationRepresent(
            acronym=False,
            parent=False,
        )
        title = represent(record.id)

        # Retrieve details for the rheader
        data = resource.select(
            [
                "organisation_organisation_type.organisation_type_id",
                "country",
                "website",
            ],
            raw_data=True,
            represent=True,
        )
        row = data.rows[0]
        raw = row["_row"]

        # Construct subtitle
        subtitle_fields = (
            "org_organisation_organisation_type.organisation_type_id",
            "org_organisation.country",
        )
        items = []
        for fname in subtitle_fields:
            if raw[fname]:
                items.append(s3_unicode(row[fname]))
        subtitle = ", ".join(items)

        # Website
        website = row["org_organisation.website"]

        # Compose the rheader
        rheader = DIV(
            DIV(
                H1(title),
                H2(subtitle),
                website if record.website else "",
                _class="rheader-details",
            ), )

    elif tablename == "project_project":

        if not tabs:
            tabs = [
                (T("About"), None),
                (T("Locations"), "location"),
                (T("Attachments"), "document"),
            ]

        # Retrieve details for the rheader
        data = resource.select(
            [
                "name",
                "organisation_id",
            ],
            represent=True,
        )
        row = data.rows[0]

        # Title and Subtitle
        title = row["project_project.name"]
        subtitle = row["project_project.organisation_id"]

        # Compose the rheader
        rheader = DIV(DIV(
            H1(title),
            H2(subtitle),
            _class="rheader-details",
        ), )

    elif tablename == "pr_person":

        if not tabs:
            tabs = [
                (T("Person Details"), None),
            ]

        from s3 import s3_fullname
        title = s3_fullname(record)

        # Link organisation_id representation to staff tab
        linkto = URL(
            c="org",
            f="organisation",
            args=["[id]", "human_resource"],
        )
        htable = s3db.hrm_human_resource
        field = htable.organisation_id
        field.represent = s3db.org_OrganisationRepresent(
            show_link=True,
            linkto=linkto,
        )

        # Retrieve details for the rheader
        data = resource.select(
            [
                "human_resource.job_title_id",
                "human_resource.organisation_id",
            ],
            raw_data=True,
            represent=True,
        )
        row = data.rows[0]
        raw = row["_row"]

        # Construct subtitle
        organisation_id = raw["hrm_human_resource.organisation_id"]
        if organisation_id:
            subtitle = row["hrm_human_resource.organisation_id"]
            job_title_id = raw["hrm_human_resource.job_title_id"]
            if job_title_id:
                subtitle = TAG[""](
                    "%s, " % row["hrm_human_resource.job_title_id"],
                    subtitle,
                )

        # Compose the rheader
        rheader = DIV(DIV(
            H1(title),
            H2(subtitle),
            _class="rheader-details",
        ), )

    if tabs:
        rheader_tabs = s3_rheader_tabs(r, tabs)
        rheader.append(rheader_tabs)

    return rheader