Invert sorting of Site Users

Invert sorting of Site Users

Postby easyexpat on Tue Mar 23, 2010 5:09 am

I would like to sort Site Users from the last one to the first (opposite to the current sorting) in the Admin panel.
I assume I need to change the SQL query but can't find it. Can anyone help?
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: Invert sorting of Site Users

Postby jondaley on Wed Mar 24, 2010 11:30 am

It was a little tricky to find.

class/view/admin/adminsiteuserslistview.class.php search for getAllUsers and change the $orderBy parameter (currently set to "") to "id DESC".
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Invert sorting of Site Users

Postby easyexpat on Thu Mar 25, 2010 2:30 pm

jondaley wrote:It was a little tricky to find.

class/view/admin/adminsiteuserslistview.class.php search for getAllUsers and change the $orderBy parameter (currently set to "") to "id DESC".

Thanks a lot jondaley, it works great.

Also, a little bit trickier it looks to me: I would like also to sort the images by reverse order (DESC) when you want to insert them in a post (Insert Resource/Album). Problem currently is when you add a new photo for your post, it is always at the end of the album so when you want to insert it you have to go to the last page ... I would like to avoid it by displaying first the last image).
I found class/view/admin/adminresourcelistview.class.php but it is not obvious :?
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: Invert sorting of Site Users

Postby easyexpat on Thu Mar 25, 2010 2:41 pm

I think I sorted it out.

Open class/gallery/dao/galleryresources.class.php

FIND
Code: Select all
            if( $searchTerms != "" )
                $query .= " (".$this->getSearchConditions( $searchTerms ).")";
           
            // just in case if for any reason the string ends with "AND"
            $query = trim( $query );
            if( substr( $query, -3, 3 ) == "AND" )
                $query = substr( $query, 0, strlen( $query ) - 3 );
         
            $result = $this->Execute( $query, $page, $itemsPerPage );


REPLACE
Code: Select all
            if( $searchTerms != "" )
                $query .= " (".$this->getSearchConditions( $searchTerms ).")";
           
            // just in case if for any reason the string ends with "AND"
            $query = trim( $query );
            if( substr( $query, -3, 3 ) == "AND" )
                $query = substr( $query, 0, strlen( $query ) - 3 );
           
         //MOD: sort by revers order the images
         $query .= " ORDER BY id DESC";
         
            $result = $this->Execute( $query, $page, $itemsPerPage );


Just an additional question: where is the size of the popup stored? I need to modify the size for the album/resources popup?

:P
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: Invert sorting of Site Users

Postby jondaley on Fri Mar 26, 2010 2:07 pm

yes, that looks good. And a couple people have asked for that feature before, though I think it was mostly solved by making it album show the most recent page when you upload a resource from within the new post page.

For the popup, I think you are asking about the code in /js/ui/common.js
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Invert sorting of Site Users

Postby easyexpat on Fri Mar 26, 2010 2:41 pm

jondaley wrote:For the popup, I think you are asking about the code in /js/ui/common.js

Yes, thanks, that exactly that :-)
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm


Return to Configuration and Installation

cron