Confirm Exit From MAIN MENU
Scott Walker
ScottWalker at RAMSystemsCorp.com
Mon Jul 19 19:54:27 PDT 2010
Brian,
Thank you much for such a complete answer.
Regards,
Scott
-----Original Message-----
From:
filepro-list-bounces+scottwalker=ramsystemscorp.com at lists.celestial.com
[mailto:filepro-list-bounces+scottwalker=ramsystemscorp.com at lists.celestial.
com] On Behalf Of Brian K. White
Sent: Monday, July 19, 2010 5:37 PM
Cc: filepro-list at lists.celestial.com
Subject: Re: Confirm Exit From MAIN MENU
On 7/19/2010 12:11 PM, Scott Walker wrote:
>
>
> Sometimes I am a few User Menus deep in my application and I start
pressing
> "X" to back out, sometimes I hit "X" one too many times and actually back
> out of the MAIN MENU (and then exits me from the login).
>
>
>
> Is there any practical way to put a confirmation on just my main menu, so
> when you press "X" it asks you for to confirm that you want to exit?
We do this with a special login script. Here is a simplified version of it.
Save this file somewhere that will be in every users $PATH
ie: /usr/bin/plogin (which is a _terrible place to put anything like
this and not where I have ours installed but I don't want to get sucked
into a discussion about editing system defaults in /etc/profile.local)
/usr/bin/plogin:
trap "" 2 3
unset x
until [[ "$x" = "Y" ]] ; do
$@
echo "Exit? (Y/n): " ; read x
case "$x" in [Yy]*|"") x="Y" ;; esac
done
remember chmod 755 /usr/bin/plogin
Now put at the end of a users .profile :
exec plogin p menuname
They can xxxxx and it stops at the top menu.
If they hit Enter at the y/n prompt it will exit. If they hit xxxxxEnter
or anything other than Y or y or Enter, it will just put them back in
the top menu.
The trap statement makes it so that the user can't break out of the
script and gain access to the shell, yet, the break key still works
normally in filepro and if the connection drops the hangup signal from
sshd/telnetd/getty still works to close their programs.
In our case there is more to it. We have multiple companies per physical
server and every instance of filepro is launched by a start script that
sets up per-customer PFDATA PFDIR PFQUAL. So our plogin does above, but
also uses $LOGNAME to find a set of per-user settings from a filepro
file or from a plain text file, and uses those settings to decided which
of several start scripts to run, and what menu name to run with that
start script, or display a message if either is empty for any reason.
And we don't put anything on the plogin command line. We edit the
skeleton .profile file so that when you run useradd, every user already
has exec plogin right when they're created, and no admin ever has to
edit a .profile file. All the users startup settings are administered
right in a filepro file using filepro processing & screens that any user
with access to that program can use. (no root required) and instead of
"$@" above, there is essentially "$system p $menu" where $system and
$menu are looked up.
--
bkw
_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list