3 * Copyright (C) 2008-2009 Alcatel-Lucent
5 * This file is part of FusionForge.
7 * FusionForge is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Gforge; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Standard Alcatel-Lucent disclaimer for contributing to open source
25 * "The Tag Cloud ("Contribution") has not been tested and/or
26 * validated for release as or in products, combinations with products or
27 * other commercial use. Any use of the Contribution is entirely made at
28 * the user's own responsibility and the user can not rely on any features,
29 * functionalities or performances Alcatel-Lucent has attributed to the
32 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
33 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
35 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
36 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
37 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
38 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
39 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
40 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
44 require_once('../env.inc.php');
45 require_once $gfwww.'include/pre.php';
46 require_once $gfwww.'include/trove.php';
47 require_once $gfcommon.'include/tag_cloud.php';
49 if (!$sys_use_project_tags) {
53 $HTML->header(array('title'=>_('Software Map'),'pagename'=>'softwaremap'));
55 $subMenuTitle = array();
56 $subMenuUrl = array();
58 if ($GLOBALS['sys_use_project_tags']) {
59 $subMenuTitle[] = _('Tag cloud');
60 $subMenuUrl[] = '/softwaremap/tag_cloud.php';
63 if (forge_get_config('use_trove')) {
64 $subMenuTitle[] = _('Project Tree');
65 $subMenuUrl[] = '/softwaremap/trove_list.php';
68 $subMenuTitle[] = _('Project List');
69 $subMenuUrl[] = '/softwaremap/full_list.php';
71 echo ($HTML->subMenu($subMenuTitle, $subMenuUrl));
73 $selected_tag = getStringFromRequest('tag');
74 $page = getIntFromRequest('page', 1);
76 echo '<br />' . tag_cloud(array('selected' => $selected_tag, 'nb_max' => 100)) . '<br /><br />';
81 $res_grp = db_query_params('
82 SELECT groups.group_id, group_name, unix_group_name, short_description, register_time
83 FROM project_tags, groups
85 AND project_tags.group_id = groups.group_id
86 AND status = $2 AND is_public=1 AND type_id=1 AND register_time > 0
87 ORDER BY group_name ASC',
88 array($selected_tag, 'A'), $TROVE_HARDQUERYLIMIT);
89 $querytotalcount = db_numrows($res_grp);
90 if ($querytotalcount > 0) {
91 while ($group = db_fetch_array($res_grp)) {
92 $groups[] = "'" . $group['group_id'] . "'";
94 $cond_rq = ' AND group_id IN (' . join(',', $groups) . ') ';
95 db_reset_result($res_grp);
100 // #################################################################
101 // limit/offset display
103 // store this as a var so it can be printed later as well
105 if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
106 $html_limit .= sprintf(_('More than <strong>%1$s</strong> projects have <strong>%2$s</strong> as tag.'), $TROVE_HARDQUERYLIMIT, htmlspecialchars($selected_tag));
109 $html_limit .= sprintf(ngettext('<strong>%d</strong> project in result set.',
110 '<strong>%d</strong> projects in result set.',
115 // only display pages stuff if there is more to display
116 if ($querytotalcount > $TROVE_BROWSELIMIT) {
118 $html_limit .= sprintf (ngettext ('Displaying %d project per page. Projects sorted by alphabetical order.<br />',
119 'Displaying %d projects per page. Projects sorted by alphabetical order.<br />',
121 $TROVE_BROWSELIMIT) ;
123 // display all the numbers
124 for ($i=1;$i<=ceil($querytotalcount/$TROVE_BROWSELIMIT);$i++) {
127 $html_limit .= util_make_link ('/softwaremap/tag_cloud.php?tag='.$selected_tag.'&page='.$i,
130 $html_limit .= '<strong><'.$i.'></strong>';
136 print $html_limit."<hr />\n";
138 // #################################################################
139 // print actual project listings
140 // note that the for loop starts at 1, not 0
141 for ($i_proj=1;$i_proj<=$querytotalcount;$i_proj++) {
142 $row_grp = db_fetch_array($res_grp);
144 // check to see if row is in page range
145 if (($i_proj > (($page-1)*$TROVE_BROWSELIMIT)) && ($i_proj <= ($page*$TROVE_BROWSELIMIT))) {
151 if ($row_grp && $viewthisrow) {
152 print '<table border="0" cellpadding="0" width="100%">';
153 print '<tr valign="top"><td colspan="2">';
154 print util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']).'/',
155 '<strong>'.$row_grp['group_name'].'</strong> ');
157 if ($row_grp['short_description']) {
158 print "- " . $row_grp['short_description'];
163 print '<tr valign="top"><td colspan="2">';
164 print _('Tags'). ': ' . list_project_tag($row_grp['group_id']);
166 print '<tr valign="top"><td>';
167 // list all trove categories
168 print trove_getcatlisting($row_grp['group_id'],0,1,0);
169 print '</td>'."\n".'<td align="right">'; // now the right side of the display
170 $res = db_query_params('SELECT percentile, ranking
171 FROM project_weekly_metric
172 WHERE group_id=$1', array($row_grp['group_id']));
173 $nb_line = db_numrows($res);
179 $percentile = number_format(db_result($res, 0, 'percentile'));
180 $ranking = number_format(db_result($res, 0, 'ranking'));
182 printf ('<br />'._('Activity Percentile: <strong>%3.0f</strong>'), $percentile);
183 printf ('<br />'._('Activity Ranking: <strong>%d</strong>'), $ranking);
184 printf ('<br />'._('Registered: <strong>%s</strong>'),
185 date(_('Y-m-d H:i'),$row_grp['register_time']));
188 if ($row_grp['jobs_count']) {
189 print '<tr><td colspan="2" align="center">'
190 .util_make_link ('/people/?group_id='.$row_grp['group_id'],_("[This project needs help]")).'</td></td>';
195 } // end if for row and range chacking
198 // print bottom navigation if there are more projects to display
199 if ($querytotalcount > $TROVE_BROWSELIMIT) {
204 $HTML->footer(array());