[vhffs-dev] [1845] Clean up clean up

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1845
Author:   beuss
Date:     2011-06-03 00:03:35 +0200 (Fri, 03 Jun 2011)
Log Message:
-----------
Clean up clean up

Yes I'll be making a lot of commits for that. First because I want to
improve my commit ranking on ohloh, second because I wanna be able to
bissect in case of problem.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Main.pm
    trunk/vhffs-panel/templates/Makefile.am

Removed Paths:
-------------
    trunk/vhffs-panel/templates/misc/errors.tmpl

Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-06-02 22:03:24 UTC (rev 1844)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-06-02 22:03:35 UTC (rev 1845)
@@ -168,10 +168,9 @@
     my $user = $panel->{user};
     unless($user->is_moderator || $user->is_admin) {
         $panel->set_title( gettext('Access denied') );
-        $panel->add_error( gettext('You are not granted to access this page') );
-	$panel->build;
-	$panel->display;
-	exit 0;
+        $panel->render('misc/message.tt', {
+            message => gettext('You are not allowed to access this page')
+        });
     }
 }
 
@@ -189,10 +188,9 @@
     my $user = $panel->{user};
     unless($user->is_admin) {
         $panel->set_title( gettext('Access denied') );
-        $panel->add_error( gettext('You are not granted to access this page') );
-        $panel->build;
-        $panel->display;
-        exit 0;
+        $panel->render('misc/message.tt', {
+            message => gettext('You are not allowed to access this page')
+        });
     }
 }
 
@@ -464,40 +462,6 @@
 }
 
 
-sub build
-{
-	my $panel = shift;
-	my $template = shift;
-	my $cgi = $panel->{cgi};
-	my $theme = $panel->{theme};
-	my $templatedir = $panel->{templatedir};
-
-	$panel->add_info( Encode::decode_utf8( $cgi->param('msg') ) ) if( defined $cgi->param('msg') );
-	$panel->add_error( Encode::decode_utf8( $cgi->param('error') ) ) if( defined $cgi->param('error') );
-
-	my $paneltemplate = new HTML::Template( filename => $templatedir.'/panel/main/panel.tmpl' );
-	$paneltemplate->param( TITLE => $panel->{title} );
-	$paneltemplate->param( HEADER => $panel->generate_header );
-
-	if( @{$panel->{errors}} > 0 ) {
-		my $tmplerrors = new HTML::Template( filename => $templatedir.'/panel/misc/errors.tmpl' );
-		$tmplerrors->param( ERRORS => $panel->{errors} );
-		$paneltemplate->param( ERRORS => $tmplerrors->output );
-	}
-
-	if( @{$panel->{infos}} > 0 ) {
-		my $tmplinfos = new HTML::Template( filename => $templatedir.'/panel/misc/infos.tmpl' );
-		$tmplinfos->param( INFOS => $panel->{infos} );
-		$paneltemplate->param( INFOS => $tmplinfos->output );
-	}
-
-	$paneltemplate->param( CONTENT => $template->output ) if( defined $template );
-
-	$panel->{content} = $paneltemplate->output;
-	return;
-}
-
-
 sub light
 {
 	my $panel = shift;

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-06-02 22:03:24 UTC (rev 1844)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-06-02 22:03:35 UTC (rev 1845)
@@ -12,7 +12,6 @@
 	main/main.tmpl \
 	menu/main.tmpl \
 	menu/user.tmpl \
-	misc/errors.tmpl \
 	misc/group_service.tmpl \
 	misc/history_part.tmpl \
 	misc/infos.tmpl \

Deleted: trunk/vhffs-panel/templates/misc/errors.tmpl
===================================================================
--- trunk/vhffs-panel/templates/misc/errors.tmpl	2011-06-02 22:03:24 UTC (rev 1844)
+++ trunk/vhffs-panel/templates/misc/errors.tmpl	2011-06-02 22:03:35 UTC (rev 1845)
@@ -1,5 +0,0 @@
-<div id="errors">
-<TMPL_LOOP NAME="errors">
-<p class="error"><TMPL_VAR ESCAPE=1 NAME="msg"></p>
-</TMPL_LOOP>
-</div>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/