[vhffs-dev] [1852] Removed Vhffs::Panel::Menu

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


Revision: 1852
Author:   beuss
Date:     2011-06-03 00:05:05 +0200 (Fri, 03 Jun 2011)
Log Message:
-----------
Removed Vhffs::Panel::Menu

.... and again ...

Isn't it amazing how a brain-fucked templating system can increase
complexity?

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

Removed Paths:
-------------
    trunk/vhffs-api/src/Vhffs/Panel/Menu.pm

Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-06-02 22:04:58 UTC (rev 1851)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2011-06-02 22:05:05 UTC (rev 1852)
@@ -21,7 +21,6 @@
 use Vhffs::User;
 use Vhffs::Group;
 use Vhffs::Functions;
-use Vhffs::Panel::Menu;
 use Vhffs::Panel::User;
 use Vhffs::Panel::Commons;
 
@@ -355,62 +354,6 @@
 	return $session;
 }
 
-
-=head2 generate_header
-
-    print $panel->generate_header;
-
-Generates panel header (account name, project label, contextuel menu, etc.).
-
-=cut
-
-sub generate_header {
-    my $panel = shift;
-    my $user = $panel->{user};
-    my $theme = $panel->{theme};
-    my $templatedir = $panel->{templatedir};
-    my $vhffs = $panel->{vhffs};
-    my $cgi = $panel->{cgi};
-
-    my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
-
-    my $menutemplate = new HTML::Template( filename => $templatedir.'/panel/menu/main.tmpl' );
-    $menutemplate->param( THEME => $theme );
-
-    $menutemplate->param( USERNAME          => $user->get_username() );
-    # Sets account type and admin link if needed
-    if( $user->is_admin == 1 ) {
-        $menutemplate->param( TEXT_ACCOUNT    => gettext('Admin account') );
-        $menutemplate->param( TEXT_ADMIN => gettext('Administration') ) 
-    } elsif( $user->is_moderator == 1 ) {
-        $menutemplate->param( TEXT_ACCOUNT    => gettext('Moderator account') );
-        $menutemplate->param( TEXT_ADMIN => gettext('Administration') ) 
-    } else {
-        $menutemplate->param( TEXT_ACCOUNT    => gettext('User account') );
-    }
-    $menutemplate->param( TEXT_HOME         => gettext('Home page') );
-    $menutemplate->param( TEXT_PREFS        => gettext("User Preferences") );
-    $menutemplate->param( TEXT_PROJECTS     => gettext('My Projects') );
-    $menutemplate->param( TEXT_HELP         => gettext("Help") );
-    $menutemplate->param( TEXT_SUBMITBUG    => gettext("Submit a bug") );
-    $menutemplate->param( TEXT_LOGOUT       => gettext("Logout") );
-    $menutemplate->param( HELP_URL          => $vhffs->get_config->get_panel->{'url_help'} || 'http://www.vhffs.org/' );
-
-    # Current project stuff
-    if( ( CGI::url( -absolute => 1) =~ /^\/admin\// ) || defined $cgi->param('admin_menu')) {
-        if( $user->is_admin ) {
-            $menutemplate->param( CONTEXTUAL_MENU => Vhffs::Panel::Menu::generate_admin_ctxmenu( $vhffs->get_config ) );
-        } elsif( $user->is_moderator ) {
-            $menutemplate->param( CONTEXTUAL_MENU => Vhffs::Panel::Menu::generate_moderator_ctxmenu( $vhffs->get_config ) );
-        }
-    } elsif( $group ) {
-        $menutemplate->param( CONTEXTUAL_MENU => Vhffs::Panel::Menu::generate_project_ctxmenu( $vhffs->get_config , $group ) );
-    }
-
-
-    return $menutemplate->output();
-}
-
 sub has_errors
 {
     my $panel = shift;

Deleted: trunk/vhffs-api/src/Vhffs/Panel/Menu.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Menu.pm	2011-06-02 22:04:58 UTC (rev 1851)
+++ trunk/vhffs-api/src/Vhffs/Panel/Menu.pm	2011-06-02 22:05:05 UTC (rev 1852)
@@ -1,137 +0,0 @@
-#!%PERL% -w
-# 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::Menu;
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-
-
-=pod
-
-=head1 NAME
-
-Vhffs::Panel::Menu - Handle top menu in VHFFS panel.
-
-=head1 METHODS
-
-=head2 generate_project_ctxmenu
-
-    print Vhffs::Panel::Main::generate_project_ctxmenu($vhffs->get_config);
-
-Generates and returns the contextual menu for a project.
-
-=cut
-
-sub generate_project_ctxmenu($$) {
-    my $config = shift;
-    my $group = shift;
-    my $context_tmpl = new HTML::Template( filename => $config->get_templatedir.'/panel/menu/context-group.tmpl' , global_vars => 1 );
-
-    $context_tmpl->param( GROUPNAME => $group->get_groupname );
-
-    my $items = [];
-    push @$items, {path => 'web', label => gettext('Web') } if( $config->get_service_availability('web') );
-    push @$items, {path => 'mysql', label => gettext('MySQL') } if( $config->get_service_availability('mysql') );
-    push @$items, {path => 'pgsql', label => gettext('PgSQL') } if( $config->get_service_availability('pgsql') );
-    push @$items, {path => 'cvs', label => gettext('CVS') } if( $config->get_service_availability('cvs') );
-    push @$items, {path => 'svn', label => gettext('SVN') } if( $config->get_service_availability('svn') );
-    push @$items, {path => 'git', label => gettext('GIT') } if( $config->get_service_availability('git') );
-    push @$items, {path => 'mercurial', label => gettext('Mercurial') } if( $config->get_service_availability('mercurial') );
-    push @$items, {path => 'bazaar', label => gettext('Bazaar') } if( $config->get_service_availability('bazaar') );
-    push @$items, {path => 'dns', label => gettext('Domain names') } if( $config->get_service_availability('dns') );
-    push @$items, {path => 'repository', label => gettext('Dl repos') } if( $config->get_service_availability('repository') );
-    push @$items, {path => 'mail', label => gettext('Mail') } if( $config->get_service_availability('mail') );
-    push @$items, {path => 'mailinglist', label => gettext('ML') } if( $config->get_service_availability('mailinglist') );
-    push @$items, {path => 'cron', label => gettext('Crons') } if( $config->get_service_availability('cron') );
-    $context_tmpl->param( MENU_ITEMS => $items );
-    return $context_tmpl->output();
-}
-
-=head2 generate_moderator_ctxmenu
-
-    print Vhffs::Panel::Main::generate_moderator_ctxmenu($vhffs->get_config);
-
-Generates and returns the contextual menu for moderation part.
-
-=cut
-
-sub generate_moderator_ctxmenu {
-    my $config = shift;
-    my $context_tmpl = new HTML::Template( filename => $config->get_templatedir.'/panel/menu/context-modo.tmpl' );
-
-    my $items = [];
-    push @$items, {path => 'admin/stats.pl', label => gettext('Get Statistics') };
-    push @$items, {path => 'admin/moderation/index.pl', label => gettext('Moderation') };
-    $context_tmpl->param( MENU_ITEMS => $items );
-    return $context_tmpl->output();
-}
-
-=head2 generate_admin_ctxmenu
-
-    print Vhffs::Panel::Main::generate_admin_ctxmenu($vhffs->get_config);
-
-Generates and returns the contextual menu for platform administration.
-
-=cut
-
-sub generate_admin_ctxmenu($) {
-    my $config = shift;
-    my $context_tmpl = new HTML::Template( filename => $config->get_templatedir.'/panel/menu/context.tmpl' );
-
-    my $items = [];
-    push @$items, {path => 'admin', label => gettext('General') };
-    push @$items, {path => 'admin/user', label => gettext('Users') };
-    push @$items, {path => 'admin/group', label => gettext('Groups') };
-    push @$items, {path => 'admin/web', label => gettext('Web') } if( $config->get_service_availability('web') );
-    push @$items, {path => 'admin/mysql', label => gettext('MySQL') } if( $config->get_service_availability('mysql') );
-    push @$items, {path => 'admin/pgsql', label => gettext('PgSQL') } if( $config->get_service_availability('pgsql') );
-    push @$items, {path => 'admin/cvs', label => gettext('CVS') } if( $config->get_service_availability('cvs') );
-    push @$items, {path => 'admin/svn', label => gettext('SVN') } if( $config->get_service_availability('svn') );
-    push @$items, {path => 'admin/git', label => gettext('GIT') } if( $config->get_service_availability('git') );
-    push @$items, {path => 'admin/mercurial', label => gettext('Mercurial') } if( $config->get_service_availability('mercurial') );
-    push @$items, {path => 'admin/bazaar', label => gettext('Bazaar') } if( $config->get_service_availability('bazaar') );
-    push @$items, {path => 'admin/dns', label => gettext('Domain names') } if( $config->get_service_availability('dns') );
-    push @$items, {path => 'admin/repository', label => gettext('Dl repos') } if( $config->get_service_availability('repository') );
-    push @$items, {path => 'admin/mail', label => gettext('Mail') } if( $config->get_service_availability('mail') );
-    push @$items, {path => 'admin/mailinglist', label => gettext('ML') } if( $config->get_service_availability('mailinglist') );
-    push @$items, {path => 'admin/cron', label => gettext('Crons') } if( $config->get_service_availability('cron') );
-    $context_tmpl->param( MENU_ITEMS => $items );
-    return $context_tmpl->output();
-
-}
-
-1;


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