From 7e16a552ef10514015aeb6545e09c17d35b0ccfa Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 16 Sep 2010 22:08:36 +0000 Subject: [PATCH] Implemented 'Custom xxx form' SVN revision: 2326 --- src/elogd.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index afc7af55..13ea859d 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -9194,8 +9194,21 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL date[0] = 0; locked_by[0] = 0; - /* check for custom form */ - if (getcfg(lbs->name, "Custom form", str, sizeof(str))) { + /* check for custom form for new entries */ + if (!bedit && getcfg(lbs->name, "Custom new form", str, sizeof(str))) { + /* check if file starts with an absolute directory */ + if (str[0] == DIR_SEPARATOR || str[1] == ':') + strcpy(file_name, str); + else { + strlcpy(file_name, logbook_dir, sizeof(file_name)); + strlcat(file_name, str, sizeof(file_name)); + } + send_file_direct(str); + return; + } + + /* check for custom form for editing an entry */ + if (bedit && getcfg(lbs->name, "Custom edit form", str, sizeof(str))) { /* check if file starts with an absolute directory */ if (str[0] == DIR_SEPARATOR || str[1] == ':') strcpy(file_name, str); @@ -23263,6 +23276,19 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command) _current_message_id = message_id; email = strieq(command, "email") || strieq(command, "oldemail"); + /* check for custom form to display entry */ + if (getcfg(lbs->name, "Custom display form", str, sizeof(str))) { + /* check if file starts with an absolute directory */ + if (str[0] == DIR_SEPARATOR || str[1] == ':') + strcpy(file_name, str); + else { + strlcpy(file_name, logbook_dir, sizeof(file_name)); + strlcat(file_name, str, sizeof(file_name)); + } + send_file_direct(str); + return; + } + /* check for guest access */ if (!getcfg(lbs->name, "Guest Menu commands", menu_str, sizeof(menu_str)) || isparam("unm") != 0) getcfg(lbs->name, "Menu commands", menu_str, sizeof(menu_str));