Changeset 581


Ignore:
Timestamp:
08/07/06 17:46:04 (13 years ago)
Author:
vahur
Message:

re #613 spent 1h
tuning

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r575 r581  
    289289) 
    290290 
     291class GroupWidget(SelectionWidget): 
     292    _properties = SelectionWidget._properties.copy() 
     293    _properties.update({ 
     294        'macro' : 'widget_group', 
     295        'format' : 'radio', 
     296    }) 
     297 
    291298 
    292299class refImagesWidget(SelectionWidget): 
  • trunk/LeMillTool.py

    r578 r581  
    115115        if hasattr(image, 'data'): 
    116116            val = image.data 
    117             if not isinstance(val, ''): 
     117            if not isinstance(val, type('')): 
    118118                val = val.aq_base 
    119119                from OFS.Image import Pdata 
  • trunk/MultimediaMaterial.py

    r577 r581  
    5858))  
    5959 
    60 schema = schema + tags + language_schema + group_sharing + target_group_schema + license_schema + coverImage + lemill_metadata_mods + no_description + author_schema 
     60schema = schema + tags + language_schema + target_group_schema + group_sharing + license_schema + coverImage + lemill_metadata_mods + no_description + author_schema 
    6161 
    6262schema.moveField('rights', pos='bottom') 
  • trunk/PresentationMaterial.py

    r577 r581  
    5555))  
    5656 
    57 schema = BaseSchema + tags + bodyText + audioFile + refsToImages + coverImage + lemill_metadata_mods + no_description + language_schema + license_schema + author_schema + group_sharing + target_group_schema 
     57schema = BaseSchema + tags + bodyText + audioFile + refsToImages + coverImage + lemill_metadata_mods + no_description + language_schema + license_schema + author_schema + target_group_schema + group_sharing  
    5858 
    5959schema.moveField('rights', pos='bottom') 
  • trunk/Resources.py

    r578 r581  
    130130            ga = pg.getGroupareaFolder(group_id) 
    131131            result += ((group_id, ga.TitleOrId()),) 
     132        result = (('', 'no sharing'),) + result 
     133        result += (('_new_group', '...or create a new group:'),) 
    132134        return result 
    133135 
     
    304306    def setGroupsShared(self, value): 
    305307        """ share a material/resource with a group(s) """ 
    306         print value 
     308        create_new = self.REQUEST.get('new_group_name', '') 
     309        if create_new: 
     310            pass 
     311            # create a new group here 
    307312        f = self.getField('groups') 
    308313        old_value = f.get(self) 
    309         to_del = copy.copy(old_value) 
    310         for v in value: 
    311             if v in old_value: 
    312                 to_del.remove(v) 
    313                 continue 
    314             self.manage_setLocalRoles(v, ('Owner',)) 
    315         for v in to_del: 
    316             self.manage_delLocalRoles((v,)) 
    317         f.set(self, value) 
     314        if old_value: 
     315            self.manage_delLocalRoles((old_value[0],)) 
     316        if value: 
     317            self.manage_setLocalRoles(value, ('Owner',)) 
     318            f.set(self, value) 
    318319 
    319320InitializeClass(Resource) 
     
    436437            if gr: 
    437438                groups.append(gr) 
    438         return groups 
     439        if groups: 
     440            return groups[0] 
    439441 
    440442InitializeClass(LearningResource) 
  • trunk/SharedMetadata.py

    r580 r581  
    2020#These are common pieces of schema for content types 
    2121from Products.Archetypes.public import * 
    22 from FieldsWidgets import WYSIWYMWidget, WYSIWYMField, TagsField, TagsWidget, CopyrightWidget, Age_rangeWidget 
     22from FieldsWidgets import WYSIWYMWidget, WYSIWYMField, TagsField, TagsWidget, CopyrightWidget, Age_rangeWidget, GroupWidget 
    2323from config import LICENSES 
    2424 
     
    260260        enforceVocabulary = True, 
    261261        multiValued = True, 
    262         widget=PicklistWidget( 
    263             label="Share with a group", 
     262        widget=GroupWidget( 
     263            label="LeMill-group", 
    264264            label_msgid="label_material_group_sharing", 
    265             description="", 
     265            description="Choose an existing group working with this content.", 
    266266            i18n_domain="lemill", 
    267267            visible={'edit': 'visible', 'view': 'invisible'}, 
  • trunk/skins/lemill/join_a_group.cpt

    r578 r581  
    2020        <metal:block define-macro="join_a_group"> 
    2121        <div id="join_a_group" 
    22             tal:define="group_editing context/getGroupsEditing"> 
     22            tal:define="group_editing context/getGroupsEditing" 
     23            tal:condition="group_editing"> 
    2324        <p i18n:translate="text_join_a_group_to_edit"> 
    2425        LeMill materials are edited by groups. To edit the material you must join the group 
    2526        <span i18n:name="gruop_name"> 
    26             <a tal:repeat="gr group_editing" href=""  
    27                 tal:attributes="href python:mtool.getHomeFolder(gr.getId()).absolute_url()" 
    28                 tal:content="gr/getGroupTitleOrName">link to group</a> 
     27            <a href=""  
     28                tal:attributes="href python:mtool.getHomeFolder(group_editing.getId()).absolute_url()" 
     29                tal:content="group_editing/getGroupTitleOrName">link to group</a> 
    2930        </span> 
    3031        working with this material. Do you want to go on, join the group and start to edit the material? 
     
    3334        <form action="" method="post" tal:attributes="action string:${here/absolute_url}/join_a_group"> 
    3435            <input type="hidden" value="" 
    35                 tal:attributes="value python:group_editing[0].getId()" 
     36                tal:attributes="value group_editing/getId" 
    3637                name="group_to_join" /> 
    3738            <div class="formControls" tal:omit-tag=""> 
Note: See TracChangeset for help on using the changeset viewer.