added content prototypes

This commit is contained in:
JT Smith 2005-03-06 16:21:20 +00:00
parent 25b7e89b0c
commit 7446031b99
6 changed files with 80 additions and 12 deletions

View file

@ -1,6 +1,10 @@
6.5.0 6.5.0
- Added content prototypes.
- Fixed a bug in the Collaboration post where the post end date was set to - Fixed a bug in the Collaboration post where the post end date was set to
the start date. the start date.
- fix [ 1157202 ] users can add themselves to Admins group
- fix [ 1157218 ] user cannot view it's own profile
6.4.0 6.4.0
- You can now see the groups of groups hierarchy in the group manager. - You can now see the groups of groups hierarchy in the group manager.

View file

@ -0,0 +1,4 @@
insert into webguiVersion values ('6.5.0','upgrade',unix_timestamp());
alter table asset add column isPrototype int not null default 0;
alter table asset add index isPrototype_className_assetId (isPrototype,className,assetId);

View file

@ -381,6 +381,10 @@ sub definition {
fieldType=>'yesNo', fieldType=>'yesNo',
defaultValue=>0 defaultValue=>0
}, },
isPrototype=>{
fieldType=>'yesNo',
defaultValue=>0
},
isHidden=>{ isHidden=>{
fieldType=>'yesNo', fieldType=>'yesNo',
defaultValue=>0 defaultValue=>0
@ -703,6 +707,22 @@ sub getAssetAdderLinks {
} }
} }
} }
my $constraint;
if ($getContainerLinks) {
$constraint = quoteAndJoin($session{config}{assetContainers});
} else {
$constraint = quoteAndJoin($session{config}{assets});
}
my $sth = WebGUI::SQL->read("select className,assetId from asset where isPrototype=1 and className in ($constraint)");
while (my ($class,$id) = $sth->array) {
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
my $url = $self->getUrl("func=add&class=".$class."&prototype=".$id);
$url = WebGUI::URL::append($url,$addToUrl) if ($addToUrl);
push(@links,{
label=>$asset->get("title"),
url=>$url
});
}
return \@links; return \@links;
} }
@ -1026,6 +1046,12 @@ sub getEditForm {
-value=>$self->getValue("isPackage"), -value=>$self->getValue("isPackage"),
-uiLevel=>7 -uiLevel=>7
); );
$tabform->getTab("meta")->yesNo(
-name=>"isPrototype",
-label=>WebGUI::International::get("make prototype","Asset"),
-value=>$self->getValue("isPrototype"),
-uiLevel=>7
);
return $tabform; return $tabform;
} }
@ -2222,7 +2248,20 @@ Adds a new Asset based upon the class of the current form. Returns the Asset cal
sub www_add { sub www_add {
my $self = shift; my $self = shift;
my %prototypeProperties;
if ($session{form}{'prototype'}) {
my $prototype = WebGUI::Asset->newByDynamicClass($session{form}{'prototype'},$session{form}{class});
foreach my $definition (@{$prototype->definition}) { # 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)));
next if ($definition->{properties}{$property}{noFormPost});
$prototypeProperties{$property} = $prototype->get($property);
}
}
}
my %properties = ( my %properties = (
%prototypeProperties,
groupIdView => $self->get("groupIdView"), groupIdView => $self->get("groupIdView"),
groupIdEdit => $self->get("groupIdEdit"), groupIdEdit => $self->get("groupIdEdit"),
ownerUserId => $self->get("ownerUserId"), ownerUserId => $self->get("ownerUserId"),

View file

@ -303,16 +303,27 @@ sub www_editGroup {
-value=>$g->scratchFilter, -value=>$g->scratchFilter,
-label=>WebGUI::International::get(945) -label=>WebGUI::International::get(945)
); );
$f->yesNo( if ($session{form}{gid} eq "3") {
-name=>"autoAdd", $f->hidden(
-value=>$g->autoAdd, -name=>"autoAdd",
-label=>WebGUI::International::get(974) -value=>0
); );
$f->yesNo( $f->hidden(
-name=>"autoDelete", -name=>"autoDelete",
-value=>$g->autoDelete, -value=>0
-label=>WebGUI::International::get(975) );
); } else {
$f->yesNo(
-name=>"autoAdd",
-value=>$g->autoAdd,
-label=>WebGUI::International::get(974)
);
$f->yesNo(
-name=>"autoDelete",
-value=>$g->autoDelete,
-label=>WebGUI::International::get(975)
);
}
$f->databaseLink( $f->databaseLink(
-value=>[$g->databaseLinkId] -value=>[$g->databaseLinkId]
); );

View file

@ -225,7 +225,7 @@ sub www_viewProfile {
$u = WebGUI::User->new($session{form}{uid}); $u = WebGUI::User->new($session{form}{uid});
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(347).' '.$u->username.'</h1>'; $vars->{displayTitle} = '<h1>'.WebGUI::International::get(347).' '.$u->username.'</h1>';
return WebGUI::Privilege::notMember() if($u->username eq ""); return WebGUI::Privilege::notMember() if($u->username eq "");
return $vars->{displayTitle}.WebGUI::International::get(862) if($u->profileField("publicProfile") < 1); return $vars->{displayTitle}.WebGUI::International::get(862) if($u->profileField("publicProfile") < 1 && ($session{user}{userId} ne $session{form}{uid} || WebGUI::Grouping::isInGroup(3)));
return WebGUI::Privilege::insufficient() if(!WebGUI::Grouping::isInGroup(2)); return WebGUI::Privilege::insufficient() if(!WebGUI::Grouping::isInGroup(2));
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId $a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
and userProfileCategory.visible=1 and userProfileField.visible=1 order by userProfileCategory.sequenceNumber, and userProfileCategory.visible=1 and userProfileField.visible=1 order by userProfileCategory.sequenceNumber,

View file

@ -25,6 +25,11 @@ our $I18N = {
lastUpdated => 1099344172, lastUpdated => 1099344172,
}, },
'make prototype' => {
message => q|Make prototype?|,
lastUpdated => 1099344172,
},
'asset id' => { 'asset id' => {
message => q|Asset ID|, message => q|Asset ID|,
lastUpdated => 1099344172, lastUpdated => 1099344172,
@ -107,10 +112,15 @@ These tags will be added to the &lt;HEAD&gt; section of each page that the asset
</p> </p>
<p> <p>
<b>Make available as package?</b><br> <b>Make package?</b><br>
Many WebGUI tasks are very repetitive. Automating such tasks in Webgui, such as Many WebGUI tasks are very repetitive. Automating such tasks in Webgui, such as
creating an Asset, or sets of Assets, is done by creating a package that can be reused creating an Asset, or sets of Assets, is done by creating a package that can be reused
through the site. Check yes if you want this Asset to be available as a package. through the site. Check yes if you want this Asset to be available as a package.
</p>
<p>
<b>Make prototype?</b><br>
Chances are if you like assets to be configured a certain way, then you'll find prototypes useful. By setting an asset as a prototype you can create new items in your add content menu configured exactly as you like. For instance, if you use the Collaboration System as a photo gallery, then create a photo gallery and mark it as a prototype. From then on you can just "Add content > New Content > Photo Gallery".
</p> </p>
|, |,