- Added an option for hosters to limit the number of assets that may be
created on a WebGUI site. fixed some bugs
This commit is contained in:
parent
9b7d160a7a
commit
5a7fedc731
6 changed files with 33 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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")});
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -386,19 +386,19 @@ sub showDebug {
|
|||
my $self = shift;
|
||||
my $text = $self->session->stow->get('debug_error');
|
||||
$text =~ s/\n/\<br \/\>\n/g;
|
||||
my $output = 'beginDebug<br /><div style="background-color: #800000;color: #ffffff;">'.$text."</div>\n";
|
||||
my $output = '<div style="text-align: left;background-color: #800000;color: #ffffff;">'.$text."</div>\n";
|
||||
$text = $self->session->stow->get('debug_warn');
|
||||
$text =~ s/\n/\<br \/\>\n/g;
|
||||
$output .= '<div style="background-color: #ffdddd;color: #000000;">'.$text."</div>\n";
|
||||
$output .= '<div style="text-align: left;background-color: #ffdddd;color: #000000;">'.$text."</div>\n";
|
||||
$text = $self->session->stow->get('debug_info');
|
||||
$text =~ s/\n/\<br \/\>\n/g;
|
||||
$output .= '<div style="background-color: #ffffdd;color: #000000;">'.$text."</div>\n";
|
||||
$output .= '<div style="text-align: left;background-color: #ffffdd;color: #000000;">'.$text."</div>\n";
|
||||
$text = $self->session->stow->get('debug_debug');
|
||||
$text =~ s/\n/\<br \/\>\n/g;
|
||||
$output .= '<div style="background-color: #dddddd;color: #000000;">'.$text."</div>\n";
|
||||
$output .= '<div style="text-align: left;background-color: #dddddd;color: #000000;">'.$text."</div>\n";
|
||||
$text = $self->getSessionVars();
|
||||
$text =~ s/\n/\<br \/\>\n/g;
|
||||
$output .= '<div style="background-color: #ffffff;color: #000000;">'.$text."</div>\n";
|
||||
$output .= '<div style="text-align: left;background-color: #ffffff;color: #000000;">'.$text."</div>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
package WebGUI::i18n::English::Asset;
|
||||
|
||||
our $I18N = {
|
||||
'over max assets' => {
|
||||
message => q|Your administrator has limited the number of assets you may place on your site, and you have exceeded the limit. Delete some old assets in order to add more.|,
|
||||
lastUpdated => 0,
|
||||
context => q|an error message that will be displayed if the number of assets is >= to the maximumAssets defined in the config file|
|
||||
},
|
||||
|
||||
'confirm change url message' => {
|
||||
message => q|Setting this to 'Yes' confirms that you want to permanently change this URL, thusly deleteing all old revisions of this asset.|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue