Merging changes from 6.6.4

Added new definition features to wobjects and assets.
This commit is contained in:
JT Smith 2005-07-21 01:17:05 +00:00
parent 3805ebed23
commit c4b3e4092d
43 changed files with 457 additions and 717 deletions

View file

@ -392,8 +392,10 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
assetName=>WebGUI::International::get("asset","Asset"),
tableName=>'assetData',
className=>'WebGUI::Asset',
icon=>'assets.gif'
properties=>{
title=>{
fieldType=>'text',
@ -1129,13 +1131,15 @@ sub getEditForm {
-options=>$options
);
}
# Add a quick link to add field
$tabform->getTab("meta")->readOnly(
if (WebGUI::Grouping::isInGroup(3)) {
# Add a quick link to add field
$tabform->getTab("meta")->readOnly(
-value=>'<p><a href="'.WebGUI::URL::page("func=editMetaDataField&fid=new").'">'.
WebGUI::International::get('Add new field','Asset').
'</a></p>'
-hoverHelp=>WebGUI::International::get('make prototype description',"Asset"),
);
);
}
}
return $tabform;
}
@ -1172,8 +1176,10 @@ If this evaluates to True, then the smaller extras/adminConsole/small/assets.gif
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/adminConsole/small/assets.gif' if ($small);
return $session{config}{extrasURL}.'/adminConsole/assets.gif';
my $definition = $self->definition;
my $icon = $definition->[0]{icon};
return $session{config}{extrasURL}.'/adminConsole/small/'.$icon if ($small);
return $session{config}{extrasURL}.'/adminConsole/'.$icon;
}
#-------------------------------------------------------------------
@ -1503,7 +1509,9 @@ Returns the internationalization of the word "Asset".
=cut
sub getName {
return WebGUI::International::get("asset","Asset");
my $self = shift;
my $definition = $self->definition;
return $definition->[0]{assetName};
}
#-------------------------------------------------------------------
@ -2020,14 +2028,7 @@ sub paste {
my $assetId = shift;
my $pastedAsset = WebGUI::Asset->newByDynamicClass($assetId);
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) {
my $assetIds = WebGUI::SQL->buildArrayRef("select assetId from asset where lineage like ".quote($self->get("lineage").'%')." and (state='clipboard' or state='clipboard-limbo')");
my $idList = quoteAndJoin($assetIds);
WebGUI::SQL->write("update asset set state='published', stateChangedBy=".quote($session{user}{userId}).", stateChanged=".time()." where assetId in (".$idList.")");
my $cache = WebGUI::Cache->new;
foreach my $id (@{$assetIds}) {
# we do the purge directly cuz it's a lot faster than instanciating all these assets
$cache->deleteChunk(["asset",$id]);
}
$pastedAsset->publish;
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
return 1;
}

View file

