[vhffs-dev] [638] No more quota_used script, an image is streched instead.

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


Revision: 638
Author:   beuss
Date:     2007-06-05 22:34:20 +0000 (Tue, 05 Jun 2007)

Log Message:
-----------
No more quota_used script, an image is streched instead.
Fixed bad link for DL repo admin.
Minor skin adjustements.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Main.pm
    trunk/vhffs-panel/Makefile.am
    trunk/vhffs-panel/admin/group/edit.pl
    trunk/vhffs-panel/repository/index.pl
    trunk/vhffs-panel/repository/prefs.pl
    trunk/vhffs-panel/templates/admin/group/edit.tmpl
    trunk/vhffs-panel/templates/group/info.tmpl
    trunk/vhffs-panel/templates/repository/prefs.tmpl
    trunk/vhffs-panel/themes/vhffs-ng/main.css

Removed Paths:
-------------
    trunk/vhffs-panel/group/quota_used.pl
    trunk/vhffs-panel/repository/quota_used.pl


Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-06-05 22:34:20 UTC (rev 638)
@@ -749,7 +749,7 @@
         mailinglist => 'Mailing lists',
         mysql => 'MySQL DBs',
         pgsql => 'PostgreSQL DBs',
-        repo => 'Download repositories',
+        repository => 'Download repositories',
         svn => 'SVN repositories',
         web => 'Webareas',
     );

Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/Makefile.am	2007-06-05 22:34:20 UTC (rev 638)
@@ -108,7 +108,6 @@
 	group/prefs_save.pl \
 	group/prefs.pl \
 	group/project_submit.pl \
-	group/quota_used.pl \
 	group/remove_user_from_group.pl \
 	help/cvs.html \
 	help/index.html \
@@ -167,7 +166,6 @@
 	repository/index.pl \
 	repository/prefs_save.pl \
 	repository/prefs.pl \
-	repository/quota_used.pl \
 	repository/repository_submit.pl \
 	svn/create.pl \
 	svn/delete.pl \

Modified: trunk/vhffs-panel/admin/group/edit.pl
===================================================================
--- trunk/vhffs-panel/admin/group/edit.pl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/admin/group/edit.pl	2007-06-05 22:34:20 UTC (rev 638)
@@ -87,9 +87,10 @@
 {
 	$template = new HTML::Template( filename => $templatedir."/admin/group/edit.tmpl" );
 
-	$template->param( TITLE => gettext("Edit Group") );
+	$panel->set_title( gettext('Edit Group') );
 
 
+    $template->param( THEME => $panel->{theme} );
 	$template->param( TEXT_GROUPNAME => gettext("Groupname") );
 	$template->param( TEXT_GID => gettext("GID") );
 	$template->param( TEXT_OWNER => gettext("Owner") );
@@ -103,12 +104,16 @@
 	$template->param( VALUE_GROUPNAME => $group->get_groupname );
 	$template->param( VALUE_GID => $group->get_gid );
 	$template->param( VALUE_OWNER => $group->get_owner_username );
+
+    # Quota stuff
+    $template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $group->get_quota_used , $group->get_quota ) );
+    # Yes, sorry quota progress image has to be 300px width max
+    $template->param( QUOTA_WIDTH => ( ($group->get_quota_used / $group->get_quota) * 300 ) );
+ 
 	$template->param( VALUE_QUOTA => $group->get_quota );
 	$template->param( VALUE_QUOTA_USED => $group->get_quota_used );
 	$template->param( VALUE_DESCRIPTION => $group->get_description );
 
-$template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $group->get_quota_used , $group->get_quota ) );
-
 	my $oid = $group->get_oid;
 	$template->param( VALUE_HISTORY => "/history.pl?OID=$oid" );
 

