[vhffs-dev] [1364] display avatars only if enabled in configuration

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


Revision: 1364
Author:   gradator
Date:     2009-03-10 11:00:40 +0100 (Tue, 10 Mar 2009)

Log Message:
-----------
display avatars only if enabled in configuration

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Public.pm
    trunk/vhffs-panel/getavatar.pl
    trunk/vhffs-public/avatar.pl
    trunk/vhffs-public/templates/content/group-details.tt
    trunk/vhffs-public/templates/parts/group-general.tt
    trunk/vhffs-public/templates/parts/user-general.tt


Modified: trunk/vhffs-api/src/Vhffs/Panel/Public.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2009-03-10 10:00:40 UTC (rev 1364)
@@ -44,6 +44,7 @@
 
 use lib '%VHFFS_LIB_DIR%';
 use Vhffs::Tag;
+use Vhffs::Functions;
 
 sub new {
 	my $class = shift;
@@ -88,6 +89,8 @@
 	$vars->{top} = 'parts/top-menu.tt' unless(defined $vars->{top});
 	$vars->{panel_url} = $conf->get_panel->{url};
 	$vars->{help_url} = $conf->get_panel->{url_help};
+	$vars->{users_avatar} = Vhffs::Functions::strtobool( $conf->get_panel->{'users_avatars'} );
+	$vars->{groups_avatar} = Vhffs::Functions::strtobool( $conf->get_panel->{'groups_avatars'} );
 	
 	# Handling ajax stuff
 	if($self->{is_ajax_request}) {
@@ -109,4 +112,4 @@
 	
 }
 
-1;
\ No newline at end of file
+1;

Modified: trunk/vhffs-panel/getavatar.pl
===================================================================
--- trunk/vhffs-panel/getavatar.pl	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-panel/getavatar.pl	2009-03-10 10:00:40 UTC (rev 1364)
@@ -38,6 +38,7 @@
 use Vhffs::Main;
 use Vhffs::Object;
 use Vhffs::Panel::Avatar;
+use Vhffs::Functions;
 
 #Get some basics informations with CGI
 my $cgi;
@@ -81,9 +82,9 @@
 #$wp->font_path('/usr/share/fonts/ttfonts');
 print CGI->header( -type=>"image/png" );
 
-binmode STDOUT ;
+binmode STDOUT;
 
-if( $vhffs->get_config->get_panel->{'users_avatars'} ne 'yes' && $vhffs->get_config->get_panel->{'groups_avatars'} ne 'yes' )
+unless( Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'users_avatars'} ) or Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'groups_avatars'} ) )
 {
 	$wp = GD::Text::Wrap->new($gd,
 		width       => 70,

Modified: trunk/vhffs-public/avatar.pl
===================================================================
--- trunk/vhffs-public/avatar.pl	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-public/avatar.pl	2009-03-10 10:00:40 UTC (rev 1364)
@@ -38,6 +38,7 @@
 use Vhffs::Main;
 use Vhffs::Object;
 use Vhffs::Panel::Avatar;
+use Vhffs::Functions;
 
 #Get some basics informations with CGI
 my $cgi;
@@ -81,11 +82,11 @@
 #$wp->font_path('/usr/share/fonts/ttfonts');
 print CGI->header( -type=>"image/png" );
 
-binmode STDOUT ;
+binmode STDOUT;
 
 # TODO user pregenerated images	
 
-if( $vhffs->get_config->get_panel->{'users_avatars'} ne 'yes' && $vhffs->get_config->get_panel->{'groups_avatars'} ne 'yes' )
+unless( Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'users_avatars'} ) or Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'groups_avatars'} ) )
 {
 	$wp = GD::Text::Wrap->new($gd,
 		width       => 70,

Modified: trunk/vhffs-public/templates/content/group-details.tt
===================================================================
--- trunk/vhffs-public/templates/content/group-details.tt	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-public/templates/content/group-details.tt	2009-03-10 10:00:40 UTC (rev 1364)
@@ -2,7 +2,9 @@
 <div class="group-details">
 <h1 class="groupname">[% group.realname | html | format(title_str) %]</h1>
 <h2>[% 'General information' | i18n %]</h2>
+[% IF groups_avatar %]
 <img class="group-avatar" src="/avatar.pl?oid=[% group.object_id %]"/>
+[% END %]
 <ul>
 <li>[% 'Groupname' | i18n %]:[% group.groupname | html %]</li>
 <li>[% 'Users' | i18n %]:</li>
@@ -89,4 +91,4 @@
 [% END %]
 
 </div>
-</div>
\ No newline at end of file
+</div>

Modified: trunk/vhffs-public/templates/parts/group-general.tt
===================================================================
--- trunk/vhffs-public/templates/parts/group-general.tt	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-public/templates/parts/group-general.tt	2009-03-10 10:00:40 UTC (rev 1364)
@@ -1,9 +1,11 @@
 <h2 class="groupname">[% g.realname | html%]</h2>
 <div class="group-info">
+[% IF groups_avatar %]
 <img class="group-avatar" src="/avatar.pl?oid=[% g.object_id %]"/>
+[% END %]
 <p><span class="groupname">[% g.groupname %]</span> (<span class="owner">[% g.owner_name %]</span>)</p>
 <div class="description">
 [% g.description | html | html_para %]
 </div>
 <p class="more-group"><a href="/group.pl?name=[% g.groupname %]" class="ajax">[% 'More info...' | i18n %]</a></p>
-</div>
\ No newline at end of file
+</div>

Modified: trunk/vhffs-public/templates/parts/user-general.tt
===================================================================
--- trunk/vhffs-public/templates/parts/user-general.tt	2009-03-10 09:35:19 UTC (rev 1363)
+++ trunk/vhffs-public/templates/parts/user-general.tt	2009-03-10 10:00:40 UTC (rev 1364)
@@ -1,6 +1,8 @@
 <h2 class="username">[% u.username | html%]</h2>
 <div class="user-info">
+[% IF users_avatar %]
 <img class="user-avatar" src="/avatar.pl?oid=[% u.object_id %]"/>
+[% END %]
 <ul>
 <li>[% 'First name' | i18n %]: [% u.firstname | html %]</li>
 <li>[% 'Last name' | i18n %]: [% u.lastname | html %]</li>
@@ -10,4 +12,4 @@
 [% END %]
 </li>
 </ul>
-</div>
\ No newline at end of file
+</div>


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