[vhffs-dev] [1793] Preparing for Admin templates refactoring.

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


Revision: 1793
Author:   beuss
Date:     2011-05-22 16:13:33 +0200 (Sun, 22 May 2011)
Log Message:
-----------
Preparing for Admin templates refactoring.

Vhffs::Panel::Admin is now a subclass of Panel::Main which check for
user access level. Vhffs::Panel::Modo is a new class that perform the
same kind of checks.

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

Added Paths:
-----------
    trunk/vhffs-api/src/Vhffs/Panel/Modo.pm

Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am	2011-05-20 11:14:52 UTC (rev 1792)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am	2011-05-22 14:13:33 UTC (rev 1793)
@@ -32,6 +32,7 @@
 	Panel/Main.pm \
 	Panel/Menu.pm \
 	Panel/Mercurial.pm \
+	Panel/Modo.pm \
 	Panel/Mysql.pm \
 	Panel/Object.pm \
 	Panel/Pgsql.pm \

Modified: trunk/vhffs-api/src/Vhffs/Panel/Admin.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Admin.pm	2011-05-20 11:14:52 UTC (rev 1792)
+++ trunk/vhffs-api/src/Vhffs/Panel/Admin.pm	2011-05-22 14:13:33 UTC (rev 1793)
@@ -38,6 +38,8 @@
 
 package Vhffs::Panel::Admin;
 
+use base qw(Vhffs::Panel::Main);
+
 use DBI;
 use POSIX qw(locale_h);
 use HTML::Template;
@@ -49,6 +51,14 @@
 use Vhffs::Panel::Main;
 use Vhffs::Constants;
 
+sub new {
+	my ($class, @args) = @_;
+	my $panel = $class->SUPER::new(@args);
+    $panel->get_session();
+	$panel->check_admin();
+	return $panel;
+}
+
 =pod
 
 =head1 NAME

Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-05-20 11:14:52 UTC (rev 1792)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-05-22 14:13:33 UTC (rev 1793)
@@ -24,7 +24,6 @@
 use Vhffs::Panel::Menu;
 use Vhffs::Panel::User;
 use Vhffs::Panel::Commons;
-use Vhffs::Panel::Admin;
 
 =pod
 

Added: trunk/vhffs-api/src/Vhffs/Panel/Modo.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Modo.pm	                        (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Panel/Modo.pm	2011-05-22 14:13:33 UTC (rev 1793)
@@ -0,0 +1,63 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in 
+#    the documentation and/or other materials provided with the 
+#    distribution.
+# 3. Neither the name of vhffs nor the names of its contributors 
+#    may be used to endorse or promote products derived from this 
+#    software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+use utf8;
+
+package Vhffs::Panel::Modo;
+
+use base qw(Vhffs::Panel::Main);
+
+use locale;
+use Locale::gettext;
+use POSIX qw(locale_h);
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Tag;
+use Vhffs::Functions;
+
+=head1 Vhffs::Panel::Modo
+
+C<Vhffs::Panel> specialization that performs necessary checks on the user
+to ensure it is moderator.
+
+=cut
+
+sub new {
+	my ($class, @args) = @_;
+	my $panel = $class->SUPER::new(@args);
+    $panel->get_session();
+	$panel->check_modo();
+	return $panel;
+}
+
+1;
+


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