Deleted: trunk/vhffs-panel/group/quota_used.pl
===================================================================
--- trunk/vhffs-panel/group/quota_used.pl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/group/quota_used.pl	2007-06-05 22:34:20 UTC (rev 638)
@@ -1,160 +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 POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use GD;
-use GD::Text::Wrap;
-
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $groupname = $cgi->param('group');
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-my $template;
-my $subtemplate;
-my $group = Vhffs::Group::get_by_groupname( $vhffs , $groupname );
-
-my $status;
-my $quota;
-my $quota_used;
-my $black;
-my $blue;
-my $white;
-my $red;
-my $green;
-my $gd;
-my $wp;
-my $moy;
-
-if( ! $panel)  {
-        exit 0;
-}
-
-$status = 0;
-
-if( ( ! defined $group ) )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "You have not enough right",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-	$wp->set(para_space => 10, preserve_nl => 0);
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $group , $vhffs ) < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "You have not enough right",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-	$wp->set(para_space => 10, preserve_nl => 0);
-}
-
-elsif( $group->get_status != Vhffs::Constants::ACTIVATED )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "Group not activated",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-}
-else
-{
-	$quota = $group->get_quota;
-	$quota_used = $group->get_quota_used;
-	$moy = ( ( $quota_used / $quota ) * 100 );
-
-
-	$gd = GD::Image->new(301,11);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-	$red  = $gd->colorAllocate( 207 , 9 , 9 );
-	$gd->rectangle(0,0,300,10,$black);
-	$gd->rectangle(1,1, 3 * $moy,9,$red);
-	$gd->fill($moy - 1 , 8 ,$red);
-	
-}
-
-print CGI->header( -type=>"image/png" );
-binmode STDOUT;
-print STDOUT $gd->png();
-close STDOUT;
-exit 0;

Modified: trunk/vhffs-panel/repository/index.pl
===================================================================
--- trunk/vhffs-panel/repository/index.pl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/repository/index.pl	2007-06-05 22:34:20 UTC (rev 638)
@@ -60,7 +60,7 @@
     if($repos < 0) {
         $panel->add_error( gettext('Unable to get repositories') );
     } else {
-        $panel->display($panel->create_service_index('repo', $repos));
+        $panel->display($panel->create_service_index('repository', $repos));
     }
 }
 

Modified: trunk/vhffs-panel/repository/prefs.pl
===================================================================
--- trunk/vhffs-panel/repository/prefs.pl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/repository/prefs.pl	2007-06-05 22:34:20 UTC (rev 638)
@@ -93,11 +93,12 @@
 {
 	$template = new HTML::Template( filename => $templatedir."/repository/prefs.tmpl" );
 
-	$template->param( TEXT_TITLE => gettext("Admin Download repository") );
+	$panel->set_title( gettext('Admin Download repository') );
 	$template->param( TEXT_REPONAME => $repo->get_name );
 
-	$template->param( REPONAME => $repo->get_name );
+    $template->param( THEME => $panel->{theme} );
 	$template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $repo->get_quota_used , $repo->get_quota ) );
+    $template->param( QUOTA_WIDTH => ( ($repo->get_quota_used / $repo->get_quota) * 300 ) );
 
 	$template->param( TEXT_DELETE_REPOSITORY => gettext("Delete this project") );
 	$template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. All services associated to this project will be DESTROYED.") );

Deleted: trunk/vhffs-panel/repository/quota_used.pl
===================================================================
--- trunk/vhffs-panel/repository/quota_used.pl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/repository/quota_used.pl	2007-06-05 22:34:20 UTC (rev 638)
@@ -1,161 +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 POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use GD;
-use GD::Text::Wrap;
-
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Services::Repository;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $reponame = $cgi->param('repo');
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-my $template;
-my $subtemplate;
-my $repo = Vhffs::Services::Repository::get_by_reponame( $vhffs , $reponame );
-
-my $status;
-my $quota;
-my $quota_used;
-my $black;
-my $blue;
-my $white;
-my $red;
-my $green;
-my $gd;
-my $wp;
-my $moy;
-
-if( ! $panel)  {
-        exit 0;
-}
-
-$status = 0;
-
-if( ! defined $repo )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "You have not enough right",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-	$wp->set(para_space => 10, preserve_nl => 0);
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $repo , $vhffs ) < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "You have not enough right",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-	$wp->set(para_space => 10, preserve_nl => 0);
-}
-
-elsif( $repo->get_status != Vhffs::Constants::ACTIVATED )
-{
-	$gd = GD::Image->new(70,100);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-
-	$wp = GD::Text::Wrap->new($gd,
-		width       => 70,
-		line_space  => 0,
-		color       => $black,
-		text        => "Repository not activated",
-	);
-	$wp->set_font(gdLargeFont, 14);
-	$wp->set(align => 'center');  
-	$wp->draw(0,5);
-}
-else
-{
-	$quota = $repo->get_quota;
-	$quota_used = $repo->get_quota_used;
-	$moy = ( ( $quota_used / $quota ) * 100 );
-
-
-	$gd = GD::Image->new(301,11);
-	$white = $gd->colorAllocate(255,255,255);
-	$black = $gd->colorAllocate(  0,  0,  0);
-	$blue  = $gd->colorAllocate(127,127,255);
-	$red  = $gd->colorAllocate( 207 , 9 , 9 );
-	$gd->rectangle(0,0,300,10,$black);
-	$gd->rectangle(1,1, 3 * $moy,9,$red);
-	$gd->fill($moy - 1 , 8 ,$red);
-	
-}
-
-print CGI->header( -type=>"image/png" );
-binmode STDOUT;
-print STDOUT $gd->png();
-close STDOUT;
-exit 0;