@ -38,12 +38,13 @@ use WebGUI::Asset::Wobject::EventsCalendar;
our @ISA = qw(WebGUI::Asset);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(511,"Asset_Event"),
icon=>'calendar.gif',
tableName=>'EventsCalendar_event',
className=>'WebGUI::Asset::Event',
properties=>{
@ -325,20 +326,6 @@ sub getEditForm {
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
return $session{config}{extrasURL}.'/assets/calendar.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(511,"Asset_Event");
}
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
@ -381,6 +368,25 @@ sub processPropertiesFromFormPost {
}
#-------------------------------------------------------------------
=head setParent ( newParent )
We're overloading the setParent in Asset because we don't want events to be able to be posted to anything other than the events calendar.
=head3 newParent
An asset object to make the parent of this asset.
=cut
sub setParent {
my $self = shift;
my $newParent = shift;
return 0 unless ($newParent->get("className") eq "WebGUI::Asset::Wobject::EventsCalendar");
return $self->SUPER::setParent($newParent);
}
#-------------------------------------------------------------------
sub view {
my $self = shift;

View file

@ -60,6 +60,7 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('file',"Asset_File"),
tableName=>'FileAsset',
className=>'WebGUI::Asset::File',
properties=>{
@ -163,19 +164,6 @@ sub getIcon {
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get('file',"Asset_File");
}
#-------------------------------------------------------------------
sub getStorageLocation {
my $self = shift;
@ -212,7 +200,6 @@ sub processPropertiesFromFormPost {
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
$self->update(\%data);
$self->setSize($storage->getFileSize($filename));
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
$self->{_storageLocation} = $storage;
} else {
$storage->delete;
@ -239,6 +226,27 @@ sub purge {
}
#-------------------------------------------------------------------
=head2 update
We overload the update method from WebGUI::Asset in order to handle file system privileges.
=cut
sub update {
my $self = shift;
my %before = (
owner => $self->get("ownerUserId"),
view => $self->get("groupIdView"),
edit => $self->get("groupIdEdit")
);
$self->SUPER::update(@_);
if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) {
$self->getStorageLocation->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit"));
}
}
#-------------------------------------------------------------------
sub view {
my $self = shift;

View file

@ -64,6 +64,7 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('image',"Asset_Image"),
tableName=>'ImageAsset',
className=>'WebGUI::Asset::File::Image',
properties=>{
@ -152,19 +153,6 @@ sub getIcon {
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get('image',"Asset_Image");
}
#-------------------------------------------------------------------
sub getStorageLocation {
my $self = shift;

View file

@ -93,6 +93,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('post',"Asset_Post")
icon=>'post.gif',
tableName=>'Post',
className=>'WebGUI::Asset::Post',
properties=>{
@ -256,13 +258,6 @@ sub getEditUrl {
return $self->getUrl("func=edit");
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/post.gif' if ($small);
return $session{config}{extrasURL}.'/assets/post.gif';
}
#-------------------------------------------------------------------
sub getImageUrl {
@ -279,10 +274,6 @@ sub getImageUrl {
return $url;
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get('post',"Asset_Post");
}
#-------------------------------------------------------------------
@ -670,7 +661,6 @@ sub processPropertiesFromFormPost {
$filename = $storage->addFileFromFormPost("file", $attachmentLimit) if $attachmentLimit;
if (defined $filename) {
$self->setSize($storage->getFileSize($filename));
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
foreach my $file (@{$storage->getFiles}) {
if ($storage->isImage($file)) {
$storage->generateThumbnail($file,$session{setting}{maxImageSize});
@ -740,6 +730,25 @@ sub setLastPost {
}
#-------------------------------------------------------------------
=head setParent ( newParent )
We're overloading the setParent in Asset because we don't want posts to be able to be posted to anything other than other posts or threads.
=head3 newParent
An asset object to make the parent of this asset.
=cut
sub setParent {
my $self = shift;
my $newParent = shift;
return 0 unless ($newParent->get("className") eq "WebGUI::Asset::Post" || $newParent->get("className") eq "WebGUI::Asset::Post::Thread");
return $self->SUPER::setParent($newParent);
}
#-------------------------------------------------------------------
=head2 setStatusApproved ( )
@ -841,6 +850,27 @@ sub unmarkRead {
WebGUI::SQL->write("delete from forumRead where userId=".quote($session{user}{userId})." and postId=".quote($self->getId));
}
#-------------------------------------------------------------------
=head2 update
We overload the update method from WebGUI::Asset in order to handle file system privileges.
=cut
sub update {
my $self = shift;
my %before = (
owner => $self->get("ownerUserId"),
view => $self->get("groupIdView"),
edit => $self->get("groupIdEdit")
);
$self->SUPER::update(@_);
if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) {
$self->getStorageLocation->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit"));
}
}
#-------------------------------------------------------------------
sub view {
my $self = shift;
@ -1021,7 +1051,7 @@ sub www_edit {
richEditId=>$self->getThread->getParent->get("richEditor")
});
$var{'form.submit'} = WebGUI::Form::submit({
extras=>"onclick=\"this.value='".WebGUI::International::get(452)."'; this.form.func.value='editSave'; this.form.submit();\""
extras=>"onclick=\"this.value='".WebGUI::International::get(452)."'; this.form.func.value='editSave'; this.form.submit();return false;\""
});
$var{'form.preview'} = WebGUI::Form::submit({
value=>WebGUI::International::get("preview","Asset_Collaboration")

View file

@ -72,6 +72,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('thread',"Asset_Thread"),
icon=>'thread.gif',
tableName=>'Thread',
className=>'WebGUI::Asset::Post::Thread',
properties=>{
@ -119,14 +121,6 @@ sub DESTROY {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/thread.gif' if ($small);
return $session{config}{extrasURL}.'/assets/thread.gif';
}
#-------------------------------------------------------------------
sub getLastPost {
@ -172,10 +166,6 @@ sub getLockUrl {
$self->getUrl("func=lock");
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get('thread',"Asset_Thread");
}
#-------------------------------------------------------------------
@ -470,6 +460,25 @@ sub rate {
}
#-------------------------------------------------------------------
=head setParent ( newParent )
We're overloading the setParent in Asset because we don't want threads to be able to be posted to anything other than other collaboration systems.
=head3 newParent
An asset object to make the parent of this asset.
=cut
sub setParent {
my $self = shift;
my $newParent = shift;
return 0 unless ($newParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration");
# specify the Asset package here directly because we don't want to use the ruls in WebGUI::Asset::Post, as they don't fit for Threads.
return $self->WebGUI::Asset::setParent($newParent);
}
#-------------------------------------------------------------------

View file

@ -60,6 +60,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('redirect',"Asset_Redirect"),
icon=>'redirect.gif',
tableName=>'redirect',
className=>'WebGUI::Asset::Redirect',
properties=>{
@ -95,13 +97,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/redirect.gif' if ($small);
return $session{config}{extrasURL}.'/assets/redirect.gif';
}
#-------------------------------------------------------------------
@ -116,18 +111,6 @@ sub getUiLevel {
return 9;
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get('redirect',"Asset_Redirect");
}
#-------------------------------------------------------------------

View file

@ -62,6 +62,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>'Rich Editor',
icon=>'richEdit.gif',
tableName=>'RichEdit',
className=>'WebGUI::Asset::RichEdit',
properties=>{
@ -363,14 +365,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/adminConsole/small/richEdit.gif' if ($small);
return $session{config}{extrasURL}.'/adminConsole/richEdit.gif';
}
#-------------------------------------------------------------------
@ -399,18 +393,6 @@ sub getUiLevel {
return 5;
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return "Rich Editor";
}
#-------------------------------------------------------------------
sub getRichEditor {

View file

@ -25,6 +25,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(3,"Asset_Shortcut"),
icon=>'shortcut.gif',
tableName=>'Shortcut',
className=>'WebGUI::Asset::Shortcut',
properties=>{
@ -186,19 +188,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/shortcut.gif' if ($small);
return $session{config}{extrasURL}.'/assets/shortcut.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(3,"Asset_Shortcut");
}
#-------------------------------------------------------------------

View file

@ -61,6 +61,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('snippet',"Asset_Snippet"),
icon=>'snippet.gif',
tableName=>'snippet',
className=>'WebGUI::Asset::Snippet',
properties=>{
@ -123,14 +125,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/snippet.gif' if ($small);
return $session{config}{extrasURL}.'/assets/snippet.gif';
}
#-------------------------------------------------------------------
@ -159,17 +153,6 @@ sub getUiLevel {
return 5;
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get('snippet',"Asset_Snippet");
}
#-------------------------------------------------------------------

View file

@ -99,6 +99,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('template',"Asset_Template"),
icon=>'template.gif',
tableName=>'template',
className=>'WebGUI::Asset::Template',
properties=>{
@ -179,13 +181,6 @@ sub getEditForm {
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/template.gif' if ($small);
return $session{config}{extrasURL}.'/assets/template.gif';
}
#-------------------------------------------------------------------
@ -209,18 +204,6 @@ sub getList {
}
#-------------------------------------------------------------------
=head2 getName
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get('template',"Asset_Template");
}
#-------------------------------------------------------------------

View file

@ -72,27 +72,52 @@ sub definition {
properties=>{
description=>{
fieldType=>'HTMLArea',
defaultValue=>undef
defaultValue=>undef,
tab=>"properties",
label=>WebGUI::International::get(85,'Wobject'),
hoverHelp=>WebGUI::International::get('85 description','Wobject')
},
displayTitle=>{
fieldType=>'yesNo',
defaultValue=>1
defaultValue=>1,
tab=>"display",
label=>WebGUI::International::get(174,'Wobject'),
hoverHelp=>WebGUI::International::get('174 description','Wobject'),
uiLevel=>5
},
cacheTimeout=>{
fieldType=>'interval',
defaultValue=>60
defaultValue=>60,
tab=>"display",
label=>WebGUI::International::get(895,'Wobject'),
hoverHelp=>WebGUI::International::get('895 description','Wobject'),
uiLevel=>8
},
cacheTimeoutVisitor=>{
fieldType=>'interval',
defaultValue=>600
tab=>"display",
label=>WebGUI::International::get(896,'Wobject'),
hoverHelp=>WebGUI::International::get('896 description','Wobject'),
uiLevel=>8
},
styleTemplateId=>{
fieldType=>'template',
defaultValue=>undef
defaultValue=>undef,
tab=>"display",
label=>WebGUI::International::get(1073,'Wobject'),
hoverHelp=>WebGUI::International::get('1073 description','Wobject'),
namespace=>'style',
afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
},
printableStyleTemplateId=>{
fieldType=>'template',
defaultValue=>undef
defaultValue=>undef,
tab=>"display",
label=>WebGUI::International::get(1079,'Wobject'),
hoverHelp=>WebGUI::International::get('1079 description','Wobject'),
namespace=>'style',
afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
}
}
});
@ -223,49 +248,18 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->yesNo(
-name=>"displayTitle",
-label=>WebGUI::International::get(174,'Wobject'),
-hoverHelp=>WebGUI::International::get('174 description','Wobject'),
-value=>$self->getValue("displayTitle"),
-uiLevel=>5
);
$tabform->getTab("display")->template(
-name=>"styleTemplateId",
-label=>WebGUI::International::get(1073,'Wobject'),
-hoverHelp=>WebGUI::International::get('1073 description','Wobject'),
-value=>$self->getValue("styleTemplateId"),
-namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
);
$tabform->getTab("display")->template(
-name=>"printableStyleTemplateId",
-label=>WebGUI::International::get(1079,'Wobject'),
-hoverHelp=>WebGUI::International::get('1079 description','Wobject'),
-value=>$self->getValue("printableStyleTemplateId"),
-namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
);
$tabform->getTab("properties")->HTMLArea(
-name=>"description",
-label=>WebGUI::International::get(85,'Wobject'),
-hoverHelp=>WebGUI::International::get('85 description','Wobject'),
-value=>$self->getValue("description")
);
$tabform->getTab("display")->interval(
-name=>"cacheTimeout",
-label=>WebGUI::International::get(895,'Wobject'),
-hoverHelp=>WebGUI::International::get('895 description','Wobject'),
-value=>$self->getValue("cacheTimeout"),
-uiLevel=>8
);
$tabform->getTab("display")->interval(
-name=>"cacheTimeoutVisitor",
-label=>WebGUI::International::get(896,'Wobject'),
-hoverHelp=>WebGUI::International::get('896 description','Wobject'),
-value=>$self->getValue("cacheTimeoutVisitor"),
-uiLevel=>8
);
my $definition = $self->definition;
my $properties = $definition->[0]{properties};
foreach my $fieldname (keys %{$properties}) {
my %params;
foreach my $key (keys %{$properties->{$fieldname}}) {
next if ($key eq "tab" || $key eq "fieldType");
$params{"-".$key} = $properties->{$fieldname}{$key}
}
$params{"-value"} = $self->getValue($fieldname);
$params{"-name"} = $fieldname;
$tabform->getTab($properties->{$fieldname}{tab})->dynamicField($properties->{$fieldname}{fieldType},%params);
}
return $tabform;
}

View file

@ -26,24 +26,39 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_Article"),
icon=>'article.gif',
tableName=>'Article',
className=>'WebGUI::Asset::Wobject::Article',
properties=>{
templateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000002'
defaultValue=>'PBtmpl0000000000000002',
namespace=>"Article",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
},
linkURL=>{
fieldType=>'url',
defaultValue=>undef
defaultValue=>undef,
label=>WebGUI::International::get(8,"Asset_Article"),
hoverHelp=>WebGUI::International::get('link url description','Asset_Article'),
uiLevel=>3
},
linkTitle=>{
fieldType=>'text',
defaultValue=>undef
defaultValue=>undef,
label=>WebGUI::International::get(7,"Asset_Article"),
hoverHelp=>WebGUI::International::get('link title description','Asset_Article'),
uiLevel=>3
},
convertCarriageReturns=>{
fieldType=>'yesNo',
defaultValue=>0
defaultValue=>0,
label=>WebGUI::International::get(10,"Asset_Article"),
subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,"Asset_Article").'</span>',
hoverHelp=>WebGUI::International::get('carriage return description','Asset_Article'),
uiLevel=>5
}
}
});
@ -52,51 +67,6 @@ sub definition {
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"Article",
-hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
-label=>WebGUI::International::get(72,"Asset_Article"),
);
$tabform->getTab("properties")->text(
-name=>"linkTitle",
-label=>WebGUI::International::get(7,"Asset_Article"),
-value=>$self->getValue("linkTitle"),
-hoverHelp=>WebGUI::International::get('link title description','Asset_Article'),
-uiLevel=>3
);
$tabform->getTab("properties")->url(
-name=>"linkURL",
-label=>WebGUI::International::get(8,"Asset_Article"),
-value=>$self->getValue("linkURL"),
-hoverHelp=>WebGUI::International::get('link url description','Asset_Article'),
-uiLevel=>3
);
$tabform->getTab("display")->yesNo(
-name=>"convertCarriageReturns",
-label=>WebGUI::International::get(10,"Asset_Article"),
-value=>$self->getValue("convertCarriageReturns"),
-subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,"Asset_Article").'</span>',
-hoverHelp=>WebGUI::International::get('carriage return description','Asset_Article'),
-uiLevel=>5,
-defaultValue=>0
);
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/article.gif' if ($small);
return $session{config}{extrasURL}.'/assets/article.gif';
}
#-------------------------------------------------------------------
sub getIndexerParams {
my $self = shift;
@ -130,10 +100,6 @@ sub getIndexerParams {
};
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,"Asset_Article");
}
#-------------------------------------------------------------------

View file

@ -259,6 +259,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get('collaboration system',"Asset_collaboration"),
icon=>'collaboration.gif',
tableName=>'Collaboration',
className=>'WebGUI::Asset::Wobject::Collaboration',
properties=>{
@ -605,20 +607,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/collaboration.gif' if ($small);
return $session{config}{extrasURL}.'/assets/collaboration.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get('collaboration system',"Asset_collaboration");
}
#-------------------------------------------------------------------
@ -775,10 +763,21 @@ sub isSubscribed {
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
my $self = shift;
my $updatePrivs = ($session{form}{groupIdView} ne $self->get("groupIdView") || $session{form}{moderateGroupId} ne $self->get("moderateGroupId"));
$self->SUPER::processPropertiesFromFormPost;
if ($self->get("subscriptionGroupId") eq "") {
$self->createSubscriptionGroup;
}
if ($updatePrivs) {
foreach my $descendant (@{$self->getLineage(["descendants"],{returnObjects=>1})}) {
$descendant->update({
groupIdView=>$self->get("groupIdView"),
groupIdEdit=>$self->get("moderateGroupId")
});
}
}
WebGUI::Session::deleteScratch($self->getId."_sortBy");
WebGUI::Session::deleteScratch($self->getId."_sortDir");
}
@ -869,9 +868,9 @@ sub view {
my $scratchSortOrder = $self->getId."_sortDir";
my $sortBy = $session{form}{sortBy} || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder");
if ($sortBy ne $session{scratch}{$scratchSortBy}) {
if ($sortBy ne $session{scratch}{$scratchSortBy} && $session{form}{func} ne "editSave") {
WebGUI::Session::setScratch($scratchSortBy,$session{form}{sortBy});
} elsif ($session{form}{sortBy}) {
} elsif ($session{form}{sortBy} && $session{form}{func} ne "editSave") {
if ($sortOrder eq "asc") {
$sortOrder = "desc";
} else {

View file

@ -135,7 +135,9 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_DataForm"),
tableName=>'DataForm',
icon=>'dataForm.gif',
className=>'WebGUI::Asset::Wobject::DataForm',
properties=>{
templateId =>{
@ -270,13 +272,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/dataForm.gif' if ($small);
return $session{config}{extrasURL}.'/assets/dataForm.gif';
}
#-------------------------------------------------------------------
sub getIndexerParams {
@ -542,10 +537,6 @@ sub getRecordTemplateVars {
return $var;
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,"Asset_DataForm");
}
#-------------------------------------------------------------------
sub getUiLevel {

View file

@ -38,11 +38,14 @@ our @ISA = qw(WebGUI::Asset::Wobject);
# return WebGUI::Grouping::isInGroup($self->getValue("groupIdManage"),$userId);
#}
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(2,"Asset_EventsCalendar"),
icon=>'calendar.gif',
tableName=>'EventsCalendar',
className=>'WebGUI::Asset::Wobject::EventsCalendar',
properties=>{
@ -180,19 +183,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
return $session{config}{extrasURL}.'/assets/calendar.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(2,"Asset_EventsCalendar");
}
#-------------------------------------------------------------------
sub getUiLevel {

View file

@ -59,6 +59,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get("folder","Asset_Folder"),
icon=>'folder.gif',
tableName=>'Folder',
className=>'WebGUI::Asset::Wobject::Folder',
properties=>{
@ -103,27 +105,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/folder.gif' if ($small);
return $session{config}{extrasURL}.'/assets/folder.gif';
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get("folder","Asset_Folder");
}
#-------------------------------------------------------------------
=head2 getUiLevel ()

View file

@ -33,6 +33,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(3,"Asset_HttpProxy"),
icon=>'httpProxy.gif',
tableName=>'HttpProxy',
className=>'WebGUI::Asset::Wobject::HttpProxy',
properties=>{
@ -164,19 +166,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/httpProxy.gif' if ($small);
return $session{config}{extrasURL}.'/assets/httpProxy.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(3,"Asset_HttpProxy");
}
#-------------------------------------------------------------------
sub getUiLevel {
return 5;

View file

@ -59,6 +59,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get("layout","Asset_Layout"),
icon=>'layout.gif',
tableName=>'Layout',
className=>'WebGUI::Asset::Wobject::Layout',
properties=>{
@ -128,25 +130,6 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/layout.gif' if ($small);
return $session{config}{extrasURL}.'/assets/layout.gif';
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get("layout","Asset_Layout");
}
#-------------------------------------------------------------------

View file

@ -26,45 +26,23 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(2,"Asset_MessageBoard"),
icon=>'messageBoard.gif',
tableName=>'MessageBoard',
className=>'WebGUI::Asset::Wobject::MessageBoard',
properties=>{
templateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000047'
defaultValue=>'PBtmpl0000000000000047',
namespace=>"MessageBoard",
label=>WebGUI::International::get(73,"Asset_MessageBoard"),
hoverHelp=>WebGUI::International::get('73 description',"Asset_MessageBoard")
},
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"MessageBoard",
-label=>WebGUI::International::get(73,"Asset_MessageBoard")
-hoverHelp=>WebGUI::International::get('73 description',"Asset_MessageBoard")
);
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/messageBoard.gif' if ($small);
return $session{config}{extrasURL}.'/assets/messageBoard.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(2,"Asset_MessageBoard");
}
#-------------------------------------------------------------------
sub view {

View file

@ -27,12 +27,13 @@ use WebGUI::Utility;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get("navigation","Asset_Navigation"),
icon=>'navigation.gif',
tableName=>'Navigation',
className=>'WebGUI::Asset::Wobject::Navigation',
properties=>{
@ -257,18 +258,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/navigation.gif' if ($small);
return $session{config}{extrasURL}.'/assets/navigation.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get("navigation","Asset_Navigation");
}
#-------------------------------------------------------------------

View file

@ -38,7 +38,9 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_Poll"),
tableName=>'Poll',
icon=>'poll.gif',
className=>'WebGUI::Asset::Wobject::Poll',
properties=>{
templateId =>{
@ -240,14 +242,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/poll.gif' if ($small);
return $session{config}{extrasURL}.'/assets/poll.gif';
}
#-------------------------------------------------------------------
sub getIndexerParams {
my $self = shift;
@ -279,11 +273,6 @@ sub getIndexerParams {
};
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,"Asset_Poll");
}
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {

View file

@ -77,6 +77,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_Product"),
icon=>'product.gif',
tableName=>'Product',
className=>'WebGUI::Asset::Wobject::Product',
properties=>{
@ -299,10 +301,6 @@ sub getIndexerParams {
};
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,"Asset_Product");
}
#-------------------------------------------------------------------
sub getThumbnailFilename {

View file

@ -32,6 +32,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_SQLReport"),
icon=>'sqlReport.gif',
tableName=>'SQLReport',
className=>'WebGUI::Asset::Wobject::SQLReport',
properties=>{
@ -231,19 +233,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/sqlReport.gif' if ($small);
return $session{config}{extrasURL}.'/assets/sqlReport.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,"Asset_SQLReport");
}
#-------------------------------------------------------------------
sub getUiLevel {

View file

@ -55,6 +55,8 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(1,'Asset_Survey'),
icon=>'survey.gif',
tableName => 'Survey',
className => 'WebGUI::Asset::Wobject::Survey',
properties => {
@ -286,13 +288,6 @@ sub getEditForm {
return $tabform;
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/survey.gif' if ($small);
return $session{config}{extrasURL}.'/assets/survey.gif';
}
#
# WID FIXEN!
@ -520,10 +515,6 @@ sub getUserId {
return $userId;
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1,'Asset_Survey');
}
#-------------------------------------------------------------------
sub purge {

View file

@ -73,60 +73,56 @@ sub definition {
my $class = shift;
my $definition = shift;
push(@{$definition}, {
assetName=>WebGUI::International::get(2,'Asset_SyndicatedContent'),
icon=>'syndicatedContent.gif',
tableName=>'SyndicatedContent',
className=>'WebGUI::Asset::Wobject::SyndicatedContent',
properties=>{
templateId =>{
fieldType=>'template',
defaultValue=>'PBtmpl0000000000000065'
defaultValue=>'PBtmpl0000000000000065',
namespace=>'SyndicatedContent',
label=>WebGUI::International::get(72,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('72 description','Asset_SyndicatedContent')
},
rssUrl=>{
defaultValue=>undef,
fieldType=>'textarea'
fieldType=>'textarea',
label=>WebGUI::International::get(1,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('1 description','Asset_SyndicatedContent')
},
maxHeadlines=>{
fieldType=>'integer',
defaultValue=>10
defaultValue=>10,
label=>WebGUI::International::get(3,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('3 description','Asset_SyndicatedContent')
},
displayMode=>{
fieldType=>'text',
defaultValue=>'interleaved'
},
fieldType=>'selectList',
defaultValue=>'interleaved',
options=>{
'interleaved'=>WebGUI::International::get('interleaved','Asset_SyndicatedContent'),
'grouped'=>WebGUI::International::get('grouped','Asset_SyndicatedContent'),
},
sortByValue=>1,
label=>WebGUI::International::get('displayModeLabel','Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('displayModeLabel description','Asset_SyndicatedContent'),
subtext=>WebGUI::International::get('displayModeSubtext','Asset_SyndicatedContent')
},
hasTerms=>{
fieldType=>'text',
defaultValue=>''
}
fieldType=>'text',
defaultValue=>'',
label=>WebGUI::International::get('hasTermsLabel','Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('hasTermsLabel description','Asset_SyndicatedContent'),
maxlength=>255
}
}
});
return $class->SUPER::definition($definition);
}
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=head2 getName ()
Returns the icons associated with this asset.
=cut
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/syndicatedContent.gif' if ($small);
return $session{config}{extrasURL}.'/assets/syndicatedContent.gif';
}
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=head2 getName ()
Returns the displayable name of this asset.
=cut
sub getName {
return WebGUI::International::get(2,'Asset_SyndicatedContent');
}
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -141,59 +137,6 @@ sub getUiLevel {
}
#-------------------------------------------------------------------
=head2 getEditForm ()
Returns the TabForm object that will be used in generating the edit page for this asset.
=cut
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab('display')->template(
-value=>$self->getValue('templateId'),
-namespace=>'SyndicatedContent',
-label=>WebGUI::International::get(72,'Asset_SyndicatedContent'),
-hoverHelp=>WebGUI::International::get('72 description','Asset_SyndicatedContent'),
);
$tabform->getTab('display')->selectList(
-name=>'displayMode',
-options=>{
'interleaved'=>WebGUI::International::get('interleaved','Asset_SyndicatedContent'),
'grouped'=>WebGUI::International::get('grouped','Asset_SyndicatedContent'),
},
-sortByValue=>1,
-label=>WebGUI::International::get('displayModeLabel','Asset_SyndicatedContent'),
-hoverHelp=>WebGUI::International::get('displayModeLabel description','Asset_SyndicatedContent'),
-value=>[$self->getValue('displayMode')],
-subtext=>WebGUI::International::get('displayModeSubtext','Asset_SyndicatedContent'),
);
$tabform->getTab('display')->text(
-name=>'hasTerms',
-label=>WebGUI::International::get('hasTermsLabel','Asset_SyndicatedContent'),
-hoverHelp=>WebGUI::International::get('hasTermsLabel description','Asset_SyndicatedContent'),
-maxlength=>255,
-value=>$self->getValue('hasTerms'),
);
$tabform->getTab('properties')->textarea(
-name=>'rssUrl',
-label=>WebGUI::International::get(1,'Asset_SyndicatedContent'),
-hoverHelp=>WebGUI::International::get('1 description','Asset_SyndicatedContent'),
-value=>$self->getValue('rssUrl')
);
$tabform->getTab('display')->integer(
-name=>'maxHeadlines',
-label=>WebGUI::International::get(3,'Asset_SyndicatedContent'),
-hoverHelp=>WebGUI::International::get('3 description','Asset_SyndicatedContent'),
-value=>$self->getValue('maxHeadlines')
);
#$tabform->addTab('rss',WebGUI::International::get('rssTabName','Asset_SyndicatedContent'));
return $tabform;
}
#-------------------------------------------------------------------
# strip all html tags from the given data structure. This is important to
# prevent cross site scripting attacks

View file

@ -55,17 +55,18 @@ sub _create_cache_key {
return $cache_key;
}
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $definition = shift;
my $httpHeaderFieldType;
if ($session{'config'}{'soapHttpHeaderOverride'}) {
$httpHeaderFieldType = 'text';
} else {
$httpHeaderFieldType = 'hidden';
}
push(@{$definition}, {
assetName=>WebGUI::International::get(1, "Asset_WSClient"),
icon=>'web_services.gif',
tableName=>'WSClient',
className=>'WebGUI::Asset::Wobject::WSClient',
properties=>{
@ -130,19 +131,6 @@ sub definition {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/web_services.gif' if ($small);
return $session{config}{extrasURL}.'/assets/web_services.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(1, "Asset_WSClient");
}
#-------------------------------------------------------------------
sub getUiLevel {
return 9;

View file

@ -381,7 +381,7 @@ sub displayLogin {
my $method = $_[0] || "login";
my $vars = $_[1];
unless ($session{form}{op} eq "auth") {
WebGUI::Session::setScratch("redirectAfterLogin",$session{env}{REQUEST_URI});
WebGUI::Session::setScratch("redirectAfterLogin",WebGUI::URL::getSiteURL().WebGUI::URL::getScriptURL().$session{env}{PATH_INFO}."?".$session{env}{QUERY_STRING});
}
$vars->{title} = WebGUI::International::get(66);
my $action;

View file

@ -326,11 +326,6 @@ our $HELP = {
description => '535 description',
namespace => 'WebGUI',
},
{
title => '973',
description => '973 description',
namespace => 'WebGUI',
},
{
title => '400',
description => '400 description',

View file

@ -86,10 +86,11 @@ sub send {
}
$from = $_[4] || $session{setting}{companyEmail};
#header
$message = "To: $_[0]\n";
my $to = $session{config}{emailOverride} || $_[0];
$message = "To: $to\n";
$message .= "From: $from\n";
$message .= "CC: $_[3]\n" if ($_[3]);
$message .= "BCC: $_[5]\n" if ($_[5]);
$message .= "CC: $_[3]\n" if ($_[3] && !$session{config}{emailOverride});
$message .= "BCC: $_[5]\n" if ($_[5] && !$session{config}{emailOverride});
$message .= "Subject: ".$_[1]."\n";
$message .= "Date: ".WebGUI::DateTime::epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n";
if (($_[2] =~ m/<html>/i) || ($_[2] =~ m/<a\sname=/i)) {
@ -103,6 +104,7 @@ sub send {
$message .= $_[2]."\n";
#footer
$message .= WebGUI::Macro::process("\n".$session{setting}{mailFooter});
$message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n";
if ($session{setting}{smtpServer} =~ /\/sendmail/) {
if (open(MAIL,"| $session{setting}{smtpServer} -t -oi")) {
print MAIL $message;
@ -114,9 +116,9 @@ sub send {
$smtp = Net::SMTP->new($session{setting}{smtpServer}); # connect to an SMTP server
if (defined $smtp) {
$smtp->mail($from); # use the sender's address here
$smtp->to($_[0]); # recipient's address
$smtp->cc($_[3]) if ($_[3]);
$smtp->bcc($_[5]) if ($_[5]);
$smtp->to($to); # recipient's address
$smtp->cc($_[3]) if ($_[3] && !$session{config}{emailOverride});
$smtp->bcc($_[5]) if ($_[5] && !$session{config}{emailOverride});
$smtp->data(); # Start the mail
$smtp->datasend($message);
$smtp->dataend(); # Finish sending the mail

View file

@ -110,11 +110,7 @@ sub getOperations {
'deleteGroupGrouping' => 'WebGUI::Operation::Group',
'autoAddToGroup' => 'WebGUI::Operation::Group',
'autoDeleteFromGroup' => 'WebGUI::Operation::Group',
'listGroupsSecondary' => 'WebGUI::Operation::Group',
'manageUsersInGroupSecondary' => 'WebGUI::Operation::Group',
'addUsersToGroupSave' => 'WebGUI::Operation::Group',
'addUsersToGroupSecondarySave' => 'WebGUI::Operation::Group',
'deleteGroupingSecondary' => 'WebGUI::Operation::Group',
'viewHelp' => 'WebGUI::Operation::Help',
'viewHelpIndex' => 'WebGUI::Operation::Help',
'viewMessageLog' => 'WebGUI::Operation::MessageLog',

View file

@ -50,6 +50,8 @@ sub _submenu {
}
if (WebGUI::Grouping::isInGroup(3)) {
$ac->addSubmenuItem(WebGUI::URL::page('op=editGroup&gid=new'), WebGUI::International::get(90));
}
if (WebGUI::Grouping::isInGroup(11)) {
unless ($session{form}{op} eq "listGroups"
|| $session{form}{gid} eq "new"
|| $session{form}{op} eq "deleteGroupConfirm") {
@ -60,8 +62,6 @@ sub _submenu {
$ac->addSubmenuItem(WebGUI::URL::page("op=deleteGroup&gid=".$session{form}{gid}), WebGUI::International::get(806));
}
$ac->addSubmenuItem(WebGUI::URL::page("op=listGroups"), WebGUI::International::get(756));
} else {
$ac->addSubmenuItem(WebGUI::URL::page("op=listGroupsSecondary"), WebGUI::International::get(756));
}
return $ac->render($workarea, $title);
}
@ -154,7 +154,7 @@ sub walkGroups {
#-------------------------------------------------------------------
sub www_addGroupsToGroupSave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my @groups = $session{cgi}->param('groups');
WebGUI::Grouping::addGroupsToGroups(\@groups,[$session{form}{gid}]);
return www_manageGroupsInGroup();
@ -162,20 +162,12 @@ sub www_addGroupsToGroupSave {
#-------------------------------------------------------------------
sub www_addUsersToGroupSave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my @users = $session{cgi}->param('users');
WebGUI::Grouping::addUsersToGroups(\@users,[$session{form}{gid}]);
return www_manageUsersInGroup();
}
#-------------------------------------------------------------------
sub www_addUsersToGroupSecondarySave {
return WebGUI::Privilege::adminOnly() unless _hasSecondaryPrivilege($session{form}{gid});
my @users = $session{cgi}->param('users');
WebGUI::Grouping::addUsersToGroups(\@users,[$session{form}{gid}]);
return www_manageUsersInGroupSecondary();
}
#-------------------------------------------------------------------
sub www_autoAddToGroup {
return WebGUI::AdminConsole->new("groups")->render(WebGUI::Privilege::insufficient()) unless ($session{user}{userId} ne 1);
@ -198,7 +190,7 @@ sub www_autoDeleteFromGroup {
#-------------------------------------------------------------------
sub www_deleteGroup {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
return WebGUI::Privilege::vitalComponent() if (isIn($session{form}{gid}, qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
my ($output);
$output .= WebGUI::International::get(86).'<p>';
@ -211,7 +203,7 @@ sub www_deleteGroup {
#-------------------------------------------------------------------
sub www_deleteGroupConfirm {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
return WebGUI::Privilege::vitalComponent() if (isIn($session{form}{gid}, qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
my $g = WebGUI::Group->new($session{form}{gid});
$g->delete;
@ -220,14 +212,14 @@ sub www_deleteGroupConfirm {
#-------------------------------------------------------------------
sub www_deleteGroupGrouping {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup('3'));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup('3') || _hasSecondaryPrivilege($session{form}{gid}));
WebGUI::Grouping::deleteGroupsFromGroups([$session{form}{delete}],[$session{form}{gid}]);
return www_manageGroupsInGroup();
}
#-------------------------------------------------------------------
sub www_deleteGrouping {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
return WebGUI::Privilege::vitalComponent();
}
@ -240,19 +232,10 @@ sub www_deleteGrouping {
return WebGUI::Operation::Group::www_manageUsersInGroup();
}
#-------------------------------------------------------------------
sub www_deleteGroupingSecondary {
return WebGUI::Privilege::adminOnly() unless _hasSecondaryPrivilege($session{form}{gid});
if ($session{user}{userId} eq $session{form}{uid}) {
return WebGUI::Privilege::vitalComponent();
}
WebGUI::Grouping::deleteUsersFromGroups([$session{form}{uid}],[$session{form}{gid}]);
return www_manageUsersInGroupSecondary();
}
#-------------------------------------------------------------------
sub www_editGroup {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my ($output, $f, $g);
if ($session{form}{gid} eq "new") {
$g = WebGUI::Group->new("");
@ -392,7 +375,7 @@ sub www_editGroup {
#-------------------------------------------------------------------
sub www_editGroupSave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my $g = WebGUI::Group->new($session{form}{gid});
$g->description($session{form}{description});
$g->name($session{form}{groupName});
@ -417,7 +400,7 @@ sub www_editGroupSave {
#-------------------------------------------------------------------
sub www_editGrouping {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my $f = WebGUI::HTMLForm->new;
$f->hidden("op","editGroupingSave");
$f->hidden("uid",$session{form}{uid});
@ -438,7 +421,7 @@ sub www_editGrouping {
#-------------------------------------------------------------------
sub www_editGroupingSave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
WebGUI::Grouping::userGroupExpireDate($session{form}{uid},$session{form}{gid},setToEpoch($session{form}{expireDate}));
WebGUI::Grouping::userGroupAdmin($session{form}{uid},$session{form}{gid},$session{form}{groupAdmin});
return www_manageUsersInGroup();
@ -446,7 +429,7 @@ sub www_editGroupingSave {
#-------------------------------------------------------------------
sub www_emailGroup {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my ($output,$f);
$f = WebGUI::HTMLForm->new;
$f->hidden("op","emailGroupSend");
@ -472,7 +455,7 @@ sub www_emailGroup {
#-------------------------------------------------------------------
sub www_emailGroupSend {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my ($sth, $email);
$sth = WebGUI::SQL->read("select b.fieldData from groupings a left join userProfileData b
on a.userId=b.userId and b.fieldName='email' where a.groupId=".quote($session{form}{gid}));
@ -487,65 +470,63 @@ sub www_emailGroupSend {
#-------------------------------------------------------------------
sub www_listGroups {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my $output = getGroupSearchForm("listGroups");
my ($groupCount) = WebGUI::SQL->quickArray("select count(*) from groups");
return _submenu($output) unless ($session{form}{doit} || $groupCount<250 || $session{form}{pn} > 1);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'
.WebGUI::International::get(748).'</td></tr>';
my $p = doGroupSearch("op=listGroups",1);
foreach my $row (@{$p->getPageData}) {
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($row->{groupId}));
$output .= '
<tr>
<td valign="top" class="tableData"><a href="'.WebGUI::URL::page("op=editGroup&gid=".$row->{groupId}).'">'.$row->{groupName}.'</a></td>
<td valign="top" class="tableData">'.$row->{description}.'</td>
<td valign="top" class="tableData">'.$userCount.'</td>
</tr>
if (WebGUI::Grouping::isInGroup(3)) {
my $output = getGroupSearchForm("listGroups");
my ($groupCount) = WebGUI::SQL->quickArray("select count(*) from groups");
return _submenu($output) unless ($session{form}{doit} || $groupCount<250 || $session{form}{pn} > 1);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'
.WebGUI::International::get(748).'</td></tr>';
my $p = doGroupSearch("op=listGroups",1);
foreach my $row (@{$p->getPageData}) {
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($row->{groupId}));
$output .= '
<tr>
<td valign="top" class="tableData"><a href="'.WebGUI::URL::page("op=editGroup&gid=".$row->{groupId}).'">'.$row->{groupName}.'</a></td>
<td valign="top" class="tableData">'.$row->{description}.'</td>
<td valign="top" class="tableData">'.$userCount.'</td>
</tr>
';
}
$output .= '</table>';
$output .= $p->getBarTraditional;
return _submenu($output,'',"groups manage");
} elsif (WebGUI::Grouping::isInGroup(11)) {
my ($output, $p, $sth, @data, @row, $i, $userCount);
my @editableGroups = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($session{user}{userId})." and groupAdmin=1");
push (@editableGroups,0);
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups
where groupId in (".quoteAndJoin(\@editableGroups).") order by groupName");
while (@data = $sth->array) {
$row[$i] = '<tr>';
$row[$i] .= '<td valign="top" class="tableData"><a href="'
.WebGUI::URL::page('op=manageUsersInGroup&gid='.$data[0]).'">'.$data[1].'</td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td>';
($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($data[0]));
$row[$i] .= '<td valign="top" class="tableData">'.$userCount.'</td></tr>';
$row[$i] .= '</tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroups'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'
.WebGUI::International::get(748).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
return _submenu($output,'89');
}
$output .= '</table>';
$output .= $p->getBarTraditional;
return _submenu($output,'',"groups manage");
return WebGUI::Privilege::adminOnly();
}
#-------------------------------------------------------------------
sub www_listGroupsSecondary {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(11));
my ($output, $p, $sth, @data, @row, $i, $userCount);
my @editableGroups = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($session{user}{userId})." and groupAdmin=1");
push (@editableGroups,0);
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups
where groupId in (".quoteAndJoin(\@editableGroups).") order by groupName");
while (@data = $sth->array) {
$row[$i] = '<tr>';
$row[$i] .= '<td valign="top" class="tableData"><a href="'
.WebGUI::URL::page('op=manageUsersInGroupSecondary&gid='.$data[0]).'">'.$data[1].'</td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td>';
($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($data[0]));
$row[$i] .= '<td valign="top" class="tableData">'.$userCount.'</td></tr>';
$row[$i] .= '</tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroupsSecondary'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'
.WebGUI::International::get(748).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
return _submenu($output,'89');
}
#-------------------------------------------------------------------
sub www_manageGroupsInGroup {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my ($output, $p, $group, $groups, $f);
$f = WebGUI::HTMLForm->new;
$f->hidden("op","addGroupsToGroupSave");
@ -583,7 +564,7 @@ sub www_manageGroupsInGroup {
#-------------------------------------------------------------------
sub www_manageUsersInGroup {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
my $output = WebGUI::Form::formHeader()
.WebGUI::Form::hidden({
name=>"gid",
@ -644,47 +625,6 @@ sub www_manageUsersInGroup {
return _submenu($output,'88');
}
#-------------------------------------------------------------------
sub www_manageUsersInGroupSecondary {
return WebGUI::Privilege::adminOnly() unless _hasSecondaryPrivilege($session{form}{gid});
my ($output, $sth, %hash);
tie %hash, 'Tie::CPHash';
my $group = WebGUI::Group->new($session{form}{gid});
my $f = WebGUI::HTMLForm->new;
$f->hidden("gid",$session{form}{gid});
$f->hidden("op","addUsersToGroupSecondarySave");
my $existingUsers = WebGUI::Grouping::getUsersInGroup($session{form}{gid});
push(@{$existingUsers},"1");
push(@{$existingUsers},"3");
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where status='Active' and userId not in (".quoteAndJoin($existingUsers).") order by username");
$f->selectList(
-name=>"users",
-label=>WebGUI::International::get(976),
-options=>$users,
-multiple=>1,
-size=>7
);
$f->submit;
$output .= $f->print;
$output .= '<table border="1" cellpadding="2" cellspacing="0"><tr><td class="tableHeader">&nbsp;</td>
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
<td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
$sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate
from groupings,users where groupings.groupId=".quote($session{form}{gid})." and groupings.userId=users.userId
order by users.username");
while (%hash = $sth->hash) {
$output .= '<tr><td>'
.deleteIcon('op=deleteGroupingSecondary&uid='.$hash{userId}.'&gid='.$session{form}{gid})
.'</td>';
$output .= '<td class="tableData"><a href="'.WebGUI::URL::page('op=editUser&uid='.$hash{userId}).'">'
.$hash{username}.'</a></td>';
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%z").'</td></tr>';
}
$sth->finish;
$output .= '</table>';
return _submenu($output,'88');
}
1;

View file

@ -162,12 +162,6 @@ sub www_editSettings {
-label=>$i18n->get(535),
-value=>[$session{setting}{onNewUserAlertGroup}]
);
# misc settings
$tabform->getTab("misc")->yesNo(
-name=>"proxiedClientAddress",
-label=>$i18n->get(973),
-value=>$session{setting}{proxiedClientAddress}
);
$tabform->getTab("misc")->yesNo(
-name=>"preventProxyCache",
-label=>$i18n->get(400),

View file

@ -358,7 +358,7 @@ sub open {
### evironment variables from web server
$session{env} = \%ENV;
### check to see if client is proxied and adjust remote_addr as necessary
if (($session{setting}{proxiedClientAddress} eq "1") && ($ENV{HTTP_X_FORWARDED_FOR} ne "")) {
if ($ENV{HTTP_X_FORWARDED_FOR} ne "") {
$session{env}{REMOTE_ADDR} = $ENV{HTTP_X_FORWARDED_FOR};
}
###----------------------------
@ -491,13 +491,8 @@ Session id will be generated if not specified. In almost every case you should l
sub start {
my ($sessionId);
$sessionId = $_[1] || _uniqueSessionId();
if (($session{setting}{proxiedClientAddress} eq "1") && ($ENV{HTTP_X_FORWARDED_FOR} ne "")) {
WebGUI::SQL->write("insert into userSession values ('$sessionId', ".
(_time()+$session{setting}{sessionTimeout}).", "._time().", 0, '$ENV{HTTP_X_FORWARDED_FOR}', ".quote($_[0]).")");
} else {
WebGUI::SQL->write("insert into userSession values ('$sessionId', ".
(_time()+$session{setting}{sessionTimeout}).", "._time().", 0, '$ENV{REMOTE_ADDR}', ".quote($_[0]).")");
}
WebGUI::SQL->write("insert into userSession values ('$sessionId', ".
(_time()+$session{setting}{sessionTimeout}).", "._time().", 0, '$ENV{REMOTE_ADDR}', ".quote($_[0]).")");
push @{$session{http}{cookie}}, $session{cgi}->cookie(
-name=>"wgSession",
-value=>$sessionId,

View file

@ -2981,11 +2981,6 @@ As with any delete operation, you are prompted to be sure you wish to proceed wi
lastUpdated => 1091514049
},
'973' => {
message => q|If proxied, use real client IP address?|,
lastUpdated => 1053459227
},
'339' => {
message => q|Male|,
lastUpdated => 1031514049
@ -3685,11 +3680,6 @@ Optionally, if you are running a sendmail server on the same machine as WebGUI,
lastUpdated => 1120239343,
},
'973 description' => {
message => q|If enabled and if the environment variable HTTP_X_FORWARDED_FOR is present, it's value will be used in place of REMOTE_ADDRESS as the client browser's IP address. This is required for IP based groups to function properly in reverse-proxied, load-balanced system architectures. In these environments, all requests would otherwise appear to come from the same host, namely the proxy server. If you are uncertain if you need this setting enabled, you should probably leave it turned off.|,
lastUpdated => 1120239343,
},
'400 description' => {
message => q|Some companies have proxy servers that cause problems with WebGUI. If you're experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to <i>Yes</i>. Beware that WebGUI's URLs will not be as user-friendly after this feature is turned on.|,
lastUpdated => 1120239343,