web/uicfg.py
branchstable
changeset 1849 1901fa97f521
parent 1819 7d3e8adcd559
child 1878 204b79e3e0ec
equal deleted inserted replaced
1848:981b8dc9e4d0 1849:1901fa97f521
    95             section = 'relations'
    95             section = 'relations'
    96         else:
    96         else:
    97             section = 'sideboxes'
    97             section = 'sideboxes'
    98         rtag.tag_relation((sschema, rschema, oschema, role), section)
    98         rtag.tag_relation((sschema, rschema, oschema, role), section)
    99 
    99 
   100 primaryview_section = RelationTags(init_primaryview_section,
   100 primaryview_section = RelationTags('primaryview_section',
   101                                     frozenset(('attributes', 'relations',
   101                                    init_primaryview_section,
       
   102                                    frozenset(('attributes', 'relations',
   102                                                'sideboxes', 'hidden')))
   103                                                'sideboxes', 'hidden')))
   103 for rtype in ('eid', 'creation_date', 'modification_date',
   104 for rtype in ('eid', 'creation_date', 'modification_date',
   104               'is', 'is_instance_of', 'identity',
   105               'is', 'is_instance_of', 'identity',
   105               'owned_by', 'created_by',
   106               'owned_by', 'created_by',
   106               'in_state', 'wf_info_for', 'require_permission',
   107               'in_state', 'wf_info_for', 'require_permission',
   138     if displayinfo is None:
   139     if displayinfo is None:
   139         displayinfo = {}
   140         displayinfo = {}
   140         rtag.tag_relation((sschema, rschema, oschema, role), displayinfo)
   141         rtag.tag_relation((sschema, rschema, oschema, role), displayinfo)
   141     displayinfo.setdefault('label', label)
   142     displayinfo.setdefault('label', label)
   142 
   143 
   143 primaryview_display_ctrl = DisplayCtrlRelationTags(init_primaryview_display_ctrl)
   144 primaryview_display_ctrl = DisplayCtrlRelationTags('primaryview_display_ctrl',
       
   145                                                    init_primaryview_display_ctrl)
   144 
   146 
   145 
   147 
   146 # index view configuration ####################################################
   148 # index view configuration ####################################################
   147 # entity type section in the index/manage page. May be one of
   149 # entity type section in the index/manage page. May be one of
   148 # * 'application'
   150 # * 'application'
   176             section = 'secondary'
   178             section = 'secondary'
   177         else:
   179         else:
   178             section = 'generic'
   180             section = 'generic'
   179         rtag.tag_relation((sschema, rschema, oschema, role), section)
   181         rtag.tag_relation((sschema, rschema, oschema, role), section)
   180 
   182 
   181 autoform_section = RelationTags(init_autoform_section,
   183 autoform_section = RelationTags('autoform_section', init_autoform_section,
   182                                 set(('primary', 'secondary', 'generic',
   184                                 set(('primary', 'secondary', 'generic',
   183                                      'metadata', 'generated')))
   185                                      'metadata', 'generated')))
   184 # use primary and not generated for eid since it has to be an hidden
   186 # use primary and not generated for eid since it has to be an hidden
   185 autoform_section.tag_attribute(('*', 'eid'), 'primary')
   187 autoform_section.tag_attribute(('*', 'eid'), 'primary')
   186 autoform_section.tag_attribute(('*', 'description'), 'secondary')
   188 autoform_section.tag_attribute(('*', 'description'), 'secondary')
   215 autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually
   217 autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually
   216 autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic')
   218 autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic')
   217 
   219 
   218 
   220 
   219 # relations'field class
   221 # relations'field class
   220 autoform_field = RelationTags()
   222 autoform_field = RelationTags('autoform_field')
   221 
   223 
   222 # relations'field explicit kwargs (given to field's __init__)
   224 # relations'field explicit kwargs (given to field's __init__)
   223 autoform_field_kwargs = RelationTags()
   225 autoform_field_kwargs = RelationTags()
   224 autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
   226 autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
   225                                     {'widget': formwidgets.TextInput})
   227                                     {'widget': formwidgets.TextInput})
   229 
   231 
   230 
   232 
   231 # inlined view flag for non final relations: when True for an entry, the
   233 # inlined view flag for non final relations: when True for an entry, the
   232 # entity(ies) at the other end of the relation will be editable from the
   234 # entity(ies) at the other end of the relation will be editable from the
   233 # form of the edited entity
   235 # form of the edited entity
   234 autoform_is_inlined = RelationTagsBool()
   236 autoform_is_inlined = RelationTagsBool('autoform_is_inlined')
   235 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True)
   237 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True)
   236 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True)
   238 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True)
   237 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True)
   239 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True)
   238 autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True)
   240 autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True)
   239 
   241 
   240 
   242 
   241 # set of tags of the form <action>_on_new on relations. <action> is a
   243 # set of tags of the form <action>_on_new on relations. <action> is a
   242 # schema action (add/update/delete/read), and when such a tag is found
   244 # schema action (add/update/delete/read), and when such a tag is found
   243 # permissions checking is by-passed and supposed to be ok
   245 # permissions checking is by-passed and supposed to be ok
   244 autoform_permissions_overrides = RelationTagsSet()
   246 autoform_permissions_overrides = RelationTagsSet('autoform_permissions_overrides')
   245 
   247 
   246 
   248 
   247 # boxes.EditBox configuration #################################################
   249 # boxes.EditBox configuration #################################################
   248 
   250 
   249 # 'link' / 'create' relation tags, used to control the "add entity" submenu
   251 # 'link' / 'create' relation tags, used to control the "add entity" submenu
   252         card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object']
   254         card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object']
   253         if not card in '?1' and \
   255         if not card in '?1' and \
   254                rschema.rproperty(sschema, oschema, 'composite') == role:
   256                rschema.rproperty(sschema, oschema, 'composite') == role:
   255             rtag.tag_relation((sschema, rschema, oschema, role), True)
   257             rtag.tag_relation((sschema, rschema, oschema, role), True)
   256 
   258 
   257 actionbox_appearsin_addmenu = RelationTagsBool(init_actionbox_appearsin_addmenu)
   259 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu',
       
   260                                                init_actionbox_appearsin_addmenu)
   258 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False)
   261 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False)
   259 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False)
   262 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False)
   260 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False)
   263 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False)
   261 actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False)
   264 actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False)
   262 actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False)
   265 actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False)