3 * Copyright (C) 2008-2009 Alcatel-Lucent
5 * This file is part of FusionForge. FusionForge is free software;
6 * you can redistribute it and/or modify it under the terms of the
7 * GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the Licence, or (at your option)
11 * FusionForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Standard Alcatel-Lucent disclaimer for contributing to open source
24 * "The Tag Cloud ("Contribution") has not been tested and/or
25 * validated for release as or in products, combinations with products or
26 * other commercial use. Any use of the Contribution is entirely made at
27 * the user's own responsibility and the user can not rely on any features,
28 * functionalities or performances Alcatel-Lucent has attributed to the
31 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
32 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
33 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
34 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
35 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
36 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
37 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
38 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
39 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
43 require_once('../env.inc.php');
44 require_once $gfcommon.'include/pre.php';
45 require_once $gfwww.'include/trove.php';
46 require_once $gfcommon.'include/tag_cloud.php';
48 if (!forge_get_config('use_project_tags')) {
52 $HTML->header(array('title'=>_('Software Map'),'pagename'=>'softwaremap'));
53 $HTML->printSoftwareMapLinks();
55 $selected_tag = getStringFromRequest('tag');
56 $page = getIntFromRequest('page', 1);
58 echo '<br />' . tag_cloud(array('selected' => $selected_tag, 'nb_max' => 100)) . '<br />';
61 $res_grp = db_query_params('
62 SELECT groups.group_id, group_name, unix_group_name, short_description, register_time
63 FROM project_tags, groups
65 AND project_tags.group_id = groups.group_id
66 AND status = $2 AND type_id=1 AND register_time > 0
67 ORDER BY group_name ASC',
68 array($selected_tag, 'A'), $TROVE_HARDQUERYLIMIT);
70 $project_ids = array();
71 while ($row_grp = db_fetch_array($res_grp)) {
72 if (!forge_check_perm('project_read', $row_grp['group_id'])) {
75 $projects[] = $row_grp;
76 $project_ids[] = $row_grp['group_id'];
78 $querytotalcount = count($projects);
80 // #################################################################
81 // limit/offset display
83 // store this as a var so it can be printed later as well
85 if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
86 $html_limit .= sprintf(_('More than <strong>%1$s</strong> projects have <strong>%2$s</strong> as tag.'), $TROVE_HARDQUERYLIMIT, htmlspecialchars($selected_tag));
89 $html_limit .= sprintf(ngettext('<strong>%d</strong> project in result set.',
90 '<strong>%d</strong> projects in result set.',
95 // only display pages stuff if there is more to display
96 if ($querytotalcount > $TROVE_BROWSELIMIT) {
98 $html_limit .= sprintf (ngettext ('Displaying %d project per page. Projects sorted by alphabetical order.<br />',
99 'Displaying %d projects per page. Projects sorted by alphabetical order.<br />',
103 // display all the numbers
104 for ($i=1 ;$i <= ceil($querytotalcount/$TROVE_BROWSELIMIT); $i++) {
107 $html_limit .= util_make_link ('/softwaremap/tag_cloud.php?tag='.$selected_tag.'&page='.$i,
110 $html_limit .= '<strong><'.$i.'></strong>';
116 print $html_limit."<hr />\n";
118 // #################################################################
119 // print actual project listings
120 for ($i_proj = 0; $i_proj < $querytotalcount; $i_proj++) {
121 $row_grp = $projects[$i_proj];
123 // check to see if row is in page range
124 if (($i_proj >= (($page-1)*$TROVE_BROWSELIMIT)) && ($i_proj < ($page*$TROVE_BROWSELIMIT))) {
130 if ($row_grp && $viewthisrow) {
131 print '<table border="0" cellpadding="0" width="100%">';
132 print '<tr valign="top"><td colspan="2">';
133 print util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']).'/',
134 '<strong>'.$row_grp['group_name'].'</strong> ');
136 if ($row_grp['short_description']) {
137 print "- " . $row_grp['short_description'];
142 print '<tr valign="top"><td colspan="2">';
143 print _('Tags'). ': ' . list_project_tag($row_grp['group_id']);
145 print '<tr valign="top"><td>';
146 // list all trove categories
147 print trove_getcatlisting($row_grp['group_id'],0,1,0);
148 print '</td>'."\n".'<td align="right">'; // now the right side of the display
149 $res = db_query_params('SELECT percentile, ranking
150 FROM project_weekly_metric
151 WHERE group_id=$1', array($row_grp['group_id']));
152 $nb_line = db_numrows($res);
158 $percentile = number_format(db_result($res, 0, 'percentile'));
159 $ranking = number_format(db_result($res, 0, 'ranking'));
161 printf ('<br />'._('Activity Percentile: <strong>%3.0f</strong>'), $percentile);
162 printf ('<br />'._('Activity Ranking: <strong>%d</strong>'), $ranking);
163 printf ('<br />'._('Registered: <strong>%s</strong>'),
164 date(_('Y-m-d H:i'),$row_grp['register_time']));
167 if ($row_grp['jobs_count']) {
168 print '<tr><td colspan="2" class="align-center">'
169 .util_make_link ('/people/?group_id='.$row_grp['group_id'],_("[This project needs help]")).'</td></td>';
174 } // end if for row and range chacking
177 // print bottom navigation if there are more projects to display
178 if ($querytotalcount > $TROVE_BROWSELIMIT) {
183 $HTML->footer(array());