Diff for /MPIWGWeb/MPIWGProjects.py between versions 1.47.2.10 and 1.47.2.15

version 1.47.2.10, 2005/06/06 14:51:47 version 1.47.2.15, 2005/06/20 17:53:25
Line 61  def sortI(x,y): Line 61  def sortI(x,y):
     except:      except:
         return cmp(x[1],y[1])          return cmp(x[1],y[1])
   
   class MPIWGLink(SimpleItem):
       """create a symbolic link to another page"""
   
       meta_type="MPIWGLink"
       
   
       def __init__(self,id,link,title='',weight=''):
           """init mpiwglink"""
           self.id=id
           self.link=link
           self.title=title
           self.weight=weight
   
       def getObj(self):
           """bekomme original"""
          ##  objpath=self.link.replace("/",".")
   ##         if objpath[0]!=".":
   ##             objpath="."+objpath
   
   ##         print objpath
   ##         return eval("self"+objpath)
   
   
           splitted=self.link.lstrip().split("/")
           obj=self
           for x in splitted:
           if not x=="":
                 obj=getattr(obj,x)
               
           return obj
   
       def getWeight(self):
           if self.linkWeight and linkWeight!="":
               return self.linkWeight
           else:
               return self.getObj().weight
   
       manage_options=SimpleItem.manage_options+(
           {'label':'main config','action':'changeLinkForm'},
           )
   
   
       def changeLinkForm(self):
           """change MPIWG link"""
           pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGLinkChange.zpt')).__of__(self)
           return pt()
   
       def changeLink(self,link,title,weight,RESPONSE=None):
           """change links"""
           self.link=link
           self.title=title
           self.weight=weight
   
           if RESPONSE is not None:
               RESPONSE.redirect('manage')
   
       def index_html(self):
           """index"""
           
           return self.getObj().pt_render(extra_context={'here':self})
                                          
   
   def manage_addMPIWGLinkForm(self):
       """Form for adding link"""
       pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGLink.zpt')).__of__(self)
       return pt()
   
   def manage_addMPIWGLink(self,id,link,title,weight,RESPONSE=None):
       """add link"""
       newObj=MPIWGLink(id,link,title,weight)
   
       self._setObject(id,newObj)
       
       if RESPONSE is not None:
           RESPONSE.redirect('manage_main')
   
   
 class MPIWGTemplate(ZopePageTemplate):  class MPIWGTemplate(ZopePageTemplate):
     """Create a layout Template for different purposes"""      """Create a layout Template for different purposes"""
   
Line 203  class MPIWGRoot(ZSQLExtendFolder): Line 280  class MPIWGRoot(ZSQLExtendFolder):
             y1=int(getattr(y[1],'weight','0'))              y1=int(getattr(y[1],'weight','0'))
             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','MPIWGLink'])
             subret=[]              subret=[]
             for x in subs:              for x in subs:
                 if not(x[1].title==""):                  if not(x[1].title==""):
Line 422  class MPIWGRoot(ZSQLExtendFolder): Line 499  class MPIWGRoot(ZSQLExtendFolder):
         return cmp(x.WEB_title[0],y.WEB_title[0])          return cmp(x.WEB_title[0],y.WEB_title[0])
   
     if type(fieldContentsEntry) is StringType:      if type(fieldContentsEntry) is StringType:
             fieldContents=[fieldContentsEntry]              fieldContentsTmp=[fieldContentsEntry]
         else:          else:
             fieldContents=fieldContentsEntry              fieldContentsTmp=fieldContentsEntry
                           
         projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' OR')})          fieldContents=[]
           for x in fieldContentsTmp:
               fieldContents.append(" AND ".join(x.split()))
           projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' AND')})
         #print projects          #print projects
     ret=[x for x in projects]      ret=[x for x in projects]
     ret.sort(sort)      ret.sort(sort)
Line 449  class MPIWGRoot(ZSQLExtendFolder): Line 529  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 644  class MPIWGRoot(ZSQLExtendFolder): Line 726  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 660  class MPIWGRoot(ZSQLExtendFolder): Line 743  class MPIWGRoot(ZSQLExtendFolder):
                     ret+="""<div class="dept">\n<ul class="liste">\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):
                           if i>0:
                               ret+="<li>"
                         ret+="""<ul class="liste">\n"""                          ret+="""<ul class="liste">\n"""
                                           
                 actualDepth=element[0]                  actualDepth=element[0]
Line 667  class MPIWGRoot(ZSQLExtendFolder): Line 752  class MPIWGRoot(ZSQLExtendFolder):
             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>\n</li>\n</ul>\n</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+="""</ul></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 class="liste">\n                      <div class="dept">\n<ul class="liste">\n
                     """%department                      """%department
Line 683  class MPIWGRoot(ZSQLExtendFolder): Line 775  class MPIWGRoot(ZSQLExtendFolder):
             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+="""<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="#top"><img src="../grafik/totop.gif" vspace="10" border="0"></a><br><a name="dept%s"></a>%s: """%(department,departmentName[department])
   
Line 850  class MPIWGRoot(ZSQLExtendFolder): Line 942  class MPIWGRoot(ZSQLExtendFolder):
         ret=[]          ret=[]
         splitNeu=[]          splitNeu=[]
         if email:          if email:
             print "IIII:",self.getId()              
             members=self.ZopeFind(self.members,obj_metatypes=['MPIWGStaff'],obj_ids=[email],search_sub=1)              members=self.ZopeFind(self.members,obj_metatypes=['MPIWGStaff'],obj_ids=[email],search_sub=1)
             name =  members[0][1].title.decode('utf-8')              name =  members[0][1].title.decode('utf-8')
   
Line 1199  class MPIWGProject(CatalogAware,Folder): Line 1291  class MPIWGProject(CatalogAware,Folder):
                 tmp=splitted[1].split("</p>")                  tmp=splitted[1].split("</p>")
         #return repr(splitted[1])          #return repr(splitted[1])
                 try:                  try:
             self.REQUEST.SESSION['image']=tmp[0].split("\"")[1].encode('utf-8')              self.imageURL=tmp[0].split("\"")[1].encode('utf-8')
         except:          except:
             self.REQUEST.SESSION['image']=tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')              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 1209  class MPIWGProject(CatalogAware,Folder): Line 1302  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 1224  class MPIWGProject(CatalogAware,Folder): Line 1318  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 1301  class MPIWGProject(CatalogAware,Folder): Line 1395  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.10  
changed lines
  Added in v.1.47.2.15


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