Wobjects are now added/removed through the config file rather than the filesystem.

This commit is contained in:
JT Smith 2003-02-27 03:20:49 +00:00
parent deedf4f8eb
commit 3d50eeb7db
3 changed files with 19 additions and 32 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);
}
#-------------------------------------------------------------------