# HG changeset patch # User casties # Date 1311943513 -7200 # Node ID a29665fa9c62e57081c94c734d39ce8807c4c9ca # Parent 68bc459c9f592be7e9aa03aa2a3220458465d6bb more work for non-bib metadata diff -r 68bc459c9f59 -r a29665fa9c62 MetaData.py --- a/MetaData.py Fri Jul 29 12:09:33 2011 +0200 +++ b/MetaData.py Fri Jul 29 14:45:13 2011 +0200 @@ -28,12 +28,19 @@ #{'label':'Select Fields for Display','action':'indicateDisplayFieldsForm'}, ) - mappingSelectAttribute = 'type' + mappingSelectAttribute = None """the name of the attribute that can be used to select a mapping (if applicable)""" - def __init__(self,id,shortDescription='',description='',fields=''): + def __init__(self,id,title=None,shortDescription='',description='',fields=''): """initialize a new instance""" self.id = id + # title is tag name + if title: + self.title = title + else: + # assume id is tag name + self.title = id + self.shortDescription =shortDescription #label fuer link auf add page self.description=description #description of the method for link page self.fieldList=fields.split(",")[0:] @@ -46,7 +53,10 @@ def getTagName(self): """returns the tag name of this element""" - return self.shortDescription + if self.title: + return self.title + else: + return self.shortDescription def getXmlPath(self, omitRoot=False): """returns the xpath to this element""" @@ -125,7 +135,11 @@ def getMapFields(self, data): """returns dict with metadata description for data""" fields = {} - type = data['@type'] + type = data.get('@type', None) + if not type: + logging.error("getMapFields: no @type!") + return fields + # get mapping from main/meta/bib mapping = self.getMapping(type) if mapping is None: @@ -297,12 +311,17 @@ changeMetaDataForm = PageTemplateFile('zpt/changeMetadata', globals()) security.declarePublic('changeMetaData') - def changeMetaData(self,shortDescription,description,fields,metaDataServerUrl,RESPONSE=None): + def changeMetaData(self,title=None,shortDescription=None,description=None,mappingSelectAttribute=None,fields=None,metaDataServerUrl=None,RESPONSE=None): """Change Metadata""" + self.title = title self.shortDescription=shortDescription self.description=description - self.fieldList=fields.split(",")[0:] + self.mappingSelectAttribute=mappingSelectAttribute + if fields: + self.fieldList=fields.split(",")[0:] + self.metaDataServerUrl=metaDataServerUrl + if RESPONSE is not None: RESPONSE.redirect('manage_main') diff -r 68bc459c9f59 -r a29665fa9c62 MetaDataFolder.py --- a/MetaDataFolder.py Fri Jul 29 12:09:33 2011 +0200 +++ b/MetaDataFolder.py Fri Jul 29 14:45:13 2011 +0200 @@ -166,7 +166,7 @@ getFormattedLabel = getBibFormattedLabel - def getDCFormatted(self,path): + def OLDgetDCFormatted(self,path): """get the metadata as dc set""" logging.debug("getDCFormatted(path=%s)"%path) namespace={ 'mpiwg': "http://www.mpiwg-berlin.mpg.de/ns/mpiwg"} diff -r 68bc459c9f59 -r a29665fa9c62 zpt/addMetadataForm.zpt --- a/zpt/addMetadataForm.zpt Fri Jul 29 12:09:33 2011 +0200 +++ b/zpt/addMetadataForm.zpt Fri Jul 29 14:45:13 2011 +0200 @@ -2,9 +2,11 @@
ID:

+ Tag name (=title):

short description:

Description:

- Generic Metafields + + + +

diff -r 68bc459c9f59 -r a29665fa9c62 zpt/changeMetadata.zpt --- a/zpt/changeMetadata.zpt Fri Jul 29 12:09:33 2011 +0200 +++ b/zpt/changeMetadata.zpt Fri Jul 29 14:45:13 2011 +0200 @@ -5,9 +5,13 @@
- ShortDescription:

- Description:

- Generic Metafields + Tag name (title):

+ ShortDescription:

+ Description:

+ (optional) Attribute to select a mapping (mappingSelectAttribute):

+ + +