diff --git a/II/Render.pm b/II/Render.pm index 9bb2c62..1808e9d 100644 --- a/II/Render.pm +++ b/II/Render.pm @@ -63,7 +63,7 @@ sub out { } sub echo_mes { - my ( $self, $echo ) = @_; + my ( $self, $echo, $view ) = @_; my $db = $self->{_db}; my $t = $self->{_template}; @@ -71,17 +71,25 @@ sub echo_mes { # Render header my $render = $t->head("ii :: $echo"); - $render .= "Новое сообщение"; + $render .= $t->echo($echo); my $count = 0; - while ( $count < @post ) { + if ($view eq 'thread') { + while ( $count < @post ) { - # Render post - if ( !( @post[$count]->{subg} =~ /Re.+/ ) ) { - $render .= $t->tree( @post[$count] ); + # Render post + if ( !( @post[$count]->{subg} =~ /Re.+/ ) ) { + $render .= $t->tree( @post[$count] ); + } + + $count++; + } + } + else { + while ( $count < @post ) { + $render .= $t->post( @post[$count] ); + $count++; } - - $count++; } $render .= $t->foot(); diff --git a/II/T.pm b/II/T.pm index 5fb2100..d80fd3c 100644 --- a/II/T.pm +++ b/II/T.pm @@ -19,6 +19,16 @@ sub head { return $t->output; } +sub echo { + my ($self, $echo) = @_; + + my $e = HTML::Template->new(filename => 't/echo.html'); + + $e->param(ECHO => $echo); + + return $e->output(); +} + sub index { my ( $self, $echoareas ) = @_; my $i = HTML::Template->new( filename => 't/index.html' ); diff --git a/README.md b/README.md index 8d8d69f..3954feb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Plack/Perl web client for ii network * SQL::Abstract; * DBD::SQlite; * Plack; -* HTML::Tempplate; +* HTML::Template; * LWP; **Only GNU/Linux is supported** diff --git a/t/echo.html b/t/echo.html new file mode 100644 index 0000000..96cd62b --- /dev/null +++ b/t/echo.html @@ -0,0 +1,8 @@ +
+ Вид:  + &view=plain>[плоский]  + &view=thread>[по темам]  +
+ >[Новое сообщение] +
+
\ No newline at end of file diff --git a/t/head.html b/t/head.html index bc4472a..4a2d6d9 100644 --- a/t/head.html +++ b/t/head.html @@ -99,6 +99,21 @@ .answer a:visited { color: #222; } + .view_change { + top: 0em; + position: relative; + margin-left: 15%; + margin-right: 15%; + } + .view_change a { + color: #222; + } + .view_change a:visited { + color: #222; + } + .new_mes { + position: relative; + }
diff --git a/t/index.html b/t/index.html index 17fac2b..c71a194 100644 --- a/t/index.html +++ b/t/index.html @@ -1 +1 @@ ->
\ No newline at end of file +&view=thread>
\ No newline at end of file