Diff for /MPIWGWeb/MPIWGProjects.py between versions 1.47.2.5 and 1.47.2.12

version 1.47.2.5, 2005/05/27 08:34:37 version 1.47.2.12, 2005/06/08 20:13:17
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 generateUrlProject(self,url):      def getKategory(self,url):
       """kategorie"""
       splitted=url.split("/")
       return splitted[4]
   
       def generateUrlProject(self,url,project=None):
         """erzeuge aus absoluter url, relative des Projektes"""          """erzeuge aus absoluter url, relative des Projektes"""
   
         splitted=url.split("/")          splitted=url.split("/")
         length=len(splitted)          length=len(splitted)
         short=splitted[length-2:length]          short=splitted[length-2:length]
       if project:
               base=self.REQUEST['URL3']+"/"+"/".join(short)
       else:
         base=self.REQUEST['URL1']+"/"+"/".join(short)          base=self.REQUEST['URL1']+"/"+"/".join(short)
         return base          return base
           
Line 195  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 405  class MPIWGRoot(ZSQLExtendFolder): Line 418  class MPIWGRoot(ZSQLExtendFolder):
   
     def getProjectsByFieldContent(self,fieldName,fieldContentsEntry):      def getProjectsByFieldContent(self,fieldName,fieldContentsEntry):
         """gib alle Projekte aus mit Value von field mit fieldName enthält ein Element der Liste fieldContents"""          """gib alle Projekte aus mit Value von field mit fieldName enthält ein Element der Liste fieldContents"""
           def sort(x,y):
           return cmp(x.WEB_title[0],y.WEB_title[0])
   
         if type(fieldContentsEntry) is StringType:          if type(fieldContentsEntry) is StringType:
             fieldContents=[fieldContentsEntry]              fieldContents=[fieldContentsEntry]
         else:          else:
Line 412  class MPIWGRoot(ZSQLExtendFolder): Line 428  class MPIWGRoot(ZSQLExtendFolder):
                           
         projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' OR')})          projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' OR')})
         #print projects          #print projects
         return projects      ret=[x for x in projects]
       ret.sort(sort)
           return ret
   
     def changeMPIWGRootForm(self):      def changeMPIWGRootForm(self):
         """edit"""          """edit"""
Line 431  class MPIWGRoot(ZSQLExtendFolder): Line 449  class MPIWGRoot(ZSQLExtendFolder):
   
     def getDisciplineList(self):      def getDisciplineList(self):
         """get disciplines as list"""          """get disciplines as list"""
         return self.disciplineList.split("\n")          list= self.disciplineList.split("\n")
           return [x.rstrip().lstrip() for x in list]
           
     def getThemeList(self):      def getThemeList(self):
         """get themes as list"""          """get themes as list"""
         return self.themesList.split("\n")          list= self.themesList.split("\n")
           return [x.rstrip().lstrip() for x in list]
           
     def test(self):      def test(self):
         """test"""          """test"""
Line 626  class MPIWGRoot(ZSQLExtendFolder): Line 646  class MPIWGRoot(ZSQLExtendFolder):
                     #title=project[0].WEB_title                      #title=project[0].WEB_title
                     title=[project[0].getContent('WEB_title')]                      title=[project[0].getContent('WEB_title')]
                     #print title                      #print title
               if idNr[0]!="x":
                     returnList.append((depth,nr,title,project[0]))                      returnList.append((depth,nr,title,project[0]))
                   
         return returnList          return returnList
