diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt
index dd091f1a4..866d94553 100644
--- a/docs/changelog/6.x.x.txt
+++ b/docs/changelog/6.x.x.txt
@@ -11,6 +11,8 @@
- Run on registration and alert on new user have been converted to a single
workflow.
- Added a Photogallery prototype to the default installation.
+ - Added an option for hosters to limit the number of assets that may be
+ created on a WebGUI site.
- Added a change url function that will allow an editor to change the URL of
an asset permanently (circumventing normal versioning).
- Added a wiki-like feature that will automatically bring a user to the
diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original
index 181a0e330..bc53add53 100644
--- a/etc/WebGUI.conf.original
+++ b/etc/WebGUI.conf.original
@@ -147,6 +147,13 @@
"htm" : "/bin/cat"
},
+# Enter the maximum number of assets that should be allowed to
+# be created on this site. Keep in mind that a base install of
+# WebGUI has around 300 assets. Enter zero (0) if you want to
+# allow an unlimited number.
+
+"maximumAssets" : 0,
+
# Specify a the list of assets you want to appear in your
# Add Content menus.
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index 858819cd0..466221cf0 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -1799,6 +1799,11 @@ NOTE: Don't try to override or overload this method. It won't work. What you are
sub www_editSave {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
+ if ($self->session->config("maximumAssets")) {
+ my ($count) = $self->session->db->quickArray("select count(*) from asset");
+ my $i18n = WebGUI::International->new($self->session, "Asset");
+ $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
+ }
my $object;
if ($self->session->form->process("assetId") eq "new") {
$object = $self->addChild({className=>$self->session->form->process("class")});
diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm
index bd11f3c14..102a7b1d1 100644
--- a/lib/WebGUI/AssetLineage.pm
+++ b/lib/WebGUI/AssetLineage.pm
@@ -54,11 +54,18 @@ sub addChild {
my $self = shift;
my $properties = shift;
my $id = shift || $self->session->id->generate();
+ # add a few things just in case the creator forgets
+ $properties->{ownerUserId} ||= '3';
+ $properties->{groupIdEdit} ||= '12';
+ $properties->{groupIdView} ||= '7';
+ $properties->{styleTemplateId} ||= 'PBtmpl0000000000000060';
+
my $lineage = $self->get("lineage").$self->getNextChildRank;
$self->{_hasChildren} = 1;
$self->session->db->beginTransaction;
my $now =$self->session->datetime->time();
- $self->session->db->write("insert into asset (assetId, parentId, lineage, creationDate, createdBy, className, state) values (".$self->session->db->quote($id).",".$self->session->db->quote($self->getId).", ".$self->session->db->quote($lineage).", ".$now.", ".$self->session->db->quote($self->session->user->userId).", ".$self->session->db->quote($properties->{className}).", 'published')");
+ $self->session->db->write("insert into asset (assetId, parentId, lineage, creationDate, createdBy, className, state) values (?,?,?,?,?,?,'published')",
+ [$id,$self->getId,$lineage,$now,$self->session->user->userId,$properties->{className}]);
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,{
assetId=>$id,
className=>$properties->{className}
diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm
index 26d55ec9c..41c8197fb 100644
--- a/lib/WebGUI/Session/ErrorHandler.pm
+++ b/lib/WebGUI/Session/ErrorHandler.pm
@@ -386,19 +386,19 @@ sub showDebug {
my $self = shift;
my $text = $self->session->stow->get('debug_error');
$text =~ s/\n/\
\n/g;
- my $output = 'beginDebug