# 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: RealmMailPublicForm.bunit,v 2.2 2011/02/18 18:01:40 nagler Exp $ FormModel(); my($this); my($create) = sub { req()->set_realm(shift); my($rm) = model('RealmMail'); $rm->create_from_rfc822( \(<<'EOF'), From: a@model.realmmail2.bunit Message-ID: Date: Sun, 1 May 2005 10:11:41 -0600 Subject: subj Body EOF ); $this = $rm->get('realm_file_id'); return; }; [ req_state({ realm => 'mail_forum', query => sub {+{ this => $this, }}, }), inline_case(sub { $create->('mail_forum'); return; }), [] => FORBIDDEN(), inline_case(sub { $create->('mail_forum'); req('Model.RealmFile')->toggle_is_public; return; }), [] => [{ 'Model.RealmFile' => { is_public => 0, }, }], [] => FORBIDDEN(), req_state_merge({ realm => 'mail_forum_allow_public', }), inline_case(sub { $create->('mail_forum_allow_public'); return; }), [] => [{ 'Model.RealmFile' => { is_public => 1, }, }], [] => [{ 'Model.RealmFile' => { is_public => 0, }, }], ];