[vhffs-dev] [1307] Added new group details page.

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


Revision: 1307
Author:   beuss
Date:     2008-11-01 13:09:44 +0100 (Sat, 01 Nov 2008)

Log Message:
-----------
Added new group details page.

Modified Paths:
--------------
    branches/vhffs-design/vhffs-public/group.pl
    branches/vhffs-design/vhffs-public/groupsearch.pl
    branches/vhffs-design/vhffs-public/templates/Makefile.am
    branches/vhffs-design/vhffs-public/templates/parts/group-general.tt
    branches/vhffs-design/vhffs-themes/light-grey/main.css

Added Paths:
-----------
    branches/vhffs-design/vhffs-public/templates/content/group-details.tt


Modified: branches/vhffs-design/vhffs-public/group.pl
===================================================================
--- branches/vhffs-design/vhffs-public/group.pl	2008-11-01 12:08:09 UTC (rev 1306)
+++ branches/vhffs-design/vhffs-public/group.pl	2008-11-01 12:09:44 UTC (rev 1307)
@@ -35,103 +35,64 @@
 use POSIX qw(locale_h);
 use locale;
 use Locale::gettext;
-use CGI;
-use CGI::Session;
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Constants;
-use Vhffs::Functions;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Template;
+use Vhffs::Group;
+use Vhffs::Panel::Public;
 use Vhffs::Tag;
 
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
+my $panel = new Vhffs::Panel::Public();
+my $cgi = $panel->{cgi};
+my $vhffs = $panel->{vhffs};
+my $config = $vhffs->get_config();
 
-my $vhffs = $panel->{'vhffs'};
-my $cgi = $panel->{'cgi'};
-my $templatedir = $panel->{'templatedir'};
+my $groupname = $cgi->param('name');
+my $group = Vhffs::Group::get_by_groupname($panel->{vhffs}, $groupname);
+# TODO undefined groupname or group not found.
+my $tag_categories = $group->get_tags(Vhffs::Constants::TAG_VISIBILITY_PUBLIC); 
 
-$panel->check_public();
+my $vars = {
+	group => $group,
+	tag_categories => $tag_categories
+};
 
