[cpif] r259 - trunk/frontend-web/skins/default
svn at argo.es
svn at argo.es
Wed Jul 11 11:31:37 CEST 2007
Author: alvaro
Date: Wed Jul 11 11:31:36 2007
New Revision: 259
Log:
Quoteo cuando se pulsa en responder
Modified:
trunk/frontend-web/skins/default/body_show_thread.html
Modified: trunk/frontend-web/skins/default/body_show_thread.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread.html (original)
+++ trunk/frontend-web/skins/default/body_show_thread.html Wed Jul 11 11:31:36 2007
@@ -12,7 +12,7 @@
%(nav)s
</ul>
<div>
- <a href="javascript:responder('hilos',2);">Escribir respuesta</a>
+ <a href="javascript:responder('hilos');">Escribir respuesta</a>
</div>
<div id="form">
<form id="fNewpost" action="%(link_form_new_post)s" method="post" enctype="multipart/form-data">
@@ -52,6 +52,8 @@
}
}
+var used_ids = new Array();
+
function responder(id) {
var post = document.getElementById(id);
/* Descomentar si se desea que el formulario original de postear se conserve */
@@ -63,10 +65,34 @@
/* finline.id = "form-inline"; */
/* } */
/* post.appendChild(finline); */
-
post.appendChild(document.getElementById("form"));
toggleBox('form',1);
+ if(id == "hilos") { return; }
+
+ /* quotes */
+ var my_id = id.slice(1);
+ if(! used_ids[my_id]){
+ used_ids[my_id] = true;
+ var req = false;
+ try {
+ req = new XMLHttpRequest();
+ }
+ catch(e) {
+ req = false;
+ }
+ if(req) {
+ req.open("GET","/get_msg_source/"+my_id,false);
+ req.send("");
+ var xml = req.responseXML;;
+ var author = xml.getElementsByTagName("autor")[0].textContent;
+ var post = xml.getElementsByTagName("cuerpo")[0].textContent;
+ var form = document.getElementById("form");
+ var textarea = form.getElementsByTagName("textarea")[0];
+ text = '[quote="'+author+'"]'+post+'[/quote]\n';
+ textarea.value += text;
+ }
+ }
}
window.onload = toggleBox('form',0);
More information about the cpif
mailing list