Gnus development mailing list
 help / color / mirror / Atom feed
From: Wes Hardaker <wes@hardakers.net>
Subject: Re: ... and now for something completely different: User Friendliness
Date: Tue, 07 Jan 2003 07:27:38 -0800	[thread overview]
Message-ID: <sd7kdhc74l.fsf@wanderer.hardakers.net> (raw)
In-Reply-To: <m3bs2tild8.fsf@quimbies.gnus.org> (Lars Magne Ingebrigtsen's message of "Tue, 07 Jan 2003 06:23:31 +0100")

>>>>> On Tue, 07 Jan 2003 06:23:31 +0100, Lars Magne Ingebrigtsen <larsi@gnus.org> said:

Lars> I didn't find any examples on the page as to what the config
Lars> generating language looks like -- do you have an example?

Oh, uh, yeah...  This is defined in perl structures:

add_primary('notification_destinations',
            title => "Setting up a notification receiver",
            sub_modules => 'target_addr',
            questions => [{ name => 'destination',
                            type => 'menu',
                            text => 'enter the notification destination',
                            # inline at-run-time value extraction
                            values => [\&net_policy_select,"select name from cli
ents"]
                          },
                          { name => 'snmpNotifyType',
                            text =>
                            'What type of notification do you want to send?',
                            type => 'radio',
                            values => [qw(1 2)],
                            labels => {'1' => 'trap',
                                       '2' => 'inform'}},
                          { name => 'SNMPVersion',
                            type => 'menu',
                            text => 'What version of the SNMP protocol should th
e notification be sent over?',
                            values => [qw(0 1 3)],
                            labels => {'0' => 'SNMP version 1',
                                       '1' => 'SNMP version 2c',
                                       '3' => 'SNMP version 3',
                                      }
                          }],
            post_answers => [
                             sub { my $wiz = shift;
                                   if (param(SNMPVersion) eq '3') {
                                       $wiz->add_late_todos('target_param_3');
                                   } else {
                                       $wiz->add_late_todos('target_param_commun
ity');
                                   }
                                   return 'OK';
                               }
                             ],
            actions_descr => ['Adding the notification receiver mapping'],
            actions => [[\&net_policy_sql,'insert into snmpNotifyTable(snmpNotif
yName,snmpNotifyTag,snmpNotifyType,snmpNotifyStorageType,snmpNotifyRowStatus) va
lues(@destination@,@destination@,@snmpNotifyType@,3,4)'],
                        'Adding the notification receiver']);

add_primary('target_addr',
            title => 'Configure the notification destination',
            questions =>
            [
             { text => "Timeout length",
               type => text,
               name => 'snmpTargetAddrTimeout',
               # default value:
               values => 1500 },
             { text => "Number of Retries",
               type => text,
               name => 'snmpTargetAddrRetryCount',
               values => 3 }
             { type => 'hidden',  # hard coded value
               name => 'snmpTargetAddrTAddress',
               # inline at-run-time value extraction
               values => [sub {my $x = net_policy_select('bogus','select ipaddr
from clients where name = @destination@');
                               $x->[0] .= "00A2";
                               return $x}] }
            ],
            actions => [[sub {do_something_with(param('snmpTargetAddrTimeout'));
                              #...}],
                       # prints to the users screen
                       'Configuring the notification receiver\'s address']);

I actually need to write the documentation for the module, but my
coworker needs that asap as well so it'll be done shortly.  Also,
ignore the net_policy_select and net_policy_sql functions referenced
above.  They're project specific.  This data will be hard to read
because you don't understand what it's trying to do (it's very SNMP
specific, which is certainly a protocol you don't likely grok).
-- 
"The trouble with having an open mind, of course, is that people will
 insist on coming along and trying to put things in it."   -- Terry Pratchett



  reply	other threads:[~2003-01-07 15:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-02  7:37 Lars Magne Ingebrigtsen
2003-01-02 10:11 ` Frank Schmitt
2003-01-02 18:19   ` Lars Magne Ingebrigtsen
2003-01-02 19:29 ` Simon Josefsson
2003-01-02 19:37   ` Lars Magne Ingebrigtsen
2003-01-02 22:10     ` Simon Josefsson
2003-01-06 16:05 ` Wes Hardaker
2003-01-07  5:23   ` Lars Magne Ingebrigtsen
2003-01-07 15:27     ` Wes Hardaker [this message]
2003-01-08  4:45       ` Lars Magne Ingebrigtsen
2003-01-08  6:31         ` Wes Hardaker
2003-01-08 15:18         ` Ted Zlatanov
2003-01-11 20:10           ` Lars Magne Ingebrigtsen
2003-01-13  0:44             ` Wes Hardaker
2003-01-13 18:24               ` Lars Magne Ingebrigtsen
2003-01-13 19:22             ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sd7kdhc74l.fsf@wanderer.hardakers.net \
    --to=wes@hardakers.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).