Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub www_setContentPositions {
- my $self = shift;
- return $self->session->privilege->insufficient() unless ($self->canEdit);
- $self->session->errorHandler->warn($self->getTitle()."\n");
- my $position = $self->session->form->process("map");
- my @contentPosition = split(',',$position);
- my @child_assetIds;
- my $newRank=1;
- for (my $x=0;$x<@contentPosition;$x++){
- my $children = $self->getLineageIterator(["children"]);
- #loop through the children of the layout asset
- while (1) {
- my $child;
- eval { $child = $children->() };
- if (my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
- $self->session->log->error($x->full_message);
- next;
- }last unless $child;
- #loop through definitive order from setContentPositions
- if ($contentPosition[$x] eq $child->getId){
- $self->session->errorHandler->warn("child title: ".$child->getTitle." Rank: $newRank Current Rank: ".$child->getRank."\n");
- $child->setRank($newRank);
- $newRank++;
- }
- }
- }
- $self->addRevision({
- contentPositions=>$self->session->form->process("map")
- });
- WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
- return "Map set: ".$self->session->form->process("map");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement