make the dynamic list of macros work again
This commit is contained in:
parent
5f93f2dc13
commit
dbab69eb2f
4 changed files with 35 additions and 46 deletions
|
|
@ -18,9 +18,35 @@ our $HELP = {
|
|||
|
||||
'macros list' => {
|
||||
title => 'macros list title',
|
||||
body => 'macros list body',
|
||||
fields => [
|
||||
],
|
||||
body => sub {
|
||||
my $session = shift;
|
||||
my $dir = join '/', $session->config->getWebguiRoot,"lib","WebGUI","Macro";
|
||||
opendir (DIR,$dir) or $session->errorHandler->fatal("Can't open Macro directory: $dir!");
|
||||
my @macros = map { s/Macro_//; s/\.pm//; $_; }
|
||||
grep { /\.pm$/ }
|
||||
readdir(DIR); ##list of namespaces
|
||||
closedir(DIR);
|
||||
|
||||
##Build list of enabled macros, by namespace, by reversing session hash:
|
||||
my %macros = reverse %{ $session->config->get("macros") };
|
||||
|
||||
my $macro_table =
|
||||
join "\n",
|
||||
map { join '', '<tr><td>', $_, '</td><td>',
|
||||
($macros{$_} ? ('^', $macros{$_}, '();') : ' '),
|
||||
'</td></tr>' }
|
||||
@macros;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Macros');
|
||||
$macro_table =
|
||||
join("\n",
|
||||
'<table border="1" cellpadding="3">',
|
||||
'<tr><th>',$i18n->get('macro name'),
|
||||
'</th><th>',
|
||||
$i18n->get('macro shortcut'),
|
||||
'</th></tr>',$macro_table,'</table>');
|
||||
},
|
||||
fields => [],
|
||||
related => sub { ##Hey, you gotta pass in the session var, right?
|
||||
my $session = shift;
|
||||
sort { $a->{tag} cmp $b->{tag} }
|
||||
|
|
|
|||
|
|
@ -304,7 +304,12 @@ sub www_viewHelp {
|
|||
}
|
||||
my %vars;
|
||||
$vars{uiLevelLabel} = $i18n->get('739', 'WebGUI');
|
||||
$vars{body} = $i18n->get($help->{body});
|
||||
if (ref $help->{body} eq 'CODE') {
|
||||
$vars{body} = $help->{body}->($session);
|
||||
}
|
||||
else {
|
||||
$vars{body} = $i18n->get($help->{body});
|
||||
}
|
||||
my $userUiLevel = $session->user->profileField("uiLevel");
|
||||
my $uiOverride = $session->form->process("uiOverride");
|
||||
foreach my $row (@{ $help->{fields} }) {
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
package WebGUI::i18n::English::Automated_Information;
|
||||
|
||||
##This module must not be preloaded, since it requires that $session
|
||||
##be populated when the module is use'ed.
|
||||
|
||||
use WebGUI::International;
|
||||
my $i18n = WebGUI::International->new($session, 'Macros');
|
||||
|
||||
##Get list of all macros by namespace/module name
|
||||
my $dir = join '/', $self->session->config->getWebguiRoot,"lib","WebGUI","Macro";
|
||||
opendir (DIR,$dir) or $self->session->errorHandler->fatal("Can't open Macro directory: $dir!");
|
||||
my @macros = map { s/Macro_//; s/\.pm//; $_; }
|
||||
grep { /\.pm$/ }
|
||||
readdir(DIR); ##list of namespaces
|
||||
closedir(DIR);
|
||||
|
||||
##Build list of enabled macros, by namespace by reversing session hash:
|
||||
my %macros = reverse %{ $self->session->config->get("macros") };
|
||||
|
||||
my $macro_table =
|
||||
join "\n",
|
||||
map { join '', '<tr><td>', $_, '</td><td>',
|
||||
($macros{$_} ? ('^', $macros{$_}, '();') : ' '),
|
||||
'</td></tr>' }
|
||||
@macros;
|
||||
|
||||
$macro_table =
|
||||
join("\n",
|
||||
'<table border="1" cellpadding="3">',
|
||||
'<tr><th>',$i18n->get('macro name'),
|
||||
'</th><th>',
|
||||
$i18n->get('macro shortcut'),
|
||||
'</th></tr>',$macro_table,'</table>');
|
||||
|
||||
our $I18N = {
|
||||
'macro table' => {
|
||||
message => $macro_table,
|
||||
lastUpdated => 1112466408,
|
||||
}
|
||||
};
|
||||
1;
|
||||
|
|
@ -19,7 +19,6 @@ our $I18N = {
|
|||
|
||||
'macros list body' => {
|
||||
message => q|<p>The set of available Macros is defined in the WebGUI configuration file. These Macros are available for use on your site:</p>
|
||||
^International("macro table","Automated_Information");
|
||||
|,
|
||||
context => 'Content for dynamically generated macro list',
|
||||
lastUpdated => 1114134745,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue