Diff for /MPIWGWeb/MPIWGProjects.py between versions 1.47.2.7 and 1.47.2.11

version 1.47.2.7, 2005/05/27 14:58:27 version 1.47.2.11, 2005/06/08 20:00:16
Line 204  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 414  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 421  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 635  class MPIWGRoot(ZSQLExtendFolder): Line 644  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 648  class MPIWGRoot(ZSQLExtendFolder): Line 658  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<ul>\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"                          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>\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':'NWG','5':'NWG'} 
                 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 1188  class MPIWGProject(CatalogAware,Folder): Line 1201  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 1196  class MPIWGProject(CatalogAware,Folder): Line 1214  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 1211  class MPIWGProject(CatalogAware,Folder): Line 1230  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 1219  class MPIWGProject(CatalogAware,Folder): Line 1238  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"

Removed from v.1.47.2.7  
changed lines
  Added in v.1.47.2.11


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