Wobjects are now added/removed through the config file rather than the filesystem.
This commit is contained in:
parent
deedf4f8eb
commit
3d50eeb7db
3 changed files with 19 additions and 32 deletions
|
|
@ -1,8 +1,16 @@
|
|||
dsn = DBI:mysql:WebGUI
|
||||
dbuser = webgui
|
||||
dbpass = password
|
||||
|
||||
logfile = /data/webgui.log
|
||||
|
||||
extrasURL = /extras
|
||||
extrasPath = /data/WebGUI/www/extras
|
||||
|
||||
uploadsURL = /uploads
|
||||
uploadsPath = /data/WebGUI/www/uploads
|
||||
|
||||
wobjects = Article, EventsCalendar, ExtraColumn, FAQ, FileManager, HttpProxy, \
|
||||
Item, LinkList, MailForm, MessageBoard, Poll, Product, SiteMap, \
|
||||
SQLReport, Survey, SyndicatedContent, USS, WobjectProxy
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,12 @@ sub _replacement {
|
|||
if ($session{user}{uiLevel} >= 7) {
|
||||
$hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376);
|
||||
}
|
||||
foreach $key (keys %{$session{wobject}}) {
|
||||
my $cmd = "\$WebGUI::Wobject::".$key."::name";
|
||||
#$hash{WebGUI::URL::page('func=edit&wid=new&namespace='.$key)} = $session{wobject}{$key};
|
||||
$hash{WebGUI::URL::page('func=edit&wid=new&namespace='.$key)} = eval($cmd);
|
||||
WebGUI::ErrorHandler::warn("Could use wobject $key because: ".$@) if ($@);
|
||||
foreach my $namespace (@{$session{config}{wobjects}}) {
|
||||
my $cmd = "WebGUI::Wobject::".$namespace."::uiLevel";
|
||||
next if (eval($cmd) > $session{user}{uiLevel});
|
||||
$cmd = "\$WebGUI::Wobject::".$namespace."::name";
|
||||
$hash{WebGUI::URL::page('func=edit&wid=new&namespace='.$namespace)} = eval($cmd);
|
||||
WebGUI::ErrorHandler::warn("Could use wobject $namespace because: ".$@) if ($@);
|
||||
}
|
||||
%hash = sortHash(%hash);
|
||||
%hash = (%{{WebGUI::URL::page()=>WebGUI::International::get(1)}},%hash);
|
||||
|
|
|
|||
|
|
@ -213,35 +213,13 @@ sub _loadMacros {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _loadWobjects {
|
||||
my ($dir, @files, $file, $cmd, $namespace, $exclude);
|
||||
$dir = $session{config}{webguiRoot}.$session{os}{slash}."lib".$session{os}{slash}."WebGUI".$session{os}{slash}."Wobject";
|
||||
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatalError("Can't open wobject directory!");
|
||||
@files = readdir(DIR);
|
||||
foreach $file (@files) {
|
||||
if ($file =~ /(.*?)\.pm$/) {
|
||||
$namespace = $1;
|
||||
$cmd = "use WebGUI::Wobject::".$namespace;
|
||||
eval($cmd);
|
||||
unless ($@) {
|
||||
$exclude = $session{config}{excludeWobject};
|
||||
$exclude =~ s/ //g;
|
||||
next if (isIn($namespace, split(/,/,$exclude)));
|
||||
$cmd = "WebGUI::Wobject::".$namespace."::uiLevel";
|
||||
next if (eval($cmd) > $session{user}{uiLevel});
|
||||
# $cmd = "\$WebGUI::Wobject::".$namespace."::name";
|
||||
# $session{wobject}{$namespace} = eval($cmd);
|
||||
$session{wobject}{$namespace} = $namespace;
|
||||
# if ($@) {
|
||||
# WebGUI::ErrorHandler::warn("No name method in wobject: $namespace. ".$@);
|
||||
# $session{wobject}{$namespace} = "ERROR: ".$namespace;
|
||||
# }
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("Wobject failed to compile: $namespace. ".$@);
|
||||
$session{wobject}{$namespace} = "ERROR: ".$namespace;
|
||||
}
|
||||
foreach my $namespace (@{$session{config}{wobjects}}) {
|
||||
my $cmd = "use WebGUI::Wobject::".$namespace;
|
||||
eval($cmd);
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("Wobject failed to compile: $namespace. ".$@);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue