# Copyright (c) 2005 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: RealmFileDAVList.bunit,v 1.5 2007/11/08 03:24:17 aviggio Exp $ ListModel(); req()->initialize_fully->set_realm_and_user('demo', 'demo'); my($pub) = Bivio::Biz::Model->new(req(), 'RealmFile')->load({path => '/public'}); my($load_dav) = { method => 'load_dav', compute_params => sub { my(undef, $params) = @_; req()->put(path_info => $params->[0]); return []; }, compute_return => sub { return [shift->get('object')->get_result_set_size]; }, }; [ $load_dav => [ '/not-found' => 0, '/*' => CORRUPT_QUERY(), '/' => 1, '' => 1, '/public' => 1, ], dav_propfind => [ [] => [{ displayname => 'Public', uri => '', getlastmodified => $pub->get('modified_date_time'), }], ], dav_propfind_children => [ [] => [ $pub->new_other('RealmFileList')->map_iterate(sub { my($m) = @_; my($n) = Bivio::Type::FileName->get_tail( $m->get('RealmFile.path')); return { uri => $n, displayname => $n, $m->get('RealmFile.is_folder') ? () : (getcontenttype => $m->get_content_type, getcontentlength => $m->get_content_length), getlastmodified => $m->get('RealmFile.modified_date_time'), }; }, { path_info => '/public', }), ], ], $load_dav => [ '/hello.txt' => 0, ], dav_put => [ [\(my $x = <<'EOF')] => not_die(), hello world EOF ], $load_dav => [ '/hello.txt' => 1, ], dav_put => [ [\(my $y = <<'EOF')] => not_die(), Hello world! EOF ], $load_dav => [ '/Archived/hello;1.txt' => 1, ], ];