Macros have been converted to be configured from the config file rather than the filesystem.
This commit is contained in:
parent
3d50eeb7db
commit
7bca02db6d
3 changed files with 57 additions and 19 deletions
|
|
@ -91,8 +91,8 @@ A string of HTML to be processed.
|
|||
sub process {
|
||||
my ($macro, $cmd, $output, $temp);
|
||||
$output = $_[0];
|
||||
foreach $macro (keys %{$session{macro}}) {
|
||||
$cmd = "WebGUI::Macro::".$macro."::process";
|
||||
foreach $macro (keys %{$session{config}{macros}}) {
|
||||
$cmd = "WebGUI::Macro::".$session{config}{macros}{$macro}."::process";
|
||||
$temp = eval{&$cmd($output)};
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("Processing failed on macro: $macro: ".$@);
|
||||
|
|
|
|||
|
|
@ -191,24 +191,11 @@ sub _loadAuthentication {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _loadMacros {
|
||||
my ($namespace, $cmd, @files, $file, $dir, $exclude);
|
||||
$dir = $session{config}{webguiRoot}.$session{os}{slash}."lib".$session{os}{slash}."WebGUI".$session{os}{slash}."Macro";
|
||||
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatalError("Can't open macro directory!");
|
||||
@files = readdir(DIR);
|
||||
foreach $file (@files) {
|
||||
if ($file =~ /(.*?)\.pm$/) {
|
||||
$namespace = $1;
|
||||
$cmd = "use WebGUI::Macro::".$1;
|
||||
eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Macro failed to compile: $namespace.".$@) if($@);
|
||||
$exclude = $session{config}{excludeMacro};
|
||||
$exclude =~ s/ //g;
|
||||
unless (isIn($namespace, split(/,/,$exclude))) {
|
||||
$session{macro}{$namespace} = $namespace;
|
||||
}
|
||||
}
|
||||
foreach my $key (keys %{$session{config}{macros}}) {
|
||||
my $cmd = "use WebGUI::Macro::".$session{config}{macros}{$key};
|
||||
eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Macro failed to compile: $key.".$@) if($@);
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue