Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.



     Discuss > WebGUI Dev

How is page asset order determined?

User iadawn
Date 4/20/2007 5:41 am
Views 1783
Rating -8    Rate [
|
]
Previous · Next
User Message
iadawn

Hi,

Sorry if this is a second post, 'something weird' (tm) happened to my first post on this topic... if it is not the second post then ignore my ramblings!

I have a workflow activity which is used to create an historical record of some system graphs. The activity retrieves the image of the graph from a specified url and adds it as an article to a specified container. The following code is used to shift the new article to the top of the container:

        my $object = $container->addChild({
            className       => 'WebGUI::Asset::Wobject::Article',
            title           => 'VM Stat Graph ' . $today->strftime( '%e %b, %Y' ),
            menuTitle       => $today->strftime( '%e %b, %Y' ),
            url             => $self->get('container') . "/" . lc( $today->strftime( '%d-%b-%Y' ) ),
            styleTemplateId => $styletemplate->getId,
            templateId      => $template->getId,
            isHidden        => 1,
            description     => "<img src='" . $store->getUrl( $file ) . "' />",
        });

        # Move the item to the top of the list
        while( $object->promote ) { }

As far as I can determine from the docs, the 'promote' while loop will push the create article to the top rank within the container.

The main aim is to have a descending date view of the graphs by pushing any new graph to the top of the page. I had seen this code work when I was testing but it does not seem to work now and on playing about with rank I am not sure what the relationship between asset rank and page display order is.

My question (finally) is, what determines the order of asset display on a page? And, how can I manipulate this programmatically.

Thanks for any assistance,

Kevin 



Back to Top
Rate [
|
]
 
 
iadawn

Hi Again,

Well after a bit of playing around with bits and bobs I found out how this was done. Seems page asset order is determined by a comma separated list of asset ids in the container. The property is 'contentPositions' and the additional code required to put my new graph at the top of the page is:

        # Update the content position on the page
        my $contentPositions = $container->get( 'contentPositions' );
        $container->update({ contentPositions => $object->getId . ",$contentPositions" });

Thanks me :) 

Kevin 



Back to Top
Rate [
|
]
 
 
JT
Incidentally, the rank is used to control assets in nav. The reason that it's not used in page layouts is that you need to be able to control the position of assets across multiple content areas.


Back to Top
Rate [
|
]
 
 
     Discuss > WebGUI Dev




shows by JT - Mon @ 05:16pm

Glad to be here by titlandata - Mon @ 04:22pm

Re: Partner for Featu Document Repository by JT - Mon @ 04:21pm

User Registration and update page by aewhale - Mon @ 03:56pm

Re: Partner for Feature: Document Repository by sduensin - Mon @ 03:35pm

Re: Partner for Featu Document Repository by JT - Mon @ 03:26pm

Re: Glad to be here by sduensin - Mon @ 02:26pm

Re: Partner for Feature: Document Repository by sduensin - Mon @ 02:14pm

Re: is there a an audio/video gallery wobject? by fdillon - Mon @ 02:04pm

Re: Security on files ? by knowmad - Mon @ 01:55pm

Form not working. Help! by pvanthony - Mon @ 12:01pm

Security on files ? by dwittenberg - Mon @ 11:47am

Re: Partner for Feature: Document Repository by alphamega - Mon @ 11:08am