version 1.7, 2005/04/06 09:18:41
|
version 1.15, 2005/11/29 13:21:33
|
Line 12 import xml.dom.pulldom
|
Line 12 import xml.dom.pulldom
|
import OSAS_helpers |
import OSAS_helpers |
import zLOG |
import zLOG |
import string |
import string |
import xml.xpath |
try: |
|
from xml.xpath import Evaluate |
|
except: |
|
from Ft.Xml.XPath import Evaluate |
import xmlrpclib |
import xmlrpclib |
|
|
from types import * |
from types import * |
Line 107 class OSAS_MetadataMapping(SimpleItem):
|
Line 110 class OSAS_MetadataMapping(SimpleItem):
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
manage_workspace=changeMetadataMappingForm |
|
|
def manage_addMetadataMappingForm(self): |
def manage_addMetadataMappingForm(self): |
"""interface for adding the OSAS_root""" |
"""interface for adding the OSAS_root""" |
Line 121 def manage_addMetadataMapping(self,idOfO
|
Line 124 def manage_addMetadataMapping(self,idOfO
|
argList={} |
argList={} |
for arg in self.fieldList: |
for arg in self.fieldList: |
if not (arg in ['idOfObject','titleOfObject']): |
if not (arg in ['idOfObject','titleOfObject']): |
argList[arg]=(self.REQUEST.form[arg],self.REQUEST.form['label_'+arg],self.REQUEST.form['explanation_'+arg],arglist['status_'+fieldName],arglist['values_'+fieldName]) |
argList[arg]=(self.REQUEST.form[arg],self.REQUEST.form['label_'+arg],self.REQUEST.form['explanation_'+arg],self.REQUEST.form['status_'+arg],self.REQUEST.form['values_'+arg]) |
|
|
newObj=OSAS_MetadataMapping(idOfObject,titleOfObject,argList) |
newObj=OSAS_MetadataMapping(idOfObject,titleOfObject,argList) |
self._setObject(idOfObject,newObj) |
self._setObject(idOfObject,newObj) |
Line 181 class OSAS_Metadata(Folder):
|
Line 184 class OSAS_Metadata(Folder):
|
def generateMappingList(self): |
def generateMappingList(self): |
"""Erzeuge Mapping""" |
"""Erzeuge Mapping""" |
mapping={} |
mapping={} |
|
|
for dict in self.__dict__: |
for dict in self.__dict__: |
#print dict |
#print dict |
obj=getattr(self,dict) |
obj=getattr(self,dict) |
if hasattr(obj,'meta_type'): |
if hasattr(obj,'meta_type'): |
if obj.meta_type=="OSAS_MetadataMapping": |
if obj.meta_type=="OSAS_MetadataMapping__neu": |
mapping[obj.getId()]=obj.generateMappingHash() |
mapping[obj.getId()]=obj.generateMappingHash() |
|
|
return mapping |
return mapping |
|
|
def generateMappingForType(self,type,clean="yes"): |
def generateMappingForType(self,type,clean="yes"): |
"""erzeuge spezifisches Mapping""" |
"""erzeuge spezifisches Mapping""" |
|
|
hash=self.generateMappingList() |
hash=self.generateMappingList() |
if hash.has_key(type): |
|
|
for key in hash.keys(): |
|
if (key.lower() == type.lower()): |
if clean=="yes": |
if clean=="yes": |
temp={} |
temp={} |
for x in hash[type].keys(): |
for x in hash[key].keys(): |
if not hash[type][x]=="": |
if not hash[key][x]=="": |
temp[x]=hash[type][x] |
temp[x]=hash[key][x] |
return temp |
return temp |
else: |
else: |
return hash[type] |
|
|
|
else: |
return hash[key] |
|
|
return {} |
return {} |
|
|
def getFieldList(self): |
def getFieldList(self): |
Line 212 class OSAS_Metadata(Folder):
|
Line 220 class OSAS_Metadata(Folder):
|
except: |
except: |
return "" |
return "" |
|
|
|
security.declarePublic('getFields') |
def getFields(self): |
def getFields(self): |
"""ausgabe der Felder""" |
"""ausgabe der Felder""" |
return self.fieldList |
return self.fieldList |
Line 239 class OSAS_Metadata(Folder):
|
Line 248 class OSAS_Metadata(Folder):
|
|
|
types=[] |
types=[] |
|
|
for obj in self.ZopeFind(self,obj_metatypes=['OSAS_MetadataMapping_neu']): |
for obj in self.ZopeFind(self,obj_metatypes=['OSAS_MetadataMapping__neu']): |
if obj.title=="": |
if obj[1].title=="": |
title=obj.id |
title=obj[1].id |
else: |
else: |
title=obj.title |
title=obj[1].title |
types.append((obj.id,title,obj)) |
types.append((obj[1].id, title, obj[1])) |
|
|
return types |
return types |
|
|
Line 429 class OSAS_Metadata(Folder):
|
Line 438 class OSAS_Metadata(Folder):
|
xpathStr=MDF_xpathStart |
xpathStr=MDF_xpathStart |
|
|
|
|
xpathNodes=xml.xpath.Evaluate(xpathStr,actualNode) |
xpathNodes=Evaluate(xpathStr,actualNode) |
|
|
|
|
if len(xpathNodes)>0: |
if len(xpathNodes)>0: |
Line 500 class OSAS_Metadata(Folder):
|
Line 509 class OSAS_Metadata(Folder):
|
xpathStr=MDF_xpathStart |
xpathStr=MDF_xpathStart |
|
|
|
|
xpathNodes=xml.xpath.Evaluate(xpathStr,actualNode) |
xpathNodes=Evaluate(xpathStr,actualNode) |
|
|
|
|
|
|
Line 511 class OSAS_Metadata(Folder):
|
Line 520 class OSAS_Metadata(Folder):
|
else: |
else: |
#existiert nicht dann neue erzeugen |
#existiert nicht dann neue erzeugen |
|
|
if len(xml.xpath.Evaluate(MDF_xpathStart,dom))>0: |
if len(Evaluate(MDF_xpathStart,dom))>0: |
|
|
create=True |
create=True |
|
|
Line 568 class OSAS_Metadata(Folder):
|
Line 577 class OSAS_Metadata(Folder):
|
actualNode.appendChild(namenode) |
actualNode.appendChild(namenode) |
|
|
ret=newdoc.toxml(encoding='utf-8') |
ret=newdoc.toxml(encoding='utf-8') |
|
zLOG.LOG("OSAS_metadata (writeMetadata)",zLOG.INFO,"write: %s"%ret) |
|
|
|
|
server.writeMetaDataFile(indexFile,ret) |
server.writeMetaDataFile(indexFile,ret) |
|
|
Line 593 class OSAS_Metadata(Folder):
|
Line 604 class OSAS_Metadata(Folder):
|
|
|
if list=="": |
if list=="": |
return None |
return None |
listsplit=list.split("\n") |
listsplit=[i.rstrip() for i in list.split("\n")] |
return listsplit |
return listsplit |
|
|
def showHelp(self,refType,genericTag): |
def showHelp(self,refType,genericTag): |