# Copyright (c) 2011 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: RealmFolderFileList.bunit,v 2.1 2011/03/23 19:18:20 moeller Exp $ ListModel(); req()->set_realm_and_user('btest_read', 'btest_read') ->initialize_fully('FORUM_FOLDER_FILE_LIST'); options({ compute_return => sub { my(undef, $actual) = @_; return $actual unless ref($actual->[0]); return $actual->[0]->map_rows(sub{shift->get('RealmFile.path_lc');}); }, }); my($folder_id) = sub { my($path) = @_; return model(RealmFile => { path_lc => $path, })->get('realm_file_id'); }; [ load_all => [ [{ parent_id => $folder_id->('/'), }] => [], [{ parent_id => $folder_id->('/public'), }] => ['/public/file.txt'], [{ parent_id => $folder_id->('/private'), }] => [qw(/private/file.html /private/image.gif)], ], sub { req()->set_user(undef); return 1; } => 1, load_all => [ [{ parent_id => $folder_id->('/'), }] => [], [{ parent_id => $folder_id->('/public'), }] => ['/public/file.txt'], [{ parent_id => $folder_id->('/private'), }] => [], ], ];