Diff for /MPIWGWeb/MPIWGProjects.py between versions 1.47.2.2 and 1.47.2.9

version 1.47.2.2, 2005/05/26 08:47:29 version 1.47.2.9, 2005/06/05 22:06:35
Line 168  class MPIWGRoot(ZSQLExtendFolder): Line 168  class MPIWGRoot(ZSQLExtendFolder):
     folders=['MPIWGProject','Folder','ECHO_Navigation']      folders=['MPIWGProject','Folder','ECHO_Navigation']
     meta_type='MPIWGRoot'      meta_type='MPIWGRoot'
   
       def getKategory(self,url):
       """kategorie"""
       splitted=url.split("/")
       return splitted[4]
   
       def generateUrlProject(self,url,project=None):
           """erzeuge aus absoluter url, relative des Projektes"""
   
           splitted=url.split("/")
           length=len(splitted)
           short=splitted[length-2:length]
       if project:
               base=self.REQUEST['URL3']+"/"+"/".join(short)
       else:
           base=self.REQUEST['URL1']+"/"+"/".join(short)
           return base
       
     def isNewCapital(self,text=None,reset=None):      def isNewCapital(self,text=None,reset=None):
         if reset:          if reset:
             self.REQUEST['capital']="A"              self.REQUEST['capital']="A"
Line 187  class MPIWGRoot(ZSQLExtendFolder): Line 204  class MPIWGRoot(ZSQLExtendFolder):
             return cmp(x1,y1)              return cmp(x1,y1)
         if hasattr(self,id):          if hasattr(self,id):
             subs=self.ZopeFind(getattr(self,id),obj_metatypes=['MPIWGTemplate'])              subs=self.ZopeFind(getattr(self,id),obj_metatypes=['MPIWGTemplate'])
             subs.sort(sortWeight)              subret=[]
             return subs              for x in subs:
                   if not(x[1].title==""):
                       subret.append(x)
               subret.sort(sortWeight)
               return subret
         else:          else:
             return None              return None
     def isActive(self,name):      def isActive(self,name):
Line 622  class MPIWGRoot(ZSQLExtendFolder): Line 643  class MPIWGRoot(ZSQLExtendFolder):
                   
         return returnList          return returnList
   
       def formatElementsAsList(self,elements):
           """formatiere tree als liste"""
           
           actualDepth=0
           ret=""
           for element in elements:
               if (element[0]>actualDepth):
                   #fuege soviele ul ein wie unterschied in tiefe
                   if element[0]==1:
                       ret+="""<div class="dept">\n<ul>\n"""
                   else:
                       for i in range(element[0]-actualDepth):
                           ret+="</li>\n<li><ul>\n"
                       
                   actualDepth=element[0]
                   
               elif (element[0]<actualDepth):
                   #fuege soviele /ul ein wie unterschied in tiefe
                   for i in range(-element[0]+actualDepth):
                       ret+="<br><br></li></ul></li>\n"
   
                   if element[0]==1:
                       department=int(element[3].getContent('xdata_05'))-1
                       
                       ret+="""</div>\n"""
                       ret+="""<div class="bildspalte"><img src="../grafik/dept%i.jpg" width="160" height="120" vspace="40"></div>
                       <div class="dept">\n<ul>\n
                       """%department
               
                   actualDepth=element[0]
               else:
                   ret+="""</li>\n"""
               ret+="""<li>\n"""
               
               if actualDepth==1:
                   departmentName={'1':'Department I','2':'Department II','3':'Department III', '4':'NWG','5':'NWG'} 
                   department=element[3].getContent('xdata_05')
                   ret+="""<img src="../grafik/totop.gif" vspace="10" border="0"></a><br><a name="dept%s"></a>%s: """%(department,departmentName[department])
   
               ret+="""<a href="%s">%s</a>"""%(self.generateUrlProject(element[3].absolute_url())+"/index.html",element[3].getContent('WEB_title'))
           return ret
   
     def formatElementForOverview(self,element):      def formatElementForOverview(self,element):
         """format the element for output in overview"""          """format the element for output in overview"""
Line 1094  class MPIWGProject(CatalogAware,Folder): Line 1156  class MPIWGProject(CatalogAware,Folder):
         """get attrbiute"""          """get attrbiute"""
         return getattr(self,field)          return getattr(self,field)
   
     def getContent(self,field):      def getContent(self,field,filter=None):
         """Inhalt des Feldes"""          """Inhalt des Feldes"""
                   
         text=u''          text=u''
Line 1126  class MPIWGProject(CatalogAware,Folder): Line 1188  class MPIWGProject(CatalogAware,Folder):
         if (text2=='') and (field=='WEB_project_header'):          if (text2=='') and (field=='WEB_project_header'):
             return self.getContent('WEB_title')              return self.getContent('WEB_title')
   
           if filter:
               splitted=text2.split("""<p class="picture">""")
               if len(splitted)>1:
                   tmp=splitted[1].split("</p>")
                   self.REQUEST.SESSION['image']=tmp[0].split("\"")[1].encode('utf-8')
                   split2="</p>".join(tmp[1:])
   
                   text3=splitted[0]+split2
   
                   splitted=text3.split("""<p class="picturetitle">""")
                   if len(splitted)>1:
                       tmp=splitted[1].split("</p>")
                       self.REQUEST.SESSION['imagecap']=tmp[0].encode('utf-8')
                       split4="".join(tmp[1:])
   
                       text5=splitted[0]+split4
                   else:
                       #keine caption
                       text5=text3
               else:
                   #kein bild
                   text5=text2
           else:
               text5=text2
   
         #teste ob WEB_project_description und keine führenden p tags          #teste ob WEB_project_description und keine führenden p tags
         if (len(text2)>4) and (not text2[0:3]=='<p>') and (field=='WEB_project_description'):          if (len(text5)>4) and (not text5[0:3]=='<p>') and (field=='WEB_project_description'):
             return "<p>"+text2+"</p>"              return "<p>"+text5+"</p>"
   
   
         return text2.encode('utf-8')          #filter image
           
         
           return text5.encode('utf-8')
   
       def showImagesOfPage(self,imageUrl=None):
           """show Images of project"""
           self.getContent('WEB_project_description',filter='yes') #get the content and store image infos into session
           pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','projectImageView.zpt')).__of__(self)
           return pt()
           
           
     def show_html(self):      def show_html(self):
         """simple index"""          """simple index"""

Removed from v.1.47.2.2  
changed lines
  Added in v.1.47.2.9


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