/[Arh]/lib/Arh/Action/ToggleEdit.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/Arh/Action/ToggleEdit.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60 - (show annotations)
Mon Apr 7 10:30:34 2008 UTC (15 years, 11 months ago) by dpavlin
File size: 802 byte(s)
fixed enable/disable edit action (and thus button)
1 use strict;
2 use warnings;
3
4 =head1 NAME
5
6 Arh::Action::ToggleEdit
7
8 =cut
9
10 package Arh::Action::ToggleEdit;
11 use base qw/Arh::Action Jifty::Action/;
12
13 use Data::Dump qw/dump/;
14
15 use Jifty::Param::Schema;
16 use Jifty::Action schema {
17
18 };
19
20 =head2 take_action
21
22 =cut
23
24 sub take_action {
25 my $self = shift;
26
27 # warn "## user_object = ",dump( $self->current_user->user_object->as_hash );
28
29 if ( ! $self->current_user->id ) {
30 $self->result->error( _('You need to login') );
31 warn "not logged in!";
32 return 0;
33 }
34
35 my $editing = $self->current_user->user_object->editing ? 0 : 1;
36 $self->current_user->user_object->set_editing( $editing );
37
38 $self->result->message( _('Edit mode is now ') . ( $editing ? _('on') : _("off") ) );
39
40 warn "## editing $editing for ", $self->current_user->id;
41
42 return 1;
43 }
44
45
46 1;
47

  ViewVC Help
Powered by ViewVC 1.1.26