Advertisement
Guest User

Untitled

a guest
Oct 26th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. sub www_setContentPositions {
  2. my $self = shift;
  3. return $self->session->privilege->insufficient() unless ($self->canEdit);
  4. $self->session->errorHandler->warn($self->getTitle()."\n");
  5.  
  6. my $position = $self->session->form->process("map");
  7. my @contentPosition = split(',',$position);
  8.  
  9.  
  10. my @child_assetIds;
  11. my $newRank=1;
  12. for (my $x=0;$x<@contentPosition;$x++){
  13.  
  14. my $children = $self->getLineageIterator(["children"]);
  15. #loop through the children of the layout asset
  16. while (1) {
  17. my $child;
  18. eval { $child = $children->() };
  19. if (my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
  20. $self->session->log->error($x->full_message);
  21. next;
  22. }last unless $child;
  23. #loop through definitive order from setContentPositions
  24. if ($contentPosition[$x] eq $child->getId){
  25. $self->session->errorHandler->warn("child title: ".$child->getTitle." Rank: $newRank Current Rank: ".$child->getRank."\n");
  26. $child->setRank($newRank);
  27. $newRank++;
  28. }
  29. }
  30. }
  31.  
  32. $self->addRevision({
  33. contentPositions=>$self->session->form->process("map")
  34. });
  35. WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
  36. return "Map set: ".$self->session->form->process("map");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement