X-Git-Url: https://code.citadel.org/?p=citadel;a=blobdiff_plain;f=webcit-ng%2Fstatic%2Fjs%2Fview_forum.js;h=618e3b8b02c606b75f6e3ce9c6da7a5113d8ee31;hp=3711a2aed10f3bad9dc7bff11ae2e754a3967f96;hb=88f5e004e01b9942db384ebdaf4c26b55b1afd48;hpb=c994a997c95509a5c43b0f7b0e97e720f6e84c95 diff --git a/webcit-ng/static/js/view_forum.js b/webcit-ng/static/js/view_forum.js index 3711a2aed..618e3b8b0 100644 --- a/webcit-ng/static/js/view_forum.js +++ b/webcit-ng/static/js/view_forum.js @@ -227,13 +227,13 @@ function open_reply_box(prefix, msgnum, is_quoted) { + "" // end footer info on left side + "" // begin buttons on right side - + "" // FIXME save and cancel buttons - + " " + + "" + + " " // save button + _("Post message") + "" - + "" // FIXME save and cancel buttons - + " " + + "" + + " " // cancel button + _("Cancel") + "" @@ -260,3 +260,28 @@ function open_reply_box(prefix, msgnum, is_quoted) { window.getSelection().collapse(tag.firstChild, 0); // positions the cursor }, 0); } + + +// Abort a message post (it simply destroys the div) +function cancel_post(div_name) { + document.getElementById(div_name).outerHTML = ""; // make it cease to exist +} + + +// Save the posted message to the server +function save_message(div_name, reply_to_msgnum) { + + msg_text = "" + document.getElementById("ctdl-editor-body").innerHTML + "\n"; + url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/dummy_name_for_new_message"; + + var request = new XMLHttpRequest(); + request.open("PUT", url, true); + request.setRequestHeader("Content-type", "text/html"); + request.setRequestHeader("Content-length", msg_text.length); + request.onreadystatechange = function() { + alert("well, something happened"); + }; + request.send(msg_text); + request = null; + +}