--- /dev/null
+*.iws
+*.beam
+var/
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="ERLANG_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="erlang" name="Erlang">
+ <configuration />
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="Erlang 17" jdkType="Erlang SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ <entry name="!?*.aj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+ <component name="CopyrightManager" default="" />
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="IdProvider" IDEtalkID="B6AEF54337EB68A2965D2FCB524498D7" />
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$//euphorik.iml" filepath="$PROJECT_DIR$//euphorik.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<erl>
- out(A) ->
- {header, {content_type,
- case string:str((A#arg.headers)#headers.user_agent, "MSIE") of
- 0 -> "text/html"; %"application/xhtml+xml"; % TODO : jquery.lightbox does not support application/xhtml+xml
- _ -> "text/html"
- end
- }}.
-</erl>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>euphorik.ch</title>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
+"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
+<erl>\r
+ out(A) ->\r
+ {header, {content_type,\r
+ case string:str((A#arg.headers)#headers.user_agent, "MSIE") of\r
+ 0 -> "text/html"; %"application/xhtml+xml"; % TODO : jquery.lightbox does not support application/xhtml+xml\r
+ _ -> "text/html"\r
+ end\r
+ }}.\r
+</erl>\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
+ <title>euphorik.ch</title>\r
<erl>\r
- % set the stylesheet
- out(A) ->
- CSS = case euphorik_bd:css_from_user_cookie(yaws_api:find_cookie_val("cookie", A)) of
- undefined -> "styles/1/euphorik.css";
- C -> C
- end,
- {ehtml, {link ,
- [
- {id, "mainCss" },
- {rel, "stylesheet"},
- {href, CSS},
- {type, "text/css"},
- {media, "screen"}
- ], []}
- }.
- </erl>
- <link rel="stylesheet" href="styles/jquery.lightbox.css" type="text/css" media="screen" ></link>
-
- <script type="text/javascript" src="js/libs/jquery.js" prod="delete"></script>
- <script type="text/javascript" src="js/libs/jquery.lightbox.js" prod="delete"></script>
- <script type="text/javascript" src="js/libs/md5.js" prod="delete"></script>
- <script type="text/javascript" src="js/libs/json2.js" prod="delete"></script>
-
- <script type="text/javascript" src="js/betterjs.js" prod="delete"></script>
- <script type="text/javascript" src="js/comet.js" prod="delete"></script>
- <script type="text/javascript" src="js/fragment.js" prod="delete"></script>
-
- <script type="text/javascript" src="js/euphorik.js"></script>
-
- <script type="text/javascript" src="js/communication.js" prod="delete"></script>
- <script type="text/javascript" src="js/conf.js" prod="delete"></script>
- <script type="text/javascript" src="js/util.js" prod="delete"></script>
- <script type="text/javascript" src="js/formater.js" prod="delete"></script>
- <script type="text/javascript" src="js/pages.js" prod="delete"></script>
- <script type="text/javascript" src="js/client.js" prod="delete"></script>
-
- <script type="text/javascript" src="js/chat/chat.js" prod="delete"></script>
- <script type="text/javascript" src="js/chat/conversation.js" prod="delete"></script>
- <script type="text/javascript" src="js/chat/conversations.js" prod="delete"></script>
- <script type="text/javascript" src="js/chat/message.js" prod="delete"></script>
- <script type="text/javascript" src="js/chat/commandes.js" prod="delete"></script>
-
- <script type="text/javascript" src="js/pageStatic.js" prod="delete"></script>
- <script type="text/javascript" src="js/pageMinichat.js" prod="delete"></script>
- <script type="text/javascript" src="js/pageAdmin.js" prod="delete"></script>
- <script type="text/javascript" src="js/pageProfile.js" prod="delete"></script>
- <script type="text/javascript" src="js/pageRegister.js" prod="delete"></script>
- <script type="text/javascript" src="js/pageAbout.js" prod="delete"></script>
-
-</head>
- <body>
- <div id="container">
- <erl>
- % permet de prédéfinir la "class" du logo pour un ekMaster...
- out(A) ->
- Est_ek_master = euphorik_bd:is_ek_master_from_cookie(yaws_api:find_cookie_val("cookie", A)),
- {ehtml, {'div', [{id, "logo"}] ++ if Est_ek_master -> [{class, "ekMaster"}]; true -> [] end}}.
-
- </erl>
- <div id="info" style="display:none" ><div id="icone"></div><div class="close" ></div><div class="message" ></div><div class="buttons"></div></div>
- <div id="waitbar" style="display:none" ><div class="image"></div></div>
- <ul id="menu">
- <li class="minichat">chat</li><li class="admin" style="display:none">admin</li><li class="profile"></li><li class="register">register</li><li class="logout">logout</li><li class="about">about</li>
- </ul>
- <form action="" id="formMenuCss">
- <p>
- <select id="menuCss">
- <erl>
- % parse les styles disponible
- out(A) ->
- Stlyes_dir = A#arg.docroot ++ "/styles",
- {ok, Liste_dir} = file:list_dir(Stlyes_dir),
- {ehtml,
- lists:foldr(
- fun(Dir, Acc) ->
- case file:consult(Stlyes_dir ++ "/" ++ Dir ++ "/infos.txt") of
- {ok, [{nom, Nom}]} ->
- [{option, [{value, Dir}], Nom} | Acc];
- _ ->
- Acc
- end
- end,
- [],
- Liste_dir
- )
- }.
- </erl>
- </select>
- </p>
- </form>
- <div id="page"></div>
- <div id="footer"><span class="copyright">copyright 2008 euphorik.ch</span><span class="termsOfUse pageLink">terms of use</span><a href="http://yaws.hyber.org"><img src="img/powered-by-yaws.gif" alt="powered by Yaws" /></a></div>
- </div>
- </body>
-</html>
+ % set the stylesheet\r
+ out(A) ->\r
+ CSS = case euphorik_bd:css_from_user_cookie(yaws_api:find_cookie_val("cookie", A)) of\r
+ undefined -> "styles/1/euphorik.css";\r
+ C -> C\r
+ end,\r
+ {ehtml, {link ,\r
+ [\r
+ {id, "mainCss" },\r
+ {rel, "stylesheet"},\r
+ {href, CSS},\r
+ {type, "text/css"},\r
+ {media, "screen"}\r
+ ], []}\r
+ }.\r
+ </erl>\r
+ <link rel="stylesheet" href="styles/jquery.lightbox.css" type="text/css" media="screen" ></link>\r
+\r
+ <script type="text/javascript" src="js/libs/jquery.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/libs/jquery.lightbox.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/libs/md5.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/libs/json2.js" prod="delete"></script>\r
+\r
+ <script type="text/javascript" src="js/betterjs.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/fragment.js" prod="delete"></script>\r
+\r
+ <script type="text/javascript" src="js/euphorik.js"></script>\r
+\r
+ <script type="text/javascript" src="js/communication.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/conf.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/util.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/formater.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pages.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/client.js" prod="delete"></script>\r
+\r
+ <script type="text/javascript" src="js/chat/chat.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/chat/conversation.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/chat/conversations.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/chat/message.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/chat/commandes.js" prod="delete"></script>\r
+\r
+ <script type="text/javascript" src="js/pageStatic.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pageMinichat.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pageAdmin.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pageProfile.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pageRegister.js" prod="delete"></script>\r
+ <script type="text/javascript" src="js/pageAbout.js" prod="delete"></script>\r
+\r
+</head>\r
+ <body>\r
+ <div id="container">\r
+ <erl>\r
+ % permet de prédéfinir la "class" du logo pour un ekMaster...\r
+ out(A) ->\r
+ Est_ek_master = euphorik_bd:is_ek_master_from_cookie(yaws_api:find_cookie_val("cookie", A)),\r
+ {ehtml, {'div', [{id, "logo"}] ++ if Est_ek_master -> [{class, "ekMaster"}]; true -> [] end}}.\r
+\r
+ </erl>\r
+ <div id="info" style="display:none" ><div id="icone"></div><div class="close" ></div><div class="message" ></div><div class="buttons"></div></div>\r
+ <div id="waitbar" style="display:none" ><div class="image"></div></div>\r
+ <ul id="menu">\r
+ <li class="minichat">chat</li><li class="admin" style="display:none">admin</li><li class="profile"></li><li class="register">register</li><li class="logout">logout</li><li class="about">about</li>\r
+ </ul>\r
+ <form action="" id="formMenuCss">\r
+ <p>\r
+ <select id="menuCss">\r
+ <erl>\r
+ % parse les styles disponible\r
+ out(A) ->\r
+ Stlyes_dir = A#arg.docroot ++ "/styles",\r
+ {ok, Liste_dir} = file:list_dir(Stlyes_dir),\r
+ {ehtml,\r
+ lists:foldr(\r
+ fun(Dir, Acc) ->\r
+ case file:consult(Stlyes_dir ++ "/" ++ Dir ++ "/infos.txt") of\r
+ {ok, [{nom, Nom}]} ->\r
+ [{option, [{value, Dir}], Nom} | Acc];\r
+ _ ->\r
+ Acc\r
+ end\r
+ end,\r
+ [],\r
+ Liste_dir\r
+ )\r
+ }.\r
+ </erl>\r
+ </select>\r
+ </p>\r
+ </form>\r
+ <div id="page"></div>\r
+ <div id="footer"><span class="copyright">copyright 2008 euphorik.ch</span><span class="termsOfUse pageLink">terms of use</span><a href="http://yaws.hyber.org"><img src="img/powered-by-yaws.gif" alt="powered by Yaws" /></a></div>\r
+ </div>\r
+ </body>\r
+</html>\r
* (Not use for the moment)
* See : http://www.coolpage.com/developer/javascript/Correct%20OOP%20for%20Javascript.html
*
- * Example :
+ * Example :
*
* function Mammal(name) {
* this.name = name;
euphorik.Client = function(util, communication) {\r
this.util = util;\r
this.communication = communication;\r
- \r
+\r
this.cookie = null;\r
this.regexCookie = /cookie=([^;]*)/;\r
- \r
+\r
this.resetPersonalData();\r
- \r
+\r
this.setStatus(euphorik.Client.statusType.disconnected);\r
- \r
+\r
// If true then each data change is flushed to the server.\r
// Active only for opera which doesn't support the unload event.\r
this.autoflush = $.browser.opera;\r
\r
// The three status of a client.\r
euphorik.Client.statusType = {\r
- // authentified and registered : The user can post messages and can modify his profile\r
+ // Authentified and registered : The user can post messages and can modify his profile.\r
auth_registered : 0,\r
- // authentified but not registered : The user can only post messages\r
+ // Authentified but not registered : The user can only post messages.\r
auth_not_registered : 1,\r
- // disconnected (the initial state) : The user cannot post message\r
+ // Disconnected (the initial state) : The user cannot post message.\r
disconnected : 2\r
};\r
\r
this.viewTimes = true;\r
this.viewTooltips = true;\r
this.cookie = undefined;\r
- \r
+\r
this.mainConversationPage = 1;\r
this.ekMaster = false;\r
this.ostentatiousMaster = "light";\r
- \r
+\r
// The user opened conversations.\r
// Each conversation object owns theses properties :\r
// - root (integer)\r
\r
this.css = css;\r
$("link#mainCss").attr("href", this.css);\r
- \r
+\r
if (this.autoflush) {\r
this.flush(true);\r
}\r
* Définit la première page pour la conversation donnée.\r
* @return true si la page a changé sinon false\r
*/\r
-euphorik.Client.prototype.goFirstPage = function(numConv)\r
-{\r
+euphorik.Client.prototype.goFirstPage = function(numConv) {\r
if (numConv < 0) {\r
if (this.mainConversationPage === 1) {\r
return false;\r
* @return true si la conversation a été créée sinon false (par exemple si la conv existe déjà)\r
*/\r
euphorik.Client.prototype.ajouterConversation = function(racine) {\r
- // vérification s'il elle n'existe pas déjà \r
+ // vérification s'il elle n'existe pas déjà\r
var existe = false;\r
this.conversations.each(function(i, conv) {\r
if (conv.root === racine) {\r
if (existe) {\r
return false;\r
}\r
- \r
+\r
this.conversations.push({root : racine, page : 1, isCollapsed : false});\r
if (this.autoflush) {\r
this.flush(true);\r
}\r
- \r
+\r
return true;\r
};\r
\r
if (num < 0 || num >= this.conversations.length) {\r
return;\r
}\r
- \r
- // décalage TODO : supprimer le dernier élément \r
+\r
+ // décalage TODO : supprimer le dernier élément\r
for (var i = num; i < this.conversations.length - 1; i++) {\r
this.conversations[i] = this.conversations[i+1];\r
}\r
this.conversations.pop();\r
- \r
+\r
if (this.autoflush) {\r
this.flush(true);\r
}\r
if (!this.cookie) {\r
return;\r
}\r
- \r
+\r
// doesn't work under IE....\r
/*document.cookie = "cookie=" + this.cookie + "; max-age=" + (60 * 60 * 24 * 365) */\r
- \r
- document.cookie = \r
+\r
+ document.cookie =\r
"cookie="+this.cookie+"; expires=" + new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365).toUTCString();\r
};\r
\r
};\r
\r
euphorik.Client.prototype.setStatus = function(statut)\r
-{ \r
+{\r
// conversation en "enum" si en "string"\r
if (typeof(statut) === "string") {\r
statut =\r
euphorik.Client.statusType.auth_registered :\r
(statut === "auth_not_registered" ? euphorik.Client.statusType.auth_not_registered : euphorik.Client.statusType.disconnected);\r
}\r
- \r
+\r
if (statut === this.statut) {\r
return;\r
}\r
- \r
+\r
this.statut = statut;\r
- \r
+\r
this.majMenu();\r
this.majLogo();\r
};\r
-
-/**
- * Try to authentify the client with the cookie information.
- * Do nothing if there is no cookie.
+\r
+/**\r
+ * Try to authentify the client with the cookie information.\r
+ * Do nothing if there is no cookie.\r
*/\r
euphorik.Client.prototype.connectionCookie = function() {\r
this.getCookie();\r
return this.connexion("authentification", {"login" : login, "password" : password });\r
};\r
\r
-euphorik.Client.prototype.enregistrement = function(login, password) { \r
+euphorik.Client.prototype.enregistrement = function(login, password) {\r
if (this.authentifie()) {\r
this.login = login;\r
this.password = password;\r
*/\r
euphorik.Client.prototype.getJSONEnregistrement = function(login, password) {\r
var mess = {};\r
- \r
+\r
if (login && password) {\r
mess.login = login;\r
mess.password = password;\r
}\r
- \r
+\r
mess.profile = this.getJSONProfileInfos();\r
- \r
+\r
return mess;\r
};\r
\r
*/\r
euphorik.Client.prototype.connexion = function(action, messageJson) {\r
var thisClient = this;\r
- \r
+\r
this.communication.requete(\r
action,\r
messageJson,\r
// la modification du statut qui suit met à jour le menu, le menu dépend (page admin)\r
// de l'état ekMaster\r
this.ekMaster = data.ek_master ? data.ek_master : false;\r
- \r
+\r
this.setStatus(data.status);\r
- \r
+\r
if (this.authentifie()) {\r
this.cookie = data.cookie;\r
this.setCookie();\r
- \r
+\r
this.id = data.id;\r
this.login = data.login;\r
this.nick = data.profile.nick;\r
this.viewTimes = data.profile.view_times;\r
this.viewTooltips = data.profile.view_tooltips;\r
this.ostentatiousMaster = data.profile.ostentatious_master;\r
- \r
+\r
// la page de la conversation principale\r
this.mainConversationPage = 1;\r
- \r
+\r
// les conversations\r
this.conversations = data.profile.conversations;\r
this.conversations.map(function(conv) {\r
return { root : conv.root, page : 1, isCollapsed : conv.minimized };\r
});\r
- \r
+\r
this.majBulle();\r
this.majCssSelectionee();\r
}\r
*/\r
euphorik.Client.prototype.flush = function(async) {\r
async = async || false;\r
- \r
+\r
if (!this.authentifie()) {\r
return false;\r
}\r
- \r
+\r
var thisClient = this;\r
var ok = true;\r
- \r
+\r
this.communication.requete(\r
"set_profile",\r
this.getJSONProfile(),\r
function(data) {\r
- thisClient.majBulle(); \r
+ thisClient.majBulle();\r
},\r
function(data) {\r
thisClient.util.messageDialog(data.error_message);\r
},\r
async\r
);\r
- \r
+\r
return ok;\r
};\r
\r
var displayType = "block";\r
\r
$("#menu .admin").css("display", this.ekMaster ? displayType : "none");\r
- \r
- // met à jour le menu \r
+\r
+ // met à jour le menu\r
if (this.statut === euphorik.Client.statusType.auth_registered) {\r
$("#menu .profile").css("display", displayType).text("profile");\r
$("#menu .logout").css("display", displayType);\r
\r
euphorik.PageProfile = function(client, formater, util) {\r
this.name = "profile";\r
- \r
+\r
this.client = client;\r
this.formater = formater;\r
this.util = util;\r
\r
euphorik.PageProfile.prototype.charger = function() {\r
$("#page").html(this.getHTML());\r
- \r
+\r
// en fonction du statut\r
if (this.client.authentifie()) {\r
this.chargerProfile();\r
} else {\r
this.chargerLogin();\r
}\r
- \r
+\r
$("#page form#profile").submit(function(){ return false; });\r
};\r
\r
-euphorik.PageProfile.prototype.chargerProfile = function() { \r
+euphorik.PageProfile.prototype.chargerProfile = function() {\r
var thisPage = this;\r
- \r
+\r
$("form#profile input.login").val(this.client.login);\r
$("form#profile input.nick").val(this.client.nick);\r
$("form#profile input.email").val(this.client.email);\r
$("form#profile input#viewTooltips").attr("checked", this.client.viewTooltips);\r
$("form#profile input#viewTimes").attr("checked", this.client.viewTimes);\r
- \r
+\r
$("form#profile select#chatOrder option").removeAttr("selected");\r
$("form#profile select#chatOrder option[value=" + this.client.chatOrder + "]").attr("selected", "selected");\r
- \r
+\r
$("form#profile select#affichagePseudo option").removeAttr("selected");\r
$("form#profile select#affichagePseudo option[value=" + this.client.nickFormat + "]").attr("selected", "selected");\r
- \r
+\r
if (this.client.ostentatiousMaster) {\r
$("form#profile select#degreeOstentatoire option").removeAttr("selected");\r
$("form#profile select#degreeOstentatoire option[value=" + this.client.ostentatiousMaster + "]").attr("selected", "selected");\r
\r
$("form#profile button").click(\r
function() {\r
- thisPage.client.nick = thisPage.formate.formatNick($("form#profile input.nick").val());\r
+ thisPage.client.nick = thisPage.formater.formatNick($("form#profile input.nick").val());\r
thisPage.client.email = $("form#profile input.email").val();\r
thisPage.client.chatOrder = $("form#profile select#chatOrder option:selected").attr("value");\r
thisPage.client.nickFormat = $("form#profile select#affichagePseudo option:selected").attr("value");\r
}\r
thisPage.client.viewTooltips = $("form#profile input#viewTooltips").attr("checked");\r
thisPage.client.viewTimes = $("form#profile input#viewTimes").attr("checked");\r
- \r
+\r
var password = $("form#profile input.password").val();\r
var passwordRe = $("form#profile input.passwordRe").val();\r
if (password !== "" || passwordRe !== "") {\r
- if (password !== passwordRe) { \r
+ if (password !== passwordRe) {\r
thisPage.util.messageDialog("Les mots de passes ne correspondent pas");\r
return;\r
}\r
thisPage.client.password = thisPage.util.md5(password);\r
}\r
- \r
+\r
if(!thisPage.client.flush()) {\r
thisPage.util.messageDialog("Impossible de mettre à jour votre profile, causes inconnues", euphorik.Util.messageType.erreur);\r
- } else { \r
+ } else {\r
thisPage.util.messageDialog("Votre profile a été mis à jour");\r
thisPage.pages.displayPage("minichat");\r
}\r
);\r
};\r
\r
-euphorik.PageProfile.prototype.chargerLogin = function() { \r
+euphorik.PageProfile.prototype.chargerLogin = function() {\r
var thisPage = this;\r
\r
$("#page form#profile button").click(\r
' <tr>' +\r
' <td>password</td>' +\r
' <td><input class="password" type="password" size="20" maxlength="20"/></td>' +\r
- ' </tr>' + \r
+ ' </tr>' +\r
(this.client.authentifie() ? '' +\r
' <tr>' +\r
' <td>password re</td>' +\r
% You should have received a copy of the GNU General Public License\r
% along with Euphorik. If not, see <http://www.gnu.org/licenses/>.\r
%\r
-% Ce module est fait pour répondre à des requêtes JSON via 'AJAX'.\r
-% Il est définit comme 'appmods' pour l'url "request" dans Yaws.\r
-% Par exemple http://www.euphorik.ch/request abouti sur la fonction out/1 de ce module.\r
+% This module responds to JSON requests via 'AJAX'.\r
+% It's defined as an Yaws 'appmods' with the url '/request'.\r
+% For instance in debug mode 'http://localhost:8090/request' will call the out/1 function.\r
% @author G.Burri\r
\r
\r
-include("../include/euphorik_defines.hrl").\r
\r
\r
-% Point d'entrée pour les requêtes AJAX sur http://www.euphorik.ch/request.\r
+% Entry point for all AJAX requests on '/request'.\r
out(A) ->\r
IP = case inet:peername(A#arg.clisock) of\r
- {ok, {Adresse, _Port}} -> Adresse;\r
- _ -> inconnue\r
+ {ok, {Address, _Port}} -> Address;\r
+ _ -> unknown\r
end,\r
- % passive -> active, permet de recevoir {tcp_closed, _} lorsque le socket se ferme\r
- % keepalive -> true, evite que des firewalls coupe la connexion TCP sans prévenir\r
+ % active: to receive {tcp_closed, _} when the socket is closing.\r
+ % keepalive: avoid firewalls to cut the connection.\r
inet:setopts(A#arg.clisock, [{active, true}, {keepalive, true}]),\r
{value, {_, Contenu}} = lists:keysearch("action", 1, yaws_api:parse_post(A)),\r
Ret = traiter_message(Contenu, IP),\r