From 3e65413647ae58ca48ef63565a48f393d5ebd0ac Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Fri, 13 Jul 2007 15:04:24 +0000 Subject: [PATCH] Implemented forward/backward navigation with Ctrl-PgUp/PgDn/Home/End SVN revision: 1886 --- scripts/elcode.js | 41 +++++++++++++++++++++++++ src/elogd.c | 77 ++++++++++++++++++++++++++++++----------------- 2 files changed, 90 insertions(+), 28 deletions(-) diff --git a/scripts/elcode.js b/scripts/elcode.js index 2ddcf6b9..6091236c 100755 --- a/scripts/elcode.js +++ b/scripts/elcode.js @@ -213,3 +213,44 @@ function elKeyPress(evt) return true; } + +function browse(evt) +{ + evt = (evt) ? evt : window.event; + var unicode = evt.charCode ? evt.charCode : evt.keyCode; + var actualkey = String.fromCharCode(unicode); + + if (evt.ctrlKey && !evt.shiftKey && !evt.altKey) { + + if (browser == 'MSIE') { + if (unicode == 10) + unicode = 13; + else + unicode += 96; + actualkey = String.fromCharCode(unicode); + } + + if (actualkey == "$") { + // home + window.location.href = "?cmd_first.x=1"; + return false; + } + if (actualkey == "#") { + // end + window.location.href = "?cmd_last.x=1"; + return false; + } + if (actualkey == "!") { + // page up + window.location.href = "?cmd_previous.x=1"; + return false; + } + if (actualkey == "\"") { + // page down + window.location.href = "?cmd_next.x=1"; + return false; + } + } + + return true; +} diff --git a/src/elogd.c b/src/elogd.c index 2549e7d1..c3d6630e 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -7087,16 +7087,36 @@ void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head, rsprintf("title=\"ELOG %s\" ", lbs->name); rsprintf("href=\"elog.rdf\" />\n"); } - + if (close_head) rsprintf("\n"); } -void show_standard_header(LOGBOOK * lbs, BOOL expires, char *title, char *path, BOOL rss_feed, char *cookie) +void show_standard_header(LOGBOOK * lbs, BOOL expires, char *title, char *path, BOOL rss_feed, char *cookie, + char *script) { - show_html_header(lbs, expires, title, TRUE, rss_feed, cookie, FALSE); + if (script) { + show_html_header(lbs, expires, title, FALSE, rss_feed, cookie, FALSE); + + rsprintf("\n"); + rsprintf("\n\n"); + rsprintf("\n"); + } else + show_html_header(lbs, expires, title, TRUE, rss_feed, cookie, FALSE); - rsprintf("\n"); + if (script) + rsprintf("\n", script); + else + rsprintf("\n"); show_top_text(lbs); @@ -7739,7 +7759,7 @@ void show_error(char *error) void show_query(LOGBOOK *lbs, char *title, char *query_string, char *button1, char *button1_url, char *button2, char *button2_url) { - show_standard_header(lbs, TRUE, "ELog query", title, FALSE, NULL); + show_standard_header(lbs, TRUE, "ELog query", title, FALSE, NULL, NULL); rsprintf(""); @@ -8290,7 +8310,7 @@ void show_change_pwd_page(LOGBOOK * lbs) } } - show_standard_header(lbs, TRUE, loc("ELOG change password"), NULL, FALSE, NULL); + show_standard_header(lbs, TRUE, loc("ELOG change password"), NULL, FALSE, NULL, NULL); rsprintf("
"); @@ -10820,7 +10840,7 @@ void show_find_form(LOGBOOK * lbs) /*---- header ----*/ - show_standard_header(lbs, FALSE, loc("ELOG find"), NULL, FALSE, NULL); + show_standard_header(lbs, FALSE, loc("ELOG find"), NULL, FALSE, NULL, NULL); /*---- title ----*/ @@ -12286,7 +12306,7 @@ void show_config_page(LOGBOOK * lbs) /*---- header ----*/ - show_standard_header(lbs, TRUE, loc("ELOG user config"), ".", FALSE, NULL); + show_standard_header(lbs, TRUE, loc("ELOG user config"), ".", FALSE, NULL, NULL); /*---- javascript to warn removal of user ----*/ rsprintf("