From 994f68e1f8a7a43b55d6bd6214b2a0066671ba74 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Wed, 18 Jun 2008 20:18:43 +0000 Subject: [PATCH] =?utf8?q?MOD=20avancement=20dans=20l'extraction=20d'une?= =?utf8?q?=20conversation=20enti=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- css/1/pageMinichat.css | 19 ++++++++++++++++++- doc/protocole3.txt | 5 +++-- img/css1/fleche_proprietaire.png | Bin 0 -> 302 bytes img/css1/fleche_repondu.png | Bin 0 -> 303 bytes img/css1/fleche_reponse.png | Bin 0 -> 302 bytes js/euphorik.js | 10 ++++------ js/pageMinichat.js | 22 ++++++++++++++++------ modules/erl/euphorik_bd.erl | 26 ++++++++++++++++++++------ modules/erl/euphorik_protocole.erl | 3 +-- modules/include/euphorik_bd.hrl | 2 +- sessions/css1.session | 12 ++++++------ sessions/doc.session | 10 +++++----- sessions/erl.session | 14 +++++++------- sessions/js.session | 12 ++++++------ 14 files changed, 87 insertions(+), 48 deletions(-) create mode 100644 img/css1/fleche_proprietaire.png create mode 100644 img/css1/fleche_repondu.png create mode 100644 img/css1/fleche_reponse.png diff --git a/css/1/pageMinichat.css b/css/1/pageMinichat.css index 2cc07be..722c3fb 100755 --- a/css/1/pageMinichat.css +++ b/css/1/pageMinichat.css @@ -248,7 +248,7 @@ } #page.minichat div.message .pseudo .login { margin-left: 2px; - font-size: 8px; + font-size: 8px; } #page.minichat #conversations .repondA { z-index: 5; @@ -273,6 +273,13 @@ #page.minichat #conversations .contenu { margin-left: 5px; } +#page.minichat #conversations .outilsMess { + float: right; + display: none; +} +#page.minichat #conversations div.message:hover .outilsMess { + display: block +} #page.minichat #conversations .extraire { float: right; width: 13px; @@ -283,3 +290,13 @@ #page.minichat #conversations .extraire:hover { background-image: url(../../img/css1/extraction_hover.png); } +#page.minichat #conversations .extraireCompletement { + float: right; + width: 13px; + height: 13px; + background-image: url(../../img/css1/extraction.png); + margin-top: 2px +} +#page.minichat #conversations .extraireCompletement:hover { + background-image: url(../../img/css1/extraction_hover.png); +} diff --git a/doc/protocole3.txt b/doc/protocole3.txt index 2979cdf..8c8d253 100644 --- a/doc/protocole3.txt +++ b/doc/protocole3.txt @@ -138,7 +138,7 @@ c -> s "troll_id" : 45, "conversations" : [ { - "racine" : 123, + "root" : 123, "page" : 1, "last_message_id" : 4 (pas obligatoire) } @@ -165,7 +165,8 @@ Le format de la date n'est pas formel. "is_a_reply" : true | false, "nick" : "Paul", "login" : "paul_22", - "content" : "Salut", + "content" : "Salut", + "root" : 453, "answer_to" : [ { "id" : 123, "nick" : "Pierre", "login" : "pierre_45" } ] diff --git a/img/css1/fleche_proprietaire.png b/img/css1/fleche_proprietaire.png new file mode 100644 index 0000000000000000000000000000000000000000..d852d2572400c9b4ab51b0d46a9b13386c14df75 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^>_9BU!3HF!dmi}>q*#ibJVQ8upoSx*1IXtr@Q5sC zU=ZF9!i-v<=5YcAB}-f*N`mv#O3D+9QW?t2%k?tzvWt@w3sUv+i_&MmvylQSTJ7oL z7@{$;^x{G;CP#r|ANPy1G#_O*klMSKH*Is^&J?4LlaF#gD4Jz$$@pUU=JdX%g9<+w z7A5M+$yga1B>v#7VRjCD+C4=mDE+`aD`S@xJTDm1U;BhRH82)j5LmF~+!|As57%Z+ zY_9BU!3HF!dmi}>q*#ibJVQ8upoSx*1IXtr@Q5sC zU=ZF9!i-v<=5YcAB}-f*N`mv#O3D+9QW?t2%k?tzvWt@w3sUv+i_&MmvylQSTI1>B z7@{$;^x{G;CP#r|ANPy1G#@RK?r~duGbcoECQs5%O|`_=xtrfg>Ppq}?0%n6;P`>j z<#42pMM+u0p%2nO*xHoNiid_SEMqtdti^ zY}^0SmY4C@fs2xvnH&a;W`-;h$3JkLF|A<=mj2^>cq;F|MX}Mh9`Jv?aKv~+Uf#6| tW+Ul8zs2JZoMEf~@2!8SMzZ=F`}-{(8)kp5t_QlC!PC{xWt~$(69BhJYW@HK literal 0 HcmV?d00001 diff --git a/img/css1/fleche_reponse.png b/img/css1/fleche_reponse.png new file mode 100644 index 0000000000000000000000000000000000000000..98786cd171da7f1c80aad023035878ce47e0e3d3 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^>_9BU!3HF!dmi}>q*#ibJVQ8upoSx*1IXtr@Q5sC zU=ZF9!i-v<=5YcAB}-f*N`mv#O3D+9QW?t2%k?tzvWt@w3sUv+i_&MmvylQSTJ7oL z7@{$;^x{G;CP#r|ANPy1G(UXC*mEe?V3xV`RByHB89Hk6hgMu%bg_L0>+Ztc2Nh1F zUECnX&o@_ghQS}UeT@sXK1KEjt~E}0-oq21#cXxpq~yyijtlJHG+8v}PE6%uG&^^~ zp!IG3z6_2F%zfuPyqy~aH~1+w_&yY!k@bV+*tPcdHtyGlU3Zsd*IHb07CwJq)y~Mr tyc%oy-^bT53co)5SAVb8r^;71<&&OyG)&f96#;ZMgQu&X%Q~loCIG=%Z|492 literal 0 HcmV?d00001 diff --git a/js/euphorik.js b/js/euphorik.js index 0f1eb39..4e70844 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -560,7 +560,7 @@ Client.prototype.resetDonneesPersonnelles = function() this.ekMaster = false // les conversations, une conversation est un objet possédant les attributs suivants : - // - racine (entier) + // - root (entier) // - page (entier) this.conversations = new Array() } @@ -624,9 +624,8 @@ Client.prototype.ajouterConversation = function(racine) for (var i = 0; i < this.conversations.length; i++) if (this.conversations[i].root == racine) return false - - this.conversations.push({root : racine, page : 1}) + this.conversations.push({root : racine, page : 1}) if (this.autoflush) this.flush(true) return true @@ -699,7 +698,6 @@ Client.prototype.getJSONProfile = function() "nick_format" : this.nickFormat, "view_times" : this.viewTimes, "view_tooltips" : this.viewTooltips, - "main_page" : this.pagePrincipale < 1 ? 1 : this.pagePrincipale, "conversations" : this.getJSONConversations() } } @@ -846,7 +844,7 @@ Client.prototype.chargerDonnees = function(data) this.viewTooltips = data["view_tooltips"] // la page de la conversation principale - this.pagePrincipale = data["main_page"] == undefined ? 1 : data["main_page"] + this.pagePrincipale = 1 // les conversations this.conversations = data["conversations"] @@ -944,7 +942,7 @@ Client.prototype.majCssSelectionee = function() { // extraction du numéro de la css courante var numCssCourante = this.css.match(/^.*?\/(\d)\/.*$/) - if (numCssCourante[1] != undefined) + if (numCssCourante != null && numCssCourante[1] != undefined) { $("#menuCss option").removeAttr("selected") $("#menuCss option[value=" + numCssCourante[1]+ "]").attr("selected", "selected") diff --git a/js/pageMinichat.js b/js/pageMinichat.js index d9dbde2..ec745f3 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -580,7 +580,7 @@ Conversation.prototype.flush = function(funClickOuvrirConv) (this.messages[i].systeme ? " systeme" : "") + (this.messages[i].ekMaster ? " ekMaster" : "") + "\">" + - "
" + + "
" + "[" + message.date + "]" + "" + message.auteurId + "" + identifiant + "" + XHTMLrepondA + @@ -604,7 +604,8 @@ Conversation.prototype.flush = function(funClickOuvrirConv) } ) - thisConversation.util.infoBulle("Extraction de la conversation", $(".extraire", this)) + thisConversation.util.infoBulle("Extraction de la conversation à partir de ce message", $(".extraire", this)) + thisConversation.util.infoBulle("Extraction de la conversation complète", $(".extraireCompletement", this)) // l'id du message var idMess36 = $(this).attr("id").substr(4) @@ -772,6 +773,7 @@ function Messages(client, formateur, util) this.util = util this.conversations = new Array() // les conversations, la première représente la conversation principale + this.nouvelleConversation(0) this.trollIdCourant = 0 @@ -799,10 +801,17 @@ Messages.prototype.getJSONrafraichirMessages = function() Messages.prototype.getJSONConversations = function() { - var clientConv = this.client.getJSONConversations() - for (var i = 1; i < this.conversations.length; i++) + var clientConv = [] + + for (var i = 0; i < this.client.conversations.length; i++) { - clientConv[i-1]["last_message_id"] = this.conversations[i].idDernierMessageAffiche + clientConv.push( + { + root : this.client.conversations[i].root, + page : this.client.conversations[i].page, + last_message_id : this.conversations[i + 1] == undefined ? 0 : this.conversations[i + 1].idDernierMessageAffiche + } + ) } return clientConv } @@ -885,7 +894,8 @@ Messages.prototype.nouvelleConversation = function(num, funFermer, funLien) { var thisMessages = this - this.conversations[num] = new Conversation(num, this.util, this.formateur, this.client) + this.conversations[num] = new Conversation(num, this.util, this.formateur, this.client) + if (funFermer != undefined) this.conversations[num].eventFermer(funFermer) if (funLien != undefined) diff --git a/modules/erl/euphorik_bd.erl b/modules/erl/euphorik_bd.erl index 1f9a682..4c27577 100755 --- a/modules/erl/euphorik_bd.erl +++ b/modules/erl/euphorik_bd.erl @@ -420,14 +420,21 @@ user_by_mess(Id) -> % Ajoute un message. Repond_A est une liste d'id auquel le message répond % retourne soit l'id du message soit {erreur, }. -nouveau_message(Mess, Auteur_id, Repond_A) -> +nouveau_message(Mess, Auteur_id, Repond_A_ids) -> % regarde si les id 'Repond_A' existent F = fun() -> - Nb_id_trouve = length(e(q([E#minichat.id || E <- mnesia:table(minichat), lists:member(E#minichat.id, Repond_A)]), [{tmpdir, ?KEY_SORT_TEMP_DIR}])), + Repond_A = e( + q([M || M <- mnesia:table(minichat), lists:member(M#minichat.id, Repond_A_ids)]), + [{tmpdir, ?KEY_SORT_TEMP_DIR}] + ), + Racine_id = case Repond_A of + [] -> undefined; + [M | _ ] -> M#minichat.racine_id + end, % est-ce que l'auteur existe ? case e(q([E || E <- mnesia:table(user), E#user.id =:= Auteur_id]), [{tmpdir, ?KEY_SORT_TEMP_DIR}]) of [Auteur] -> - if Nb_id_trouve =/= length(Repond_A) -> + if length(Repond_A) =/= length(Repond_A_ids) -> {erreur, "Un ou plusieurs messages introuvable"}; true -> % comparaison entre la date du dernier poste et maintenant (gestion du flood) @@ -446,8 +453,15 @@ nouveau_message(Mess, Auteur_id, Repond_A) -> true -> mnesia:write(Auteur_maj), Id = nouvel_id(minichat), - inserer_reponses(Id, Repond_A), - mnesia:write(#minichat{id=Id, auteur_id=Auteur#user.id, date=now(), pseudo=Auteur#user.pseudo, contenu=Mess}), + inserer_reponses(Id, Repond_A_ids), + mnesia:write(#minichat{ + id = Id, + auteur_id = Auteur#user.id, + date = now(), + pseudo = Auteur#user.pseudo, + contenu = Mess, + racine_id = if Racine_id =:= undefined -> Id; true -> Racine_id end + }), Id end end; @@ -477,7 +491,7 @@ nouveau_message_sys(Mess, Troll_id) -> resultat_transaction(mnesia:transaction( fun() -> Id = nouvel_id(minichat), - mnesia:write(#minichat{id=Id, auteur_id=0, date=now(), pseudo=Root#user.pseudo, contenu=Mess, troll_id=Troll_id}), + mnesia:write(#minichat{id=Id, auteur_id=0, date=now(), pseudo=Root#user.pseudo, contenu=Mess, troll_id=Troll_id, racine_id=Id}), Id end )). diff --git a/modules/erl/euphorik_protocole.erl b/modules/erl/euphorik_protocole.erl index 3305c37..c15ada1 100755 --- a/modules/erl/euphorik_protocole.erl +++ b/modules/erl/euphorik_protocole.erl @@ -113,7 +113,6 @@ profile( {nick_format, Nick_format_str}, {view_times, View_times}, {view_tooltips, View_tooltips}, - {main_page, Main_page}, {conversations, {array, Conversations_json}} ] ) -> @@ -135,7 +134,6 @@ profile( list_to_atom(Nick_format_str), View_times, View_tooltips, - Main_page, Conversations) of ok -> json_reponse_ok(); @@ -272,6 +270,7 @@ wait_event_page_chat(User, Racines_conversations, Message_count, Last_message_id {nick, Mess#minichat.pseudo}, {login, User_mess#user.login}, {content, Mess#minichat.contenu}, + {root, Mess#minichat.racine_id}, {answer_to, {array, lists:map( fun(Id_mess) -> {ok, M} = euphorik_bd:message_by_id(Id_mess), diff --git a/modules/include/euphorik_bd.hrl b/modules/include/euphorik_bd.hrl index 2eaf9e6..ad5c04c 100755 --- a/modules/include/euphorik_bd.hrl +++ b/modules/include/euphorik_bd.hrl @@ -47,7 +47,7 @@ pseudo, % chaine de caractère contenu, % chaine de caractère troll_id = undefined, % l'id du troll associé correspondant - racine_id % la racine, par défaut correspond à l'id du message + racine_id = undefined % la racine, par défaut correspond à l'id du message }). diff --git a/sessions/css1.session b/sessions/css1.session index b206b00..cd82884 100644 --- a/sessions/css1.session +++ b/sessions/css1.session @@ -1,20 +1,20 @@ # SciTE session file -buffer.1.path=/home/gburri/projets/euphorik/css/1/euphorik.css +buffer.1.path=/home/gburri/projets/euphorik/trunk/css/1/euphorik.css buffer.1.position=377 -buffer.2.path=/home/gburri/projets/euphorik/css/1/pageAbout.css +buffer.2.path=/home/gburri/projets/euphorik/trunk/css/1/pageAbout.css buffer.2.position=1 -buffer.3.path=/home/gburri/projets/euphorik/css/1/pageAdmin.css +buffer.3.path=/home/gburri/projets/euphorik/trunk/css/1/pageAdmin.css buffer.3.position=1 -buffer.4.path=/home/gburri/projets/euphorik/css/1/pageMinichat.css +buffer.4.path=/home/gburri/projets/euphorik/trunk/css/1/pageMinichat.css buffer.4.position=1 -buffer.5.path=/home/gburri/projets/euphorik/css/1/pageProfileRegister.css +buffer.5.path=/home/gburri/projets/euphorik/trunk/css/1/pageProfileRegister.css buffer.5.position=130 -buffer.6.path=/home/gburri/projets/euphorik/index.yaws +buffer.6.path=/home/gburri/projets/euphorik/trunk/index.yaws buffer.6.position=1 buffer.6.current=1 diff --git a/sessions/doc.session b/sessions/doc.session index f576177..4fc2817 100755 --- a/sessions/doc.session +++ b/sessions/doc.session @@ -1,17 +1,17 @@ # SciTE session file -buffer.1.path=/home/gburri/projets/euphorik/doc/technique.txt +buffer.1.path=/home/gburri/projets/euphorik/trunk/doc/technique.txt buffer.1.position=572 -buffer.2.path=/home/gburri/projets/euphorik/doc/TODO.txt +buffer.2.path=/home/gburri/projets/euphorik/trunk/doc/TODO.txt buffer.2.position=181 buffer.2.current=1 -buffer.3.path=/home/gburri/projets/euphorik/doc/protocole3.txt +buffer.3.path=/home/gburri/projets/euphorik/trunk/doc/protocole3.txt buffer.3.position=248 -buffer.4.path=/home/gburri/projets/euphorik/doc/description.txt +buffer.4.path=/home/gburri/projets/euphorik/trunk/doc/description.txt buffer.4.position=1 -buffer.5.path=/home/gburri/projets/euphorik/doc/installation.txt +buffer.5.path=/home/gburri/projets/euphorik/trunk/doc/installation.txt buffer.5.position=1231 diff --git a/sessions/erl.session b/sessions/erl.session index ce6313a..8edfd21 100755 --- a/sessions/erl.session +++ b/sessions/erl.session @@ -1,23 +1,23 @@ # SciTE session file -buffer.1.path=/home/gburri/projets/euphorik/modules/erl/euphorik_minichat_conversation.erl +buffer.1.path=/home/gburri/projets/euphorik/trunk/modules/erl/euphorik_minichat_conversation.erl buffer.1.position=580 -buffer.2.path=/home/gburri/projets/euphorik/modules/erl/euphorik_protocole.erl +buffer.2.path=/home/gburri/projets/euphorik/trunk/modules/erl/euphorik_protocole.erl buffer.2.position=1 -buffer.3.path=/home/gburri/projets/euphorik/modules/erl/euphorik_requests.erl +buffer.3.path=/home/gburri/projets/euphorik/trunk/modules/erl/euphorik_requests.erl buffer.3.position=1 -buffer.4.path=/home/gburri/projets/euphorik/modules/include/euphorik_bd.hrl +buffer.4.path=/home/gburri/projets/euphorik/trunk/modules/include/euphorik_bd.hrl buffer.4.position=1 -buffer.5.path=/home/gburri/projets/euphorik/modules/include/euphorik_defines.hrl +buffer.5.path=/home/gburri/projets/euphorik/trunk/modules/include/euphorik_defines.hrl buffer.5.position=336 -buffer.6.path=/home/gburri/projets/euphorik/modules/erl/euphorik_bd.erl +buffer.6.path=/home/gburri/projets/euphorik/trunk/modules/erl/euphorik_bd.erl buffer.6.position=1 -buffer.7.path=/home/gburri/projets/euphorik/modules/erl/euphorik_daemon.erl +buffer.7.path=/home/gburri/projets/euphorik/trunk/modules/erl/euphorik_daemon.erl buffer.7.position=1 buffer.7.current=1 diff --git a/sessions/js.session b/sessions/js.session index 5eab12e..3dfc6e0 100755 --- a/sessions/js.session +++ b/sessions/js.session @@ -1,20 +1,20 @@ # SciTE session file -buffer.1.path=/home/gburri/projets/euphorik/js/euphorik.js +buffer.1.path=/home/gburri/projets/euphorik/trunk/js/euphorik.js buffer.1.position=22818 -buffer.2.path=/home/gburri/projets/euphorik/js/pageMinichat.js +buffer.2.path=/home/gburri/projets/euphorik/trunk/js/pageMinichat.js buffer.2.position=7496 -buffer.3.path=/home/gburri/projets/euphorik/js/pageProfile.js +buffer.3.path=/home/gburri/projets/euphorik/trunk/js/pageProfile.js buffer.3.position=1 -buffer.4.path=/home/gburri/projets/euphorik/js/pageRegister.js +buffer.4.path=/home/gburri/projets/euphorik/trunk/js/pageRegister.js buffer.4.position=1 -buffer.5.path=/home/gburri/projets/euphorik/js/pageAbout.js +buffer.5.path=/home/gburri/projets/euphorik/trunk/js/pageAbout.js buffer.5.position=1 -buffer.6.path=/home/gburri/projets/euphorik/js/pageAdmin.js +buffer.6.path=/home/gburri/projets/euphorik/trunk/js/pageAdmin.js buffer.6.position=1 buffer.6.current=1 -- 2.45.2