several small improvements to lots of stuff
This commit is contained in:
parent
d272e7de58
commit
7cf2c22a95
12 changed files with 122 additions and 64 deletions
|
|
@ -36,7 +36,9 @@ PerlRequire /data/WebGUI/sbin/preload.perl
|
|||
|
||||
5. Extract WebGUI into your webroot.
|
||||
|
||||
6. Run the following Database commands. (You should modify the
|
||||
6. Start MySQL.
|
||||
|
||||
7. Run the following Database commands. (You should modify the
|
||||
commands to match your database, username, and password.)
|
||||
|
||||
mysql -e "create database WebGUI"
|
||||
|
|
@ -44,9 +46,9 @@ PerlRequire /data/WebGUI/sbin/preload.perl
|
|||
mysql -e "flush privileges"
|
||||
mysql -uwebgui -ppassword WebGUI < docs/create.sql
|
||||
|
||||
7. Edit "etc/WebGUI.conf" to match your DB settings and log directory.
|
||||
8. Edit "etc/WebGUI.conf" to match your DB settings and log directory.
|
||||
|
||||
8. Run the following command from your WebGUI/sbin directory to install
|
||||
9. Run the following command from your WebGUI/sbin directory to install
|
||||
the required perl modules and determine whether you've configured
|
||||
your system correctly.
|
||||
|
||||
|
|
@ -54,6 +56,13 @@ PerlRequire /data/WebGUI/sbin/preload.perl
|
|||
|
||||
If it returns all "OK" then you're done.
|
||||
|
||||
9. Browse to your site. You'll be guided through a few quick questions
|
||||
10. Start Apache.
|
||||
|
||||
11. Start Spectre.
|
||||
|
||||
cd /data/WebGUI/sbin
|
||||
perl spectre.pl --daemon
|
||||
|
||||
12. Browse to your site. You'll be guided through a few quick questions
|
||||
to setup an admin account.
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ sub addAdManager {
|
|||
title varchar(255) not null,
|
||||
type varchar(15) not null default 'text',
|
||||
storageId varchar(22) binary,
|
||||
filename varchar(255),
|
||||
adText varchar(255),
|
||||
url text,
|
||||
richMedia text,
|
||||
|
|
@ -105,6 +104,12 @@ sub addAdManager {
|
|||
renderedAd text
|
||||
)");
|
||||
$session->db->write("alter table advertisement add index adSpaceId_isActive (adSpaceId, isActive)");
|
||||
my $macros = $session->config->get("macros");
|
||||
$macros->{AdSpace} = "AdSpace";
|
||||
$session->config->set("macros",$macros);
|
||||
my $group = WebGUI::Group->new($session, "new", "pbgroup000000000000017");
|
||||
$group->name("Ad Manager");
|
||||
$group->description("These users will be able to manage advertisements.");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@ sub contentHandler {
|
|||
}
|
||||
$session->http->setCookie("wgSession",$session->var->{_var}{sessionId}) unless $session->var->{_var}{sessionId} eq $session->http->getCookies->{"wgSession"};
|
||||
$session->http->getHeader();
|
||||
$session->output->print($output) unless ($session->http->isRedirect());
|
||||
unless ($session->http->isRedirect()) {
|
||||
$session->output->print($output);
|
||||
$session->output->goodNightAndGoodLuck();
|
||||
}
|
||||
WebGUI::Affiliate::grabReferral($session); # process affilliate tracking request
|
||||
}
|
||||
$session->close;
|
||||
|
|
@ -195,9 +198,6 @@ sub page {
|
|||
if ($output eq "chunked") {
|
||||
$output = undef;
|
||||
}
|
||||
if ($session->errorHandler->canShowDebug()) {
|
||||
$output .= $session->errorHandler->showDebug();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,36 @@ sub canView {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 checkView ( )
|
||||
|
||||
Returns error messages if a user can't view due to publishing problems, otherwise it sets the cookie and returns undef. This is sort of a hack until we find something better.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkView {
|
||||
my $self = shift;
|
||||
unless ($self->canView) {
|
||||
if ($self->get("state") eq "published") { # no privileges, make em log in
|
||||
return $self->session->privilege->noAccess();
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
|
||||
return undef;
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return undef;
|
||||
} else { # tell em it doesn't exist anymore
|
||||
$self->session->http->setStatus("410");
|
||||
return WebGUI::Asset->getNotFound($self->session)->www_view;
|
||||
}
|
||||
}
|
||||
$self->logView();
|
||||
# must find a way to do this next line better
|
||||
$self->session->http->setCookie("wgSession",$self->session->var->{_var}{sessionId}) unless $self->session->var->{_var}{sessionId} eq $self->session->http->getCookies->{"wgSession"};
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ definition ] )
|
||||
|
|
|
|||
|
|
@ -1033,22 +1033,8 @@ Renders self->view based upon current style, subject to timeouts. Returns Privil
|
|||
sub www_view {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->noAccess() unless $self->canView;
|
||||
unless ($self->canView) {
|
||||
if ($self->get("state") eq "published") { # no privileges, make em log in
|
||||
return $self->session->privilege->noAccess();
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
|
||||
return undef;
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return undef;
|
||||
} else { # tell em it doesn't exist anymore
|
||||
$self->session->http->setStatus("410");
|
||||
return WebGUI::Asset->getNotFound($self->session)->www_view;
|
||||
}
|
||||
}
|
||||
# must find a way to do this next line better
|
||||
$self->session->http->setCookie("wgSession",$self->session->var->{_var}{sessionId}) unless $self->session->var->{_var}{sessionId} eq $self->session->http->getCookies->{"wgSession"};
|
||||
my $check = $self->checkView;
|
||||
return $check if (defined $check);
|
||||
$self->session->http->getHeader;
|
||||
$self->prepareView;
|
||||
my $style = $self->getParent->processStyle("~~~");
|
||||
|
|
|
|||
|
|
@ -266,7 +266,11 @@ This method sets the tags from the head block parameter of the template into the
|
|||
sub prepare {
|
||||
my $self = shift;
|
||||
$self->{_prepared} = 1;
|
||||
$self->session->style->setRawHeadTags($self->get("headBlock"));
|
||||
if ($self->session->style->sent) {
|
||||
$self->session->output->print($self->get("headBlock"));
|
||||
} else {
|
||||
$self->session->style->setRawHeadTags($self->get("headBlock"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -552,23 +552,8 @@ Renders self->view based upon current style, subject to timeouts. Returns Privil
|
|||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
unless ($self->canView) {
|
||||
if ($self->get("state") eq "published") { # no privileges, make em log in
|
||||
return $self->session->privilege->noAccess();
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
|
||||
return undef;
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return undef;
|
||||
} else { # tell em it doesn't exist anymore
|
||||
$self->session->http->setStatus("410");
|
||||
return WebGUI::Asset->getNotFound($self->session)->www_view;
|
||||
}
|
||||
}
|
||||
$self->logView();
|
||||
# must find a way to do this next line better
|
||||
$self->session->http->setCookie("wgSession",$self->session->var->{_var}{sessionId}) unless $self->session->var->{_var}{sessionId} eq $self->session->http->getCookies->{"wgSession"};
|
||||
my $check = $self->checkView;
|
||||
return $check if (defined $check);
|
||||
$self->session->http->getHeader;
|
||||
$self->prepareView;
|
||||
my $style = $self->processStyle("~~~");
|
||||
|
|
|
|||
|
|
@ -265,31 +265,23 @@ sub www_setContentPositions {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
# slashdot / burst protection
|
||||
# slashdot / burst protection hack
|
||||
if ($self->session->var->get("userId") eq "1" && $self->session->form->param("func") eq "" && $self->session->form->param("op") eq "") {
|
||||
unless ($self->canView) {
|
||||
if ($self->get("state") eq "published") { # no privileges, make em log in
|
||||
return $self->session->privilege->noAccess();
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
|
||||
return undef;
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return undef;
|
||||
} else { # tell em it doesn't exist anymore
|
||||
$self->session->http->setStatus("410");
|
||||
return WebGUI::Asset->getNotFound($self->session)->www_view;
|
||||
}
|
||||
}
|
||||
$self->logView();
|
||||
# must find a way to do this next line better
|
||||
$self->session->http->setCookie("wgSession",$self->session->var->{_var}{sessionId}) unless $self->session->var->{_var}{sessionId} eq $self->session->http->getCookies->{"wgSession"};
|
||||
my $check = $self->checkView;
|
||||
return $check if (defined $check);
|
||||
my $cache = WebGUI::Cache->new($self->session, "view_".$self->getId);
|
||||
my $out = $cache->get if defined $cache;
|
||||
unless ($out) {
|
||||
$self->prepareView;
|
||||
$self->session->stow->set("cacheFixOverride", 1);
|
||||
$out = $self->processStyle($self->view);
|
||||
$cache->set($out, 60);
|
||||
$self->session->stow->delete("cacheFixOverride");
|
||||
}
|
||||
while ($out =~ /(\[AD\:(\w+)\])/gs) {
|
||||
my $ad = $1;
|
||||
my $macro = "^AdSpace(".$2.");";
|
||||
$out =~ s/\Q$ad/$macro/ges;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ The unique name of an Ad Space.
|
|||
sub process {
|
||||
my $session = shift;
|
||||
my $name = shift;
|
||||
if ($session->stow->get("cacheFixOverride")) {
|
||||
return "[AD:".$name."]";
|
||||
}
|
||||
my $adSpace = WebGUI::AdSpace->newByName($session, $name);
|
||||
return undef unless defined $adSpace;
|
||||
return $adSpace->displayImpression;
|
||||
|
|
|
|||
|
|
@ -264,11 +264,17 @@ Edit or add an ad space form.
|
|||
|
||||
sub www_editAdSpace {
|
||||
my $session = shift;
|
||||
my $adSpace = shift;
|
||||
return $session->privilege->insufficient unless ($session->user->isInGroup("pbgroup000000000000017"));
|
||||
my $id = $session->form->param("adSpaceId") || "new";
|
||||
my $id;
|
||||
if (defined $adSpace) {
|
||||
$id = $adSpace->getId;
|
||||
} else {
|
||||
$id = $session->form->param("adSpaceId") || "new";
|
||||
$adSpace = WebGUI::AdSpace->new($session, $id);
|
||||
}
|
||||
my $ac = WebGUI::AdminConsole->new($session,"adSpace");
|
||||
my $i18n = WebGUI::International->new($session,"AdSpace");
|
||||
my $adSpace = WebGUI::AdSpace->new($session, $id);
|
||||
$ac->addSubmenuItem($session->url->page("op=editAd;adSpaceId=".$id), $i18n->get("add an ad")) if defined $adSpace;
|
||||
$ac->addSubmenuItem($session->url->page("op=manageAdSpaces"), $i18n->get("manage ad spaces"));
|
||||
my $f = WebGUI::HTMLForm->new($session);
|
||||
|
|
@ -349,7 +355,8 @@ sub www_editAdSpaceSave {
|
|||
height=>$session->form->process("height", "integer"),
|
||||
);
|
||||
if ($session->form->param("adSpaceId") eq "new") {
|
||||
WebGUI::AdSpace->create($session, \%properties);
|
||||
my $adSpace = WebGUI::AdSpace->create($session, \%properties);
|
||||
return www_editAdSpace($session, $adSpace);
|
||||
} else {
|
||||
my $adSpace = WebGUI::AdSpace->new($session, $session->form->param("adSpaceId"));
|
||||
$adSpace->set(\%properties);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,20 @@ sub DESTROY {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 goodNightAndGoodLuck ( )
|
||||
|
||||
This should be called at the end of all possible output HTML output. It handles printing out debug and other maintenance tasks.
|
||||
|
||||
=cut
|
||||
|
||||
sub goodNightAndGoodLuck {
|
||||
my $self = shift;
|
||||
if ($self->session->errorHandler->canShowDebug()) {
|
||||
print $self->session->errorHandler->showDebug();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ The unique identifier for the template to retrieve.
|
|||
|
||||
sub process {
|
||||
my $self = shift;
|
||||
$self->sent(1);
|
||||
my %var;
|
||||
$var{'body.content'} = shift;
|
||||
my $templateId = shift;
|
||||
|
|
@ -234,6 +235,28 @@ sub session {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sent ( boolean )
|
||||
|
||||
Returns a boolean indicating whether the style has already been sent. This is important when trying to set things to the HTML head block.
|
||||
|
||||
=head3 boolean
|
||||
|
||||
Set the value.
|
||||
|
||||
=cut
|
||||
|
||||
sub sent {
|
||||
my $self = shift;
|
||||
my $boolean = shift;
|
||||
if (defined $boolean) {
|
||||
$self->session->stow->set("styleHeadSent",$boolean);
|
||||
return $boolean;
|
||||
}
|
||||
return $self->session->stow->get("styleHeadSent");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLink ( url, params )
|
||||
|
||||
Sets a <link> tag into the <head> of this rendered page for this page view. This is typically used for dynamically adding references to CSS and RSS documents.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue