projects
/
euphorik.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MOD amélioration du style
[euphorik.git]
/
js
/
euphorik.js
diff --git
a/js/euphorik.js
b/js/euphorik.js
index
a3b0acf
..
b44f042
100755
(executable)
--- a/
js/euphorik.js
+++ b/
js/euphorik.js
@@
-465,6
+465,9
@@
function Client(util)
this.resetDonneesPersonnelles()
this.setStatut(statutType.deconnected)
\r
this.resetDonneesPersonnelles()
this.setStatut(statutType.deconnected)
\r
+
\r
+ // si true alors chaque modification du client est mémorisé sur le serveur
\r
+ this.autoflush = $.browser["opera"]
\r
}
\r
Client.prototype.resetDonneesPersonnelles = function()
\r
}
\r
Client.prototype.resetDonneesPersonnelles = function()
\r
@@
-494,7
+497,9
@@
Client.prototype.setCss = function(css)
this.css = css
$("link#cssPrincipale").attr("href", this.css)
this.css = css
$("link#cssPrincipale").attr("href", this.css)
- this.majMenu()
+ this.majMenu()
\r
+
\r
+ if (this.autoflush) this.flush(true)
}
Client.prototype.pageSuivante = function(numConv)
}
Client.prototype.pageSuivante = function(numConv)
@@
-547,7
+552,10
@@
Client.prototype.ajouterConversation = function(racine)
if (this.conversations[i].root == racine)
return false
if (this.conversations[i].root == racine)
return false
- this.conversations.push({root : racine, page : 1})
+ this.conversations.push({root : racine, page : 1})
\r
+
\r
+ if (this.autoflush) this.flush(true)
\r
+
return true
}
return true
}
@@
-558,7
+566,9
@@
Client.prototype.supprimerConversation = function(num)
// décalage TODO : supprimer le dernier élément
for (var i = num; i < this.conversations.length - 1; i++)
this.conversations[i] = this.conversations[i+1]
// décalage TODO : supprimer le dernier élément
for (var i = num; i < this.conversations.length - 1; i++)
this.conversations[i] = this.conversations[i+1]
- this.conversations.pop()
+ this.conversations.pop()
\r
+
\r
+ if (this.autoflush) this.flush(true)
}
Client.prototype.getJSONLogin = function(login, password)
}
Client.prototype.getJSONLogin = function(login, password)
@@
-904,6
+914,9
@@
function PageEvent(page, util)
// l'objet JSONHttpRequest représentant la connexion d'attente
this.attenteCourante = null
// l'objet JSONHttpRequest représentant la connexion d'attente
this.attenteCourante = null
+
+ // le multhreading du pauvre, merci javascript de m'offrire autant de primitives pour la gestion de la concurrence...
+ this.stop = false
}
/**
}
/**
@@
-911,8
+924,12
@@
function PageEvent(page, util)
*/
PageEvent.prototype.stopAttenteCourante = function()
{
*/
PageEvent.prototype.stopAttenteCourante = function()
{
+ this.stop = true
+
if (this.attenteCourante != null)
if (this.attenteCourante != null)
+ {
this.attenteCourante.abort()
this.attenteCourante.abort()
+ }
}
/**
}
/**
@@
-922,11
+939,13
@@
PageEvent.prototype.stopAttenteCourante = function()
*/
PageEvent.prototype.waitEvent = function(funSend, funReceive)
{
*/
PageEvent.prototype.waitEvent = function(funSend, funReceive)
{
- var thisPageEvent = this
-
this.stopAttenteCourante()
this.stopAttenteCourante()
+
+ this.stop = false
+
+ var thisPageEvent = this
- // on doit conserver l'ordre des valeurs de l'objet JSON (le serveur les veu
x
dans l'ordre définit dans le protocole)
+ // on doit conserver l'ordre des valeurs de l'objet JSON (le serveur les veu
t
dans l'ordre définit dans le protocole)
// TODO : ya pas mieux ?
var dataToSend =
{
// TODO : ya pas mieux ?
var dataToSend =
{
@@
-938,6
+957,7
@@
PageEvent.prototype.waitEvent = function(funSend, funReceive)
dataToSend[v] = poulpe[v]
;;; dumpObj(dataToSend)
dataToSend[v] = poulpe[v]
;;; dumpObj(dataToSend)
+
this.attenteCourante = jQuery.ajax({
type: "POST",
url: "request",
this.attenteCourante = jQuery.ajax({
type: "POST",
url: "request",
@@
-951,15
+971,24
@@
PageEvent.prototype.waitEvent = function(funSend, funReceive)
funReceive(data)
// rappel de la fonction dans 100 ms
funReceive(data)
// rappel de la fonction dans 100 ms
- setTimeout(function(){ thisPageEvent.waitEvent
(funSend, funReceive) }, 100);
+ setTimeout(function(){ thisPageEvent.waitEvent
2(funSend, funReceive) }, 100)
},
error:
function(XMLHttpRequest, textStatus, errorThrown)
{
},
error:
function(XMLHttpRequest, textStatus, errorThrown)
{
- setTimeout(function(){ thisPageEvent.waitEvent
(funSend, funReceive) }, 1000);
+ setTimeout(function(){ thisPageEvent.waitEvent
2(funSend, funReceive) }, 1000)
}
})
}
})
+}
+/**
+ * Si un stopAttenteCourante survient un peu n'importe quand il faut imédiatement arreter de boucler.
+ */
+PageEvent.prototype.waitEvent2 = function(funSend, funReceive)
+{
+ if (this.stop)
+ return
+ this.waitEvent(funSend, funReceive)
}
///////////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////