hi
as there are quite a lot of pages in matrix theme which generates dropdowns for album/image replacement etc, it uses Utilites::createAlbumTree() for generating those trees..
the only problem with it that it's not sorted in any way.
Having an album with 200subalbums+subs in those too,it's quite hard to find anything unordered :O
it would be cool to have those sorted as sorting is solved at albumselect module..
or at least 1 of those..by title 
looked at GalleryUtilites.class, i guess the most efficient could be to set the sorting order there..
it's okay that i need to get the title for all albums with something like
/* Index the albums by id */
$map = array();
foreach ($albums as $album) {
$albumId = $album->getId();
$albumTitle = $album->getTitle();
The only other clear thing that sorting should be done per subalbumtree..
but where? :O
in here:
/* Walk the root albums */
$tree = array();
foreach ($roots as $id) {
$tree = array_merge($tree, GalleryUtilities::_createDepthTree($map, $id));
}
or in here?
function _createDepthTree(&$map, $id, $depth=0) {
....
if (isset($map[$id]['children'])) {
foreach ($map[$id]['children'] as $childId) {
$data = array_merge($data,
GalleryUtilities::_createDepthTree($map, $childId, $depth+1));
}
}
..
or am i totally wrong here? it's a way too much arrays for me in here ;>
thanks for any guidance!
Posts: 8601
I don't see any references to this in matrix theme.. perhaps you are referring to item-edit pages like ItemMove.
These cases all get their album data using GalleryCoreApi::fetchAllItemIds.. perhaps you can try having this function sort its output rather than sorting in createAlbumTree. Try adding an ORDER BY [GalleryItem::title] in modules/core/classes/GalleryItemHelper_medium.class around line 76.
Posts: 556
hah, yez
works pretty well.
the only unproper behaviour what i see is that the rootalbums(so only the first albums which are real albums, not g2 "itself") not ordered by title. all the other part of the tree ordered well.
What can be the reason for this?
Posts: 8601
seems reasonable to have some sort here, so i'll add it to cvs.
it sorted them all for me, didn't skip top level albums; i viewed it in Move item.
Posts: 556
nice
well i dunno..i checked at Move item too..
here is a "merged" screenshot of that..
the orange bar shows that those 2 is at the same level..and is not seem to be sorted alphabetical at that level :o
Posts: 8601
i don't suppose one of those has a space at the start of the title?
Posts: 556
no!
i doublechecked
Posts: 556
heh..database cache emptied-> one of the titles changed as the result->order OK :O
i was just wondered what's the title "Egyedi mezők" as that means "Custom fields" in english :O..but i thought the other admin might changed that for some testing purpose..but not.. so i have no idea how could that show up as a title there :o
Posts: 556
anyway..it works now.. and it's good to add this to cvs.
might be even better if it would do that comfortable marking as g1, that it would mark the current place of the album (for the moveitem dropdown).. G1 does it by putting a "(Current place)" or something after the title..it would be good, but would be even better with setting that line bold.. (as when scrolling down in an albumtree with 100s of albums, it's not that easy to notify that extra text..but quite easy when that line is bold
thanks mindless!