-my $template;
-my $subtemplate;
-my $repos;
-my $files;
-my $objs;
-
-my $name = $cgi->param("name");
-
-
-my $group;
-my $message;
-
-if( ! defined $name )
-{
-	$template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
-	$message = gettext( "CGI Error !");
-	$template->param( MESSAGE => $message );
+# Services filling... Really boring
+if( $config->get_service_availability('web') == 1 ) {
+	use Vhffs::Panel::Web;
+	$vars->{websites} = Vhffs::Panel::Web::get_websites_per_group($vhffs, $group->get_gid);
 }
-elsif( ! defined ($group= Vhffs::Group::get_by_groupname( $vhffs , $name ) ) )
-{
 
-	$template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
-	$message = gettext( "No such group");
-	$template->param( MESSAGE => $message );
-
+if( $vhffs->get_config->get_service_availability('cvs') == 1 ) {
+	use Vhffs::Panel::Cvs;
+	$vars->{cvs} = {
+		cvs_web_url => $config->get_service('cvs')->{'cvsweb_url'},
+		repositories => Vhffs::Panel::Cvs::get_repos_per_group($vhffs, $group->get_gid )
+	};
 }
-else
-{
-    $name = Vhffs::Functions::check_arg( $name );
-	$template = new Vhffs::Panel::Template( filename => $templatedir."/public/group.tmpl", 
-                        die_on_bad_params => 0,
-                        loop_context_vars => 1,
-                        global_var => 1,
-                        functions => { obfuscate_email => \&obfuscate_email } );
-    $template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-    $template->param( VALUE_REALNAME => $group->get_realname );
-    $template->param( VALUE_GROUPNAME => $group->get_groupname );
-    $template->param( VALUE_DESCRIPTION => Vhffs::Panel::Main::format_description($group->get_description));
-    $template->param( USERS => $group->get_users );
-    $template->param( TAG_CATEGORIES => $group->get_tags(Vhffs::Constants::TAG_VISIBILITY_PUBLIC) );
 
-    if( $vhffs->get_config->get_service_availability('web') == 1 ) {
-        use Vhffs::Panel::Web;
-        $template->param( WEBSITES_TITLE => gettext('Websites for this group') );
-        $template->param( WEBSITES => Vhffs::Panel::Web::get_websites_per_group($vhffs, $group->get_gid) );
-    }
-
-    if( $vhffs->get_config->get_service_availability('cvs') == 1 ) {
-        use Vhffs::Panel::Cvs;
-        $template->param( WEBCVS => $vhffs->get_config->get_service('cvs')->{'cvsweb_url'} );
-        $template->param( CVSREPOS => Vhffs::Panel::Cvs::get_repos_per_group($vhffs, $group->get_gid ) );
-    }
-
-    if( $vhffs->get_config->get_service_availability('svn') == 1 ) {
-        use Vhffs::Panel::Svn;
-        $template->param( WEBSVN => $vhffs->get_config->get_service('svn')->{'svnweb_url'} );
-        $template->param( SVNREPOS => Vhffs::Panel::Svn::get_repos_per_group($vhffs, $group->get_gid) );
-    }
-
-    if( $vhffs->get_config->get_service_availability('git') == 1 ) {
-        use Vhffs::Panel::Git;
-        $template->param( WEBGIT => $vhffs->get_config->get_service('git')->{'gitweb_url'} );
-        $template->param( GITREPOS => Vhffs::Panel::Git::get_repos_per_group($vhffs, $group->get_gid) );
-    }
-
-    if( $vhffs->get_config->get_service_availability('mailinglist') == 1 ) {
-        use Vhffs::Panel::MailingList;
-        $template->param( ARCHIVESURL => $vhffs->get_config->get_service('mailinglist')->{'url_archives'} );
-        $template->param( LISTS => Vhffs::Panel::MailingList::get_lists_per_group($vhffs, $group->get_gid) );
-    }
+if( $vhffs->get_config->get_service_availability('svn') == 1 ) {
+	use Vhffs::Panel::Svn;
+	$vars->{svn} = {
+		svn_web_url => $config->get_service('svn')->{'svnweb_url'},
+		repositories => Vhffs::Panel::Svn::get_repos_per_group($vhffs, $group->get_gid )
+	};
 }
 
-# We've to wrap the function since $vhffs isn't reachable from templates
-sub obfuscate_email {
-    return Vhffs::Functions::obfuscate_email($vhffs, $_[0]);
+if( $vhffs->get_config->get_service_availability('git') == 1 ) {
+	use Vhffs::Panel::Git;
+	$vars->{git} = {
+		git_web_url => $config->get_service('git')->{'gitweb_url'},
+		repositories => Vhffs::Panel::Git::get_repos_per_group($vhffs, $group->get_gid )
+	};
 }
 
-$panel->light( $template );
-$panel->display;
 
+if( $vhffs->get_config->get_service_availability('mailinglist') == 1 ) {
+	use Vhffs::Panel::MailingList;;
+	$vars->{ml} = {
+		archives_url => $config->get_service('mailinglist')->{'url_archives'},
+		lists => Vhffs::Panel::MailingList::get_lists_per_group($vhffs, $group->get_gid )
+	};
+}
+
+$panel->render('content/group-details.tt', $vars);

Modified: branches/vhffs-design/vhffs-public/groupsearch.pl
===================================================================
--- branches/vhffs-design/vhffs-public/groupsearch.pl	2008-11-01 12:08:09 UTC (rev 1306)
+++ branches/vhffs-design/vhffs-public/groupsearch.pl	2008-11-01 12:09:44 UTC (rev 1307)
@@ -74,6 +74,8 @@
 my ($groups, $count) = Vhffs::Panel::Group::public_search($panel->{vhffs}, $groupname, $description, \@included_tags_ids, \@excluded_tags_ids, $page - 1);
 my $pager = Vhffs::Panel::Commons::get_pager($page, $count, 10, 5, $panel->{url}, { groupname => $groupname, description => $description, included_tags => \@included_tags_ids, excluded_tags => \@excluded_tags_ids});
 
+# TODO No group found
+
 my $vars = {
 	groups => $groups,
 	gs_title => gettext( 'Search results' ),

Modified: branches/vhffs-design/vhffs-public/templates/Makefile.am
===================================================================
--- branches/vhffs-design/vhffs-public/templates/Makefile.am	2008-11-01 12:08:09 UTC (rev 1306)
+++ branches/vhffs-design/vhffs-public/templates/Makefile.am	2008-11-01 12:09:44 UTC (rev 1307)
@@ -3,6 +3,7 @@
 	banner.tmpl \
 	common/pager.tt \
 	content/last-groups.tt \
+	content/group-details.tt \
 	content/groupsearch-form.tt \
 	content/groupsearch-results.tt \
 	group_part.tmpl \

Added: branches/vhffs-design/vhffs-public/templates/content/group-details.tt
===================================================================
--- branches/vhffs-design/vhffs-public/templates/content/group-details.tt	                        (rev 0)
+++ branches/vhffs-design/vhffs-public/templates/content/group-details.tt	2008-11-01 12:09:44 UTC (rev 1307)
@@ -0,0 +1,92 @@
+[% title_str = 'Details for group %s' | i18n %]
+<div class="group-details">
+<h1 class="groupname">[% group.realname | html | format(title_str) %]</h1>
+<h2>[% 'General information' | i18n %]</h2>
+<img class="group-avatar" src="/avatar.pl?oid=[% group.object_id %]"/>
+<ul>
+<li>[% 'Groupname' | i18n %]:[% group.groupname | html %]</li>
+<li>[% 'Users' | i18n %]:</li>
+<li>[% 'Description' | i18n %]:[% group.description | html | html_para %]</li>
+</ul>
+<div class="tags">
+<h2>[% 'Tags' | i18n %]</h2>
+[% IF (tag_categories.size) %]
+<ul class="tags-list">
+[% FOREACH cat = tag_categories %]
+	<li>[% cat.label %]:
+[% FOREACH t = cat.tags %]
+	[% t.label %][% ',' UNLESS loop.last %]
+[% END %]
+	</li>
+[% END %]
+</ul>
+[% ELSE %]
+<p class="info">[% 'No tag for this group' | i18n %]</p>
+[% END %]
+</div>
+<div class="services">
+<h2>[% 'Services' | i18n %]</h2>
+
+[% IF websites.size %]
+<h3>[% 'Websites' | i18n %]</h3>
+<ul class="webareas-info">
+[% FOREACH w = websites %]
+<li>
+<p><a class="webarea-link" href="http://[% w.servername %]">[% w.servername %]</a></p>
+<p>[% w.description %]</p>
+</li>
+[% END %]
+</ul>
+[% END %]
+
+[% IF cvs && cvs.repositories.size %]
+<h3>[% 'CVS Repositories' | i18n %]</h3>
+<ul class="cvs-info">
+[% FOREACH c = cvs.repositories %]
+<li>
+<p><a class="webcvs-link" href="[% cvs.cvs_web_url %]/[% c.cvsroot %]">[% c.cvsroot %]</a></p>
+<p>[% c.description %]</p>
+</li>
+[% END %]
+</ul>
+[% END %]
+
+[% IF svn && svn.repositories.size %]
+<h3>[% 'SVN Repositories' | i18n %]</h3>
+<ul class="svn-info">
+[% FOREACH s = svn.repositories %]
+<li>
+<p><a class="websvn-link" href="[% svn.svn_web_url %]/[% s.reponame %]">[% s.reponame %]</a></p>
+<p>[% s.description %]</p>
+</li>
+[% END %]
+</ul>
+[% END %]
+
+[% IF git && git.repositories.size %]
+<h3>[% 'GIT Repositories' | i18n %]</h3>
+<ul class="git-info">
+[% FOREACH g = git.repositories %]
+<li>
+<p><a class="webgit-link" href="[% git.git_web_url %]/[% g.reponame %]">[% g.reponame %]</a></p>
+<p>[% g.description %]</p>
+</li>
+[% END %]
+</ul>
+[% END %]
+
+[% IF ml && ml.lists.size %]
+<h3>[% 'Mailing Lists' | i18n %]</h3>
+<ul class="ml-info">
+[% FOREACH list = ml.lists %]
+<li>
+<p><a class="list-archives-link" href="[% ml.archives_url %]/[% list.domain %]/[% list.local_part %]">
+	[% list.listname | mail %]</a></p>
+<p>[% list.description %]</p>
+</li>
+[% END %]
+</ul>
+[% END %]
+
+</div>
+</div>
\ No newline at end of file

Modified: branches/vhffs-design/vhffs-public/templates/parts/group-general.tt
===================================================================
--- branches/vhffs-design/vhffs-public/templates/parts/group-general.tt	2008-11-01 12:08:09 UTC (rev 1306)
+++ branches/vhffs-design/vhffs-public/templates/parts/group-general.tt	2008-11-01 12:09:44 UTC (rev 1307)
@@ -1,10 +1,9 @@
 <h2 class="groupname">[% g.realname | html%]</h2>
-[% g.get_groupname %]
 <div class="group-info">
 <img class="group-avatar" src="/avatar.pl?oid=[% g.object_id %]"/>
 <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 %]">[% 'More info...' | i18n %]</a></p>
+<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

Modified: branches/vhffs-design/vhffs-themes/light-grey/main.css
===================================================================
--- branches/vhffs-design/vhffs-themes/light-grey/main.css	2008-11-01 12:08:09 UTC (rev 1306)
+++ branches/vhffs-design/vhffs-themes/light-grey/main.css	2008-11-01 12:09:44 UTC (rev 1307)
@@ -435,15 +435,26 @@
 	font-size: 120%
 }
 
-div.group-info img.group-avatar {
+img.group-avatar {
 	width: 90px;
 	height: 60px;
 	float: left;
-	margin-right: 5px;
 	margin-bottom: 5px;
 	border: 1px dashed gray;
 }
 
+/* In summary info avatar is on the left... */
+div.group-info img.group-avatar {
+	margin-right: 5px;
+	float:left;
+}
+
+/* ... but on the right in detailed info. */
+div.group-details img.group-avatar {
+	margin-left: 5px;
+	float:right;
+}
+
 div.group-info div.description{
 	/* Should be rougly img.group-avatar height */
 	min-height: 60px;
@@ -1352,7 +1363,11 @@
 	font-size: 12px
 }
 
-#public-content a.webarea-link {
+#public-content a.webarea-link, 
+#public-content a.webcvs-link, 
+#public-content a.websvn-link, 
+#public-content a.webgit-link,
+#public-content a.list-archives-link {
 	text-decoration: none;
 	font-weight: bold
 }


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