[vhffs-dev] [781] Added full project history, object name is still not displayed due to lack of a field name in vhffs_object

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


Revision: 781
Author:   gradator
Date:     2007-08-28 13:40:02 +0000 (Tue, 28 Aug 2007)

Log Message:
-----------
Added full project history, object name is still not displayed due to lack of a field name in vhffs_object

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/Panel/Main.pm
    trunk/vhffs-panel/Makefile.am
    trunk/vhffs-panel/templates/Makefile.am
    trunk/vhffs-panel/templates/group/info.tmpl
    trunk/vhffs-panel/themes/vhffs/main.css

Added Paths:
-----------
    trunk/vhffs-panel/group/history.pl


Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2007-08-28 13:40:02 UTC (rev 781)
@@ -671,6 +671,20 @@
     return $class->SUPER::_fill_object($obj, $sql);
 }
 
+
+# Returns a hashref which contains all the history
+sub get_full_history
+{
+	my $self = shift;
+
+	my $query = 'SELECT o.object_id,\'\' AS name,o.type,h.history_id,h.date,h.message FROM vhffs_history h INNER JOIN vhffs_object o ON o.object_id=h.object_id WHERE o.owner_gid=?';
+	my $request = $self->{'db'}->prepare( $query );
+	return undef unless( $request->execute( $self->{'gid'} ) );
+
+	return $request->fetchall_hashref('history_id');
+}
+
+
 1;
 
 __END__

Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-08-28 13:40:02 UTC (rev 781)
@@ -511,6 +511,8 @@
         my $services_list = '';
 
         $template->param( TEXT_PREFS => gettext('Preferences') );
+        $template->param( TEXT_GENERAL => gettext('General') );
+        $template->param( TEXT_FULLHISTORY => gettext('Full history') );
 
         if($config->use_web) {
             my $webs = Vhffs::Panel::Web::getall_per_group( $vhffs, $gid );

Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-panel/Makefile.am	2007-08-28 13:40:02 UTC (rev 781)
@@ -106,6 +106,7 @@
 	group/create.pl \
 	group/delete.pl \
 	group/prefs.pl \
+	group/history.pl \
 	help/cvs.html \
 	help/index.html \
 	js/prototype.js \

Added: trunk/vhffs-panel/group/history.pl
===================================================================
--- trunk/vhffs-panel/group/history.pl	                        (rev 0)
+++ trunk/vhffs-panel/group/history.pl	2007-08-28 13:40:02 UTC (rev 781)
@@ -0,0 +1,116 @@
+#!%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 lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Group;
+use Vhffs::Main;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Group;
+use Vhffs::Functions;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+
+my $vhffs = $panel->{'vhffs'};
+my $session = $panel->{'session'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+my $projectname = $session->param("project");
+
+my $group = $panel->{'group'};
+my $templatedir = $vhffs->get_config->get_templatedir;
+my $access_level = Vhffs::Acl::what_perm_for_user( $user , $group , $vhffs );
+my $template;
+
+
+
+if( ! defined $group ) {
+	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+	$template->param( MESSAGE => gettext( "Error. This group doesn't exists") );
+} elsif( $group->get_status != Vhffs::Constants::ACTIVATED ) {
+	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+	$template->param( MESSAGE => gettext( "This object is not functional yet. Please wait creation or moderation.") );
+} elsif( $access_level < Vhffs::Constants::ACL_VIEW && ( $user->is_admin != 1 ) ) {
+	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+	$template->param( MESSAGE => gettext( 'You\'re not allowed to do this (ACL rights)' ) );
+} else {
+
+	my $subtemplate;
+	my $history = $group->get_full_history;
+	my $output = "";
+
+	$panel->set_title( gettext('Project History') );
+	$template = new HTML::Template( filename => $templatedir.'/panel/group/history.tmpl', global_vars => 1 );
+	$template->param( HDATE => gettext('Date') );
+	$template->param( HTYPE => gettext('Type') );
+	$template->param( HNAME => gettext('Name') );
+	$template->param( HEVENT => gettext('Event') );
+
+	unless( defined $history )
+	{
+		$template->param( HISTORY_PART => gettext("No event about this group") );
+	}
+	else
+	{
+		foreach( sort keys %{$history} )
+		{
+			$subtemplate = new HTML::Template( filename => $templatedir."/panel/group/history_part.tmpl" );
+			my $date = Vhffs::Functions::parse_date( $history->{$_}{date} );
+			my $datestr;
+			if( defined $date )
+			{
+				$datestr = $date->{day}."/".$date->{month}."/".$date->{year}." @ ".$date->{hours}.":".$date->{minutes}.":".$date->{seconds};
+			}
+			else
+			{
+				$datestr = gettext("no information about date");
+			}
+			$subtemplate->param( DATE => $datestr );
+			$subtemplate->param( TYPE => $history->{$_}{type} );
+			$subtemplate->param( NAME => $history->{$_}{name} );
+			$subtemplate->param( EVENT => $history->{$_}{message} );
+			$output .= $subtemplate->output;
+		}
+		$template->param( HISTORY_PART => $output );
+	}
+}
+
+display Vhffs::Panel::Main($panel, $template->output);


Property changes on: trunk/vhffs-panel/group/history.pl
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-panel/templates/Makefile.am	2007-08-28 13:40:02 UTC (rev 781)
@@ -93,6 +93,8 @@
 	group/list_user.tmpl \
 	group/prefs.tmpl \
 	group/prefs_avatar.tmpl \
+	group/history.tmpl \
+	group/history_part.tmpl \
 	mail/create.tmpl \
 	mailinglist/create.tmpl \
 	mailinglist/list_part.tmpl \

Modified: trunk/vhffs-panel/templates/group/info.tmpl
===================================================================
--- trunk/vhffs-panel/templates/group/info.tmpl	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-panel/templates/group/info.tmpl	2007-08-28 13:40:02 UTC (rev 781)
@@ -1,14 +1,18 @@
-	<div class="info_quota">
-        <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_TEXT"></p>
-	</div>
+<tmpl_if name="MESSAGE">
+<p class="info"><tmpl_var name="MESSAGE"></p>
+</tmpl_if>
 
-    <tmpl_if name="MESSAGE">
-    <p class="info"><tmpl_var name="MESSAGE"></p>
-    </tmpl_if>
+<fieldset>
+    <legend><tmpl_var name="TEXT_GENERAL"></legend>
+    <ul class="generalList">
+	<li><tmpl_var name="QUOTA_TEXT"> &mdash;
+		<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>
+	</li>
+        <li><a href="/group/history.pl"><tmpl_var name="TEXT_FULLHISTORY"></a></li>
+        <li><a href="/group/prefs.pl"><tmpl_var name="TEXT_PREFS"></a></li>
+    </ul>
+</fieldset>
 
-    <p><a href="/group/prefs.pl"><tmpl_var name="TEXT_PREFS"></a></p>
-
-    <tmpl_var name="SERVICES">
+<tmpl_var name="SERVICES">

Modified: trunk/vhffs-panel/themes/vhffs/main.css
===================================================================
--- trunk/vhffs-panel/themes/vhffs/main.css	2007-08-28 11:35:17 UTC (rev 780)
+++ trunk/vhffs-panel/themes/vhffs/main.css	2007-08-28 13:40:02 UTC (rev 781)
@@ -814,3 +814,7 @@
 label.description {
     float:none;
 }
+
+.history {
+	text-align: right;
+}


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