Example #1
0
    def user_edit(self):
        id_user=self.datas.my_session.id_user
        if id_user<0:
            return
            
        monlanguage=self.socket.input_text_value('monlanguage')  
        set_propriete(self.glob,self.database,id_user,'langue',monlanguage)
        self.datas.my_session.langue=monlanguage
        self.datas.my_session.change_langue_interface(monlanguage)
        pal_active=self.socket.input_text_value('pal_active')  
        pal_initx=self.socket.input_text_value('pal_initx')  
        pal_inity=self.socket.input_text_value('pal_inity')  
        set_propriete(self.glob,self.database,id_user,'pal_active',pal_active)
        set_propriete(self.glob,self.database,id_user,'pal_initx',pal_initx)
        set_propriete(self.glob,self.database,id_user,'pal_inity',pal_inity)


        ordre_infos=self.get_propriete('ordre_infos','').split(',')
        
        infos=self.get_dico_proprietes('infos')

        for k in infos.keys():
            if not k in  ordre_infos:
                ordre_infos.append(k)

        for elem in ordre_infos:
            if elem in infos.keys():
                info=infos[elem]
                type_info=""
                if type(info)==type({}):
                    if info.has_key('textw'):
                        uservalue=self.socket.input_text_value(elem)  
                        set_propriete(self.glob,self.database,id_user,elem,uservalue)
                            
        self.socket.redirection_http("%s/user" % self.datas.url_base)
Example #2
0
 def position(self):
     _ = self.datas._
     posx = int(self.datas.action_params[0])
     posy = int(self.datas.action_params[1])
     id_user = self.datas.my_session.id_user
     set_propriete(self.glob, self.database, id_user, "pal_initx", posx)
     set_propriete(self.glob, self.database, id_user, "pal_inity", posy)
     self.socket.send_datas("""alert:%s %s %s""" % (_("nouvelle position palette : "), posx, posy))
Example #3
0
def move_page(self):
    if not check_edit(self.datas,self.socket):
        return

    chemin=format_path_list(self.socket.args["pere"].split('__')[1:-1])
    
    idpere=int(self.socket.args["pere"].split('__')[-1])
    pos=int(self.socket.args["pos"])

    my_obj=self.glob.objets[self.id]
    oldpere=my_obj['pere']
    oldpere_obj=self.glob.objets[oldpere]
    newpere_obj=self.glob.objets[idpere]


    if (oldpere!=idpere):
        self.se_deplacer(idpere)
        self.datas.my_session.set_new_url(oldpere_obj['path'][self.glob.langues[0]])
    else:
        self.datas.my_session.set_new_url(self.path)


    # reordoner les sous pages 
    pages=newpere_obj['proprietes']['ordre_sous_pages']
    newordre=[]
    j=0
    posok=False
    for (idpage) in pages:
        if j==pos:
            newordre.append(self.id)
            j+=1
            posok=True
        if idpage!=self.id:
            newordre.append(idpage)
            j+=1
    if not posok:
        newordre.append(self.id)

    newordrestr='/'.join(map(str,newordre))
    set_propriete(self.glob,self.database,idpere,'ordre_sous_pages',newordrestr)
    newpere_obj['proprietes']['ordre_sous_pages']=newordre
    for lang in self.glob.langues:
        self.glob.get_infos_sous_pages(lang,idpere)
        
    redirect_ok(self.socket,self.datas)
Example #4
0
def dispo_add_elem(glob,database,idp,id,placement):

    colonne_max=4

    dispo_normal=get_propriete(glob,idp,'dispo_normal','=')

    ## recuperation du contenu de la page (entre = et -) 
    wikitmp2=dispo_normal
    h=''
    if dispo_normal.find('=')!=-1:
        (h,wikitmp2)=dispo_normal.split('=',1)
        if len(wikitmp2)>0 and wikitmp2[0]==',':
            wikitmp2=wikitmp2[1:]

    # decoupe les ligne mais reste la ligne init !att: reste le premier [line: sans la ','
    linesbruts=wikitmp2.split(',[line:') 
    lines=[]   
    for linebrut in linesbruts:
        # on vire le [line: restant et les ] qui leur correspondaient
        line=linebrut.replace('[line:','')[:-1].strip()
        if line:
            lines.append(line)

    if placement not in ["top","topleft","topright",
                         "bottomleft","bottomright","bottom"]:
        placement="bottom"

    # baseline pour : 0 => avant le tableau
    # baseline pour : X => dans la ligne X (notation humaine qui commence par 1)
    # baseline pour : -1 => apres le tableau

    if len(lines)==0:
        baseline=0
    elif placement=="top":
        baseline=0
    elif placement=="bottom":
        baseline=-1
    elif placement in ["topleft","topright"]:
        baseline=1
    elif placement in ["bottomleft","bottomright"]:
        baseline=len(lines)


    if baseline < 1 :
        #inser une nouvelle ligne au debut ou a la fin.
        newline="[col1:[elem:%s]]" % id
        if baseline==0:
            lines.insert(0,newline)
        else:
            lines.append(newline)

    else:
        varline=lines[baseline-1]
        colsbruts=varline.split(',[col')
        cols=[]   
        for colbrut in colsbruts:
            if colbrut:
                try:
                    col=colbrut.replace('[col','').split(":",1)[1][:-1]
                    cols.append(col)
                except:
                    log.err("erreur colbrut %s " % colbrut)
        newcol="[elem:%s]" % id
        if placement in ["topleft","bottomleft"]:
            cols.insert(0,newcol)
        if placement in ["topright","bottomright"]:
            cols.append(newcol)

        nbcols=len(cols)
        col4join=[]
        for c in cols:
            col4join.append('[col%s:%s]' % (nbcols,c))
        
        lines[baseline-1]=','.join(col4join)


    # recolage des lignes
    line4join=[]
    for l in lines:
        line4join.append('[line:%s]' % l)
    newdispo=h+'=,'+','.join(line4join)

    # ecriture nouvelle disppo
    set_propriete(glob,database,idp,'dispo_normal',newdispo)
Example #5
0
def change_Navigation(glob,database,fs_svn,socket, id_obj, direction):

    set_propriete(glob,database,id_obj,'direction',direction)