1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
<?php
/**
*
* SourceForge Trove Software Map
*
* SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
* http://sourceforge.net
*
* @version $Id: trove_list.php 3252 2004-08-04 16:18:44Z tperdue $
*
*/
require_once('pre.php');
require_once('www/include/trove.php');
if (!$sys_use_trove) {
exit_disabled();
}
// assign default. 18 is 'topic'
if (!isset($form_cat) || !$form_cat) {
$form_cat = $default_trove_cat;
}
$form_cat = intval($form_cat);
// get info about current folder
$res_trove_cat = db_query("
SELECT *
FROM trove_cat
WHERE trove_cat_id='$form_cat' ORDER BY fullname");
if (db_numrows($res_trove_cat) < 1) {
exit_error(
$Language->getText('trove_list','invalid_category_title'),
$Language->getText('trove_list','invalid_category_text').': '.db_error()
);
}
$HTML->header(array('title'=>$Language->getText('trove_list','title'),'pagename'=>'softwaremap'));
echo'
<hr />';
$row_trove_cat = db_fetch_array($res_trove_cat);
// #####################################
// this section limits search and requeries if there are discrim elements
$discrim_url = '';
$discrim_desc = '';
if (isset($discrim) && $discrim) {
unset ($discrim_queryalias);
unset ($discrim_queryand);
unset ($discrim_url_b);
// commas are ANDs
$expl_discrim = explode(',',$discrim);
// need one link for each "get out of this limit" links
$discrim_url = '&discrim=';
$lims=sizeof($expl_discrim);
if ($lims > 6) {
$lims=6;
}
// one per argument
for ($i=0;$i<$lims;$i++) {
// make sure these are all ints, no url trickery
$expl_discrim[$i] = intval($expl_discrim[$i]);
// need one aliased table for everything
//[CB] $discrim_queryalias .= ', trove_group_link trove_group_link_'.$i.' ';
$discrim_queryalias .= ', trove_agg trove_agg_'.$i.' ';
// need additional AND entries for aliased tables
//[CB] $discrim_queryand .= 'AND trove_group_link_'.$i.'.trove_cat_id='
//[CB] .$expl_discrim[$i].' AND trove_group_link_'.$i.'.group_id='
//[CB] .'trove_group_link.group_id ';
$discrim_queryand .= 'AND trove_agg_'.$i.'.trove_cat_id='
.$expl_discrim[$i].' AND trove_agg_'.$i.'.group_id='
.'trove_agg.group_id ';
// must build query string for all urls
if ($i==0) {
$discrim_url .= $expl_discrim[$i];
} else {
$discrim_url .= ','.$expl_discrim[$i];
}
// must also do this for EACH "get out of this limit" links
// convoluted logic to build urls for these, but works quickly
for ($j=0;$j<sizeof($expl_discrim);$j++) {
if ($i!=$j) {
if (!$discrim_url_b[$j]) {
$discrim_url_b[$j] = '&discrim='.$expl_discrim[$i];
} else {
$discrim_url_b[$j] .= ','.$expl_discrim[$i];
}
}
}
}
// build text for top of page on what viewier is seeing
$discrim_desc = '<span style="color:red;font-size:smaller">'.$Language->getText('trove_list','limiting_view').':
</span>';
for ($i=0;$i<sizeof($expl_discrim);$i++) {
$discrim_desc .= '<br /> '
.trove_getfullpath($expl_discrim[$i])
.' <a href="/softwaremap/trove_list.php?form_cat='.$form_cat
.$discrim_url_b[$i].'">['.$Language->getText('trove_list','remove_filter').']'
.'</a>';
}
$discrim_desc .= "<hr />\n";
}
// #######################################
print '<p>'. (isset($discrim_desc) ? $discrim_desc : '') . '</p>';
// ######## two column table for key on right
// first print all parent cats and current cat
print '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td><span style="font-family:arial,helvetica">';
$folders = explode(" :: ",$row_trove_cat['fullpath']);
$folders_ids = explode(" :: ",$row_trove_cat['fullpath_ids']);
$folders_len = count($folders);
for ($i=0;$i<$folders_len;$i++) {
for ($sp=0;$sp<($i*2);$sp++) {
print " ";
}
echo html_image("ic/ofolder15.png",'15','13',array());
print " ";
// no anchor for current cat
if ($folders_ids[$i] != $form_cat) {
print '<a href="/softwaremap/trove_list.php?form_cat='
.$folders_ids[$i].$discrim_url.'">';
} else {
print '<strong>';
}
print $folders[$i];
if ($folders_ids[$i] != $form_cat) {
print '</a>';
} else {
print '</strong>';
}
print "<br />\n";
}
// print subcategories
$res_sub = db_query("
SELECT trove_cat.trove_cat_id AS trove_cat_id,
trove_cat.fullname AS fullname,
trove_treesums.subprojects AS subprojects
FROM trove_cat LEFT JOIN trove_treesums USING (trove_cat_id)
WHERE (
trove_treesums.limit_1=0
OR trove_treesums.limit_1 IS NULL
) AND " // need no discriminators
."trove_cat.parent='$form_cat'
ORDER BY fullname
", -1, 0, SYS_DB_TROVE);
echo db_error();
while ($row_sub = db_fetch_array($res_sub)) {
for ($sp=0;$sp<($folders_len*2);$sp++) {
print " ";
}
print ('<a href="trove_list.php?form_cat='.$row_sub['trove_cat_id'].$discrim_url.'">');
echo html_image("ic/cfolder15.png",'15','13',array());
print (' '.$row_sub['fullname'].'</a> <em>('.
$Language->getText('trove_list','projects',array($row_sub['subprojects']?$row_sub['subprojects']:'0'))
.')</em><br />');
}
// ########### right column: root level
print '</span></td><td><span style="font-family:arial,helvetica">';
// here we print list of root level categories, and use open folder for current
$res_rootcat = db_query("
SELECT trove_cat_id,fullname
FROM trove_cat
WHERE parent=0
AND trove_cat_id!=0
ORDER BY fullname");
echo db_error();
print $Language->getText('trove_list','browse_by').':';
while ($row_rootcat = db_fetch_array($res_rootcat)) {
// print open folder if current, otherwise closed
// also make anchor if not current
print ('<br />');
if (($row_rootcat['trove_cat_id'] == $row_trove_cat['root_parent'])
|| ($row_rootcat['trove_cat_id'] == $row_trove_cat['trove_cat_id'])) {
echo html_image('ic/ofolder15.png','15','13',array());
print (' <strong>'.$row_rootcat['fullname']."</strong>\n");
} else {
print ('<a href="/softwaremap/trove_list.php?form_cat='
.$row_rootcat['trove_cat_id'].$discrim_url.'">');
echo html_image('ic/cfolder15.png','15','13',array());
print (' '.$row_rootcat['fullname']."\n");
print ('</a>');
}
}
print '</span></td></tr></table>';
?>
<hr />
<?php
// one listing for each project
if(!isset($discrim_queryalias)) {
$discrim_queryalias = '';
}
if(!isset($discrim_queryand)) {
$discrim_queryand = '';
}
$res_grp = db_query("
SELECT *
FROM trove_agg
$discrim_queryalias
WHERE trove_agg.trove_cat_id='$form_cat'
$discrim_queryand
ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC
", $TROVE_HARDQUERYLIMIT, 0, SYS_DB_TROVE);
echo db_error();
$querytotalcount = db_numrows($res_grp);
// #################################################################
// limit/offset display
// no funny stuff with get vars
if (!isset($page) || !is_numeric($page)) {
$page = 1;
}
// store this as a var so it can be printed later as well
$html_limit = '<span style="text-align:center;font-size:smaller">';
if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
$html_limit .= 'More than ';
$html_limit .= $Language->getText('trove_list','more_than',array($querytotalcount));
}
$html_limit .= $Language->getText('trove_list','number_of_projects',array($querytotalcount));
// only display pages stuff if there is more to display
if ($querytotalcount > $TROVE_BROWSELIMIT) {
$html_limit .= ' Displaying '.$TROVE_BROWSELIMIT.' per page. Projects sorted by activity ranking.<br />';
// display all the numbers
for ($i=1;$i<=ceil($querytotalcount/$TROVE_BROWSELIMIT);$i++) {
$html_limit .= ' ';
if ($page != $i) {
$html_limit .= '<a href="/softwaremap/trove_list.php?form_cat='.$form_cat;
$html_limit .= $discrim_url.'&page='.$i;
$html_limit .= '">';
} else $html_limit .= '<strong>';
$html_limit .= '<'.$i.'>';
if ($page != $i) {
$html_limit .= '</a>';
} else $html_limit .= '</strong>';
$html_limit .= ' ';
}
}
$html_limit .= '</span>';
print $html_limit."<hr />\n";
// #################################################################
// print actual project listings
// note that the for loop starts at 1, not 0
for ($i_proj=1;$i_proj<=$querytotalcount;$i_proj++) {
$row_grp = db_fetch_array($res_grp);
// check to see if row is in page range
if (($i_proj > (($page-1)*$TROVE_BROWSELIMIT)) && ($i_proj <= ($page*$TROVE_BROWSELIMIT))) {
$viewthisrow = 1;
} else {
$viewthisrow = 0;
}
if ($row_grp && $viewthisrow) {
print '<table border="0" cellpadding="0" width="100%"><tr valign="top"><td colspan="2"><span style="font-family:arial,helvetica">';
print "$i_proj. <a href=\"/projects/". strtolower($row_grp['unix_group_name']) ."/\"><strong>"
.htmlspecialchars($row_grp['group_name'])."</strong></a> ";
if ($row_grp['short_description']) {
print "- " . htmlspecialchars($row_grp['short_description']);
}
print '<br /> ';
// extra description
print '</span></td></tr><tr valign="top"><td><span style="font-family:arial,helvetica">';
// list all trove categories
print trove_getcatlisting($row_grp['group_id'],1,0);
print '</span></td>'."\n".'<td align="right"><span style="font-family:arial,helvetica">'; // now the right side of the display
print 'Activity Percentile: <strong>'. number_format($row_grp['percentile'],2) .'</strong>';
print '<br />Activity Ranking: <strong>'. number_format($row_grp['ranking'],2) .'</strong>';
print '<br />Register Date: <strong>'.date($sys_datefmt,$row_grp['register_time']).'</strong>';
print '</span></td></tr>';
/*
if ($row_grp['jobs_count']) {
print '<tr><td colspan="2" align="center">'
.'<a href="/people/?group_id='.$row_grp['group_id'].'">[This project needs help]</a></td></td>';
}
*/
print '</table>';
print '<hr />';
} // end if for row and range chacking
}
// print bottom navigation if there are more projects to display
if ($querytotalcount > $TROVE_BROWSELIMIT) {
print $html_limit;
}
// print '<p><FONT size="-1">This listing was produced by the following query: '
// .$query_projlist.'</FONT>';
$HTML->footer(array());
?>
|