Plain view

This commit is contained in:
Difrex(Denis Zheleztsov) 2014-06-15 19:12:03 +04:00
parent 005e228a0d
commit a7dc293f93
6 changed files with 51 additions and 10 deletions

View File

@ -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 .= "<a href=/new?echo=$echo>Новое сообщение</a>";
$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();

10
II/T.pm
View File

@ -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' );

View File

@ -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**

8
t/echo.html Normal file
View File

@ -0,0 +1,8 @@
<div class=view_change>
Вид:&nbsp
<a href=/e?echo=<TMPL_VAR NAME=ECHO>&view=plain>[плоский]</a>&nbsp
<a href=/e?echo=<TMPL_VAR NAME=ECHO>&view=thread>[по темам]</a>&nbsp
<div class=new_mes>
<a href=/new?echo=<TMPL_VAR NAME=ECHO>>[Новое сообщение]</a>
</div>
</div>

View File

@ -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;
}
</STYLE>
<body>
<div class='headall'>

View File

@ -1 +1 @@
<a href=/e?echo=<TMPL_VAR NAME=ECHO>><TMPL_VAR NAME=ECHO></a><br>
<a href=/e?echo=<TMPL_VAR NAME=ECHO>&view=thread><TMPL_VAR NAME=ECHO></a><br>