diff --git a/src/elogd.c b/src/elogd.c index 00b52280..68eed11f 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -18536,7 +18536,18 @@ BOOL is_user_allowed(LOGBOOK * lbs, char *command) /*------------------------------------------------------------------*/ -BOOL is_command_allowed(LOGBOOK * lbs, char *command) +int is_draft(LOGBOOK * lbs, int message_id) +{ + char draft[256]; + + el_retrieve(lbs, message_id, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, draft); + return draft[0]; +} + +/*------------------------------------------------------------------*/ + +BOOL is_command_allowed(LOGBOOK * lbs, char *command, int message_id) { char str[1000], menu_str[1000], other_str[1000]; char menu_item[MAX_N_LIST][NAME_LENGTH]; @@ -18651,7 +18662,7 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command) strlcat(menu_str, "Config, ", sizeof(menu_str)); } - strcpy(other_str, "Preview, Back, Search, Download, Import, CSV Import, XML Import, "); + strlcpy(other_str, "Preview, Back, Search, Download, Import, CSV Import, XML Import, ", sizeof(other_str)); strlcat(other_str, "Cancel, First, Last, Previous, Next, Requested, Forgot, ", sizeof(other_str)); /* only allow Submit & Co if "New" is allowed */ @@ -18664,10 +18675,14 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command) /* admin commands */ if (is_admin_user(lbs->name, getparam("unm"))) { - strcat(other_str, "Remove user, New user, Activate, "); + strlcat(other_str, "Remove user, New user, Activate, ", sizeof(other_str)); } else if (getcfg(lbs->name, "Self register", str, sizeof(str)) && atoi(str) > 0) { - strcat(other_str, "Remove user, New user, "); + strlcat(other_str, "Remove user, New user, ", sizeof(other_str)); } + + /* allow always edit of draft messages */ + if (is_draft(lbs, message_id)) + strlcat(other_str, "Edit, ", sizeof(other_str)); /* allow change password if "config" possible */ if (strieq(command, loc("Change password")) && stristr(menu_str, "Config")) { @@ -24511,8 +24526,11 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command) loc("You might however then overwrite each other's modifications")); } else { if (draft[0]) { - rsprintf("%s\n", + rsprintf("%s\n", loc("This is a draft message, edit and submit it to make it permament")); + rsprintf(" ", + loc("Edit"), message_id); + rsprintf("\n"); } } @@ -25933,35 +25951,41 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail) url_encode(str, sizeof(str)); rsprintf("\n", str); - rsprintf(""); + rsprintf("
"); if (fail == 1) { strlcpy(str, loc("Invalid user name or password"), sizeof(str)); - rsprintf("\n", str); + rsprintf("\n", str); } if (fail == 2) { sprintf(str, loc("User \"%s\" has no access to this logbook"), getparam("unm")); - rsprintf("\n", str); + rsprintf("\n", str); } - rsprintf("\n", loc("Please login")); + rsprintf("\n", loc("Please login")); - rsprintf("\n", loc("Username")); - rsprintf("\n", - isparam("unm") ? getparam("unm") : ""); + rsprintf("\n"); - rsprintf("\n", loc("Password")); - rsprintf("\n"); + rsprintf("\n"); if (!getcfg(lbs->name, "Login expiration", str, sizeof(str)) || atof(str) > 0) { - rsprintf("\n"); - rsprintf("", + rsprintf("", loc("Submit")); rsprintf("
%s!
%s!
%s!
%s!
%s
%s
%s:
\n"); + rsprintf("\n"); + rsprintf("\n", loc("Username")); + rsprintf("\n", + isparam("unm") ? getparam("unm") : "", loc("Username")); + rsprintf("
%s:
\n"); + rsprintf("\n"); + rsprintf("\n", loc("Password")); + rsprintf("\n"); + rsprintf("
"); + rsprintf("
"); if (isparam("urem") && atoi(getparam("urem")) == 0) rsprintf("\n"); else rsprintf("\n"); - rsprintf("%s
\n", loc("Keep me logged in on this computer")); + rsprintf("%s\n", loc("Keep me logged in on this computer")); if (str[0] == 0) rsprintf(loc("for the next %d days"), 31); @@ -25982,7 +26006,7 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail) show_self_register = (getcfg(lbs->name, "Self register", str, sizeof(str)) && atoi(str) > 0); if (show_forgot_link || show_self_register) - rsprintf("
\n"); + rsprintf("
\n"); if (show_forgot_link) rsprintf("%s", loc("Forgot"), loc("Forgot password?")); @@ -25998,7 +26022,7 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail) if (show_forgot_link || show_self_register) rsprintf("
\n"); @@ -26894,6 +26918,7 @@ void interprete(char *lbook, char *path) else _logging_level = 2; set_condition(""); + message_id = atoi(dec_path); /* evaluate "jcmd" */ if (isparam("jcmd") && *getparam("jcmd")) @@ -27548,7 +27573,7 @@ void interprete(char *lbook, char *path) } /* check if command in menu list */ - if (!is_command_allowed(lbs, command)) { + if (!is_command_allowed(lbs, command, message_id)) { /* redirect to login page for new command */ if (strieq(command, loc("New")) && !isparam("unm")) { show_login_page(lbs, _cmdline, 0); @@ -27668,7 +27693,6 @@ void interprete(char *lbook, char *path) } } - message_id = atoi(dec_path); if (strieq(command, loc("Upload")) || strieq(command, "Upload")) { show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE); diff --git a/themes/default/default.css b/themes/default/default.css index 0dde351e..0853fc84 100755 --- a/themes/default/default.css +++ b/themes/default/default.css @@ -577,6 +577,70 @@ td { .dlgform { background-color:#DDEEBB; padding:5px; + text-align:center; +} + +/* login page */ +.login_frame { + width:200px; + background-color:#486090; + border:1px solid #486090; + border-radius:25px; + overflow:hidden; + margin-top:2cm; + -webkit-box-shadow: 10px 10px 20px 0px rgba(128,128,128,1); + -moz-box-shadow: 10px 10px 20px 0px rgba(128,128,128,1); + box-shadow: 10px 10px 20px 0px rgba(128,128,128,1); +} + +.login_form { + background-color:#DDEEBB; + padding:8px; + padding-left:25px; + padding-right:25px; + text-align:center; +} + +.login_title { + background-color:#486090; + color:white; + font-size:18px; + text-align:center; + padding:10px; +} + +.login_submit { + font-size:18px; + padding:10px; + padding-top:5px; + padding-bottom:5px; + background-color:rgb(69,181,69); + color:white; + border-radius:8px; +} + +.overlay_wrapper { + position: relative; + top:0; + left:0; + z-index:10; + background:none; +} + +.overlabel { + pointer-events: none; + position: absolute; + top: -5px; + left: 5px; + z-index: 1; + color: #999; + font-size: 18px; +} + +.login_input { + font-size: 18px; + padding: 3px; + width:200px; } .calwindow {