From 7446031b9978a01ce47f50d92966ce92ea2617ca Mon Sep 17 00:00:00 2001
From: JT Smith
Date: Sun, 6 Mar 2005 16:21:20 +0000
Subject: [PATCH] added content prototypes
---
docs/changelog/6.x.x.txt | 4 +++
docs/upgrades/upgrade_6.4.0-6.5.0.sql | 4 +++
lib/WebGUI/Asset.pm | 39 +++++++++++++++++++++++++++
lib/WebGUI/Operation/Group.pm | 31 ++++++++++++++-------
lib/WebGUI/Operation/Profile.pm | 2 +-
lib/WebGUI/i18n/English/Asset.pm | 12 ++++++++-
6 files changed, 80 insertions(+), 12 deletions(-)
create mode 100644 docs/upgrades/upgrade_6.4.0-6.5.0.sql
diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt
index c048ae3a2..b352881fe 100644
--- a/docs/changelog/6.x.x.txt
+++ b/docs/changelog/6.x.x.txt
@@ -1,6 +1,10 @@
6.5.0
+ - Added content prototypes.
- Fixed a bug in the Collaboration post where the post end date was set to
the start date.
+ - fix [ 1157202 ] users can add themselves to Admins group
+ - fix [ 1157218 ] user cannot view it's own profile
+
6.4.0
- You can now see the groups of groups hierarchy in the group manager.
diff --git a/docs/upgrades/upgrade_6.4.0-6.5.0.sql b/docs/upgrades/upgrade_6.4.0-6.5.0.sql
new file mode 100644
index 000000000..040536e45
--- /dev/null
+++ b/docs/upgrades/upgrade_6.4.0-6.5.0.sql
@@ -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);
+
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index d216bacb0..1f25f5ff2 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -381,6 +381,10 @@ sub definition {
fieldType=>'yesNo',
defaultValue=>0
},
+ isPrototype=>{
+ fieldType=>'yesNo',
+ defaultValue=>0
+ },
isHidden=>{
fieldType=>'yesNo',
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;
}
@@ -1026,6 +1046,12 @@ sub getEditForm {
-value=>$self->getValue("isPackage"),
-uiLevel=>7
);
+ $tabform->getTab("meta")->yesNo(
+ -name=>"isPrototype",
+ -label=>WebGUI::International::get("make prototype","Asset"),
+ -value=>$self->getValue("isPrototype"),
+ -uiLevel=>7
+ );
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 {
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 = (
+ %prototypeProperties,
groupIdView => $self->get("groupIdView"),
groupIdEdit => $self->get("groupIdEdit"),
ownerUserId => $self->get("ownerUserId"),
diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm
index e3afcd907..7ee311cfe 100644
--- a/lib/WebGUI/Operation/Group.pm
+++ b/lib/WebGUI/Operation/Group.pm
@@ -303,16 +303,27 @@ sub www_editGroup {
-value=>$g->scratchFilter,
-label=>WebGUI::International::get(945)
);
- $f->yesNo(
- -name=>"autoAdd",
- -value=>$g->autoAdd,
- -label=>WebGUI::International::get(974)
- );
- $f->yesNo(
- -name=>"autoDelete",
- -value=>$g->autoDelete,
- -label=>WebGUI::International::get(975)
- );
+ if ($session{form}{gid} eq "3") {
+ $f->hidden(
+ -name=>"autoAdd",
+ -value=>0
+ );
+ $f->hidden(
+ -name=>"autoDelete",
+ -value=>0
+ );
+ } 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(
-value=>[$g->databaseLinkId]
);
diff --git a/lib/WebGUI/Operation/Profile.pm b/lib/WebGUI/Operation/Profile.pm
index d4dfa6088..5a6e48923 100644
--- a/lib/WebGUI/Operation/Profile.pm
+++ b/lib/WebGUI/Operation/Profile.pm
@@ -225,7 +225,7 @@ sub www_viewProfile {
$u = WebGUI::User->new($session{form}{uid});
$vars->{displayTitle} = ''.WebGUI::International::get(347).' '.$u->username.'
';
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));
$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,
diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm
index 68dd783cb..9f36c0d9e 100644
--- a/lib/WebGUI/i18n/English/Asset.pm
+++ b/lib/WebGUI/i18n/English/Asset.pm
@@ -25,6 +25,11 @@ our $I18N = {
lastUpdated => 1099344172,
},
+ 'make prototype' => {
+ message => q|Make prototype?|,
+ lastUpdated => 1099344172,
+ },
+
'asset id' => {
message => q|Asset ID|,
lastUpdated => 1099344172,
@@ -107,10 +112,15 @@ These tags will be added to the <HEAD> section of each page that the asset
-Make available as package?
+Make package?
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
through the site. Check yes if you want this Asset to be available as a package.
+
+
+
+Make prototype?
+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".
|,