add support for loopplay flag of soundfile handle

3.4
Christian Veigl 14 years ago
parent 2f9e996b3a
commit 0827f21035

@ -16,7 +16,7 @@ use XML::Simple;
use Catalyst::Log::Log4perl;
use Catalyst qw/ConfigLoader Static::Simple Unicode
use Catalyst qw/-Debug ConfigLoader Static::Simple Unicode
Authentication Authentication::Store::Minimal Authentication::Credential::Password
Session Session::Store::FastMmap Session::State::Cookie
/;

@ -45,6 +45,11 @@ sub handle : Chained('set') PathPart('handle') CaptureArgs(1) {
$c->stash->{handle_id} = $handle_id;
}
sub edit_handle : Chained('handle') PathPart('edit') Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'tt/sound_edit_files.tt';
}
sub upload_soundfile : Chained('handle') PathPart('soundfile/upload') Args(0) {
my ($self, $c) = @_;
my %messages;
@ -91,8 +96,7 @@ sub upload_soundfile : Chained('handle') PathPart('soundfile/upload') Args(0) {
}
$c->session->{messages} = \%messages;
# $c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/edit#set_' . $c->stash->{set_id});
$c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/editfiles');
$c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/edithandles');
}
sub get_soundfile : Chained('handle') PathPart('soundfile/get') Args(0) {
@ -117,7 +121,7 @@ sub edit_set : Chained('set') PathPart('edit') Args(0) {
$c->stash->{template} = 'tt/sound.tt';
}
sub edit_files : Chained('set') PathPart('editfiles') Args(0) {
sub edit_files : Chained('set') PathPart('edithandles') Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'tt/sound_edit_files.tt';
}
@ -161,8 +165,7 @@ sub delete_handle : Chained('handle') PathPart('delete') Args(0) {
$messages{sound_set_err} = 'Client.Voip.InputErrorFound';
}
# $c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/edit#set_' . $c->stash->{set_id});
$c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/editfiles');
$c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/edithandles');
}
sub save_set : Chained('set') PathPart('save') Args(0) {
@ -202,6 +205,29 @@ sub save_set : Chained('set') PathPart('save') Args(0) {
$c->response->redirect("/sound");
}
sub save_handle : Chained('handle') PathPart('save') Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'tt/sound_edit_files.tt';
my %messages;
if ($c->model('Provisioning')->call_prov($c, 'voip',
'update_sound_handle',
{ set_id => $c->stash->{set_id},
handle_id => $c->stash->{handle_id},
loopplay => $c->request->params->{loopplay} eq 'on' ? 1 : 0,
},
undef))
{
$messages{sound_set_msg} = 'Server.Voip.SavedSettings';
}
else {
$messages{sound_set_err} = 'Client.Voip.InputErrorFound';
}
$c->session->{messages} = \%messages;
$c->response->redirect('/sound/set/' . $c->stash->{set_id} . '/edithandles');
}
sub load_sets :Private {
my ($self, $c) = @_;

@ -37,7 +37,7 @@
<li class="ui-state-default">
<div class="span-6">
<a href="/sound/set/[% set.id %]/editfiles">[% set.name %]</a>
<a href="/sound/set/[% set.id %]/edithandles">[% set.name %]</a>
[% IF count > 0 %]
[% plural = 's' IF count > 1 %]
<font class="small"><i>(mapped [% count %] time[% plural %])</i></font>

@ -11,7 +11,8 @@
<li class="ui-state-default">
<div class="span-2">Setname</div>
<div class="prepend-1 span-2">Handle</div>
<div class="prepend-1 span-2">Filename</div>
<div class="prepend-1 span-1">Loopplay</div>
<div class="prepend-1 span-4">Filename</div>
</li>
<li class="ui-state-default">
<div class="span-5">
@ -28,26 +29,42 @@
<li class="ui-state-default">
<div class="span-2"></div>
<div class="prepend-1 span-2">[% h.name %]</div>
[% IF h.filename.length AND NOT h.err %]
<div class="prepend-1 span-2"><a href="/sound/set/[% set.id %]/handle/[% h.id %]/soundfile/get">[% h.filename %]</a></div>
<form action="/sound/set/[% set.id %]/handle/[% h.id %]/delete" method="post">
<div class="prepend-6 span-1">
[% UNLESS Catalyst.session.admin.read_only %]
<button class="button-delete" id="setdel[% id %]">Delete</button>
[% END %]
</form>
</div>
[% ELSE %]
[% IF NOT h.filename.length %] [%# kein file %]
<form action="/sound/set/[% set.id %]/handle/[% h.id %]/soundfile/upload" method="post" enctype="multipart/form-data">
<div class="prepend-1 span-4">
<div class="prepend-1 span-1"></div>
<div class="prepend-1 span-6">
[%# value='' is ignored by browsers for security reasons for file-input-fields %]
<input id="soundfile" name="soundfile" class="file" type="file" size="10" value="[% IF h.filename.length %][% h.filename %][% END %]">
</div>
<div class="prepend-4 span-1">
<div class="prepend-1 span-1">
<button class="button-add" id="soundadd" />
</div>
</form>
[% ELSIF handle_id == h.id %] [%# edit %]
<form action="/sound/set/[% set.id %]/handle/[% h.id %]/save" method="post">
<div class="prepend-1 span-1"><input type="checkbox" class="checkbox" id="loopplay_"[% h.id %] name="loopplay" [% IF h.loopplay %]checked="checked"[% END %]></div>
<div class="prepend-1 span-4">[% h.filename %]</div>
<div class="prepend-3 span-1">
<button class="button-save" id="handlesave[% id %]">Save</button>
</div>
<div class="span-1">
<a href="/sound/set/[% set.id %]/edithandles"><span class="button-cancel">Cancel</span></a>
</div>
</form>
[% ELSE %] [%# view %]
<div class="prepend-1 span-1"><input type="checkbox" class="checkbox" id="loopplay_"[% h.id %] name="loopplay" [% IF h.loopplay %]checked="checked"[% END %] disabled="disabled"></div>
<div class="prepend-1 span-4"><a href="/sound/set/[% set.id %]/handle/[% h.id %]/soundfile/get">[% h.filename %]</a></div>
<form action="/sound/set/[% set.id %]/handle/[% h.id %]/delete" method="post">
[% UNLESS Catalyst.session.admin.read_only %]
<div class="prepend-3 span-1">
<a href="/sound/set/[% set.id %]/handle/[% h.id %]/edit"><span class="button-edit">Edit</span></a>
</div>
<div class="span-1">
<button class="button-delete" id="setdel[% id %]">Delete</button>
</div>
[% END %]
</form>
[% END %]
</li>
[% END %]

Loading…
Cancel
Save