Changeset 261


Ignore:
Timestamp:
05/18/06 03:28:42 (13 years ago)
Author:
jukka
Message:

#324, #325 Things work better, but not yet perfect. Tests fail, body text in material keeps disappearing and I'm too tired to make any sense of it. LOM fields are hidden to separate LOM schema, which is not called at all. Author -field requires own visual widget to make it nice.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LOM.py

    r236 r261  
    1717# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    1818 
    19 from Products.Archetypes.public import MetadataSchema 
     19from Products.Archetypes.public import Schema 
    2020from Products.Archetypes.public import StringField, ComputedField, DateTimeField,\ 
    2121        LinesField, ReferenceField 
     
    2424from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget 
    2525 
    26 LOMSchema = MetadataSchema(( 
     26LOMSchema = Schema(( 
    2727    StringField('LOMCoverage', 
    2828        searchable=1, 
     29        schemata='LOM', 
    2930        accessor='getLOMCoverage', 
    3031        widget=StringWidget( 
     
    3536    StringField('LOMVersion', 
    3637        searchable=1, 
     38        schemata='LOM', 
    3739        accessor='getLOMVersion', 
    3840        widget=StringWidget( 
     
    4345    DateTimeField('LOMContributionDate', 
    4446        searchable=1, 
     47        schemata='LOM', 
    4548        accessor='getLOMContributionDate', 
    4649        widget=CalendarWidget( 
     
    5154    LinesField('LOMLearningResourceType', 
    5255        searchable=1, 
     56        schemata='LOM', 
    5357        vocabulary=('exercise', 'simulation', 'questionnaire', 'diagram', 
    5458            'figure', 'graph', 'index', 'slide', 'table', 'narrative text', 
     
    6266    LinesField('LOMIntendedEndUserRole', 
    6367        searchable=1, 
     68        schemata='LOM', 
    6469        vocabulary=('learner', 'teacher', 'author', 'manager'), 
    6570        default='learner', 
     
    7176    LinesField('LOMContext', 
    7277        searchable=1, 
     78        schemata='LOM', 
    7379        vocabulary=('Primary Education', 'Secondary Education',' Higher Education', 
    7480            'University First Cycle', 'University Second Cycle', 'University Postgrade', 
     
    8389    LinesField('LOMDifficulty', 
    8490        searchable=1, 
     91        schemata='LOM', 
    8592        vocabulary=('very easy', 'easy', 'medium', 'difficult', 'very difficult'), 
    8693        default='medium', 
     
    9299    LinesField('LOMCopyrightAndOtherRestrictions', 
    93100        searchable=1, 
     101        schemata='LOM', 
    94102        vocabulary=('yes', 'no'), 
    95103        default='no', 
     
    101109    LinesField('LOMSubjectArea', 
    102110        searchable=1, 
     111        schemata='LOM', 
    103112        accessor='getLOMSubjectArea', 
    104113        widget=LinesWidget( 
     
    108117    ReferenceField('LOMReferencePrerequisites', 
    109118        searchable=1, 
     119        schemata='LOM', 
    110120        accessor='getLOMReferencePrerequisites', 
    111121        relationship='Prerequirements', 
  • trunk/Material.py

    r253 r261  
    3333from Resources import LearningResource 
    3434 
    35 schema = BaseSchema + coverImage + age_group + tags + parentVersion + contentFile + sourceFile + LOMSchema + lemill_metadata_mods+ Schema(( 
     35schema = BaseSchema + description + tags + language_schema + author_schema + license_schema + coverImage + age_group + parentVersion + contentFile + sourceFile + LOMSchema + lemill_metadata_mods+ Schema(( 
    3636    WYSIWYMField('bodyText', 
    3737        accessor="getBodyText", 
  • trunk/MemberFolder.py

    r259 r261  
    285285     
    286286    def getLanguagelist(self): 
    287         #languages_list = [(x[0],x[1]) for x in languages_english.items()] 
    288         #return DisplayList(tuple(languages_list)) 
    289287        languagelist=self.availableLanguages() 
    290288        return DisplayList(languagelist[1:]) # Cut out the first, 'no language specified'-option 
  • trunk/Piece.py

    r259 r261  
    2828ERROR_NOT_BOTH = "You cannot upload a file, if you wrote the content!" 
    2929 
    30 schema = BaseSchema + description + tags + single_creator + coverImage + parentVersion + contentFile + sourceFile + lemill_metadata_mods  + age_group 
     30schema = BaseSchema + description + tags + language_schema + author_schema + license_schema + coverImage + parentVersion + contentFile + sourceFile + lemill_metadata_mods  + age_group 
    3131 
    3232schema = schema + Schema(( 
  • trunk/Resources.py

    r241 r261  
    5959        return home.getCollectionsFolder() 
    6060 
     61    def getAuthor(self): 
     62        """ used to set default for Creators -field """ 
     63        member = self.portal_membership.getAuthenticatedMember() 
     64        return member.getUserName() 
     65 
     66    def getLanguagelist(self): 
     67        languagelist=self.availableLanguages() 
     68        return DisplayList(languagelist)  
     69         
     70    def defaultLanguage(self): 
     71        """ Get logged users default language """ 
     72        member = self.portal_membership.getAuthenticatedMember()         
     73        lang=member.getProperty('language_skills') 
     74        if lang: 
     75            return lang[0] 
     76        else: 
     77            return '' 
     78 
    6179class LearningResource(Resource): 
    6280    """Superclass for all learning resources (material, activity, tool).""" 
  • trunk/SharedMetadata.py

    r259 r261  
    3838)) 
    3939 
    40 # Overwrite some Archetypes ExtensibleMetadata.py field definitions. Mostly to make them go away.  
     40language_schema = Schema(( 
     41    StringField( 
     42            'language', 
     43            index='FieldIndex:schema', 
     44            schemata="metadata", 
     45            accessor="Language", 
     46            default_method ='defaultLanguage', 
     47            vocabulary='getLanguagelist', 
     48            widget=SelectionWidget( 
     49                label='Language', 
     50                label_msgid="label_language", 
     51                description_msgid="help_language", 
     52                i18n_domain="lemill" 
     53                ), 
     54        ), 
     55)) 
     56 
     57license_schema = Schema(( 
     58   TextField('rights', 
     59       schemata="metadata", 
     60       vocabulary=DisplayList((LICENSES)), 
     61       widget=CopyrightWidget( 
     62           visible={'view':'visible','edit':'visible'} 
     63           ), 
     64       ), 
     65)) 
     66 
     67# Overwrite some Archetypes ExtensibleMetadata.py field definitions to make them go away.  
    4168lemill_metadata_mods = Schema(( 
    4269   StringField('allowDiscussion', 
     
    5279           ), 
    5380       ), 
    54    StringField('language', 
    55        index='FieldIndex:schema'), 
    5681   LinesField('contributors', 
    5782       widget=LinesWidget( 
     
    5984           ), 
    6085       ), 
    61    TextField('rights', 
    62        vocabulary=DisplayList((LICENSES)), 
    63        widget=CopyrightWidget( 
    64            visible={'view':'visible','edit':'visible'} 
    65            ), 
    66        ), 
    67  
    6886)) 
    6987 
     
    149167 
    150168 
    151     )) 
    152  
    153 single_creator = Schema(( 
     169)) 
     170 
     171author_schema = Schema(( 
    154172    LinesField('creators', 
    155               widget = LinesWidget( 
    156                   visible = {'view':'invisible', 'edit':'invisible'}, 
     173              schemata="metadata", 
     174              default_method='getAuthor', 
     175              widget = ComputedWidget( 
     176                  visible = {'view':'visible', 'edit':'visible'}, 
    157177                  ), 
    158178              ) 
    159    )) 
     179)) 
    160180 
    161181contentFile = Schema(( 
     
    173193                                ), 
    174194              ), 
    175     )) 
     195)) 
    176196 
    177197sourceFile = Schema(( 
     
    187207                                ), 
    188208              ), 
    189     )) 
     209)) 
  • trunk/config.py

    r259 r261  
    143143 
    144144LICENSES = (('CreativeCommons', '''<!-- Creative Commons License --> 
    145 <a href="http://creativecommons.org/&#123;license URL&#125;"> 
     145<a href="http://creativecommons.org/licenses/by-sa/2.5/"> 
    146146<img alt="Creative Commons License" border="0" 
    147147src="http://creativecommons.org/images/public/somerights" /></a> 
     
    155155    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> 
    156156<Work rdf:about=""> 
    157 <license rdf:resource="http://creativecommons.org/&#123;license URL&#125;" /> 
     157<license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> 
    158158</Work> 
    159159</rdf:RDF> 
  • trunk/tests/testWorkflow.py

    r241 r261  
    4848        # currently, when object is published, class state-public is used. if this is changed, 
    4949        # this here must be changed also 
    50         self.failUnless(re.search('state-public', result)) 
     50        self.failUnless(re.search('state-public', result),result) 
    5151 
    5252 
Note: See TracChangeset for help on using the changeset viewer.