[vhffs-dev] [647] Projects list now show projects' states.

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


Revision: 647
Author:   beuss
Date:     2007-06-15 18:09:27 +0000 (Fri, 15 Jun 2007)

Log Message:
-----------
Projects list now show projects' states.
Projects which are not active have no link.
Forgot to delete reference to removed file from Makefile.am.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/User.pm
    trunk/vhffs-panel/Makefile.am
    trunk/vhffs-panel/templates/user/projects.tmpl


Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-06-15 17:53:52 UTC (rev 646)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-06-15 18:09:27 UTC (rev 647)
@@ -186,22 +186,26 @@
     my @params;
     
 
-    my $groups;
+    my $groups = [];
     my $sql;
     push @params, $user->get_uid;
     if( defined $relation) {
         if( $relation == $RELATION_OWNER ) {
-            $sql = 'SELECT g.groupname AS project FROM vhffs_groups g WHERE g.owner_uid = ? AND g.groupname != ? ORDER BY g.groupname';
+            $sql = 'SELECT g.groupname AS project, o.state FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE g.owner_uid = ? AND g.groupname != ? ORDER BY g.groupname';
             push @params, $user->get_username;
         } else {
-            $sql = 'SELECT g.groupname AS project FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid WHERE ug.uid=? AND g.owner_uid != ug.uid ORDER BY g.groupname';
+            $sql = 'SELECT g.groupname AS project, o.state FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? AND g.owner_uid != ug.uid ORDER BY g.groupname';
         }
     } else {
-        $sql = 'SELECT g.groupname AS project FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid WHERE ug.uid=? ORDER BY g.groupname';
+        $sql = 'SELECT g.groupname AS project, o.state FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? ORDER BY g.groupname';
     }
     my $sth = $user->get_db_object->prepare( $sql );
     return undef if( ! $sth->execute(@params) );
-    $groups = $sth->fetchall_arrayref({});
+    while(my $g = $sth->fetchrow_hashref) {
+        $g->{active} = ($g->{state} == Vhffs::Constants::ACTIVATED);
+        $g->{state} = Vhffs::Functions::status_string_from_status_id($g->{state});
+        push @$groups, $g;
+    }
     return $groups;
 }
 

Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am	2007-06-15 17:53:52 UTC (rev 646)
+++ trunk/vhffs-panel/Makefile.am	2007-06-15 18:09:27 UTC (rev 647)
@@ -105,7 +105,6 @@
 	group/create.pl \
 	group/delete.pl \
 	group/prefs.pl \
-	group/project_submit.pl \
 	help/cvs.html \
 	help/index.html \
 	js/prototype.js \

Modified: trunk/vhffs-panel/templates/user/projects.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/projects.tmpl	2007-06-15 17:53:52 UTC (rev 646)
+++ trunk/vhffs-panel/templates/user/projects.tmpl	2007-06-15 18:09:27 UTC (rev 647)
@@ -3,7 +3,11 @@
 <h2><tmpl_var name="OWNED_PROJECTS_TEXT"></h2>
 <ul>
 <tmpl_loop name="OWNED_PROJECTS">
+<tmpl_if name="ACTIVE">
     <li><a href="/panel.pl?project=<tmpl_var name="PROJECT">"><tmpl_var name="PROJECT"></a></li>
+<tmpl_else>
+    <li><tmpl_var name="PROJECT">&nbsp;&mdash;&nbsp;<tmpl_var name="STATE"></li>
+</tmpl_if>
 </tmpl_loop>
 </ul>
 </div>


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