# All scripts need a starting point - HOME is the default starting point
{HOME}
                    Welcome to NAG (tm)!

This sample script demonstrates some of the basic capabilities of NAG. The 
interactive results aren't all that exciting; but by looking at the menumess
file, you'll see how things are done.

All NAG input is topics defined within a menu; topics can result in one of
three acctions:

             o {GO[home]} to another menu (a hyper text type link)
             o Can modify a data {FIELD[home]}
             o Can invoke the {LIST[home]} manager

Other covered topics to look at:

             o Some NAG script {STYLE[home]} hints
             o See how easy it's to {HOOK[home]} in a special C program
               function
             o Calling a {SYSTEM[home]} function

# All menus are terminated with the following!
{_END}

# remember: best to always bind menus to their reference screens.
{FIELD[home]}

This menu demostrates how fields are handled. Shows two types: the global
fields in the .nagrc file, and menu associated fields. Look at the menumess
file for details.

If you've run NAG with terminal setup, and answers indicated ANSI support,
then the following will say 'ansi': $term

Here's a {FIELD[field][home]}: ~testfield

You can either enter 'field=something', or simply entering 'field' will invoke
the field input menu. Be sure see comprehensive doc and script comments for
details.

# Operational notes: once you enter something for field, a file named
# 'context.field[home]' is created with your input.
#
# Also note how binding let's you give context dependent meaning to the topic
# FIELD

{_END}

{FIELD[field][home]}
# Operational note: you reference field data file as bound to the menu it's
# referenced from, and not from here! This is simply the manual invocation
# of the field input screen. Note that prompt is definable.
{_SETFIELD} field[home] testfield 1 Enter a value for the FIELD:
{_POP}
{_END}

{LIST[home]}

OK, listen up - this is a full power list manager example. When you enter
{DOIT[list][home]}, you'll be presented with a list of files. To select some, 
simply enter the corresponding letter; enter again to deselect.

See the NAG script and listmake.pl for important details!

# Create the list of files - NOTE: you don't have to put any list creation
# scripts here; putting them here means they are invoked everytime this menu
# is entered - consider performance implication. List can be created any time;
# things works as long as list is appropriately named in and right directory.

{_POPEN} ./listmake.pl ./list.list[home]

{_END}

{DOIT[list][home]}
# Custom list title
{_LISTTITLE} -- Please select some files for download --
# Note that whatever the user selects, is placed in file 'context.list[home]'
# Use THIS file to act on user selection.
# Also note VVVVVVVVVV - filename bound to menu from which referenced!
{_SETFIELD} list[home] files * Enter corresponding number to select/deselect a file:
{_POP}
{_END}

{STYLE[home]}

Actual NAG experience has shown that quality content is as important as
quality navigation capabilities. NAG makes quality navigation possible; you
have to make quality content possible. Some useful guidelines:

  + Be consistent in NAG terminology. I try to use TOPIC for commands and MENU
    for the different screens.

  + Avoid tabs in the NAG script at all costs - tabs are sometimes handled in
    weird ways.

  + Though NAG supports 32 levels of link nesting, in reality, most users
    can NOT tolerate more than 4.

That's about it - check out the comprehensive doc for more info and hints.

{_PROMPTTITLE} Enter a <CR> to continue.
{_END}

{GO[home]}

    See how simple it is to link menus.

    Entering only a <CR> reutrns you to previous menu. Entering a dash (-)
    redisplays this menu.

    There are no topics in this menu - enter some command and experience
    the error message. From the error message, you can either return here
    or jump to the HOME menu.

    When you look at the script, note the use of the _PROMPTTITLE directive to
    change the prompt to something appropriate.

{_PROMPTTITLE} Enter a <CR> to continue.
{_END}

{HOOK[home]}
{SAMPLE} String passed to sample hook function!

The 'HI THERE' is a printf statment in hook.c; the 'String passed...' just
shows what get's passed to the function.

NOTE: the SAMPLE topic is not bound to this menu; ir really should be, and if
you do bind, make sure that the topic is hooks.c includes binding syntax

# NOTE use of escapes in following line

(That is, would say \{SAMPLE[hook][home]\})

P.S. see script how above has to be escaped.

{_PROMPTTITLE} Enter a <CR> to continue.
{_END}

{SYSTEM[home]}

Look at this script to see how vi is invoked. NOTE: be careful when you do 
this!

If security is an issue - be sure SHELL is set to something like /bin/false
else users will be able to break out of the nag presentation!

Run {VI[system][home]}


{_PROMPTTITLE} Enter a <CR> to continue.
{_END}

{VI[system][home]}
{_SYSTEM} vi
{_POP}
{_END

{HELP}

All NAG scripts must have a HELP menu (unless you use PROMPTTILE in every menu
and therefore never use the default).

See the file help.menu for a starting point to incorporate into your
application.

{_PROMPTTITLE} Enter a <CR> to continue.
{_END}
