Page tweaks.
This commit is contained in:
parent
202f1f40c8
commit
126028e27f
2 changed files with 47 additions and 17 deletions
|
|
@ -225,7 +225,7 @@ sub getGroupsForUser {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getGroupsInGroup ( groupId )
|
=head2 getGroupsInGroup ( groupId [, recursive ] )
|
||||||
|
|
||||||
Returns an array reference containing a list of groups that belong to the specified group.
|
Returns an array reference containing a list of groups that belong to the specified group.
|
||||||
|
|
||||||
|
|
@ -235,18 +235,32 @@ Returns an array reference containing a list of groups that belong to the specif
|
||||||
|
|
||||||
A unique identifier for the group.
|
A unique identifier for the group.
|
||||||
|
|
||||||
|
=item recursive
|
||||||
|
|
||||||
|
A boolean value to determine whether the method should return the groups directly in the group, or to follow the entire groups of groups hierarchy. Defaults to "0".
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub getGroupsInGroup {
|
sub getGroupsInGroup {
|
||||||
return WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$_[0]");
|
my $groups = WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$_[0]");
|
||||||
|
if ($_[1]) {
|
||||||
|
my @groupsOfGroups = @$groups;
|
||||||
|
foreach my $group (@$groups) {
|
||||||
|
my $gog = getGroupsInGroup($group,1);
|
||||||
|
push(@groupsOfGroups, @$gog);
|
||||||
|
}
|
||||||
|
return \@groupsOfGroups;
|
||||||
|
} else {
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getUsersInGroup ( groupId )
|
=head2 getUsersInGroup ( groupId [, recursive ] )
|
||||||
|
|
||||||
Returns an array reference containing a list of users that belong to the specified group.
|
Returns an array reference containing a list of users that belong to the specified group.
|
||||||
|
|
||||||
|
|
@ -256,12 +270,23 @@ Returns an array reference containing a list of users that belong to the specifi
|
||||||
|
|
||||||
A unique identifier for the group.
|
A unique identifier for the group.
|
||||||
|
|
||||||
|
=item recursive
|
||||||
|
|
||||||
|
A boolean value to determine whether the method should return the users directly in the group or to follow the entire groups of groups hierarchy. Defaults to "0".
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub getUsersInGroup {
|
sub getUsersInGroup {
|
||||||
return WebGUI::SQL->buildArrayRef("select userId from groupings where groupId=$_[0]");
|
my $clause = "groupId=$_[0]";
|
||||||
|
if ($_[1]) {
|
||||||
|
my $groups = getGroupsInGroup($_[0],1);
|
||||||
|
if ($#$groups >= 0) {
|
||||||
|
$clause = "groupId in (".join(",",@$groups).")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return WebGUI::SQL->buildArrayRef("select userId from groupings where $clause");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,13 @@ sub _recursivelyChangePrivileges {
|
||||||
my ($sth, $pageId);
|
my ($sth, $pageId);
|
||||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
||||||
while (($pageId) = $sth->array) {
|
while (($pageId) = $sth->array) {
|
||||||
WebGUI::SQL->write("update page set startDate=$session{form}{startDate}, endDate=$session{form}{endDate},
|
if (WebGUI::Privilege::canEditPage($pageId)) {
|
||||||
ownerId=$session{form}{ownerId}, groupIdView=$session{form}{groupIdView},
|
WebGUI::SQL->write("update page set startDate=$session{form}{startDate},
|
||||||
groupIdEdit=$session{form}{groupIdEdit} where pageId=$pageId");
|
endDate=$session{form}{endDate},
|
||||||
_recursivelyChangePrivileges($pageId);
|
ownerId=$session{form}{ownerId}, groupIdView=$session{form}{groupIdView},
|
||||||
|
groupIdEdit=$session{form}{groupIdEdit} where pageId=$pageId");
|
||||||
|
_recursivelyChangePrivileges($pageId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +49,10 @@ sub _recursivelyChangeStyle {
|
||||||
my ($sth, $pageId);
|
my ($sth, $pageId);
|
||||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
||||||
while (($pageId) = $sth->array) {
|
while (($pageId) = $sth->array) {
|
||||||
WebGUI::SQL->write("update page set styleId=$session{form}{styleId} where pageId=$pageId");
|
if (WebGUI::Privilege::canEditPage($pageId)) {
|
||||||
_recursivelyChangeStyle($pageId);
|
WebGUI::SQL->write("update page set styleId=$session{form}{styleId} where pageId=$pageId");
|
||||||
|
_recursivelyChangeStyle($pageId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
|
@ -324,19 +329,19 @@ sub www_editPage {
|
||||||
);
|
);
|
||||||
$f->raw(
|
$f->raw(
|
||||||
-value=>'<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>',
|
-value=>'<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>',
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
$f->date(
|
$f->date(
|
||||||
-name=>"startDate",
|
-name=>"startDate",
|
||||||
-label=>WebGUI::International::get(497),
|
-label=>WebGUI::International::get(497),
|
||||||
-value=>$page{startDate},
|
-value=>$page{startDate},
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
$f->date(
|
$f->date(
|
||||||
-name=>"endDate",
|
-name=>"endDate",
|
||||||
-label=>WebGUI::International::get(498),
|
-label=>WebGUI::International::get(498),
|
||||||
-value=>$page{endDate},
|
-value=>$page{endDate},
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
$subtext = ' <a href="'.WebGUI::URL::page('op=listUsers').'">'
|
$subtext = ' <a href="'.WebGUI::URL::page('op=listUsers').'">'
|
||||||
|
|
@ -346,7 +351,7 @@ sub www_editPage {
|
||||||
}
|
}
|
||||||
my $clause;
|
my $clause;
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
my $contentManagers = WebGUI::Grouping::getUsersInGroup(4);
|
my $contentManagers = WebGUI::Grouping::getUsersInGroup(4,1);
|
||||||
$clause = "userId in ($session{user}{userId},".join(",",@$contentManagers).")";
|
$clause = "userId in ($session{user}{userId},".join(",",@$contentManagers).")";
|
||||||
} else {
|
} else {
|
||||||
$clause = "userId=$page{ownerId}";
|
$clause = "userId=$page{ownerId}";
|
||||||
|
|
@ -358,7 +363,7 @@ sub www_editPage {
|
||||||
-label=>WebGUI::International::get(108),
|
-label=>WebGUI::International::get(108),
|
||||||
-value=>[$page{ownerId}],
|
-value=>[$page{ownerId}],
|
||||||
-subtext=>$subtext,
|
-subtext=>$subtext,
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
$subtext = ' <a href="'.WebGUI::URL::page('op=listGroups').'">'
|
$subtext = ' <a href="'.WebGUI::URL::page('op=listGroups').'">'
|
||||||
|
|
@ -371,7 +376,7 @@ sub www_editPage {
|
||||||
-label=>WebGUI::International::get(872),
|
-label=>WebGUI::International::get(872),
|
||||||
-value=>[$page{groupIdView}],
|
-value=>[$page{groupIdView}],
|
||||||
-subtext=>$subtext,
|
-subtext=>$subtext,
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
$f->group(
|
$f->group(
|
||||||
-name=>"groupIdEdit",
|
-name=>"groupIdEdit",
|
||||||
|
|
@ -379,7 +384,7 @@ sub www_editPage {
|
||||||
-value=>[$page{groupIdEdit}],
|
-value=>[$page{groupIdEdit}],
|
||||||
-subtext=>$subtext,
|
-subtext=>$subtext,
|
||||||
-excludeGroups=>[1,7],
|
-excludeGroups=>[1,7],
|
||||||
-uiLevel=>9
|
-uiLevel=>6
|
||||||
);
|
);
|
||||||
if ($childCount) {
|
if ($childCount) {
|
||||||
$f->yesNo(
|
$f->yesNo(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue