#!/usr/bin/python # -*- coding: utf-8 -*- import sys, os, re, cgi, time #Repertoire a changer sous Unix : rep="/home/projets/treecloud/WORK/" rep_antidico="/home/projets/treecloud/ANTIDICOS/" #Definition des noms de fichiers en sortie: params={} param=cgi.FieldStorage() num="0" verbose=0 fichiertexte=rep+"text"+num fichierMat="" #fichierMat=" -fileCSV "+rep+"Mat"+num fichierNewick=rep+"Newick"+num+".txt" fichierDistance=rep+"dist"+num+".txt" fichierNexus=rep+"nex"+num+".txt" fichierdessin="dessin"+num+".svg" #repdessin="./" repdessin="/home/projets/treecloud/WORK/" repdessin2="http://treecloud.univ-mlv.fr/WORK/" fichierfreq=rep+"Frequences"+num+".txt" fichierantidico="" text="COLLER VOTRE TEXTE ICI" # Content-type: text/html print("""
""") for clef in param.keys() : params[clef]=param.getvalue(clef) if "minuscules" in params: minuscules=params["minuscules"] else: minuscules="NON" if "anti_perso" in params: anti_perso=params["anti_perso"] else: anti_perso="NON" if "debug" in params: debug=params["debug"] else: debug="NON" if "legend" in params: legend=params["legend"] else: legend="NON" if "typedistance" in params: typedistance=params["typedistance"] else: typedistance="jaccard" if "text1" in params: text=params["text1"] fd=open(fichiertexte+"1.txt","w") fd.write(text) fd.close() if "antidico1" in params: fichierantidico=rep+"Antidico_Perso.txt" fd=open(fichierantidico,"w") fd.write(params["antidico1"]) fd.close() if "taillefenetre" in params: taillefenetre=params["taillefenetre"] else: taillefenetre="20" if "nombremaxmots" in params: nombremaxmots=params["nombremaxmots"] else: nombremaxmots="50" if "nombreminmots" in params: nombreminmots=params["nombreminmots"] else: nombreminmots="0" if "hauteur" in params: hauteur=params["hauteur"] else: hauteur="600" if "largeur" in params: largeur=params["largeur"] else: largeur="600" if "antidico" in params: antidico=params["antidico"] else: antidico="" if "langue" in params: langue=params["langue"] else: langue="FR" if fichierantidico!="": fichierantidico="-fileantidico "+fichierantidico imagetaille="-image_width "+largeur+" -image_height "+hauteur if "big" in params: if params["big"]=="big": imagetaille="-image_width 2000 -image_height 2000" if nombreminmots!="0": nbmots=" -nombreminmots "+nombreminmots nombremaxmots="0" else: nbmots=" -nombremaxmots "+nombremaxmots commande=" -legend "+legend+" -debug "+debug+" -virtuel OUI "+" -anti_perso "+anti_perso+" -langue "+langue+" -workdir "+rep+" -file "+fichiertexte+"1.txt "+nbmots+" -minuscules "+minuscules+" -taillefenetre "+taillefenetre+" -typedistance "+typedistance+" -filegraph "+repdessin+fichierdessin+" -filenewick "+fichierNewick+" -filefrequence "+fichierfreq+" -filedistance "+fichierDistance+" -filenexus "+fichierNexus+" "+imagetaille+fichierMat reponse="..." t1=time.time() cmd=os.popen("/home/projets/treecloud/cgi-bin/ArbreArbore "+commande,"rb") reponse=cmd.read() cmd.close() t2=time.time() t3=t2-t1 if (reponse==""): reponse="Erreur, merci de me signaler ce bug (envoyez-moi vos paramètres svp)" reponse=reponse+"