1 /***************************************************************************
2 * Copyright (C) 2003-2009 Polytechnique.org *
3 * http://opensource.polytechnique.org/ *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19 ***************************************************************************/
23 this.update_html
= function(obj
, src
, func
)
26 function(data
, textStatus
) {
27 if (textStatus
== "success") {
29 $('#' + obj
).html(data
);
34 } else if (textStatus
== "error") {
35 alert("Une erreur s'est produite lors du traitement de la requête.\n"
36 +"Ta session a peut-être expirée.");
43 var Ajax
= new AjaxEngine();
45 var currentTempMessage
= 0;
46 function setOpacity(obj
, opacity
)
48 opacity
= (opacity
== 100)?99:opacity
;
50 obj
.style
.filter
= "alpha(opacity:"+opacity
+")";
51 // Safari < 1.2, Konqueror
52 obj
.style
.KHTMLOpacity
= opacity
/100;
54 obj
.style
.MozOpacity
= opacity
/100;
55 // Safari >= 1.2, Firefox and Mozilla, CSS3
56 obj
.style
.opacity
= opacity
/100
59 function _showTempMessage(id
, state
, back
)
61 var obj
= document
.getElementById(id
);
62 if (currentTempMessage
!= state
) {
65 setOpacity(obj
, back
* 4);
67 setTimeout("_showTempMessage('" + id
+ "', " + currentTempMessage
+ "," + (back
-1) + ")", 125);
73 function showTempMessage(id
, message
, success
)
75 var obj
= document
.getElementById(id
);
76 obj
.innerHTML
= (success
? "<img src='images/icons/wand.gif' alt='' /> "
77 : "<img src='images/icons/error.gif' alt='' /> ") + message
;
78 obj
.style
.fontWeight
= "bold";
79 obj
.style
.color
= (success
? "green" : "red");;
82 setTimeout("_showTempMessage('" + id
+ "', " + currentTempMessage
+ ", 25)", 1000);
85 function previewWiki(idFrom
, idTo
, withTitle
, idShow
)
87 var text
= document
.getElementById(idFrom
).value
;
91 var url
= "wiki_preview";
95 $.post(url
, { text
: text
},
97 $("#" + idTo
).html(data
);
100 if (idShow
!= null) {
101 document
.getElementById(idShow
).style
.display
= "";
105 function sendTestEmail(token
, hruid
)
107 Ajax
.update_html(null, 'emails/test' + (hruid == null ? '' : '/' + hruid
) + '?token=' + token
,
109 showTempMessage('mail_sent', "Un email a été envoyé avec succès"
110 + (hruid
== null ? " sur ton adresse." : " sur l'adresse de " + hruid
),
115 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: