[vhffs-dev] [1494] Added category name on public group search.

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


Revision: 1494
Author:   beuss
Date:     2009-08-01 01:40:34 +0200 (Sat, 01 Aug 2009)

Log Message:
-----------
Added category name on public group search. Fixed tag visibility issue (non public tags where shown in taglist)

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Tag.pm
    trunk/vhffs-public/templates/content/groupsearch-form.tt


Modified: trunk/vhffs-api/src/Vhffs/Panel/Tag.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Tag.pm	2009-07-31 23:30:40 UTC (rev 1493)
+++ trunk/vhffs-api/src/Vhffs/Panel/Tag.pm	2009-07-31 23:40:34 UTC (rev 1494)
@@ -80,6 +80,14 @@
         ' ORDER BY g.groupname', $start, $count, \@params, \&Vhffs::Panel::Group::fetch_groups_and_users);
 }
 
+=head2 get_by_tag_ids
+
+	my $tags = Vhffs::Panel::get_by_tag_ids($vhffs, id1, id2);
+
+Return information about specific public tags.
+
+=cut
+
 sub get_by_tag_ids {
 	
 	my $main = shift;
@@ -104,14 +112,15 @@
 	return undef unless($exclude ||  scalar(@ids) > 0);
 	
 	my $sql = 'SELECT c.tag_category_id AS category_id, c.label AS category_label, t.tag_id, t.label AS tag_label '.
-		'FROM vhffs_tag t INNER JOIN vhffs_tag_category c ON c.tag_category_id = t.category_id ';
+		'FROM vhffs_tag t INNER JOIN vhffs_tag_category c ON c.tag_category_id = t.category_id '.
+		'WHERE c.visibility = '.Vhffs::Constants::TAG_VISIBILITY_PUBLIC;
 	
 	if(scalar(@ids)) {
-		$sql .= 'WHERE tag_id '.($exclude ? 'NOT ' : '').'IN(?';
+		$sql .= ' AND tag_id '.($exclude ? 'NOT ' : '').'IN(?';
 		$sql .= ', ?' x (scalar(@ids) - 1);
-		$sql .= ') ORDER BY c.label, t.label';
+		$sql .= ')';
 	}
-	
+	$sql .= ' ORDER BY c.label, t.label';
 	my $dbh = $main->get_db_object;
 	return $dbh->selectall_arrayref($sql, { Slice => {} }, @ids);
 }

Modified: trunk/vhffs-public/templates/content/groupsearch-form.tt
===================================================================
--- trunk/vhffs-public/templates/content/groupsearch-form.tt	2009-07-31 23:30:40 UTC (rev 1493)
+++ trunk/vhffs-public/templates/content/groupsearch-form.tt	2009-07-31 23:40:34 UTC (rev 1494)
@@ -16,18 +16,27 @@
 [% END %]
 </span></p>
 <p>[% 'Other tags' | i18n %]:</p>
-<div id="searchTagsList">
+[% IF other_tags %]
+<ul id="searchTagsList">
+[% SET c = '' %]
 [% FOREACH t = other_tags %]
+[% IF t.category_label != c %]
+	[% SET c = t.category_label %]
+	[% '</li>' UNLESS loop.first() %]
+	<li><span class="category">[% c %]: </span>
+[% END %]
 <span id="tag[% t.tag_id %]">
 	<span class="label">[% t.tag_label %]</span>&nbsp;<a class="include" href="?[% query_string %]&amp;included_tags=[% t.tag_id %]">+</a>/<a class="exclude" href="?[% query_string %]&amp;excluded_tags=[% t.tag_id %]">-</a>
 </span>
 [% END %]
-</div>
+</li>
+</ul>
+[% END %]
 <h2>[% 'Advanced search' | i18n %]</h2>
 <p><label for="groupname">[% 'Groupname' | i18n %]:</label>
 <input type="text" maxlength="50" id="groupname" name="groupname"/></p>
 <p><label for="description">[% 'Description' | i18n %]:</label>
-<textarea name="description" id="description"></textarea></p>
+<textarea name="description" id="description" cols="100" rows="10"></textarea></p>
 <p class="submit"><input type="submit" value="[% 'OK' | i18n %]" name="searchSubmit" id="AdvancedSearchGroupFormSubmit"/></p>
 </form>
 <script type="text/javascript">


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