--- ECHO_content/ECHO_collection.py 2004/06/04 10:04:16 1.96
+++ ECHO_content/ECHO_collection.py 2004/06/18 13:32:52 1.122
@@ -46,9 +46,42 @@ import xml.dom.minidom
from ECHO_graphicalOverview import javaHandler,javaScriptMain
import ECHO_helpers
+def getCopyrightsFromForm(self,argv):
+ medias={}
+ partners={}
+ copyrights={}
+
+ copyrightsFinal=[]
+ for arg in argv.keys():
+
+ if arg[0:5]=='media':
+ nm=int(arg[5:])
+ medias[nm]=argv[arg]
+ elif arg[0:5]=='partn':
+ nm=int(arg[5:])
+ partners[nm]=argv[arg]
+ elif arg[0:5]=='copyr':
+ nm=int(arg[5:])
+ copyrights[nm]=argv[arg]
+
+
+
+ copyrightsList=[(medias[nm],partners[nm],copyrights[nm]) for nm in medias.keys()]
+ for copyright in copyrightsList:
+
+ if copyright[2]=='institution0000':
+ copyrightsFinal.append((copyright[0],copyright[1],self.getPartnerCopyright(copyright[1],'')))
+ else:
+ if not copyright[0]=='':
+ copyrightsFinal.append(copyright)
+
+
+ return copyrightsFinal
+
#List of different types for the graphical linking viewer
viewClassificationListMaster=['view point','area']
+
def checkDiffs(self,metadict):
"""check differences"""
@@ -88,8 +121,8 @@ def content_html(self,type):
#
#if templates:
# return templates[0][1]()
-
- if hasattr(self,type+"_template")
+
+ if hasattr(self,type+"_template"):
obj=getattr(self,type+"_template")
return obj()
else:
@@ -283,52 +316,61 @@ def setECHO_collectionInformation(self,t
self.coords=coords[0:]
+class ECHO_copyright(Folder):
+ """Copyright informationen"""
+ meta_type="ECHO_copyright"
+
+
+
+ def __init__(self,id,title,copyrights):
+ """init"""
+ self.title=title
+ self.id=id
+ self.copyrights=copyrights[0:]
-class scientificClassification(SimpleItem,Persistent,Implicit):
- """outdated will be deleeted in the next versions: subclass"""
- security=ClassSecurityInfo()
-
- def __init__(self,context,science,practice):
- self.context=context
- self.science=science
- self.practice=practice
- self.id="scientific_Classification"
-
- security.declarePublic('get_context')
- def get_context(self):
- return self.context
-
- security.declarePublic('get_science')
- def get_science(self):
- return self.science
-
- security.declarePublic('get_practice')
- def get_practice(self):
- return self.practice
-
-
-class scientificInformation(Folder,Persistent,Implicit):
- """outdated will be deleted in the next versions: subclass scientificInformation"""
- security=ClassSecurityInfo()
-
-
-
- def __init__(self,source_type,period):
+ def getCopyrights(self):
+ """return coyprights"""
+ return self.copyrights
+
+ manage_options = Folder.manage_options+(
+ {'label':'Main Config','action':'ECHO_copyright_configForm'},
+ )
- self.id="scientific_Information"
- self.source_type=source_type
- self.period=period
-
+ def ECHO_copyright_configForm(self):
+ """change form"""
+ pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_copyright').__of__(self)
+ pt.content_type="text/html"
+ return pt()
+ def ECHO_copyright_config(self,title,RESPONSE=None):
+ """change"""
+ self.title=title
+ self.copyrights=[]
+ self.copyrights=getCopyrightsFromForm(self,self.REQUEST.form)[0:]
- security.declarePublic('get_source_type')
- def get_source_type(self):
- return self.source_type
-
- security.declarePublic('get_period')
- def get_period(self):
- return self.period
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+def manage_addECHO_copyrightForm(self):
+ """Form for adding"""
+ pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_copyright.zpt').__of__(self)
+ return pt()
+
+def manage_addECHO_copyright(self, id,title,RESPONSE=None):
+ """add the copyright"""
+
+ meta_type="ECHO_copyright"
+
+ #first generate copyrights as list of tripels (mediaType,partner,copyrightType)
+
+
+
+ self._setObject(id, ECHO_copyright(id, title,getCopyrightsFromForm(self,self.REQUEST.form)))
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
class ECHO_layoutTemplate(ZopePageTemplate):
"""Create a layout Template for different purposes"""
@@ -404,6 +446,8 @@ class ECHO_resource(Folder,Persistent):
viewClassificationList=viewClassificationListMaster
getSubCols = ECHO_helpers.getSubCols
+
+
def getTitle(self):
"""title"""
return self.title.encode('utf-8')
@@ -443,17 +487,36 @@ class ECHO_resource(Folder,Persistent):
else:
return "no fulltext available"
- def getCopyright(self):
- """gib link auf copyright notiz aus"""
- if hasattr(self,'copyrightType'):
- obj=getattr(self.copyrightTypes,'copyrightType')
+ def getCopyrightsHTML(self):
+ """gib (link auf copyright notiz, mediatyp, institution, copyrightType, label von copyrightType) aus"""
+
+ if hasattr(self,'copyrightModell'):
+ obj=self.copyrightModell
+
else:
- obj=getattr(self.copyrightTypes,'generic')
-
- label=obj.label
- link="copyrightTypes/"+obj.getId()+'/copyright.html'
+ return "ERROR"
+ ret=[]
- return """%s"""%(link,label)
+ for copyright in obj.getCopyrights():
+
+ link="copyrightTypes/"+copyright[2]+'/copyright.html'
+
+ try:
+ copyrightTypeObj=getattr(self.copyrightTypes,copyright[2])
+ label=copyrightTypeObj.label
+ url=copyrightTypeObj.url
+
+ if url!='':
+ ret.append(("""%s"""%(url,label),copyright[0],copyright[1],copyright[2],label))
+ else:
+ if hasattr(copyrightTypeObj, 'copyright.html'):
+ ret.append(("""%s"""%(link,copyright[1],label),copyright[0],copyright[1],copyright[2],label))
+ else:
+ ret.append((label,copyright[0],copyright[1],copyright[2],label))
+ except:
+ """nothing"""
+
+ return ret
def getCredits(self):
"""Ausgabe der credits"""
@@ -672,7 +735,6 @@ class ECHO_resource(Folder,Persistent):
manage_options = Folder.manage_options+(
{'label':'Main Config','action':'ECHO_resource_config_main'},
- {'label':'Change Partners & Copyright','action':'ECHO_resource_config_credits'},
{'label':'Change Metadata','action':'ECHO_resource_config_metadata'},
{'label':'Change Coords','action':'ECHO_resource_config_coords'},
{'label':'Add coords','action':'ECHO_graphicEntry'},
@@ -1028,12 +1090,6 @@ class ECHO_externalLink(Folder):
{'label':'Main Config','action':'ECHO_externalLink_config'},
)
- def getCredits(self):
- """Ausgabe der credits"""
- if self.credits:
- return self.credits
- else:
- return []
def index_html(self):
"""standard page"""
@@ -1095,6 +1151,34 @@ class ECHO_collection(Folder, Persistent
viewClassificationList=viewClassificationListMaster
displayTypes=displayTypes
+ def getPartnerCopyright(self,name,sonst="generic"):
+ """gibt generisches copyright eines partners aus, sonst behalte jetzige einsteillung"""
+ #print "hi",name,sonst
+ #print getattr(self.partners,name).copyrightType
+ try:
+ partner=getattr(self.partners,name)
+ return partner.copyrightType
+ except:
+ print "error"
+ return sonst
+
+ def partnerSelector_HTML(self,selected=None):
+ """give type selector"""
+ if not selected:
+ retStr="