# Copyright (c) 2009 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: RemoteCopyList.pm,v 1.1 2009/03/07 02:48:20 nagler Exp $ package Bivio::Biz::Model::RemoteCopyList; use strict; use Bivio::Base 'Biz.ListModel'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.1 $ =~ /\d+/g); my($_COLS) = [ [qw(realm Name)], [qw(user RealmName)], [qw(pass Line)], [qw(uri HTTPURI)], [qw(folder FilePathArray)], ]; sub internal_initialize { my($self) = @_; my($c) = [@$_COLS]; return $self->merge_initialize_info($self->SUPER::internal_initialize, { version => 1, $self->field_decl( primary_key => [shift(@$c)], other => $c, ), }); } sub internal_load_rows { my($self) = @_; return [sort( {$a->{realm} cmp $b->{realm}} map({ $_->{uri} =~ s{/+$}{}; $_->{uri} ||= '/'; $_->{folder} = $_->{folder}->sort_unique; $_; } values(%{ $self->new_other('RealmSettingList') ->get_all_settings(RemoteCopy => [@$_COLS]) }), ), )]; } sub unauth_if_setting_available { my($self, $realm_id) = @_; return $self->new_other('RealmSettingList') ->unauth_if_file_exists(RemoteCopy => $realm_id); } 1;