MOD amélioration de la mise en évidence des messages FIX#32
authorGreg Burri <greg.burri@gmail.com>
Sat, 26 Jul 2008 13:22:07 +0000 (13:22 +0000)
committerGreg Burri <greg.burri@gmail.com>
Sat, 26 Jul 2008 13:22:07 +0000 (13:22 +0000)
doc/graphiques/maquette_1.svg
doc/protocole3.txt
js/pageMinichat/conversation.js
js/pageMinichat/conversations.js
js/pageMinichat/message.js
styles/1/img/fleche_proprietaire.png
styles/1/img/fleche_reponse.png
styles/1/pageMinichat.css

index 082335c..b6784c9 100644 (file)
@@ -29,9 +29,9 @@
      objecttolerance="10"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="2.0000001"
-     inkscape:cx="261.23852"
-     inkscape:cy="972.02611"
+     inkscape:zoom="7.5822789"
+     inkscape:cx="580.48394"
+     inkscape:cy="905.17554"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
     <path
        inkscape:export-ydpi="128.38945"
        inkscape:export-xdpi="128.38945"
-       inkscape:export-filename="/home/gburri/projets/euphorik/img/css1/fleche_proprietaire.png"
+       inkscape:export-filename="/home/gburri/projets/euphorik/trunk/styles/1/img/fleche_reponse.png"
        sodipodi:nodetypes="cccc"
        id="path3466"
        d="M 603.85013,142.72403 L 608.71149,149.16555 L 603.85013,155.34191 L 603.85013,142.72403 z"
-       style="fill:#bf2911;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;display:inline" />
+       style="fill:#846c19;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;display:inline" />
     <path
        inkscape:export-ydpi="128.38945"
        inkscape:export-xdpi="128.38945"
        id="path3703"
        d="M 326.9805,161.01509 C 324.68537,161.0151 322.82425,162.87621 322.82425,165.17134 C 322.82425,167.46648 324.68537,169.32759 326.9805,169.32759 C 329.27563,169.3276 331.13675,167.46647 331.13675,165.17134 C 331.13675,162.87622 329.27563,161.01509 326.9805,161.01509 z M 327.01175,161.35884 L 327.9805,163.82759 L 330.63675,164.01509 L 328.57425,165.70259 L 329.2305,168.26509 L 327.01175,166.85884 L 324.76175,168.26509 L 325.418,165.70259 L 323.3555,164.01509 L 326.01175,163.82759 L 327.01175,161.35884 z"
        style="opacity:1;fill:#cb2626;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
+    <text
+       xml:space="preserve"
+       style="font-size:2.74360847px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="566.50171"
+       y="134.86931"
+       id="text2512"><tspan
+         sodipodi:role="line"
+         id="tspan2514"
+         x="566.50171"
+         y="134.86931">normal</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:2.74360847px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Bitstream Vera Sans"
+       x="577.56555"
+       y="127.61289"
+       id="text2516"><tspan
+         sodipodi:role="line"
+         id="tspan2518"
+         x="577.56555"
+         y="127.61289">ses messages</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="624.87811"
+       y="131.39896"
+       id="text2520"><tspan
+         sodipodi:role="line"
+         id="tspan2522"
+         x="624.87811"
+         y="131.39896" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:2.74360847px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Bitstream Vera Sans"
+       x="603.85376"
+       y="118.74382"
+       id="text2524"><tspan
+         sodipodi:role="line"
+         id="tspan2526"
+         x="603.85376"
+         y="118.74382">messages qui</tspan><tspan
+         sodipodi:role="line"
+         x="603.85376"
+         y="122.17333"
+         id="tspan2528">nous répondent</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:2.74360847px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Bitstream Vera Sans"
+       x="625.47803"
+       y="131.13678"
+       id="text2530"><tspan
+         sodipodi:role="line"
+         x="625.47803"
+         y="131.13678"
+         id="tspan2534">messages auquels</tspan><tspan
+         sodipodi:role="line"
+         x="625.47803"
+         y="134.5663"
+         id="tspan2538">ont a répondu</tspan></text>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 576.87142,135.48744 L 584.65273,141.42233"
+       id="path2540"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+       d="M 587.62016,129.09094 L 594.47827,140.30129"
+       id="path3312"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+       d="M 612.28294,124.21114 L 605.29296,142.01582"
+       id="path3314"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+       d="M 630.08761,136.21281 L 615.84388,145.04921"
+       id="path3316"
+       sodipodi:nodetypes="cc" />
   </g>
   <g
      style="display:inline"
index 1b9d811..55e2115 100644 (file)
@@ -152,9 +152,9 @@ Si "main_page" est absent alors est vaut 1.
       "root" : 453,
       "answer_to" : [
          { "id" : 123, "nick" : "Pierre", "login" : "pierre_45" }
-      ]
+      ],
       "ek_master" : true | false,
-      "ostentatious_master" : "invisible" | "light" | "heavy",\r
+      "ostentatious_master" : "invisible" | "light" | "heavy",
       "last_modification" : "Hier 17:26:54"
    }
 
@@ -195,7 +195,7 @@ ou
    {
       "reply" : "message_updated",
       "message_id" : 123,
-      "content" : "Salut poulpe",\r
+      "content" : "Salut poulpe",
       "last_modification" : "Hier 17:26:54"
    }
 ou
index d8cd8a7..20343f9 100644 (file)
@@ -191,14 +191,25 @@ euphorik.Conversation.prototype.getId = function() {
    return "conv" + this.id;\r
 };\r
 \r
