1: %TUIMENU ;VCL/SNW-FREEM MENU HANDLER; 03/09/2025 06:26 PM
2: ;0.0;FreeM;****FREEM**;Serena Willis @2025
3: ;
4: ; $Id: %TUIMENU.m,v 1.2 2025/03/10 00:38:15 snw Exp $
5: ; FreeM Menu Handler
6: ;
7: ;
8: ; Author: Serena Willis <snw@coherent-logic.com>
9: ; Copyright (C) 1998 MUG Deutschland
10: ; Copyright (C) 2023, 2025 Coherent Logic Development LLC
11: ;
12: ;
13: ; This file is part of FreeM.
14: ;
15: ; FreeM is free software: you can redistribute it and/or modify
16: ; it under the terms of the GNU Affero Public License as published by
17: ; the Free Software Foundation, either version 3 of the License, or
18: ; (at your option) any later version.
19: ;
20: ; FreeM is distributed in the hope that it will be useful,
21: ; but WITHOUT ANY WARRANTY; without even the implied warranty of
22: ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: ; GNU Affero Public License for more details.
24: ;
25: ; You should have received a copy of the GNU Affero Public License
26: ; along with FreeM. If not, see <https://www.gnu.org/licenses/>.
27: ;
28: ; $Log: %TUIMENU.m,v $
29: ; Revision 1.2 2025/03/10 00:38:15 snw
30: ; Phase 3 of REUSE compliance and header reformatting
31: ;
32: ;
33: ; SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
34: ; SPDX-License-Identifier: AGPL-3.0-or-later
35: Q
36: GO(S,I) ;
37: N %,C,DS,OPT S (%,OPT)=""
38: D DISP(S,I)
39: NXT S DS=1 W "Select ",$$G^%DB(S,I,"NAME")," Option//",$$G^%DB(S,I,"DEFAULT")," "
40: R %
41: I (%="q")!(%="Q") W " Quit",! Q
42: I %="?" D DISP(S,I) G NXT
43: S:%="" %=$$G^%DB(S,I,"DEFAULT"),DS=0
44: S %=$TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
45: S:'$D(@S@(I,"OPTS",%)) %=""
46: I %="" W !,"Invalid selection. Press ? to view all options.",! G NXT
47: W:DS " " W @S@(I,"OPTS",%)
48: I ('$D(@S@(I,"ACT",%)))&('$D(@S@(I,"TAG",%))) W !,"No action or tag defined for ",%,".",! G NXT
49: K %TAG I $D(@S@(I,"TAG",%)) S %TAG=@S@(I,"TAG",%)
50: I $D(@S@(I,"ACT",%)) S C="D "_@S@(I,"ACT",%) X C K C G NXT
51: Q
52: DISP(S,I) ;
53: N % S %=""
54: W !,$$G^%DB(S,I,"DESC")," - ",$$G^%DB(S,I,"NAME"),!,!
55: F S %=$O(@S@(I,"OPTS",%)) Q:%="" D
56: . W " ",%,") ",@S@(I,"OPTS",%),!
57: W !," Q) Quit",!,!
58: Q
59:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>