|
|
| version 1.196, 2004/12/02 14:40:50 | version 1.205, 2005/01/21 17:32:09 |
|---|---|
| Line 61 import xml.dom.minidom | Line 61 import xml.dom.minidom |
| import urllib | import urllib |
| import xml.dom.minidom | import xml.dom.minidom |
| from ECHO_graphicalOverview import javaHandler,javaScriptMain | |
| import ECHO_helpers | import ECHO_helpers |
| from ECHO_helpers import * | from ECHO_helpers import * |
| from ECHO_language import * | from ECHO_language import * |
| Line 75 regexpPage = re.compile(patternPage, re. | Line 74 regexpPage = re.compile(patternPage, re. |
| def setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordstrs,viewClassification=""): | def setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordstrs=""): |
| """Allegemeine Informationen zu einer ECHO Collection""" | """Allegemeine Informationen zu einer ECHO Collection""" |
| self.viewClassification=viewClassification | |
| self.label = label | self.label = label |
| self.title=title | self.title=title |
| self.description=description | self.description=description |
| Line 89 def setECHO_collectionInformation(self,t | Line 86 def setECHO_collectionInformation(self,t |
| self.credits=toList(credits) | self.credits=toList(credits) |
| self.weight=weight | self.weight=weight |
| coords=[] | |
| #coordinates of for rectangles | |
| if coordstrs: | |
| for coordstr in coordstrs: | |
| try: | |
| temco=coordstr.split(",") | |
| except: | |
| temco=[] | |
| coords.append(temco) | |
| self.coords=coords[0:] | |
| class ECHO_copyright(Folder,ECHO_basis): | class ECHO_copyright(Folder,ECHO_basis): |
| """Copyright informationen""" | """Copyright informationen""" |
| Line 170 class ECHO_layoutTemplate(ZopePageTempla | Line 151 class ECHO_layoutTemplate(ZopePageTempla |
| def __init__(self, id, text=None, content_type=None,EchoType=None): | def __init__(self, id, text=None, content_type=None,EchoType=None): |
| self.id = str(id) | self.id = str(id) |
| self.ZBindings_edit(self._default_bindings) | self.ZBindings_edit(self._default_bindings) |
| if text is None: | if text is None: |
| self._default_content_fn = os.path.join(package_home(globals()), | self._default_content_fn = os.path.join(package_home(globals()), |
| Line 180 class ECHO_layoutTemplate(ZopePageTempla | Line 159 class ECHO_layoutTemplate(ZopePageTempla |
| self.pt_edit(text, content_type) | self.pt_edit(text, content_type) |
| """change form""" | |
| def manage_addECHO_layoutTemplateForm(self): | def manage_addECHO_layoutTemplateForm(self): |
| """Form for adding""" | """Form for adding""" |
| pt=zptFile(self, 'zpt/AddECHO_layoutTemplate.zpt') | pt=zptFile(self, 'zpt/AddECHO_layoutTemplate.zpt') |
| Line 282 class ECHO_resource(Folder,Persistent,EC | Line 258 class ECHO_resource(Folder,Persistent,EC |
| security=ClassSecurityInfo() | security=ClassSecurityInfo() |
| meta_type='ECHO_resource' | meta_type='ECHO_resource' |
| viewClassificationList=viewClassificationListMaster | # viewClassificationList=viewClassificationListMaster |
| getSubCols = ECHO_helpers.getSubCols | getSubCols = ECHO_helpers.getSubCols |
| Line 684 class ECHO_resource(Folder,Persistent,EC | Line 660 class ECHO_resource(Folder,Persistent,EC |
| """template fuer content""" | """template fuer content""" |
| return ECHO_basis.content_html(self,'resource') | return ECHO_basis.content_html(self,'resource') |
| def getViewClassification(self): | # def getViewClassification(self): |
| if hasattr(self,'viewClassification'): | # if hasattr(self,'viewClassification'): |
| return self.viewClassification | # return self.viewClassification |
| else: | # else: |
| return "" | # return "" |
| def getFullTextXML(self,noredirect=None): | def getFullTextXML(self,noredirect=None): |
| """getFullTextXML; gives the FullText as an XML Document, and <error></error> if somthing goes wrong.""" | """getFullTextXML; gives the FullText as an XML Document, and <error></error> if somthing goes wrong.""" |
| Line 842 class ECHO_resource(Folder,Persistent,EC | Line 818 class ECHO_resource(Folder,Persistent,EC |
| coordsnew=[] | coordsnew=[] |
| self.coords=coordsnew | self.coords=coordsnew |
| self.viewClassification="" | # self.viewClassification="" |
| Line 1024 class ECHO_resource(Folder,Persistent,EC | Line 1000 class ECHO_resource(Folder,Persistent,EC |
| self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') | self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
| return writeMetadata(self.metalink,self.metaDataHash) | return writeMetadata(self.metalink,self.metaDataHash) |
| def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None): | def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None): |
| """Aenderung der Properties""" | """Aenderung der Properties""" |
| try: | setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight) |
| coordsnew=[ string.split(x,",") for x in coords] | |
| except: | |
| coordsnew=[] | |
| setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) | |
| self.viewClassification=viewClassification | |
| self.coords=coordsnew[0:] | |
| self.link=link | self.link=link |
| self.metalink=metalink | self.metalink=metalink |
| Line 1045 class ECHO_resource(Folder,Persistent,EC | Line 1014 class ECHO_resource(Folder,Persistent,EC |
| manage_options = Folder.manage_options+( | manage_options = Folder.manage_options+( |
| {'label':'Main Config','action':'ECHO_resource_config_main'}, | {'label':'Main Config','action':'ECHO_resource_config_main'}, |
| {'label':'Change Metadata','action':'ECHO_resource_config_metadata'}, | {'label':'Change Metadata','action':'ECHO_resource_config_metadata'}, |
| {'label':'Edit Coords','action':'ECHO_resource_config_coords'}, | {'label':'Graphic Coords','action':'ECHO_graphicEntry'}, |
| {'label':'Change Coords','action':'ECHO_graphicEntry'}, | |
| {'label':'Sync Metadata','action':'ECHO_getResourceMD'}, | {'label':'Sync Metadata','action':'ECHO_getResourceMD'}, |
| {'label':'Change TemplateSets and Image Viewer','action':'changeViewerTemplateSetForm'}, | {'label':'Change TemplateSets and Image Viewer','action':'changeViewerTemplateSetForm'}, |
| {'label':'set/change startpage','action':'setStartPageForm'}, | {'label':'set/change startpage','action':'setStartPageForm'}, |
| {'label':'Copy MD for indexing and search','action':'copySearchFields'}, | {'label':'Copy MD for indexing and search','action':'copySearchFields'}, |
| ) | ) |
| def getOverview(self): | |
| """overview graphics""" | |
| return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1] | |
| def ECHO_graphicEntry(self): | |
| """DO nothing""" | |
| overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview']) | |
| if overview: | |
| pt=zptFile(self, 'zpt/ECHO_draw.zpt') | |
| return pt() | |
| else: | |
| return "NO OVERVIEW GRAPHICS" | |
| def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None): | |
| """Enter coords""" | |
| coords=self.coords | |
| temco=coordstr.split(",") | |
| temco.append(angle) | |
| coords.append(temco) | |
| self.coords=coords[0:] | |
| if RESPONSE is not None: | |
| RESPONSE.redirect('ECHO_graphicEntry') | |
| def isDefinedInThisSet(self,fields,field): | def isDefinedInThisSet(self,fields,field): |
| """checks if field is defined in fields""" | """checks if field is defined in fields""" |
| Line 1160 class ECHO_resource(Folder,Persistent,EC | Line 1103 class ECHO_resource(Folder,Persistent,EC |
| fields=[] | fields=[] |
| fieldlist=self.standardMD.fieldList | fieldlist=self.standardMD.fieldList |
| tags=self.findTagsFromMapping(self.contentType) | |
| self.referencetypes=tags[2] | |
| for referenceTypeF in self.referencetypes: | for referenceTypeF in self.referencetypes: |
| if referenceTypeF[1].title.lower() == referenceType.lower(): | if referenceTypeF[1].title.lower() == referenceType.lower(): |
| Line 1297 class ECHO_resource(Folder,Persistent,EC | Line 1242 class ECHO_resource(Folder,Persistent,EC |
| pdf=self.checkRDF(self.link) | pdf=self.checkRDF(self.link) |
| if pdf: | if pdf: |
| fh=file(pdf,'r').read() | fh=file(pdf,'r').read() |
| self.REQUEST.RESPONSE.setHeader('Content-Type','x-Application/pdf') | self.REQUEST.RESPONSE.setHeader('Content-Type','application/pdf') |
| self.REQUEST.RESPONSE.write(fh) | self.REQUEST.RESPONSE.write(fh) |
| self.REQUEST.RESPONSE.close() | self.REQUEST.RESPONSE.close() |
| return | return |
| Line 1411 class ECHO_externalLink(Folder,ECHO_basi | Line 1356 class ECHO_externalLink(Folder,ECHO_basi |
| def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None): | def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None): |
| """Aenderung der Properties""" | """Aenderung der Properties""" |
| try: | setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight) |
| coordsnew=[ string.split(x,",") for x in coords] | |
| except: | |
| coordsnew=[] | |
| setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coords) | |
| self.coords=coordsnew[0:] | |
| self.link=link | self.link=link |
| if RESPONSE is not None: | if RESPONSE is not None: |
| RESPONSE.redirect('manage_main') | RESPONSE.redirect('manage_main') |
| Line 1488 class ECHO_collection(Folder, Persistent | Line 1426 class ECHO_collection(Folder, Persistent |
| security=ClassSecurityInfo() | security=ClassSecurityInfo() |
| meta_type='ECHO_collection' | meta_type='ECHO_collection' |
| viewClassificationList=viewClassificationListMaster | # viewClassificationList=viewClassificationListMaster |
| displayTypes=displayTypes | displayTypes=displayTypes |
| path="/mpiwg/online/permanent/shipbuilding" | path="/mpiwg/online/permanent/shipbuilding" |
| Line 1552 class ECHO_collection(Folder, Persistent | Line 1490 class ECHO_collection(Folder, Persistent |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].changeAccessRightMD(argv[resource[1].getId()]) | resource[1].changeAccessRightMD(argv[resource[1].getId()]) |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def changeMetaDataLinkInCollection(self): | def changeMetaDataLinkInCollection(self): |
| Line 1567 class ECHO_collection(Folder, Persistent | Line 1505 class ECHO_collection(Folder, Persistent |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].metalink=argv[resource[1].getId()][0:] | resource[1].metalink=argv[resource[1].getId()][0:] |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def changeMetaDataLinkInCollection(self): | def changeMetaDataLinkInCollection(self): |
| Line 1582 class ECHO_collection(Folder, Persistent | Line 1520 class ECHO_collection(Folder, Persistent |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].metalink=argv[resource[1].getId()][0:] | resource[1].metalink=argv[resource[1].getId()][0:] |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def changeWeightsInCollection(self): | def changeWeightsInCollection(self): |
| Line 1597 class ECHO_collection(Folder, Persistent | Line 1535 class ECHO_collection(Folder, Persistent |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].weight=argv[resource[1].getId()][0:] | resource[1].weight=argv[resource[1].getId()][0:] |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def changeTitlesInCollection(self): | def changeTitlesInCollection(self): |
| Line 1612 class ECHO_collection(Folder, Persistent | Line 1550 class ECHO_collection(Folder, Persistent |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].title=argv[resource[1].getId()][0:] | resource[1].title=argv[resource[1].getId()][0:] |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def updateCollection(self,RESPONSE=None): | def updateCollection(self,RESPONSE=None): |
| Line 1800 class ECHO_collection(Folder, Persistent | Line 1738 class ECHO_collection(Folder, Persistent |
| """nothing""" | """nothing""" |
| return retStr | return retStr |
| def getViewClassification(self): | # def getViewClassification(self): |
| if hasattr(self,'viewClassification'): | # if hasattr(self,'viewClassification'): |
| return self.viewClassification | # return self.viewClassification |
| else: | # else: |
| return "" | # return "" |
| def createRessourcesFromXMLForm(self): | def createRessourcesFromXMLForm(self): |
| Line 1856 class ECHO_collection(Folder, Persistent | Line 1794 class ECHO_collection(Folder, Persistent |
| except: | except: |
| return "" | return "" |
| def getCollectionTreeXML(self): | def getCollectionTreeXML(self,pwstr=None): |
| """Tree as XML""" | """Tree as XML""" |
| def addPassWd(str): | def addPassWd(str,pwstr=None): |
| """adds a user/passwd to an url""" | """adds a user/passwd to an url""" |
| if pwstr: | |
| txt2=re.sub(r"(http://)(.*?)","\g<1>%s@\g<2>"%pwstr,str) | |
| else: | |
| txt2=re.sub(r"(http://)(.*?)","\g<1>www:3333@\g<2>",str) | txt2=re.sub(r"(http://)(.*?)","\g<1>www:3333@\g<2>",str) |
| return txt2 | return txt2 |
| def getCollection(object,depth=0): | def getCollection(object,depth=0,pwstr=None): |
| depth+=1 | depth+=1 |
| collections="" | collections="" |
| for entry in object.__dict__.keys(): | for entry in object.__dict__.keys(): |
| element=getattr(object,entry) | element=getattr(object,entry) |
| try: | try: |
| if element.meta_type in ["ECHO_collection","ECHO_group"]: | if element.meta_type in ["ECHO_collection","ECHO_group"]: |
| collections+="<element name=\""+urllib.quote(element.title)+"\" url=\""+addPassWd(element.absolute_url())+"\">" | collections+="<element name=\""+urllib.quote(element.title)+"\" url=\""+addPassWd(element.absolute_url(),pwstr=pwstr)+"\">" |
| collections+=getCollection(element,depth)+"</element>\n" | collections+=getCollection(element,depth)+"</element>\n" |
| except: | except: |
| """nothing""" | """nothing""" |
| return collections | return collections |
| ret="""<?xml version="1.0" encoding="utf-8" ?>""" | ret="""<?xml version="1.0" encoding="utf-8" ?>""" |
| return ret+"<collection>"+getCollection(self)+"</collection>" | return ret+"<collection>"+getCollection(self,pwstr=pwstr)+"</collection>" |
| def createJavaScript(self): | |
| """OLD CreateJava""" | |
| ret=javaScriptMain | |
| dynamical="\n" | |
| for ob in self.getGraphicCoords(): | |
| if ob[4][4] == "": | |
| dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0]) | |
| else: | |
| dynamical+="""Coords.push(new Coord('%s', Img, %s));//%s\n"""%(ob[1],ob[0],ob[4][4]) | |
| dynamical+="ShowArrow(new getObj('i.%s'),Img,%s);\n"%(ob[1],ob[0]) | |
| ret+=javaHandler%dynamical | |
| return ret | |
| def newMapArea(self, id, coords=None): | |
| """returns a new MapArea""" | |
| if coords is None: | |
| coords = [0,0,0,0] | |
| return MapArea(id, coords) | |
| def createJSAreas(self, areas): | |
| """create area calls for JavaScript""" | |
| dynamical="\n" | |
| for ob in areas: | |
| if ob.isTypeArrow(): | |
| dynamical+="""addArea('%s', 'overview', %s, 'arrow');\n"""%(ob.getFullId(),ob.getCoordString()) | |
| else: | |
| dynamical+="""addArea('%s', 'overview', %s, 'area');\n"""%(ob.getFullId(),ob.getCoordString()) | |
| return dynamical | |
| def createAllJSAreas(self): | def createAllJSAreas(self): |
| """create area calls for JavaScript""" | """create area calls for JavaScript""" |
| areas = self.getAllMapAreas() | areas = self.getAllMapAreas() |
| return self.createJSAreas(areas) | return self.createJSAreas(areas) |
| def createMapHead(self): | |
| """create javascript include and script tags for head""" | |
| pt=zptFile(self, 'zpt/ECHO_content_map_frag_js') | |
| return pt() | |
| def createMapImg(self): | |
| """generate img-tag for map""" | |
| bt = BrowserCheck(self) | |
| tag = "" | |
| src = self.REQUEST['URL1'] + "/overview" | |
| if bt.isN4: | |
| tag += '<ilayer id="overview" visibility="show"><img src="%s"></ilayer>'%src | |
| else: | |
| tag += '<img id="overview" src="%s" />'%src | |
| return tag | |
| def createMapLink(self, ob, text=None): | |
| """generate map link""" | |
| bt = BrowserCheck(self) | |
| id = ob.getFullId() | |
| link = ob.getLinkId() | |
| if text is None: | |
| text = ob.getLabel() | |
| if text is None: | |
| text = "link" | |
| tag = "" | |
| if bt.isN4: | |
| tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) | |
| tag += ">" + text + "</a></ilayer>" | |
| else: | |
| tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) | |
| if ob.text: | |
| tag += ' title="%s"'%ob.text | |
| tag += ">" + text + "</a>" | |
| return tag | |
| def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil"): | |
| """generate map link image, text and other stuff""" | |
| bt = BrowserCheck(self) | |
| id = ob.getFullId() | |
| link = ob.getLinkId() | |
| tiptext = ob.getText() | |
| tag = "" | |
| if bt.isN4: | |
| tag += '<layer id="i.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)">'%(id,id,id) | |
| if ob.isTypeArrow(): | |
| rot = ob.angle | |
| tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,arrowsrc,rot) | |
| else: | |
| tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link) | |
| if tiptext: | |
| tag += ' alt="%s"'%tiptext | |
| tag += ' /></a>' | |
| tag += '</layer>' | |
| else: | |
| tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank">'%(id,id,id,link) | |
| if ob.isTypeArrow(): | |
| rot = ob.angle | |
| if bt.isIEWin and bt.versIE > 5: | |
| tag += '<span id="i.%s" style="position:absolute; top:-100px; left:-100px; border-style:none; border-width=1px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'%s&rot=%s\');"><img style="visibility:hidden" src="%s&rot=%s" /></span>'%(id,arrowsrc,rot,arrowsrc,rot) | |
| else: | |
| tag += '<img id="i.%s" src="%s&rot=%s" border="1" style="position:absolute; top:-100px; left:-100px; border-style:none;" />'%(id,arrowsrc,rot) | |
| else: | |
| if bt.isIEWin: | |
| tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;background:url(area_img)"'%(id) | |
| else: | |
| tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;"'%(id) | |
| if tiptext: | |
| tag += ' title="%s"'%tiptext | |
| tag += '> </div>' | |
| tag += '</a>' | |
| return tag | |
| security.declarePublic('getCreditObject') | security.declarePublic('getCreditObject') |
| def getCreditObject(self,name): | def getCreditObject(self,name): |
| """credit id to credititem""" | """credit id to credititem""" |
| Line 2058 class ECHO_collection(Folder, Persistent | Line 1894 class ECHO_collection(Folder, Persistent |
| {'label':'Change Titles','action':'changeTitles'}, | {'label':'Change Titles','action':'changeTitles'}, |
| {'label':'Change Weights','action':'changeWeights'}, | {'label':'Change Weights','action':'changeWeights'}, |
| {'label':'Rerender Labels and Titles','action':'ECHO_rerenderLinksMDWarning'}, | {'label':'Rerender Labels and Titles','action':'ECHO_rerenderLinksMDWarning'}, |
| {'label':'Graphics','action':'ECHO_graphicEntry'}, | {'label':'Graphic Coords','action':'ECHO_graphicEntry'}, |
| {'label':'create resources from XML','action':'createRessourcesFromXMLForm'}, | {'label':'create resources from XML','action':'createRessourcesFromXMLForm'}, |
| {'label':'Set Startpage','action':'setStartpageFolderForm'}, | {'label':'Set Startpage','action':'setStartpageFolderForm'}, |
| {'label':'Change Viewer Templates and Image Viewer','action':'changeViewerTemplateSetsForm'}, | {'label':'Change Viewer Templates and Image Viewer','action':'changeViewerTemplateSetsForm'}, |
| Line 2067 class ECHO_collection(Folder, Persistent | Line 1903 class ECHO_collection(Folder, Persistent |
| {'label':'Copy MD for indexing and search','action':'copySearchFields'}, | {'label':'Copy MD for indexing and search','action':'copySearchFields'}, |
| ) | ) |
| def getOverview(self): | |
| """overview graphics""" | |
| return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1] | |
| def ECHO_graphicEntry(self): | |
| """DO nothing""" | |
| overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview']) | |
| if overview: | |
| pt=zptFile(self, 'zpt/ECHO_draw.zpt') | |
| return pt() | |
| else: | |
| return "NO OVERVIEW GRAPHICS" | |
| security.declarePublic('ECHO_collection_config') | security.declarePublic('ECHO_collection_config') |
| def ECHO_collection_config(self): | def ECHO_collection_config(self): |
| Line 2092 class ECHO_collection(Folder, Persistent | Line 1914 class ECHO_collection(Folder, Persistent |
| if not hasattr(self,'sortfield'): | if not hasattr(self,'sortfield'): |
| self.sortfield="weight" | self.sortfield="weight" |
| if not hasattr(self,'coords'): | |
| self.coords=[] | |
| pt=zptFile(self, 'zpt/ChangeECHO_collection.zpt') | pt=zptFile(self, 'zpt/ChangeECHO_collection.zpt') |
| return pt() | return pt() |
| Line 2108 class ECHO_collection(Folder, Persistent | Line 1927 class ECHO_collection(Folder, Persistent |
| security.declarePublic('changeECHO_collection') | security.declarePublic('changeECHO_collection') |
| def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",viewClassification=None,location=None,isAlwaysClickable=None): | def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",location=None,isAlwaysClickable=None): |
| """Aenderung der Properties""" | """Aenderung der Properties""" |
| self.secondaryLink=secondaryLink | self.secondaryLink=secondaryLink |
| self.secondaryLinkTitle=secondaryLinkTitle | self.secondaryLinkTitle=secondaryLinkTitle |
| self.imageTag=imageTag | self.imageTag=imageTag |
| self.bgcolour=bgcolour | self.bgcolour=bgcolour |
| self.viewClassification=viewClassification | |
| self.location=location | self.location=location |
| self.isAlwaysClickable=isAlwaysClickable | self.isAlwaysClickable=isAlwaysClickable |
| if coords: | setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight) |
| coordsnew=[ string.split(x,",") for x in coords] | |
| self.coords=coordsnew[0:] | |
| else: | |
| coordsnew=None | |
| self.coords=None | |
| setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) | |
| try: | |
| self.coords=coordsnew[0:] # HACK fehler in setECHO_collection | |
| except: | |
| """none""" | |
| self.sortfield=sortfield | self.sortfield=sortfield |
| Line 2223 class ECHO_collection(Folder, Persistent | Line 2030 class ECHO_collection(Folder, Persistent |
| def getAllMapAreas(self): | def getAllMapAreas(self): |
| """Give list of coordinates""" | """Give list of coordinates""" |
| subColTypes=['ECHO_collection','ECHO_resource'] | mapColTypes=['ECHO_collection','ECHO_resource'] |
| areas=[] | areas=[] |
| for entrySearch in self.ZopeFind(self,obj_metatypes=subColTypes): | for entry in self.getSubCols(self,subColTypes=mapColTypes): |
| object=entrySearch[1] | object=entry |
| areas.extend(object.getMapAreas()) | areas.extend(object.getMapAreas()) |
| return areas | return areas |
| Line 2241 class ECHO_collection(Folder, Persistent | Line 2048 class ECHO_collection(Folder, Persistent |
| parent._delObject(id) | parent._delObject(id) |
| return "Done" | return "Done" |
| def repairCoords(self): | |
| """updates map coordinates to new class objects""" | |
| msg = "" | |
| for cols in self.ZopeFind(self, obj_metatypes=['ECHO_collection','ECHO_resource'], search_sub=1): | |
| col = cols[1] | |
| if not hasattr(col, 'coords'): | |
| continue | |
| print "fixing: ", col.id | |
| msg += "fixing: "+col.id+"\n" | |
| coords = col.coords | |
| if len(coords) > 0: | |
| # delete old MapAreas | |
| for areas in self.ZopeFind(col, obj_metatypes=['MapArea']): | |
| #area = areas[1] | |
| id = areas[0] | |
| print " deleting: ", id | |
| msg += " deleting: "+id+"\n" | |
| col._delObject(id) | |
| # add new MapAreas | |
| areacnt = 0 | |
| for coord in coords: | |
| if len(coord) < 4: | |
| continue | |
| type = col.viewClassification | |
| if type == 'view point': | |
| type = 'arrow' | |
| if type is None: | |
| if len(coord) > 4: | |
| type = 'arrow' | |
| else: | |
| type = 'area' | |
| newid = "a%02d"%areacnt | |
| areacnt += 1 | |
| area = MapArea(newid, coord, type=type) | |
| print " adding: ", newid | |
| msg += " adding: "+newid+"\n" | |
| col.addMapArea(area) | |
| msg += "\nDone!" | |
| return msg | |
| getSubCols = ECHO_helpers.getSubCols | getSubCols = ECHO_helpers.getSubCols |
| Line 2310 class ECHO_group(ECHO_collection): | Line 2078 class ECHO_group(ECHO_collection): |
| manage_options = Folder.manage_options+( | manage_options = Folder.manage_options+( |
| {'label':'Main Config','action':'ECHO_group_config'}, | {'label':'Main Config','action':'ECHO_group_config'}, |
| {'label':'Rerender Links','action':'ECHO_rerenderLinksMDWarning'}, | {'label':'Rerender Links','action':'ECHO_rerenderLinksMDWarning'}, |
| {'label':'Graphics','action':'ECHO_graphicEntry'}, | {'label':'Graphic Coords','action':'ECHO_graphicEntry'}, |
| ) | ) |
| security.declareProtected('View','index_html') | security.declareProtected('View','index_html') |
| Line 2383 class ECHO_group(ECHO_collection): | Line 2151 class ECHO_group(ECHO_collection): |
| self.bgcolour=bgcolour | self.bgcolour=bgcolour |
| self.logo=logo | self.logo=logo |
| if coords: | setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight) |
| coordsnew=[ string.split(x,",") for x in coords] | |
| self.coords=coordsnew[0:] | |
| else: | |
| coordsnew=None | |
| self.coords=None | |
| setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) | |
| Line 2587 class ECHO_root(Folder,Persistent,Implic | Line 2348 class ECHO_root(Folder,Persistent,Implic |
| meta_type="ECHO_root" | meta_type="ECHO_root" |
| ###CDLI adds -> have to be removed | def getContentOverviewTemplate(self): |
| """produces overview template with macro""" | |
| pt = zptObjectOrFile(self, 'content_overview_template') | |
| return pt | |
| ###Cdli adds -> have to be removed | |
| def getTablet(self,item): | def getTablet(self,item): |
| #print "getTablet" | #print "getTablet" |
| try: | try: |
| Line 2600 class ECHO_root(Folder,Persistent,Implic | Line 2366 class ECHO_root(Folder,Persistent,Implic |
| ###END CDLI add | ###END CDLI add |
| def URLquote(self, text): | |
| """urllib.quote fuer Michael""" | |
| return urllib.quote(text) | |
| def checkResource(self,id): | def checkResource(self,id): |
| """checks if a resource is in the tree, gives back none or list of resources""" | """checks if a resource is in the tree, gives back none or list of resources""" |
| if hasattr(self,"_v_checkResource") and self._v_checkResource.has_key(id): #existiert ein cache und id ist bereits drin? | if hasattr(self,"_v_checkResource") and self._v_checkResource.has_key(id): #existiert ein cache und id ist bereits drin? |
| Line 2742 class ECHO_root(Folder,Persistent,Implic | Line 2513 class ECHO_root(Folder,Persistent,Implic |
| ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" | ret+=resource[1].getId()+" "+argv[resource[1].getId()]+"</br>" |
| resource[1].weight=argv[resource[1].getId()][0:] | resource[1].weight=argv[resource[1].getId()][0:] |
| except: | except: |
| """not""" | pass |
| return ret | return ret |
| def changeWeights(self): | def changeWeights(self): |
| Line 2983 class ECHO_root(Folder,Persistent,Implic | Line 2754 class ECHO_root(Folder,Persistent,Implic |
| return "changed all contenttypes in: "+self.title | return "changed all contenttypes in: "+self.title |
| def repairAllCoords(self): | |
| """updates map coordinates on the same and sublevels""" | |
| return repairCoords(self) | |
| def patchViewClassification(self,obj=None): | def patchViewClassification(self,obj=None): |
| """setze viewClassification heuristisch""" | """setze viewClassification heuristisch""" |
| Line 3017 class ECHO_root(Folder,Persistent,Implic | Line 2793 class ECHO_root(Folder,Persistent,Implic |
| def deleteCache(self,obj=None,RESPONSE=None): | def deleteCache(self,obj=None,RESPONSE=None): |
| """setze alle collections auf cache = CacheManager""" | """setze alle collections auf cache = CacheManager""" |
| if not obj: | if not obj: |
| obj = self | obj = self |
| entries=obj.ZopeFind(obj,search_sub=1) | entries=obj.ZopeFind(obj,search_sub=1) |
| for entry in entries: | for entry in entries: |
| if hasattr(entry[1],'_v_hash'): | if hasattr(entry[1],'_v_hash'): |
| entry[1]._v_hash=None | entry[1]._v_hash=None |
| return "changed all CM in: "+self.title | return "changed all CM in: "+self.title |
| security.declarePublic('ECHO_newViewerLink') | security.declarePublic('ECHO_newViewerLink') |
| def ECHO_newViewerLink(self,obj=None): | def ECHO_newViewerLink(self,obj=None): |
| """change links (:86 faellt weg)""" | """change links (:86 faellt weg)""" |
| Line 3749 def manage_addECHO_institution(self, id, | Line 3517 def manage_addECHO_institution(self, id, |
| REQUEST.RESPONSE.redirect('%s/manage_main' % url) | REQUEST.RESPONSE.redirect('%s/manage_main' % url) |
| return id | return id |
| def repairCoords(self): | |
| """updates map coordinates to new MapArea objects""" | |
| msg = "" | |
| for cols in self.ZopeFind(self, obj_metatypes=['ECHO_collection','ECHO_resource'], search_sub=1): | |
| col = cols[1] | |
| if not hasattr(col, 'coords'): | |
| continue | |
| print "fixing: ", col.id | |
| msg += "fixing: "+col.id+"\n" | |
| coords = col.coords | |
| if len(coords) > 0: | |
| # delete old MapAreas | |
| for areas in self.ZopeFind(col, obj_metatypes=['MapArea']): | |
| #area = areas[1] | |
| id = areas[0] | |
| print " deleting: ", id | |
| msg += " deleting: "+id+"\n" | |
| col._delObject(id) | |
| # add new MapAreas | |
| areacnt = 0 | |
| for coord in coords: | |
| if len(coord) < 4: | |
| continue | |
| type = col.viewClassification | |
| if type == 'view point': | |
| type = 'arrow' | |
| if type is None: | |
| if len(coord) > 4: | |
| type = 'arrow' | |
| else: | |
| type = 'area' | |
| newid = "a%02d"%areacnt | |
| areacnt += 1 | |
| area = MapArea(newid, coord, type=type) | |
| print " adding: ", newid | |
| msg += " adding: "+newid+"\n" | |
| col.addMapArea(area) | |
| msg += "\nDone!" | |
| return msg |