def ajoute_page(self): _=self.datas._ if not check_edit(self.datas,self.socket): return init_datas={} for code in self.config.langues: init_datas[code]={} init_datas[code]['url']=check_char_idpage(self.socket.input_text_value('urlpage_%s' % code)) init_datas[code]['textnav']=self.socket.input_text_value('textnav_%s' % code) init_datas[code]['titre']=self.socket.input_text_value('titrepage_%s' % code) new_Page(self,init_datas) self.datas.my_session.set_new_url(self.path) redirect_ok(self.socket,self.datas)
def edit_page(self): if not check_edit(self.datas,self.socket): return if self.id!=0: pereurl=path_pere(self.path)+'/%s' firstname="" oldnames=self.glob.objets[self.id]['names'] newnames={} i=0 for code in self.glob.langues: newnames[code]=check_char_idpage(self.socket.input_text_value('urlpage_%s' % code,'').strip()) if i==0: if newnames[code]=='': self.socket.send_datas('necessite url pour la page !!!') return else: namebase=newnames[code] else: if newnames[code]=='': newnames[code]=namebase names=[] flagmodifbase=False for code in self.config.langues: pathpageold=pereurl % oldnames[code] pathpagenew=pereurl % newnames[code] if len(names)==0: if oldnames[code]!=newnames[code]: flagmodifbase=True if newnames[code] in oldnames.values(): for c in oldnames: if oldnames[c]==newnames[code]: oldnames[c]=None pass #self.fs_svn.trash(pathpagenew) else: while (self.fs_svn.exist(pathpagenew)): (pathpagenew,newnames[code])=new_name_file(pathpagenew) pass #self.fs_svn.move(pathpageold,pathpagenew) else: if flagmodifbase or oldnames[code]!=newnames[code]: if pathpageold!=None and not oldnames[code] in names: pass #self.fs_svn.trash(pathpageold) if not newnames[code] in names: newlink=pereurl % names[0] while (self.fs_svn.exist(pathpagenew)): (pathpagenew,newnames[code])=new_name_file(pathpagenew) pass #self.fs_svn.add_link(newlink,pathpagenew) names.append(newnames[code]) self.rename(newnames) newlink=pereurl % names[0] self.datas.my_session.set_new_url(newlink) else: self.datas.my_session.set_new_url('') for code in self.config.langues: if self.id!=0: textnav=self.socket.input_text_value('textnav_%s' % code,'').strip() if textnav=='': textnav=newnames[code] self.set_propriete('textnav_%s' % code,textnav) titre=self.socket.input_text_value('titrepage_%s' % code,'').strip() self.set_propriete('titre_%s' % code,titre) self.glob.reinit(self.database,self.id) redirect_ok(self.socket,self.datas)