Modified: trunk/vhffs-panel/templates/admin/group/edit.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/group/edit.tmpl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/templates/admin/group/edit.tmpl	2007-06-05 22:34:20 UTC (rev 638)
@@ -1,10 +1,9 @@
-<h1><TMPL_VAR NAME="TITLE"></h1>
-
 <p>
 <div class="info_quota">
-	<img src="/group/quota_used.pl?group=<tmpl_var name="VALUE_GROUPNAME">" alt="quota used for <tmpl_var name="GROUPNAME">"/>
-	<br/>
-	<tmpl_var name="QUOTA_VALUE">
+    <div id="group_quota">
+    <img src="/themes/<tmpl_var name="THEME">/images/quota_progress.png" width="<tmpl_var name="QUOTA_WIDTH">" alt="<tmpl_var name="QUOTA_WIDTH">"/>
+    </div>
+	<p><tmpl_var name="QUOTA_VALUE"></p>
 </div>
 </p>
 

Modified: trunk/vhffs-panel/templates/group/info.tmpl
===================================================================
--- trunk/vhffs-panel/templates/group/info.tmpl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/templates/group/info.tmpl	2007-06-05 22:34:20 UTC (rev 638)
@@ -2,8 +2,7 @@
         <div id="group_quota">
         <img src="/themes/<tmpl_var name="THEME">/images/quota_progress.png" width="<tmpl_var name="QUOTA_WIDTH">" alt="<tmpl_var name="QUOTA_WIDTH">"/>
         </div>
-		<br/>
-		<tmpl_var name="QUOTA_TEXT">
+		<p><tmpl_var name="QUOTA_TEXT"></p>
 	</div>
 
     <tmpl_if name="MESSAGE">

Modified: trunk/vhffs-panel/templates/repository/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/repository/prefs.tmpl	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/templates/repository/prefs.tmpl	2007-06-05 22:34:20 UTC (rev 638)
@@ -1,10 +1,10 @@
-<h1><tmpl_var name="TEXT_TITLE"></h1>
 <h2><tmpl_var name="TEXT_REPONAME"></h2>
 
 <div class="info_quota">
-	<img src="/repository/quota_used.pl?repo=<tmpl_var name="REPONAME">" alt="quota used for <tmpl_var name="REPONAME">"/>
-	<br/>
-	<tmpl_var name="QUOTA_VALUE">
+    <div id="repo_quota">
+        <img src="/themes/<tmpl_var name="THEME">/images/quota_progress.png" width="<tmpl_var name="QUOTA_WIDTH">" alt="<tmpl_var name="QUOTA_WIDTH">"/>
+    </div>
+    <p><tmpl_var name="QUOTA_VALUE"></p>
 </div>
 
 <h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>

Modified: trunk/vhffs-panel/themes/vhffs-ng/main.css
===================================================================
--- trunk/vhffs-panel/themes/vhffs-ng/main.css	2007-05-30 12:52:21 UTC (rev 637)
+++ trunk/vhffs-panel/themes/vhffs-ng/main.css	2007-06-05 22:34:20 UTC (rev 638)
@@ -632,6 +632,7 @@
     margin-left:-485px;
     height:300px;
     overflow:auto;
+    padding:5px;
     border: 1px outset black;
     background: url('images/help_bg.png') repeat-x top;
 
@@ -699,7 +700,7 @@
     list-style-image: url('images/dbentry.png');
 }
 
-ul.repoList {
+ul.repositoryList {
     list-style-image: url('images/dbentry.png');
 }
 
@@ -792,3 +793,17 @@
 div#group_quota>img {
     height:15px;
 }
+
+div#repo_quota {
+    width:300px;
+    margin-left: auto;
+    margin-right:auto;
+    border:1px solid black;
+    height:15px;
+    text-align:left;
+}
+
+div#repo_quota>img {
+    height:15px;
+}
+


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