X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat%2Fconversation.js;h=70f8d2b170d31f458a59cb5cfd5f2b471692f121;hp=5a10c5a56b8603e62eb005092504d72ce1465948;hb=15f8b5143c6b9dcfe86eda84c22c31826a7f3d1c;hpb=7203835bce6f94b6afcc7403694145c829a4f833
diff --git a/js/pageMinichat/conversation.js b/js/pageMinichat/conversation.js
index 5a10c5a..70f8d2b 100644
--- a/js/pageMinichat/conversation.js
+++ b/js/pageMinichat/conversation.js
@@ -62,10 +62,28 @@ euphorik.Conversation = function(conversations, num) {
(reverse ? "" : messageRacineXHTML) +
'' +
(reverse ? "" : messagesXHTML) +
+ '
' +
'';
$("#conversations tr").append(XHTML);
+ // les différents événements liés à la conversation
+ var thisConversation = this;
+ $("#" + this.getId() + " .titre .lien").click(function() {
+ thisConversation.util.replaceSelection(
+ $("form#posterMessage input.message")[0],
+ "{" + thisConversation.client.conversations[thisConversation.num - 1].root.toString(36) + "}"
+ );
+ });
+ $("#" + this.getId() + " .titre .fermer").click(function() {
+ thisConversation.conversations.supprimerConversation(num);
+ });
+ $("#" + this.getId() + " .titre .reduire").click(function() {
+ $("#" + thisConversation.getId() + " .titre, #" + thisConversation.getId() + " .messages").hide()
+ var e = $("#" + thisConversation.getId() + " .messageReduit");
+ e.get()[0].innerHTML = thisConversation.getMessageReduit()
+ });
+
this.util.infoBulle("Aller à la première page", $("#" + this.getId() + " .numPage"), euphorik.Util.positionBulleType.haut);
if (num !== 0) {
this.util.infoBulle("Créer un lien vers la conversation", $("#" + this.getId() + " .lien"));
@@ -73,6 +91,16 @@ euphorik.Conversation = function(conversations, num) {
}
};
+euphorik.Conversation.prototype.getMessageReduit = function() {
+ return '' +
+ '' +
+ '' +
+ '' +
+ 'Blabla blablablabla bla blabla ..' +
+ '' +
+ '';
+}
+
/**
* @racine un message représentant la racine de la conversation, vaut undefined pour la conversation générale
*/
@@ -139,32 +167,6 @@ euphorik.Conversation.prototype.setPage = function(pageCourante, dernierePage) {
$("#" + this.getId() + " .prev").css("display", dernierePage ? "none" : "inline");
};
-/**
- * Evenement déclanché lors de l'insertion du lien de la conversation dans le message courant.
- */
-euphorik.Conversation.prototype.eventLien = function(fun) {
- var thisConversation = this;
-
- $("#" + this.getId() + " .titre .lien").click(
- function() {
- fun(thisConversation.num);
- }
- );
-};
-
-/**
- * Evenement déclanché lors de la fermeture de la conversation.
- */
-euphorik.Conversation.prototype.eventFermer = function(fun) {
- var thisConversation = this;
-
- $("#" + this.getId() + " .titre .fermer").click(
- function() {
- fun(thisConversation.num);
- }
- );
-};
-
/**
* @funNext appelé lorsque l'on passe à la page suivante (de 2 à 1 par exemple)
* @funPrev appelé lorsque l'on passe à la page précédente (de 1 à 2 par exemple)
@@ -251,7 +253,7 @@ euphorik.Conversation.prototype.flush = function() {
}
});
- var DOM = $(XHTML);
+ var DOM = $(XHTML);
// pour chaque nouveau message au niveau du document on lui assigne ses événements
DOM.each(function() { thisConversation.attacherEventsSurMessage(this); });
@@ -287,9 +289,10 @@ euphorik.Conversation.prototype.flush = function() {
euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
// l'id du message
var idMess = this.idMessageFromString($(element).attr("id"));
-
- this.util.infoBulle("Extraction de la conversation à partir de ce message", $(".extraire", element));
- this.util.infoBulle("Extraction de la conversation complète", $(".extraireCompletement", element));
+
+ if (idMess in this.conversations.messagesRepond) {
+ $(element).addClass("repondEnEvidence");
+ }
var thisConversation = this;
$(".lienConv", element).click(
@@ -301,30 +304,35 @@ euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
}
);
- $(element).click(
- function(event) {
- if ($(event.target).is("a") || $(event.target).parents("#outilsBan").length > 0) {
- return;
- }
-
- // extraction d'une conversation
- if ($(event.target).is(".extraire")) {
- thisConversation.conversations.ouvrirConversation(idMess);
- return;
- }
-
- if ($(event.target).is(".extraireCompletement")) {
- thisConversation.conversations.ouvrirConversation(thisConversation.messagesParId[idMess].racineId);
- return;
- }
+ $(element).click(function(event) {
+ if ($(event.target).is("a") || $(event.target).parents("#outilsBan").length > 0) {
+ return;
+ }
- // met ou enlève la mise en evidence du message
- thisConversation.conversations.toggleMessageRepond(thisConversation.messagesParId[idMess]);
+ // met ou enlève la mise en evidence du message
+ thisConversation.conversations.toggleMessageRepond(thisConversation.messagesParId[idMess]);
- // donne le focus à la ligne de saisie
- $("form input.message").focus();
+ // donne le focus à la ligne de saisie
+ $("form input.message").focus();
+ }).hover(function(event) { // affiche les outils liées au message
+ var top = $(this).offset().top
+ var left = $(this).offset().left + $(this).width() - thisConversation.util.outilsMessage.width()
+ thisConversation.util.outilsMessage.css("top", top + 1).css("left", left).prependTo(this).show();
+ //TODO
+ //
+ // extraction d'une conversation
+ /*if ($(event.target).is(".extraire")) {
+ thisConversation.conversations.ouvrirConversation(idMess);
+ return;
}
- );
+
+ if ($(event.target).is(".extraireCompletement")) {
+ thisConversation.conversations.ouvrirConversation(thisConversation.messagesParId[idMess].racineId);
+ return;
+ }*/
+ }, function(event) {
+ thisConversation.util.outilsMessage.hide();
+ });
// mise en évidence de la conversation
$(".entete", element).hover(
@@ -383,7 +391,7 @@ euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
);
},
function() {
- $("#outilsBan", this).hide();
+ thisConversation.util.outilsBan.hide();
}
);
}