+/**\r
+  * Après avoir créé un message celui ci est ajouté à une conversation via cette méthode.\r
+  */\r
 euphorik.Conversation.prototype.ajouterMessage = function(message) {\r
    this.messages.push(message);\r
    this.messagesParId[message.id] = message;\r
    \r
-   // enlève les messages exedentaires\r
+   // enlève le message exedentaire si nécessaire\r
    if (this.messages.length > this.nbMessageMax) {\r
       delete this.messagesParId[this.messages.shift().id];\r
    }\r
+   \r
+   // met à jour le membre 'estReponduPar' des messages de la conversation\r
+   for (var i = 0; i < this.messages.length - 1; i++) {\r
+     var autreMess = this.messages[i];\r
+     if (autreMess.id in message.repondA) {\r
+        autreMess.estReponduPar[message.id] = true;\r
+     }\r
+   }\r
 };\r
 \r
 /**\r
index 277726d..b0eea99 100644 (file)
@@ -232,9 +232,8 @@ euphorik.Conversations.prototype.ajouterMessages = function(elements, numConvers
   * @return true si une nouvelle conversation a été créée sinon false\r
   */\r
 euphorik.Conversations.prototype.ajouterMessage = function(element, numConversation) {\r
-   var thisMessages = this;\r
-\r
-   // pas d'utilisation de jquery pour des raisons de performance      \r
+   var thisConversations = this;\r
+   \r
    var message = \r
       new euphorik.Message(\r
          this.client,\r
@@ -249,12 +248,12 @@ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversat
       this.nouvelleConversation(\r
          numConversation,\r
          function(num) { // fermeture de la conversation\r
-            thisMessages.supprimerConversation(num);\r
+            thisConversations.supprimerConversation(num);\r
          },\r
          function(num) { // insertion du lien vers la conversation\r
             thisPage.util.replaceSelection(\r
                $("form#posterMessage input.message")[0],\r
-               "{" + thisMessages.client.conversations[num-1].root.toString(36) + "}"\r
+               "{" + thisConversations.client.conversations[num-1].root.toString(36) + "}"\r
             );\r
          }\r
       );\r
index 9664064..c77ac58 100644 (file)
@@ -39,6 +39,10 @@ euphorik.Message = function(client, formateur, element) {
    this.login = element.login;\r
    this.contenu = element.content;\r
    \r
+   // l'ensemble des id des messages qui reponde à ce message, exemple : {45:true, 32:true} (le 'true' ne sert à rien ^_^)\r
+   // mis à jour au fur à mesure que des messages sont ajoutés aux conversations\r
+   this.estReponduPar = {};\r
+   \r
    this.appartientAuClient = element.owner;\r
    this.clientARepondu = element.answered;\r
    this.estUneReponse = element.is_a_reply;\r
@@ -81,27 +85,24 @@ euphorik.Message.prototype.getConversation = function(messages) {
    \r
    messagesEnEvidence[this.id] = 1;\r
    \r
-   // recherche les réponses (O(n))\r
-   messages.messages.each(function(i, mess) {\r
-      if (mess.repondA.hasOwnProperty(thisMessage.id)) {\r
-         messagesEnEvidence[mess.id] = 2;\r
-      }\r
-   });\r
-   \r
-   // parcours en largeur\r
-   var f = function(tabIds, premierNiveau) {\r
-      objectEach(tabIds, function(id) {\r
-         // si le message (id) a déjà été traité\r
+   // parcours en profondeur\r
+   var f = function(m, premierNiveau, ensemble, evidence) {\r
+      objectEach(m[ensemble], function(id) {\r
          if (!messagesEnEvidence[id] || premierNiveau) {\r
             var message = messages.messagesParId[id];\r
-            if (message) { \r
-               messagesEnEvidence[id] = premierNiveau ? 3 : (message.auteurId === thisMessage.auteurId ? 1 : 0);\r
-               f(message.repondA, false);\r
+            if (message) {\r
+               messagesEnEvidence[id] = premierNiveau ? evidence : (message.auteurId === thisMessage.auteurId ? 1 : 0);\r
+               f(message, false, ensemble, evidence);\r
             }\r
          }\r
       });\r
    };\r
-   f(this.repondA, true);\r
+   \r
+   // remonte le temps\r
+   f(this, true, "estReponduPar", 2);\r
+   \r
+   // descent le temps\r
+   f(this, true, "repondA", 3);       \r
    \r
    return messagesEnEvidence;\r
 };\r
index d852d25..38845e2 100644 (file)
Binary files a/styles/1/img/fleche_proprietaire.png and b/styles/1/img/fleche_proprietaire.png differ
index 98786cd..729f937 100644 (file)
Binary files a/styles/1/img/fleche_reponse.png and b/styles/1/img/fleche_reponse.png differ
index aeefec7..71f6a08 100755 (executable)
        zoom: 1
 }
 #page.minichat div.message.reponse .entete {
-       background-color: #bf2911
+       background-color: #846c19
 }
 #page.minichat div.message.reponse .delimitationEntete,
 #page.minichat div.message.reponse .repondA {
        background-image: url(img/fleche_repondu.png);
 }
 #page.minichat div.message.proprietaire .entete {
-       background-color: #31732f
+       background-color: #13920f
 }
 #page.minichat div.message.proprietaire .delimitationEntete,
 #page.minichat div.message.proprietaire .repondA {