Line 639  class MPIWGRoot(ZSQLExtendFolder): Line 660  class MPIWGRoot(ZSQLExtendFolder):
             if (element[0]>actualDepth):              if (element[0]>actualDepth):
                 #fuege soviele ul ein wie unterschied in tiefe                  #fuege soviele ul ein wie unterschied in tiefe
                 if element[0]==1:                  if element[0]==1:
                     ret+="""<div class="dept">\n"""                      ret+="""<div class="dept">\n<ul class="liste">\n"""
                 else:                  else:
                     for i in range(element[0]-actualDepth):                      for i in range(element[0]-actualDepth):
                         ret+="</li>\n<li><ul>\n"                          if i>0:
                               ret+="<li>"
                           ret+="""<ul class="liste">\n"""
                                           
                 actualDepth=element[0]                  actualDepth=element[0]
                                   
             elif (element[0]<actualDepth):              elif (element[0]<actualDepth):
                 #fuege soviele /ul ein wie unterschied in tiefe                  #fuege soviele /ul ein wie unterschied in tiefe
                 for i in range(-element[0]+actualDepth):                  for i in range(-element[0]+actualDepth):
                     ret+="<br><br></li></ul></li>\n"  
                       ret+="<br><br></li></ul>\n"
   
                       #ret+="<br><br>\n</li>\n</ul>\n</li>\n"
   
   
                 if element[0]==1:                  if element[0]==1:
                     department=int(element[3].getContent('xdata_05'))-1                      department=int(element[3].getContent('xdata_05'))-1
                                           
                     ret+="""</div>\n"""                      ret+="""</ul></div>\n"""
               if department==4: #hack
               department=3
   
                     ret+="""<div class="bildspalte"><img src="../grafik/dept%i.jpg" width="160" height="120" vspace="40"></div>                      ret+="""<div class="bildspalte"><img src="../grafik/dept%i.jpg" width="160" height="120" vspace="40"></div>
                     <div class="dept">\n<ul>\n                      <div class="dept">\n<ul class="liste">\n
                     """%department                      """%department
                           
                 actualDepth=element[0]                  actualDepth=element[0]
             else:              else:
                 ret+="""</li>\n"""                  ret+="""\n</li>\n"""
             ret+="""<li>\n"""              ret+="""<li>\n"""
                           
             if actualDepth==1:              if actualDepth==1:
                 departmentName={'1':'Department I','2':'Department II','3':'Department III', '4':'NWG','5':'NWG'}                   departmentName={'1':'Department I','2':'Department II','3':'Department III', '4':'Ind. Research Group','5':'Ind. Research Group'} 
                 department=element[3].getContent('xdata_05')                  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="#top"><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'))              ret+="""<a href="%s">%s</a>"""%(self.generateUrlProject(element[3].absolute_url())+"/index.html",element[3].getContent('WEB_title'))
         return ret          return ret
Line 1179  class MPIWGProject(CatalogAware,Folder): Line 1209  class MPIWGProject(CatalogAware,Folder):
             splitted=text2.split("""<p class="picture">""")              splitted=text2.split("""<p class="picture">""")
             if len(splitted)>1:              if len(splitted)>1:
                 tmp=splitted[1].split("</p>")                  tmp=splitted[1].split("</p>")
                 self.REQUEST.SESSION['image']=tmp[0].split("\"")[1].encode('utf-8')          #return repr(splitted[1])
                   try:
               self.imageURL=tmp[0].split("\"")[1].encode('utf-8')
           except:
               self.imageURL=tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')
           
                 split2="</p>".join(tmp[1:])                  split2="</p>".join(tmp[1:])
   
                 text3=splitted[0]+split2                  text3=splitted[0]+split2
Line 1187  class MPIWGProject(CatalogAware,Folder): Line 1222  class MPIWGProject(CatalogAware,Folder):
                 splitted=text3.split("""<p class="picturetitle">""")                  splitted=text3.split("""<p class="picturetitle">""")
                 if len(splitted)>1:                  if len(splitted)>1:
                     tmp=splitted[1].split("</p>")                      tmp=splitted[1].split("</p>")
                     self.REQUEST.SESSION['imagecap']=tmp[0].encode('utf-8')              self.imagecap=tmp[0].encode('utf-8')
                   
                     split4="".join(tmp[1:])                      split4="".join(tmp[1:])
   
                     text5=splitted[0]+split4                      text5=splitted[0]+split4
Line 1202  class MPIWGProject(CatalogAware,Folder): Line 1238  class MPIWGProject(CatalogAware,Folder):
   
         #teste ob WEB_project_description und keine führenden p tags          #teste ob WEB_project_description und keine führenden p tags
         if (len(text5)>4) and (not text5[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>"+text5+"</p>"              text5= "<p>"+text5+"</p>"
   
   
         #filter image          #filter image
Line 1210  class MPIWGProject(CatalogAware,Folder): Line 1246  class MPIWGProject(CatalogAware,Folder):
               
         return text5.encode('utf-8')          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"""
         #return "HI"          #return "HI"
Line 1272  class MPIWGProject(CatalogAware,Folder): Line 1315  class MPIWGProject(CatalogAware,Folder):
         else:          else:
             splitted=list[0].split(";")              splitted=list[0].split(";")
   
           splitted=[y.rstrip().lstrip() for y in splitted]
   
         for x in splitted:          for x in splitted:
             if (not x==u'') and x in wert:              if (not x==u'') and x in wert:

Removed from v.1.47.2.5  
changed lines
  Added in v.1.47.2.12


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