# Copyright (c) 2006-2010 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: RealmFileTreeList.bunit,v 1.8 2010/02/07 19:10:29 nagler Exp $ ListModel(); req()->set_realm_and_user('btest_read', 'btest_read') ->initialize_fully('FORUM_FILE_TREE_LIST'); options({ compute_return => sub { my(undef, $actual) = @_; return $actual->[0]->map_rows(sub{shift->get('RealmFile.path_lc');}); }, }); [ load_all => [ [] => [qw(/ /private /public)], sub { return [{ order_by => '0d', this => join(',', @{shift->get('object')->map_rows( sub { my($it) = @_; return $it->get('RealmFile.path_lc') eq '/private' ? $it->get('RealmFile.realm_file_id') : (); }, )}), }]; } => [qw(/ /public /private /private/image.gif /private/file.html)], [{path_info => '/private'}] => [qw(/private/file.html /private/image.gif)], [{path_info => '/does-not-exist'}] => MODEL_NOT_FOUND(), ], ];