Diff for /OSAS/OSA_system/OSAS_archiver.py between versions 1.1 and 1.3

version 1.1, 2003/12/18 17:22:28 version 1.3, 2003/12/23 13:43:10
Line 10  from Globals import InitializeClass Line 10  from Globals import InitializeClass
 from Globals import Persistent  from Globals import Persistent
 from Acquisition import Implicit  from Acquisition import Implicit
 from OSAS_show import *  from OSAS_show import *
   from OSAS_helpers import *
   
 import os.path  import os.path
 import os  import os
 import OSAS_ids  import OSAS_ids
 import archive #Baustelle  import archive #Baustelle
   import time
   
   class OSAS_archiveInbox(SimpleItem,Persistent,Implicit):
       """Inbox"""
   
       meta_type="OSAS_archiveInbox"
       pathes=[]
       
       def __init__(self,id,title):
           """init"""
           self.id=id
           self.title=title
           self.pathes=[]
   
       def addPath(self,path):
           today=time.localtime()
           self.pathes.append([path,today])
   
       def index_html(self):
           """main"""
           pt=PageTemplateFile('Products/OSA_system/OSAS_archiveInboxIndex.zpt').__of__(self)
           return pt()
       
   def manage_AddOSAS_archiveInboxForm(self):
       """interface for adding the OSAS_root"""
       pt=PageTemplateFile('Products/OSA_system/AddOSAS_archiveInbox.zpt').__of__(self)
       return pt()
   
   
   def manage_AddOSAS_archiveInbox(self,id,title="",RESPONSE=None):
       """add the OSAS_root"""
       if title=="":
           title=id
           
       newObj=OSAS_archiveInbox(id, title)
       self._setObject(id,newObj)
       if RESPONSE is not None:
           RESPONSE.redirect('manage_main')
       
   
   
 class OSAS_metadataOrganizer(SimpleItem,Persistent,Implicit):  class OSAS_metadataOrganizer(SimpleItem,Persistent,Implicit):
     """Eingabe von Metadaten"""      """Eingabe von Metadaten"""
   
     meta_type="OSAS_metadataOrganizer"      meta_type="OSAS_metadataOrganizer"
       mediaTypes=["image","video","text","audio","data"]
       acquisitionTypes=["Image-Acquisition"]
       mediaToAcquisition={"image":"Image-Acquisition"}
       metaDataSets={'Image-Acquisition': [('device','opt'),('image-type','opt'),('production-comment','opt')]}
       imgData={'image':[('dpi','req')]}
       
       bibDataSets={'Book':[('author','opt'),('year','opt'),('title','opt'),('series editor','opt'),('series title','opt'),('series volume','opt'),('number of pages','opt'),('city','opt'),('publisher','opt'),('edition','opt'),('number of volumes','opt'),('translator','opt'),('ISBN ISSN','opt')],
                     'Journal Article':[('author','opt'),('year','opt'),('title','opt'),('journal','opt'),('volume','opt'),('issue','opt'),('pages','opt'),('alternate journal','opt'),('call number','opt')],
                     'Manuscript':[('author','opt'),('year','opt'),('title','opt'),('location','opt'),('signature','opt'),('pages','opt'),('editorial remarks','opt'),('description','opt'),('keywords','opt')]}
   
   
       referenceTypes=['Book','Journal Article','Manuscript']
   
     def __init__(self,id,title):      def __init__(self,id,title):
         """init"""          """init"""
