mirror of
https://github.com/brmlab/brmdoor.git
synced 2025-06-08 11:44:01 +02:00
brmd::Alphasign: Remember last mode too
This commit is contained in:
parent
e7a03df5ae
commit
387820a60d
1 changed files with 8 additions and 2 deletions
10
brmd/brmd.pl
10
brmd/brmd.pl
|
@ -414,10 +414,11 @@ sub web_alphasign_text {
|
|||
$response->push_header("Content-Type", "text/html");
|
||||
disable_caching($response);
|
||||
my $text = $alphasign->last_text_escaped();
|
||||
my $lm = $alphasign->last_mode();
|
||||
my $help = $alphasign->markup_help();
|
||||
$help =~ s/&/&/g; $help =~ s/</</g; $help =~ s/>/>/g;
|
||||
$help =~ s/\n/<br \/>/g;
|
||||
my $modes = join("\n", map { "<option>$_</option>" } $alphasign->mode_list());
|
||||
my $modes = join("\n", map { "<option".($lm eq $_?" selected":"").">$_</option>" } $alphasign->mode_list());
|
||||
|
||||
$response->content(<<EOT
|
||||
<html>
|
||||
|
@ -665,7 +666,7 @@ use Tie::IxHash;
|
|||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = bless { last_text => '' }, $class;
|
||||
my $self = bless { last_text => '', last_mode => 'hold' }, $class;
|
||||
|
||||
POE::Session->create(
|
||||
object_states => [
|
||||
|
@ -835,6 +836,7 @@ sub markup_help {
|
|||
|
||||
sub text {
|
||||
my ($heap, $self, $mode, $string) = (@_[HEAP, OBJECT, ARG0, ARG1]);
|
||||
$self->{last_mode} = $mode;
|
||||
$mode = $modes{$mode};
|
||||
$self->{last_text} = $string;
|
||||
$string = substr($string, 0, 256);
|
||||
|
@ -843,6 +845,10 @@ sub text {
|
|||
$string =~ s/<(.*?)>/$markup{$1}->[0]/gei;
|
||||
$_[KERNEL]->yield('rawtext', $mode, $string);
|
||||
}
|
||||
sub last_mode {
|
||||
my $self = shift;
|
||||
return $self->{last_mode};
|
||||
}
|
||||
sub last_text {
|
||||
my $self = shift;
|
||||
return $self->{last_text};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue