diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index d41b762aa..e4eca75d1 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -10,6 +10,7 @@ - Addded a lock menu item to explicitly lock an asset from editing. - Run on registration and alert on new user have been converted to a single workflow. + - Added a Photogallery prototype to the default installation. - Added a wiki-like feature that will automatically bring a user to the create a page form if they are in admin mode, and click on a link to a page that doesn't exist yet. diff --git a/docs/upgrades/7fixup.pl b/docs/upgrades/7fixup.pl new file mode 100644 index 000000000..68f3af823 --- /dev/null +++ b/docs/upgrades/7fixup.pl @@ -0,0 +1,65 @@ +# This file is here to add new stuff just for 7.0 installs. It will be applied for the generation of create.sql, but won't be included in the official distribution. + +use lib "../../lib"; +use strict; +use Getopt::Long; +use WebGUI::Session; + + + + +my $session = start(); # this line required + +addPrototypes(); + +finish($session); # this line required + + +#------------------------------------------------- +sub addPrototypes { + print "\tAdding default prototypes to make finding things easier for noobs.\n"; + my $importNode = WebGUI::Asset->getImportNode($session); + $importNode->addChild({ + title=>"Photo Gallery", + menuTitle=>"Photo Gallery", + url=>"photo-gallery-prototype", + groupIdView=>'7', + groupIdEdit=>'12', + className=>'WebGUI::Asset::Wobject::Collaboration', + assetId=>"new", + allowReplies=>0, + attachmentsPerPost=>10, + isPrototype=>1, + usePreview=>0, + collaborationTemplateId=>"PBtmpl0000000000000121", + threadTemplateId=>"PBtmpl0000000000000067", + postFormTemplateId=>"PBtmpl0000000000000068" + },"pbproto000000000000001"); +} + + + +# ---- DO NOT EDIT BELOW THIS LINE ---- + +#------------------------------------------------- +sub start { + my $configFile; + $|=1; #disable output buffering + GetOptions( + 'configFile=s'=>\$configFile + ); + my $session = WebGUI::Session->open("../..",$configFile); + $session->user({userId=>3}); + my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->set({name=>"Stuff just for 7.0 installs"}); + return $session; +} + +#------------------------------------------------- +sub finish { + my $session = shift; + my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->commit; + $session->close(); +} + diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index 6993bdf9b..be79ee3f4 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -175,7 +175,7 @@ sub page { if (defined($output) and $output eq "") { if ($session->var->isAdminOn) { # they're expecting it to be there, so let's help them add it my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl) || WebGUI::Asset->getDefault($session); - $session->http->setRedirect($asset->getUrl("func=add;assetId=new;class=WebGUI::Asset::Wobject::Layout;url=".$assetUrl)); + $session->http->setRedirect($asset->getUrl("func=add;class=WebGUI::Asset::Wobject::Layout;url=".$assetUrl)); } else { # not in admin mode, so can't create it, so display not found $session->http->setStatus("404","Page Not Found"); my $notFound = WebGUI::Asset->getNotFound($session); diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 566c59086..c6190544c 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1677,7 +1677,7 @@ sub www_add { return ""; } if ($self->session->form->process('prototype')) { - my $prototype = WebGUI::Asset->new($self->session->form->process("prototype"),$class); + my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class); foreach my $definition (@{$prototype->definition($self->session)}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab foreach my $property (keys %{$definition->{properties}}) { next if (isIn($property,qw(title menuTitle url isPrototype isPackage))); @@ -1696,10 +1696,11 @@ sub www_add { printableStyleTemplateId => $self->get("printableStyleTemplateId"), isHidden => $self->get("isHidden"), className=>$class, - url=>$self->session->form->param("url"), - assetId=>"new" + assetId=>"new", + url=>$self->session->form->param("url") ); $properties{isHidden} = 1 unless (WebGUI::Utility::isIn($class, @{$self->session->config->get("assetContainers")})); +$self->session->errorHandler->warn($properties{url}); my $newAsset = WebGUI::Asset->newByPropertyHashRef($self->session,\%properties); $newAsset->{_parent} = $self; return $self->session->privilege->insufficient() unless ($newAsset->canAdd($self->session));