Dynamically generate a table showing all installed activities, and show
which ones are enbled in the site's WebGUI.conf. Reword the same table in the Macros file.
This commit is contained in:
parent
3b5f69c8c7
commit
8515db2311
3 changed files with 87 additions and 3 deletions
|
|
@ -24,6 +24,53 @@ our $HELP = {
|
|||
],
|
||||
},
|
||||
|
||||
'list of installed activities' => {
|
||||
title => 'list of installed activities',
|
||||
body => sub {
|
||||
my $session = shift;
|
||||
my $dir = join '/', $session->config->getWebguiRoot,"lib","WebGUI","Workflow","Activity";
|
||||
opendir (DIR,$dir) or $session->errorHandler->fatal("Can't open Activity directory: $dir!");
|
||||
my @installedActivities = sort map { s/\.pm//; $_; }
|
||||
grep { /\.pm$/ }
|
||||
readdir(DIR); ##list of namespaces
|
||||
closedir(DIR);
|
||||
|
||||
##Build list of enabled activities, by namespace, by reversing session hash:
|
||||
my %workflows = %{ $session->config->get("workflowActivities") };
|
||||
my %activities = map { s/^WebGUI::Workflow::Activity:://; $_ => 1 }
|
||||
map { @{ $workflows{$_} } }
|
||||
keys %workflows;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Workflow_Activity');
|
||||
my $yes = $i18n->get(138, 'WebGUI');
|
||||
my $no = $i18n->get(139, 'WebGUI');
|
||||
my $activity_table =
|
||||
join "\n",
|
||||
map { join '', '<tr><td>', $_,
|
||||
'</td><td>',
|
||||
($activities{$_} ? $yes : $no),
|
||||
'</td></tr>'
|
||||
} @installedActivities;
|
||||
|
||||
$activity_table =
|
||||
join("\n",
|
||||
$i18n->get('activities list body'),
|
||||
'<table border="1" cellpadding="3">',
|
||||
'<tr><th>',$i18n->get('activity name'),
|
||||
'</th><th>',
|
||||
$i18n->get('activity enabled header'),
|
||||
'</th></tr>',$activity_table,'</table>');
|
||||
},
|
||||
isa => [
|
||||
],
|
||||
fields => [
|
||||
],
|
||||
variables => [
|
||||
],
|
||||
related => [
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1; ##All perl modules must return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue