diff --git a/NT/elogd.vcproj b/NT/elogd.vcproj
index ec2d6ccf..93b07fb4 100755
--- a/NT/elogd.vcproj
+++ b/NT/elogd.vcproj
@@ -186,6 +186,9 @@
");
@@ -9000,147 +9035,83 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("}\n\n");
/* mark_submit() gets called via "Back" button */
- rsprintf("function mark_submit() \n");
- rsprintf("{ \n");
- rsprintf(" submitted = true; \n");
- rsprintf(" return true; \n");
- rsprintf("} \n\n");
+ rsprintf("function mark_submit()\n");
+ rsprintf("{\n");
+ rsprintf(" submitted = true;\n");
+ rsprintf(" return true;\n");
+ rsprintf("}\n\n");
/* chkupload() gets called via "Upload" button */
- rsprintf("function chkupload() \n");
- rsprintf("{ \n");
- rsprintf(" if (document.form1.attfile.value == \"\") { \n");
- rsprintf(" alert(\"%s\"); \n", loc("No attachment file specified"));
- rsprintf(" return false; \n");
- rsprintf(" } \n");
- rsprintf(" submitted = true; \n");
- rsprintf(" return true; \n");
- rsprintf("} \n\n");
+ rsprintf("function chkupload()\n");
+ rsprintf("{\n");
+ rsprintf(" if (document.form1.attfile.value == \"\") {\n");
+ rsprintf(" alert(\"%s\");\n", loc("No attachment file specified"));
+ rsprintf(" return false;\n");
+ rsprintf(" }\n");
+ rsprintf(" submitted = true;\n");
+ rsprintf(" return true;\n");
+ rsprintf("}\n\n");
/* cond_submit() gets called via selection of new conditional attribute */
- rsprintf("function cond_submit() \n");
- rsprintf("{ \n");
- rsprintf(" submitted = true; \n");
- rsprintf(" document.form1.submit(); \n");
- rsprintf("} \n\n");
+ rsprintf("function cond_submit()\n");
+ rsprintf("{\n");
+ rsprintf(" submitted = true;\n");
+ rsprintf(" document.form1.submit();\n");
+ rsprintf("}\n\n");
/* abandon() gets called "onUnload" */
- rsprintf("function unload() \n");
- rsprintf("{ \n");
- rsprintf(" if (!submitted && modified) { \n");
- rsprintf(" var subm = confirm(\"%s\"); \n", loc("Submit modified ELOG entry?"));
- rsprintf(" if (subm) { \n");
- rsprintf(" document.form1.jcmd.value = \"%s\"; \n", loc("Submit"));
- rsprintf(" document.form1.submit(); \n");
- rsprintf(" } else { \n");
- rsprintf(" document.form1.jcmd.value = \"%s\"; \n", loc("Back"));
- rsprintf(" document.form1.submit(); \n");
- rsprintf(" } \n");
- rsprintf(" } \n");
- rsprintf(" if (!submitted && !modified) { \n");
- rsprintf(" document.form1.jcmd.value = \"%s\"; \n", loc("Back"));
- rsprintf(" document.form1.submit(); \n");
- rsprintf(" } \n");
- rsprintf("} \n\n");
+ rsprintf("function unload()\n");
+ rsprintf("{\n");
+ rsprintf(" if (!submitted && modified) {\n");
+ rsprintf(" var subm = confirm(\"%s\");\n", loc("Submit modified ELOG entry?"));
+ rsprintf(" if (subm) {\n");
+ rsprintf(" document.form1.jcmd.value = \"%s\";\n", loc("Submit"));
+ rsprintf(" document.form1.submit();\n");
+ rsprintf(" } else {\n");
+ rsprintf(" document.form1.jcmd.value = \"%s\";\n", loc("Back"));
+ rsprintf(" document.form1.submit();\n");
+ rsprintf(" }\n");
+ rsprintf(" }\n");
+ rsprintf(" if (!submitted && !modified) {\n");
+ rsprintf(" document.form1.jcmd.value = \"%s\";\n", loc("Back"));
+ rsprintf(" document.form1.submit();\n");
+ rsprintf(" }\n");
+ rsprintf("}\n\n");
/* mod() gets called via throuch "onchange" event */
- rsprintf("function mod() \n");
- rsprintf("{ \n");
- rsprintf(" modified = true; \n");
- rsprintf(" window.status = \"%s\"; \n", loc("Entry has been modified"));
- rsprintf("} \n\n");
+ rsprintf("function mod()\n");
+ rsprintf("{\n");
+ rsprintf(" modified = true;\n");
+ rsprintf(" window.status = \"%s\";\n", loc("Entry has been modified"));
+ rsprintf("}\n\n");
/* switch_smileys turn on/off the smiley bar by setting the smcmd, which in turn
sets the hsm=0/hsm=1 cookie */
- rsprintf("function switch_smileys() \n");
- rsprintf("{ \n");
+ rsprintf("function switch_smileys()\n");
+ rsprintf("{\n");
if (show_smileys)
- rsprintf(" document.form1.smcmd.value = 'hsm'; \n");
+ rsprintf(" document.form1.smcmd.value = 'hsm';\n");
else
- rsprintf(" document.form1.smcmd.value = 'ssm'; \n");
- rsprintf(" document.form1.submit(); \n");
- rsprintf("} \n\n");
+ rsprintf(" document.form1.smcmd.value = 'ssm';\n");
+ rsprintf(" document.form1.submit();\n");
+ rsprintf("}\n\n");
-
- /* elcode() gets called by selecting ELCode buttons */
- if (stristr(browser, "MSIE") && !stristr(browser, "opera")) { /* Internet Explorer */
- rsprintf("function elcode(text, tag, value) \n");
- rsprintf("{ \n");
- rsprintf(" text.focus(); \n");
- rsprintf(" sel = document.selection; \n");
- rsprintf(" rng = sel.createRange(); \n");
- rsprintf(" rng.colapse; \n");
- rsprintf(" \n");
- rsprintf(" is_range = rng.text.length > 0; \n");
- rsprintf(" if (tag == '') \n");
- rsprintf(" str = rng.text + value; \n");
- rsprintf(" else if (value == '') \n");
- rsprintf(" str = '[' + tag + ']' + rng.text + '[/' + tag + ']'; \n");
- rsprintf(" else \n");
- rsprintf(" str = '[' + tag + '=' + value + ']' + rng.text + '[/' + tag + ']'; \n");
- rsprintf(" \n");
- rsprintf(" rng.text = str; \n");
- rsprintf(" if (!is_range) { \n");
- rsprintf(" rng.moveStart('character', -tag.length-3); \n");
- rsprintf(" rng.moveEnd('character', -tag.length-3); \n");
- rsprintf(" rng.select(); \n");
- rsprintf(" } \n");
- rsprintf(" \n");
- rsprintf(" text.focus(); \n");
- rsprintf("} \n");
- } else if (stristr(browser, "Mozilla") && !stristr(browser, "opera") && !stristr(browser, "konqueror")) {
- /* mozilla, firefox, netscape */
- rsprintf("function elcode(text, tag, value) \n");
- rsprintf("{ \n");
- rsprintf(" var selection = ''; \n");
- rsprintf(" var str; \n");
- rsprintf(" \n");
- rsprintf(" selection = text.value.substring(text.selectionStart, text.selectionEnd); \n");
- rsprintf(" \n");
- rsprintf(" if (tag == '') \n");
- rsprintf(" str = selection + value; \n");
- rsprintf(" else if (value == '') \n");
- rsprintf(" str = '[' + tag + ']' + selection + '[/' + tag + ']'; \n");
- rsprintf(" else \n");
- rsprintf(" str = '[' + tag + '=' + value + ']' + selection + '[/' + tag + ']'; \n");
- rsprintf(" \n");
- rsprintf(" start = text.selectionStart; \n");
- rsprintf(" end = text.textLength; \n");
- rsprintf(" endtext = text.value.substring(text.selectionEnd, end); \n");
- rsprintf(" starttext = text.value.substring(0, start); \n");
- rsprintf(" text.value = starttext + str + endtext; \n");
- rsprintf(" if (selection.length > 0) { \n");
- rsprintf(" text.selectionStart = start; \n");
- rsprintf(" text.selectionEnd = text.selectionStart + str.length; \n");
- rsprintf(" } else { \n");
- rsprintf(" if (tag == '') \n");
- rsprintf(" text.selectionStart = start + value.length; \n");
- rsprintf(" else \n");
- rsprintf(" text.selectionStart = start + tag.length + 2; \n");
- rsprintf(" text.selectionEnd = text.selectionStart; \n");
- rsprintf(" } \n");
- rsprintf(" \n");
- rsprintf(" text.focus(); \n");
- rsprintf("} \n");
- } else {
- rsprintf("function elcode(text, tag, value) \n");
- rsprintf("{ \n");
- rsprintf(" var str; \n");
- rsprintf(" \n");
- rsprintf(" if (tag == '') \n");
- rsprintf(" str = value; \n");
- rsprintf(" else if (value == '') \n");
- rsprintf(" str = '[' + tag + ']' + '[/' + tag + ']'; \n");
- rsprintf(" else \n");
- rsprintf(" str = '[' + tag + '=' + value + ']' + '[/' + tag + ']'; \n");
- rsprintf(" \n");
- rsprintf(" text.value += str; \n");
- rsprintf(" text.focus(); \n");
- rsprintf("} \n");
- }
+ /* strings for elcode.js */
+ rsprintf("linkText_prompt = '%s';\n", loc("Enter name of hypelink"));
+ rsprintf("linkURL_prompt = '%s';\n", loc("Enter URL of hypelink"));
+ if (stristr(browser, "MSIE") && !stristr(browser, "opera"))
+ rsprintf("browser = 'MSIE';\n");
+ else if (stristr(browser, "Mozilla") && !stristr(browser, "opera") && !stristr(browser, "konqueror"))
+ rsprintf("browser = 'Mozilla';\n");
+ else
+ rsprintf("browser = 'Other';\n");
rsprintf("//-->\n");
- rsprintf("\n\n");
+ rsprintf("\n");
+
+ /* optionally load ELCode JavaScript code */
+ if (enc_selected == 0)
+ rsprintf("\n\n");
/* external script if requested */
if (isparam("js")) {
@@ -9649,26 +9620,26 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
}
if (enc_selected == 0) {
- rsprintf("
");
rsputs2(text);
rsputs("");
- } else
+ } else if (strieq(encoding, "ELCode"))
+ rsputs_elcode(text);
+ else
rsputs(text);
rsprintf("