def new(self):
    "Displays a generic form for creating a new object"
    context = HttpContext.current()
        
    sCC = context.request.queryString['cc'][0]
    oNewItem = misc.getCallableByName(sCC)()
    
    params = {
        'CC': sCC,
        'URI': context.request.getRootUrl() + '/' + self.id,
        'ICON': oNewItem.__image__,
        'PROPERTIES_TAB': '',
        'EXTRA_TABS': '',
        'SECURITY_TAB': baseitem._getSecurity(self, context.user, True)
    }
    
    # inspect item properties
    sProperties = ''
    for attr_name in oNewItem.__props__:
        attr = getattr(oNewItem, attr_name)
        if isinstance(attr, datatypes.DataType):
            control, tab = baseitem._getControlFromAttribute(oNewItem,
                                                             attr_name,
                                                             attr,
                                                             False,
                                                             True)
            sProperties += control
            params['EXTRA_TABS'] += tab
    
    params['PROPERTIES'] = sProperties
    
    return params
def new(self):
    "Displays the form for creating a new application"
    context = HttpContext.current()
    oApp = common.Application()
    return {
        'CC': oApp.contentclass,
        'URI': self.id,
        'ICON': oApp.__image__,
        'SECURITY_TAB': baseitem._getSecurity(self, context.user, True)
    }
def new(self):
    context = HttpContext.current()
    oGroup = security.Group()
    return {
        'CC' : oGroup.contentclass,
        'URI' : self.id,
        'REL_CC' : '|'.join(oGroup.members.relCc),
        'ICON' : oGroup.__image__,
        'SELECT_FROM_POLICIES' : 'policies',
        'POLICIES_REL_CC' : '|'.join(oGroup.policies.relCc),
        'SECURITY_TAB' : baseitem._getSecurity(self, context.user, True)
    }
def new(self):
    "Displays the form for creating a new user"
    context = HttpContext.current()
    oUser = security.User()
    return {
        'CC' : oUser.contentclass,
        'URI' : self.id,
        'REL_CC' : '|'.join(oUser.memberof.relCc),
        'ICON' : oUser.__image__,
        'SELECT_FROM_POLICIES' : 'policies',
        'POLICIES_REL_CC' : '|'.join(oUser.policies.relCc),
        'SECURITY_TAB' : baseitem._getSecurity(self, context.user, True)
    }
def properties(self):
    "Displays the group's properties form"
    context = HttpContext.current()

    context.response.setHeader('cache-control', 'no-cache')
    sLang = context.request.getLang()

    user = context.user
    iUserRole = objectAccess.getAccess(self, user)
    readonly = (iUserRole==1)

    params = {
        'ID' : self.id,
        'ICON' : self.__image__,
        'SELECT_FROM_POLICIES' : 'policies',
        'POLICIES_REL_CC' : '|'.join(self.policies.relCc),
        'NAME' : xml.xml_encode(self.displayName.value),
        'DESCRIPTION' : xml.xml_encode(self.description.value),
        'MODIFIED' : date.Date(self.modified).format(baseitem.DATES_FORMAT, sLang),
        'MODIFIED_BY' : xml.xml_encode(self.modifiedBy),
        'CONTENTCLASS' : self.contentclass,
        'SELECT_FROM' : self.parentid,
        'REL_CC' : '|'.join(self.members.relCc),
        'READONLY' : str(readonly).lower()
    }

    members_options = []
    members = self.members.getItems()
    for user in members:
        members_options += [xml.xml_encode(user.__image__),
                            user.id,
                            xml.xml_encode(user.displayName.value)]
    params['MEMBERS'] = ';'.join(members_options)

    policies_options = []
    policies = self.policies.getItems()
    for policy in policies:
        policies_options += [xml.xml_encode(policy.__image__),
                             policy.id,
                             xml.xml_encode(policy.displayName.value)]
    params['POLICIES'] = ';'.join(policies_options)
    
    params['SECURITY_TAB'] = baseitem._getSecurity(self, user)
    
    return params
def properties(self):
    "Displays the application's properties form"
    context = HttpContext.current()
    sLang = context.request.getLang()
    user = context.user
    iUserRole = permsresolver.get_access(self, user)
    readonly = (iUserRole == 1)
    modified = date.Date(self.modified)
    return {
        'ID' : self.id,
        'IMG' : self.__image__,
        'NAME' : xml.xml_encode(self.displayName.value),
        'DESCRIPTION' : xml.xml_encode(self.description.value),
        'ICON' : self.icon.value,
        'LAUNCH_URL' : xml.xml_encode(self.launchUrl.value),
        'MODIFIED' : modified.format(baseitem.DATES_FORMAT, sLang),
        'MODIFIED_BY' : xml.xml_encode(self.modifiedBy),
        'CONTENTCLASS' : self.contentclass,
        'SECURITY_TAB' : baseitem._getSecurity(self, context.user),
        'READONLY' : str(readonly).lower()
    }
def properties(self):
    "Displays the group's properties form"
    context = HttpContext.current()
    sLang = context.request.getLang()

    user = context.user
    iUserRole = permsresolver.get_access(self, user)
    readonly = iUserRole == 1

    params = {
        "ID": self.id,
        "ICON": self.__image__,
        "SELECT_FROM_POLICIES": "policies",
        "POLICIES_REL_CC": "|".join(self.policies.relCc),
        "NAME": xml.xml_encode(self.displayName.value),
        "DESCRIPTION": xml.xml_encode(self.description.value),
        "MODIFIED": date.Date(self.modified).format(baseitem.DATES_FORMAT, sLang),
        "MODIFIED_BY": xml.xml_encode(self.modifiedBy),
        "CONTENTCLASS": self.contentclass,
        "SELECT_FROM": self.parentid,
        "REL_CC": "|".join(self.members.relCc),
        "READONLY": str(readonly).lower(),
    }

    members_options = []
    members = self.members.get_items()
    for user in members:
        members_options += [xml.xml_encode(user.__image__), user.id, xml.xml_encode(user.displayName.value)]
    params["MEMBERS"] = ";".join(members_options)

    policies_options = []
    policies = self.policies.get_items()
    for policy in policies:
        policies_options += [xml.xml_encode(policy.__image__), policy.id, xml.xml_encode(policy.displayName.value)]
    params["POLICIES"] = ";".join(policies_options)

    params["SECURITY_TAB"] = baseitem._getSecurity(self, user)

    return params