Line 33  class OSAS_metadataOrganizer(SimpleItem, Line 86  class OSAS_metadataOrganizer(SimpleItem,
         pt=PageTemplateFile('Products/OSA_system/inputAcquisitionData.zpt').__of__(self)          pt=PageTemplateFile('Products/OSA_system/inputAcquisitionData.zpt').__of__(self)
         return pt()          return pt()
   
     def writeAcquisitionMetadata(self,producer,date,path,description=""):      def writeAcquisitionMetadata(self,date,path,media_type,producer="mpiwg",description=""):
         """Schreibe Acquisiondata in index.meta"""          """Schreibe Acquisiondata in index.meta"""
                   
           
           #schreibe in index.meta
           subnodes={}
           subnodes['media-type']=media_type
           changeNodesInIndexMeta(path,"",subnodes)
           
           subnodes={}
           subnodes['date']=date
           subnodes['description']=description
           
           changeNodesInIndexMeta(path,"acquisition",subnodes)
           #print "HI"
   
           subnodes={}
           subnodes['provider-id']=producer
           subnodes['url']=getattr(self.producerFolder,producer).url
           subnodes['contact']=getattr(self.producerFolder,producer).contact
           subnodes['address']=getattr(self.producerFolder,producer).address
           
           changeNodesInIndexMeta(path,"provider",subnodes,parent="acquisition")
   
           
           self.metaDataSet=self.metaDataSets[self.mediaToAcquisition[media_type]]
           self.media_type=self.mediaToAcquisition[media_type]
           
           pt=PageTemplateFile('Products/OSA_system/inputDocumentMetadata.zpt').__of__(self)
           return pt()
   
           
       def writeDocumentMetadata(self,referenceType):
   
           """write document metadata"""
           form=self.REQUEST.form
   #schreibe in index.meta
           self.bibDataSet=self.bibDataSets[form['referenceType']]
           self.bibdata_type=form['referenceType']
   
           subnodes={}
           subnodes['device']=form['device']
           subnodes['image-type']=form['image-type']
           subnodes['production-comment']=form['production-comment']
           changeNodesInIndexMeta(self.REQUEST.SESSION['path'],"image-acquisition",subnodes)
   
           subnodes={}
           subnodes['dpi']=form['dpi']
   
           
           changeNodesInIndexMeta(self.REQUEST.SESSION['path'],"img",subnodes)
   
   
           pt=PageTemplateFile('Products/OSA_system/inputBiblioMetadata.zpt').__of__(self)
           return pt()
   
       def writeBiblioMetadata(self,bibdata_type,RESPONSE=None):
           """Write all"""
           #to do write metadata
   
           subnodes={}
           form=self.REQUEST.form
           #for key in form.keys():
           #    subnodes[key]=form['device']
           subnodes=form
           changeNodesInIndexMeta(self.REQUEST.SESSION['path'],"bib",subnodes,nodeAttributes={'type':bibdata_type},parent="meta")
           self.inbox.addPath(self.REQUEST.SESSION['path'])
           RESPONSE.redirect(self.REQUEST['URL2'])
           
   
   
       
           
       
   
 def manage_AddOSAS_metadataOrganizerForm(self):  def manage_AddOSAS_metadataOrganizerForm(self):
     """interface for adding the OSAS_root"""      """interface for adding the OSAS_root"""
     pt=PageTemplateFile('Products/OSA_system/AddOSAS_metadataOrganizer.zpt').__of__(self)      pt=PageTemplateFile('Products/OSA_system/AddOSAS_metadataOrganizer.zpt').__of__(self)
Line 121  class OSAS_archiver(Folder, Persistent,I Line 246  class OSAS_archiver(Folder, Persistent,I
     #startPath="/mpiwg"      #startPath="/mpiwg"
     ## methoden aus dem alten archive.py      ## methoden aus dem alten archive.py
   
      
   
     def archiver(self,path):      def archiver(self,path):
         """archive the documents in path"""          """archive the documents in path"""
         tmp=archive.archive(path,self.REQUEST.SESSION)          tmp=archive.archive(path,self.REQUEST.SESSION)
Line 196  class OSAS_archiver(Folder, Persistent,I Line 323  class OSAS_archiver(Folder, Persistent,I
         pt=PageTemplateFile('Products/OSA_system/archiverIndex.zpt').__of__(self)          pt=PageTemplateFile('Products/OSA_system/archiverIndex.zpt').__of__(self)
         return pt()          return pt()
           
       def getDate(self):
           """date"""
           return time.strftime("%Y-%m-%d",time.localtime())
       
     def newFolders_html(self):      def newFolders_html(self):
         """main page"""          """main page"""
         pt=PageTemplateFile('Products/OSA_system/newFolders.zpt').__of__(self)          pt=PageTemplateFile('Products/OSA_system/newFolders.zpt').__of__(self)
Line 204  class OSAS_archiver(Folder, Persistent,I Line 335  class OSAS_archiver(Folder, Persistent,I
     def getProducers(self):      def getProducers(self):
         """Ausgabe der registrierten Benutzer"""          """Ausgabe der registrierten Benutzer"""
         ret=[]          ret=[]
         #print self.aq_parent.__dict__          #x=7
           id=self.producerFolder.getId()
         for list in self.producerFolder.__dict__:          for list in self.producerFolder.__dict__:
             obj=getattr(self.producerFolder,list)              obj=getattr(self.producerFolder,list)
             if (hasattr(obj,"meta_type")):              if (hasattr(obj,"meta_type")):
Line 269  def manage_AddOSAS_archiver(self,id,star Line 401  def manage_AddOSAS_archiver(self,id,star
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
   
   
 class OSAS_producer(Image,Persistent,Implicit):  class OSAS_producer(SimpleItem,Persistent,Implicit):
     """Klasse fuer Produzenteninformationen"""      """Klasse fuer Produzenteninformationen
       Metadaten nach  V1.1.1"""
   
     meta_type="OSAS_producer"      meta_type="OSAS_producer"
   
     def __init__(self,shortName,fullName):      def __init__(self,shortName,fullName,address="",url="",contact=""):
   
         self.id=shortName          self.id=shortName
         self.title=fullName          self.title=fullName
           self.address=address
           self.url=url
           self.contact=contact
   
       manage_options = SimpleItem.manage_options+(
           {'label':'Main Config','action':'changeOSAS_producerForm'},
           )
   
       def changeOSAS_producerForm(self):
           """change"""
           pt=PageTemplateFile('Products/OSA_system/ChangeOSAS_producer.zpt').__of__(self)
           return pt()
   
       def changeOSAS_producer(self,title,address,contact="",url=""):
           """change"""
           self.title=fullName
           self.address=address
           self.url=url
           self.contact=contact
   
 def manage_AddOSAS_producerForm(self):  def manage_AddOSAS_producerForm(self):
     """interface for adding the OSAS_root"""      """interface for adding the OSAS_root"""
Line 286  def manage_AddOSAS_producerForm(self): Line 437  def manage_AddOSAS_producerForm(self):
     return pt()      return pt()
   
   
 def manage_AddOSAS_producer(self,id,title="",RESPONSE=None):  def manage_AddOSAS_producer(self,id,title="",contact="",address="",url="",RESPONSE=None):
     """add the OSAS_root"""      """add the OSAS_root"""
     if title=="":      if title=="":
         title=id          title=id
                   
     newObj=OSAS_producer(id, title)      newObj=OSAS_producer(id, title,address,contact,url)
     self._setObject(id,newObj)      self._setObject(id,newObj)
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')

Removed from v.1.1  
changed lines
  Added in v.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>