[Fusionforge-commits] r11842 - in trunk/src: plugins/projects_hierarchy/common plugins/projects_hierarchy/www www/softwaremap
Franck VILLAUME
nerville at libremir.placard.fr.eu.org
Sun Dec 19 17:30:55 CET 2010
Author: nerville
Date: 2010-12-19 17:30:55 +0100 (Sun, 19 Dec 2010)
New Revision: 11842
Removed:
trunk/src/plugins/projects_hierarchy/www/softwaremap.php
Modified:
trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
trunk/src/plugins/projects_hierarchy/www/dtree.js
trunk/src/www/softwaremap/trove_list.php
Log:
rewrite trove list integration for projects_hierarchy plugin
Modified: trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php 2010-12-19 16:28:23 UTC (rev 11841)
+++ trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php 2010-12-19 16:30:55 UTC (rev 11842)
@@ -32,7 +32,7 @@
$this->_addHook("groupisactivecheckboxpost"); //
$this->_addHook("admin_project_link");
$this->_addHook("project_home_link"); // to see father and sons in project home
- $this->_addHook("tree"); // to see the tree of projects
+ $this->_addHook("display_hierarchy"); // to see the tree of projects
$this->_addHook("delete_link"); // to delete link
}
@@ -40,8 +40,10 @@
global $G_SESSION, $HTML;
$returned = false;
switch($hookname) {
- case "tree": {
- header('Location: ../plugins/projects_hierarchy/softwaremap.php');
+ case "display_hierarchy": {
+ if ($this->displayHierarchy()) {
+ $returned = true;
+ }
break;
}
case "project_home_link": {
@@ -73,8 +75,78 @@
}
return $returned;
}
+
+ function displayHierarchy() {
+ $tree = $this->buildTree();
+ $displayTree = $this->affTree($tree, 0);
+ $this->dTreeJS();
+ echo $displayTree;
+ return true;
+ }
+
+ function dTreeJS() {
+ echo '<link rel="StyleSheet" href="/splugins/projects_hierarchy/dtree.css" type="text/css" />
+ <script type="text/javascript" src="/plugins/projects_hierarchy/dtree.js"></script>';
+ }
+
+ function buildTree() {
+ global $project_name;
+ $res = db_query_params('select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated=$1 AND plugin_projects_hierarchy.link_type=$2',
+ array ('t',
+ 'shar'));
+ echo db_error();
+ // construction du tableau associatif
+ // key = name of the father
+ // value = list of sons
+ $tree = array();
+ while ($row = db_fetch_array($res)) {
+ //$tree[$row['father_name']][] = $row['son_name'];
+ $tree[$row['father_id']][] = $row['son_id'];
+ //get the unix name of the project
+ $project_name[$row['father_id']][0] = $row['father_name'];
+ $project_name[$row['son_id']][0] = $row['son_name'];
+ $project_name[$row['father_id']][1] = $row['father_unix_name'];
+ $project_name[$row['son_id']][1] = $row['son_unix_name'];
+ }
+ return $tree;
+ }
+
+ function affTree($tree, $lvl) {
+ global $project_name;
+ $returnTree = '';
+
+ $returnTree .= "<br/>";
+ $arbre = array();
+ $cpt_pere = 0;
+
+ while (list($key, $sons) = each($tree)) {
+ // Really don't know why there is a warning there, and added @
+ if(@!$arbre[$key] != 0){
+ $arbre[$key] = 0;
+ }
+ $cpt_pere = $key;
+ foreach ($sons as $son) {
+ $arbre[$son] = $cpt_pere;
+ }
+ }
+
+ $returnTree .= '<table ><tr><td>';
+ $returnTree .= '<script type="text/javascript">';
+ $returnTree .= 'd = new dTree(\'d\');';
+ $returnTree .= 'd.add(0,-1,\'Project Tree\');';
+ reset($arbre);
+ //construction automatique de l'arbre format : (num_fils, num_pere,nom,nom_unix)
+ while (list($key2, $sons2) = each($arbre)) {
+ $returnTree .= "d.add('".$key2."','".$sons2."','".$project_name[$key2][0]."','".util_make_url( '/projects/'.$project_name[$key2][1] .'/', $project_name[$key2][1] ) ."');";
+ }
+
+ $returnTree .= 'document.write(d);';
+ $returnTree .= '</script>';
+ $returnTree .= '</td></tr></table>';
+ return $returnTree;
+ }
+
}
-
// Local Variables:
// mode: php
// c-file-style: "bsd"
Modified: trunk/src/plugins/projects_hierarchy/www/dtree.js
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/dtree.js 2010-12-19 16:28:23 UTC (rev 11841)
+++ trunk/src/plugins/projects_hierarchy/www/dtree.js 2010-12-19 16:30:55 UTC (rev 11842)
@@ -23,307 +23,167 @@
// Node object
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
-
- this.id = id;
-
- this.pid = pid;
-
- this.name = name;
-
- this.url = url;
-
- this.title = title;
-
- this.target = target;
-
- this.icon = icon;
-
- this.iconOpen = iconOpen;
-
- this._io = open || false;
-
- this._is = false;
-
- this._ls = false;
-
- this._hc = false;
-
- this._ai = 0;
-
+ this.id = id;
+ this.pid = pid;
+ this.name = name;
+ this.url = url;
+ this.title = title;
+ this.target = target;
+ this.icon = icon;
+ this.iconOpen = iconOpen;
+ this._io = open || false;
+ this._is = false;
+ this._ls = false;
+ this._hc = false;
+ this._ai = 0;
this._p;
-
};
-
-
// Tree object
-
function dTree(objName) {
-
this.config = {
-
- target : null,
-
- folderLinks : true,
-
- useSelection : true,
-
- useCookies : true,
-
- useLines : true,
-
- useIcons : true,
-
+ target : null,
+ folderLinks : true,
+ useSelection : true,
+ useCookies : true,
+ useLines : true,
+ useIcons : true,
useStatusText : false,
-
- closeSameLevel : false,
-
- inOrder : false
-
+ closeSameLevel : false,
+ inOrder : false
}
this.icon = {
-
- root : 'img/base.gif',
-
- folder : 'img/folder.gif',
-
- folderOpen : 'img/folderopen.gif',
-
- node : 'img/page.gif',
-
- empty : 'img/empty.gif',
-
- line : 'img/line.gif',
-
- join : 'img/join.gif',
-
- joinBottom : 'img/joinbottom.gif',
-
- plus : 'img/plus.gif',
-
- plusBottom : 'img/plusbottom.gif',
-
- minus : 'img/minus.gif',
-
- minusBottom : 'img/minusbottom.gif',
-
- nlPlus : 'img/nolines_plus.gif',
-
- nlMinus : 'img/nolines_minus.gif'
-
+ root : '/plugins/projects_hierarchy/img/base.gif',
+ folder : '/plugins/projects_hierarchy/img/folder.gif',
+ folderOpen : '/plugins/projects_hierarchy/img/folderopen.gif',
+ node : '/plugins/projects_hierarchy/img/page.gif',
+ empty : '/plugins/projects_hierarchy/img/empty.gif',
+ line : '/plugins/projects_hierarchy/img/line.gif',
+ join : '/plugins/projects_hierarchy/img/join.gif',
+ joinBottom : '/plugins/projects_hierarchy/img/joinbottom.gif',
+ plus : '/plugins/projects_hierarchy/img/plus.gif',
+ plusBottom : '/plugins/projects_hierarchy/img/plusbottom.gif',
+ minus : '/plugins/projects_hierarchy/img/minus.gif',
+ minusBottom : '/plugins/projects_hierarchy/img/minusbottom.gif',
+ nlPlus : '/plugins/projects_hierarchy/img/nolines_plus.gif',
+ nlMinus : '/plugins/projects_hierarchy/img/nolines_minus.gif'
};
this.obj = objName;
-
this.aNodes = [];
-
this.aIndent = [];
-
this.root = new Node(-1);
-
this.selectedNode = null;
-
this.selectedFound = false;
-
this.completed = false;
-
};
-
-
// Adds a new node to the node array
-
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
-
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
-
};
-
-
// Open/close all nodes
-
dTree.prototype.openAll = function() {
-
this.oAll(true);
-
};
dTree.prototype.closeAll = function() {
-
this.oAll(false);
-
};
-
-
// Outputs the tree to the page
-
dTree.prototype.toString = function() {
-
var str = '<div class="dtree">\n';
-
if (document.getElementById) {
-
if (this.config.useCookies) this.selectedNode = this.getSelected();
-
str += this.addNode(this.root);
-
} else str += 'Browser not supported.';
-
str += '</div>';
-
if (!this.selectedFound) this.selectedNode = null;
-
this.completed = true;
-
return str;
-
};
-
-
// Creates the tree structure
-
dTree.prototype.addNode = function(pNode) {
-
var str = '';
-
var n=0;
-
if (this.config.inOrder) n = pNode._ai;
-
for (n; n<this.aNodes.length; n++) {
-
if (this.aNodes[n].pid == pNode.id) {
-
var cn = this.aNodes[n];
-
cn._p = pNode;
-
cn._ai = n;
-
this.setCS(cn);
-
if (!cn.target && this.config.target) cn.target = this.config.target;
-
if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
-
if (!this.config.folderLinks && cn._hc) cn.url = null;
-
if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
-
cn._is = true;
-
this.selectedNode = n;
-
this.selectedFound = true;
-
}
-
str += this.node(cn, n);
-
if (cn._ls) break;
-
}
-
}
-
return str;
-
};
-
-
// Creates the node icon, url and text
-
dTree.prototype.node = function(node, nodeId) {
-
var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
-
if (this.config.useIcons) {
-
if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
-
if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
-
if (this.root.id == node.pid) {
-
node.icon = this.icon.root;
-
node.iconOpen = this.icon.root;
-
}
str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
-
}
if (node.url) {
-
str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
-
if (node.title) str += ' title="' + node.title + '"';
-
if (node.target) str += ' target="' + node.target + '"';
-
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
-
if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
-
str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
str += '>';
-
}
-
else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
-
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
str += node.name;
-
if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
str += '</div>';
if (node._hc) {
-
str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
-
str += this.addNode(node);
-
str += '</div>';
-
}
this.aIndent.pop();
-
return str;
-
};
-
-
// Adds the empty and line icons
-
dTree.prototype.indent = function(node, nodeId) {
-
var str = '';
-
if (this.root.id != node.pid) {
-
for (var n=0; n<this.aIndent.length; n++)
-
str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
-
if (node._hc) {
-
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
-
if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
@@ -331,363 +191,189 @@
str += '" alt="" /></a>';
} else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
-
}
-
return str;
-
};
-
-
// Checks if a node has any children and if it is the last sibling
-
dTree.prototype.setCS = function(node) {
-
var lastId;
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n].pid == node.id) node._hc = true;
-
if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
-
}
-
if (lastId==node.id) node._ls = true;
-
};
-
-
// Returns the selected node
-
dTree.prototype.getSelected = function() {
-
var sn = this.getCookie('cs' + this.obj);
-
return (sn) ? sn : null;
-
};
-
-
// Highlights the selected node
-
dTree.prototype.s = function(id) {
-
if (!this.config.useSelection) return;
-
var cn = this.aNodes[id];
-
if (cn._hc && !this.config.folderLinks) return;
-
if (this.selectedNode != id) {
-
if (this.selectedNode || this.selectedNode==0) {
-
eOld = document.getElementById("s" + this.obj + this.selectedNode);
-
eOld.className = "node";
-
}
-
eNew = document.getElementById("s" + this.obj + id);
-
eNew.className = "nodeSel";
-
this.selectedNode = id;
-
if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
-
}
-
};
-
-
// Toggle Open or close
-
dTree.prototype.o = function(id) {
-
var cn = this.aNodes[id];
-
this.nodeStatus(!cn._io, id, cn._ls);
-
cn._io = !cn._io;
if (this.config.closeSameLevel) this.closeLevel(cn);
-
if (this.config.useCookies) this.updateCookie();
-
};
-
-
// Open or close all nodes
-
dTree.prototype.oAll = function(status) {
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
-
this.nodeStatus(status, n, this.aNodes[n]._ls)
-
this.aNodes[n]._io = status;
-
}
-
}
-
if (this.config.useCookies) this.updateCookie();
-
};
-
-
// Opens the tree to a specific node
-
dTree.prototype.openTo = function(nId, bSelect, bFirst) {
-
if (!bFirst) {
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n].id == nId) {
-
nId=n;
-
break;
-
}
-
}
-
}
var cn=this.aNodes[nId];
-
if (cn.pid==this.root.id || !cn._p) return;
-
cn._io = true;
-
cn._is = bSelect;
-
if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
-
if (this.completed && bSelect) this.s(cn._ai);
-
else if (bSelect) this._sn=cn._ai;
-
this.openTo(cn._p._ai, false, true);
-
};
-
-
// Closes all nodes on the same level as certain node
-
dTree.prototype.closeLevel = function(node) {
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
-
this.nodeStatus(false, n, this.aNodes[n]._ls);
-
this.aNodes[n]._io = false;
-
this.closeAllChildren(this.aNodes[n]);
-
}
-
}
-
}
-
-
// Closes all children of a node
-
dTree.prototype.closeAllChildren = function(node) {
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
-
if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
-
this.aNodes[n]._io = false;
-
this.closeAllChildren(this.aNodes[n]);
-
}
-
}
-
}
-
-
// Change the status of a node(open or closed)
-
dTree.prototype.nodeStatus = function(status, id, bottom) {
-
eDiv = document.getElementById('d' + this.obj + id);
-
eJoin = document.getElementById('j' + this.obj + id);
-
if (this.config.useIcons) {
-
eIcon = document.getElementById('i' + this.obj + id);
-
eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
-
}
-
eJoin.src = (this.config.useLines)?
-
((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
-
((status)?this.icon.nlMinus:this.icon.nlPlus);
-
eDiv.style.display = (status) ? 'block': 'none';
-
};
-
-
-
-
// [Cookie] Clears a cookie
-
dTree.prototype.clearCookie = function() {
-
var now = new Date();
-
var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
-
this.setCookie('co'+this.obj, 'cookieValue', yesterday);
-
this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
-
};
-
-
// [Cookie] Sets value in a cookie
-
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
-
document.cookie =
-
escape(cookieName) + '=' + escape(cookieValue)
-
+ (expires ? '; expires=' + expires.toGMTString() : '')
-
+ (path ? '; path=' + path : '')
-
+ (domain ? '; domain=' + domain : '')
-
+ (secure ? '; secure' : '');
-
};
-
-
// [Cookie] Gets a value from a cookie
-
dTree.prototype.getCookie = function(cookieName) {
-
var cookieValue = '';
-
var posName = document.cookie.indexOf(escape(cookieName) + '=');
-
if (posName != -1) {
-
var posValue = posName + (escape(cookieName) + '=').length;
-
var endPos = document.cookie.indexOf(';', posValue);
-
if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
-
else cookieValue = unescape(document.cookie.substring(posValue));
-
}
-
return (cookieValue);
-
};
-
-
// [Cookie] Returns ids of open nodes as a string
-
dTree.prototype.updateCookie = function() {
-
var str = '';
-
for (var n=0; n<this.aNodes.length; n++) {
-
if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
if (str) str += '.';
str += this.aNodes[n].id;
-
}
-
}
-
this.setCookie('co' + this.obj, str);
-
};
-
-
// [Cookie] Checks if a node id is in a cookie
-
dTree.prototype.isOpen = function(id) {
-
var aOpen = this.getCookie('co' + this.obj).split('.');
-
for (var n=0; n<aOpen.length; n++)
-
if (aOpen[n] == id) return true;
-
return false;
-
};
// If Push and pop is not implemented by the browser
-
if (!Array.prototype.push) {
-
Array.prototype.push = function array_push() {
-
for(var i=0;i<arguments.length;i++)
-
this[this.length]=arguments[i];
-
return this.length;
-
}
-
};
if (!Array.prototype.pop) {
-
Array.prototype.pop = function array_pop() {
-
lastElement = this[this.length-1];
-
this.length = Math.max(this.length-1,0);
-
return lastElement;
-
}
-
};
\ No newline at end of file
Deleted: trunk/src/plugins/projects_hierarchy/www/softwaremap.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/softwaremap.php 2010-12-19 16:28:23 UTC (rev 11841)
+++ trunk/src/plugins/projects_hierarchy/www/softwaremap.php 2010-12-19 16:30:55 UTC (rev 11842)
@@ -1,415 +0,0 @@
-<?php
-/**
- * FusionForge Trove Software Map
- *
- * Copyright 2000, Quentin Cregan/Sourceforge
- * Copyright 2002-2003, Tim Perdue/GForge, LLC
- * Copyright 2009, Roland Mas
- * Copyright 2010, Franck Villaume - Capgemini
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-session_start();
-require_once('../../env.inc.php');
-require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'include/trove.php';
-
-if (!forge_get_config('use_trove')) {
- exit_disabled();
-}
-
-//we check if the user has already chosen the tree
-if(isset($_GET['cat'])){
- $_SESSION['cat'] = $_GET['cat'];
-}
-
-// assign default. 18 is 'topic'
-if (!isset($form_cat) || !$form_cat) {
- $form_cat = forge_get_config('default_trove_cat');
-}
-
-$form_cat = intval($form_cat);
-
-// get info about current folder
-$res_trove_cat = db_query_params('
- SELECT *
- FROM trove_cat
- WHERE trove_cat_id=$1 ORDER BY fullname',
- array($form_cat));
-
-if (db_numrows($res_trove_cat) < 1) {
- exit_error(
- _('Invalid Trove Category'),
- _('That Trove category does not exist').': '.db_error()
- );
-}
-
-$HTML->header(array('title'=>_('Software Map'),'pagename'=>'softwaremap'));
-
-//rajout fab a mettre dans head
-?>
-<link rel="StyleSheet" href="dtree.css" type="text/css" />
- <script type="text/javascript" src="dtree.js"></script>
-<?php
-//fin rajout
-
-print '<b><a href="./softwaremap.php?cat=c">'._('By Category').'</a> | <a href="./softwaremap.php?cat=t">'._('By Tree').'</a></b>';
-
-echo'
- <hr />';
-
-if(@$_SESSION['cat'] != 't'){
- $row_trove_cat = db_fetch_array($res_trove_cat);
-
- // #####################################
- // this section limits search and requeries if there are discrim elements
-
- $discrim_url = '';
- $discrim_desc = '';
-
- $qpa_alias = db_construct_qpa();
- $qpa_and = db_construct_qpa();
-
- 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
- $qpa_alias = db_construct_qpa($qpa_alias,
- sprintf(', trove_agg trove_agg_%d',
- $i));
-
- // need additional AND entries for aliased tables
- $qpa_and = db_construct_qpa($qpa_and,
- sprintf(' AND trove_agg_%d.trove_cat_id=$%d AND trove_agg_%d.group_id=trove_agg.group_id ',
- $i, $i +1 , $i),
- array($expl_discrim[$i]));
-
- // 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">'._('Now limiting view to projects in the following categories').':
- </span>';
-
- for ($i=0;$i<sizeof($expl_discrim);$i++) {
- $discrim_desc .= '<br /> '
- .trove_getfullpath($expl_discrim[$i])
- .' <a href="softwaremap.php?form_cat='.$form_cat
- .$discrim_url_b[$i].'">['._('Remove This 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.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_params('
- 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 trove_cat.parent=$1
- ORDER BY fullname
- ',
- array($form_cat));
- echo db_error();
-
- while ($row_sub = db_fetch_array($res_sub)) {
- for ($sp=0;$sp<($folders_len*2);$sp++) {
- print " ";
- }
- print ('<a href="softwaremap.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>('.
- sprintf(_('%1$s projects'), $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_params ('
- SELECT trove_cat_id,fullname
- FROM trove_cat
- WHERE parent=0
- AND trove_cat_id!=0
- ORDER BY fullname',
- array ());
- echo db_error();
-
- print _('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.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
-
- $qpa = db_construct_qpa();
- $qpa = db_construct_qpa($qpa, 'SELECT * FROM trove_agg');
- $qpa = db_join_qpa($qpa, $qpa_alias);
- $qpa = db_construct_qpa($qpa, ' WHERE trove_agg.trove_cat_id=$1', array ($form_cat));
- $qpa = db_join_qpa($qpa, $qpa_and);
- $qpa = db_construct_qpa($qpa, ' ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC');
- $res_grp = db_query_qpa($qpa, $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 .= sprintf(_('More than <strong>%1$s</strong> projects in result set.'), $querytotalcount);
- }
- $html_limit .= sprintf(ngettext('<strong>%1$s</strong> project in result set.', '<strong>%1$s</strong> projects in result set.', $querytotalcount), $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.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. '.util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']) .'/','<strong>'.htmlspecialchars($row_grp['group_name']).'</strong> ');
- 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(_('Y-m-d H:i'),$row_grp['register_time']).'</strong>';
- print '</span></td></tr>';
- 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>';
-} else {
- function build_tree() {
- global $project_name;
- $res = db_query_params('select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated=$1 AND plugin_projects_hierarchy.link_type=$2',
- array ('t',
- 'shar'));
- echo db_error();
- // construction du tableau associatif
- // key = name of the father
- // value = list of sons
- $tree = array();
- while ($row = db_fetch_array($res)) {
- //$tree[$row['father_name']][] = $row['son_name'];
- $tree[$row['father_id']][] = $row['son_id'];
- //get the unix name of the project
- $project_name[$row['father_id']][0] = $row['father_name'];
- $project_name[$row['son_id']][0] = $row['son_name'];
- $project_name[$row['father_id']][1] = $row['father_unix_name'];
- $project_name[$row['son_id']][1] = $row['son_unix_name'];
- }
- return $tree;
- }
-
- function aff_tree($tree, $lvl) {
- global $project_name ;
-
- echo "<br/>";
- $arbre = array();
- $cpt_pere = 0;
-
- while (list($key, $sons) = each($tree)) {
- //echo $key . "<br/>";
- //we build a array with id of father and son.
- //If no father --> 0
- // Really don't know why there is a warning there, and added @
- if(@!$arbre[$key] != 0){
- $arbre[$key] = 0 ;
- }
- $cpt_pere = $key;
- foreach ($sons as $son) {
- //echo " " . $son . "<br/>";
- $arbre[$son] = $cpt_pere;
- }
- }
-
- echo '<table ><tr><td>';
-
- ?>
- <script type="text/javascript">
- //add files dtress.css, dtree.js et du dossier img
- d = new dTree('d');
- d.add(0,-1,'<?php echo _('Project Tree');?>');
- <?php
- reset($arbre);
- //construction automatique de l'arbre format : (num_fils, num_pere,nom,nom_unix)
- while (list($key2, $sons2) = each($arbre)) {
- echo "d.add('".$key2."','".$sons2."','".$project_name[$key2][0]."','".util_make_url( '/projects/'.$project_name[$key2][1] .'/', $project_name[$key2][1] ) ."');";
- }
- ?>
- document.write(d);
- </script>
- <?php
- echo '</td></tr></table>';
- }
-
- $tree = build_tree();
- aff_tree($tree, 0);
-}
-
-$HTML->footer(array());
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-?>
Modified: trunk/src/www/softwaremap/trove_list.php
===================================================================
--- trunk/src/www/softwaremap/trove_list.php 2010-12-19 16:28:23 UTC (rev 11841)
+++ trunk/src/www/softwaremap/trove_list.php 2010-12-19 16:30:55 UTC (rev 11842)
@@ -25,11 +25,6 @@
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
-
-// entry for hierarchy plugin
-// we didn't find any other way to do it :(
-plugin_hook('tree');
-
require_once $gfwww.'include/trove.php';
if (!forge_get_config('use_trove')) {
@@ -38,15 +33,18 @@
$form_cat = getIntFromRequest('form_cat');
$page = getIntFromRequest('page',1);
+$cat = getStringFromRequest('cat');
+if (empty($cat)) {
+ $cat = 'c';
+}
-
// assign default. 18 is 'topic'
if (!$form_cat) {
$form_cat = forge_get_config('default_trove_cat');
}
// get info about current folder
-$res_trove_cat = db_query_params ('
+$res_trove_cat = db_query_params('
SELECT *
FROM trove_cat
WHERE trove_cat_id=$1 ORDER BY fullname',
@@ -79,246 +77,262 @@
echo '<div id="project-tree" class="underline-link">' . "\n";
echo '<h2>' . _('Project tree') . '</h2>' . "\n";
-$row_trove_cat = db_fetch_array($res_trove_cat);
+$res1 = db_query_params('SELECT g.group_name FROM plugins p, group_plugin gp, groups g WHERE plugin_name = $1 and gp.group_id = g.group_id and p.plugin_id = gp.plugin_id',
+ array('projects_hierarchy'));
+if ($res1) {
+ if (db_numrows($res1) > 0) {
+ $hierarchy_used = true;
+ }
+}
+if (isset($hierarchy_used)) {
+ $hierarMenuTitle[] = _('Per Category');
+ $hierarMenuTitle[] = _('Per Hierarchy');
+ $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=c';
+ $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=h';
+ echo ($HTML->subMenu($hierarMenuTitle, $hierarMenuUrl));
+}
-// #####################################
-// this section limits search and requeries if there are discrim elements
+if ( $cat === 'c' ) {
+ $row_trove_cat = db_fetch_array($res_trove_cat);
-$discrim = getStringFromRequest('discrim');
-$discrim_url = '';
-$discrim_desc = '';
+ // #####################################
+ // this section limits search and requeries if there are discrim elements
-$qpa_alias = db_construct_qpa () ;
-$qpa_and = db_construct_qpa () ;
+ $discrim = getStringFromRequest('discrim');
+ $discrim_url = '';
+ $discrim_desc = '';
-if ($discrim) {
- $discrim_url_b = array();
+ $qpa_alias = db_construct_qpa();
+ $qpa_and = db_construct_qpa();
- // commas are ANDs
- $expl_discrim = explode(',',$discrim);
+ if ($discrim) {
+ $discrim_url_b = array();
- if (sizeof($expl_discrim) > 6) {
- array_splice ($expl_discrim, 6) ;
- }
+ // commas are ANDs
+ $expl_discrim = explode(',', $discrim);
- // one per argument
- for ($i=0;$i<sizeof($expl_discrim);$i++) {
- // make sure these are all ints, no url trickery
- $expl_discrim[$i] = intval($expl_discrim[$i]);
+ if (sizeof($expl_discrim) > 6) {
+ array_splice($expl_discrim, 6);
+ }
- // need one aliased table for everything
- $qpa_alias = db_construct_qpa ($qpa_alias,
- ', trove_agg trove_agg_'.$i) ;
-
- // need additional AND entries for aliased tables
- $qpa_and = db_construct_qpa ($qpa_and,
- sprintf (' AND trove_agg_%d.trove_cat_id=$%d AND trove_agg_%d.group_id=trove_agg.group_id ', $i, $i+1, $i),
- array ($expl_discrim[$i])) ;
+ // one per argument
+ for ($i = 0; $i < sizeof($expl_discrim); $i++) {
+ // make sure these are all ints, no url trickery
+ $expl_discrim[$i] = intval($expl_discrim[$i]);
- $expl_discrim_b = array () ;
- for ($j=0;$j<sizeof($expl_discrim);$j++) {
- if ($i!=$j) {
- $expl_discrim_b[] = $expl_discrim[$j] ;
+ // need one aliased table for everything
+ $qpa_alias = db_construct_qpa($qpa_alias,', trove_agg trove_agg_'.$i);
+
+ // need additional AND entries for aliased tables
+ $qpa_and = db_construct_qpa($qpa_and,
+ sprintf(' AND trove_agg_%d.trove_cat_id=$%d AND trove_agg_%d.group_id=trove_agg.group_id ', $i, $i+1, $i),
+ array($expl_discrim[$i]));
+
+ $expl_discrim_b = array();
+ for ($j = 0; $j < sizeof($expl_discrim); $j++) {
+ if ($i != $j) {
+ $expl_discrim_b[] = $expl_discrim[$j];
+ }
}
+ $discrim_url_b[$i] = '&discrim=' . implode(',', $expl_discrim_b);
+
}
- $discrim_url_b[$i] = '&discrim=' . implode (',', $expl_discrim_b) ;
+ $discrim_url = '&discrim=' . implode(',', $expl_discrim);
- }
- $discrim_url = '&discrim=' . implode (',', $expl_discrim);
+ // build text for top of page on what viewier is seeing
+ $discrim_desc = _('Now limiting view to projects in the following categories:');
- // build text for top of page on what viewier is seeing
- $discrim_desc = _('Now limiting view to projects in the following categories:');
-
- for ($i=0;$i<sizeof($expl_discrim);$i++) {
- $discrim_desc .= '<br /> '
- .trove_getfullpath($expl_discrim[$i])
- .util_make_link ('/softwaremap/trove_list.php?form_cat='.$form_cat .$discrim_url_b[$i],' ['._('Remove This Filter').']');
+ for ($i = 0; $i < sizeof($expl_discrim); $i++) {
+ $discrim_desc .= '<br /> '
+ .trove_getfullpath($expl_discrim[$i])
+ .util_make_link('/softwaremap/trove_list.php?form_cat='.$form_cat .$discrim_url_b[$i],' ['._('Remove This Filter').']');
+ }
+ $discrim_desc .= "<hr />\n";
}
- $discrim_desc .= "<hr />\n";
-}
-// #######################################
+ // #######################################
-print '<p>'. (isset($discrim_desc) ? $discrim_desc : '') . '</p>';
+ 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 summary="">' . "\n";
-print '<tr>' . "\n";
-print '<td id="project-tree-col1">' . "\n";
+ // ######## two column table for key on right
+ // first print all parent cats and current cat
+ print '<table summary="">' . "\n";
+ print '<tr>' . "\n";
+ print '<td id="project-tree-col1">' . "\n";
-$folders = explode(" :: ",$row_trove_cat['fullpath']);
-$folders_ids = explode(" :: ",$row_trove_cat['fullpath_ids']);
-$folders_len = count($folders);
+ $folders = explode(" :: ",$row_trove_cat['fullpath']);
+ $folders_ids = explode(" :: ",$row_trove_cat['fullpath_ids']);
+ $folders_len = count($folders);
-print "<p>";
-print html_image("category.png",'32','33',array('alt'=>""));
-print " ";
+ print "<p>";
+ print html_image("category.png",'32','33',array('alt'=>""));
+ print " ";
-for ($i=0;$i<$folders_len;$i++) {
- // no anchor for current cat
- if ($folders_ids[$i] != $form_cat) {
- print util_make_link ('/softwaremap/trove_list.php?form_cat=' .$folders_ids[$i].$discrim_url,
- $folders[$i]
- ) ;
- print " > ";
- } else {
- print '<strong>'.$folders[$i].'</strong>';
+ for ($i = 0; $i < $folders_len; $i++) {
+ // no anchor for current cat
+ if ($folders_ids[$i] != $form_cat) {
+ print util_make_link('/softwaremap/trove_list.php?form_cat=' .$folders_ids[$i].$discrim_url,
+ $folders[$i]
+ );
+ print " > ";
+ } else {
+ print '<strong>'.$folders[$i].'</strong>';
+ }
}
-}
-print "</p>";
+ print "</p>";
-// print subcategories
-$res_sub = db_query_params ('
- 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 trove_cat.parent=$1
- ORDER BY fullname',
- array ($form_cat));
-echo db_error();
+ // print subcategories
+ $res_sub = db_query_params('
+ 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 trove_cat.parent=$1
+ ORDER BY fullname',
+ array($form_cat));
+ echo db_error();
-print "<ul>";
-while ($row_sub = db_fetch_array($res_sub)) {
- print "<li>";
- print '<a href="trove_list.php?form_cat=' . $row_sub['trove_cat_id'] . $discrim_url . '">';
- print $row_sub['fullname'];
- print '</a>';
- print ' <em>(';
- print sprintf(_('%1$s projects'), $row_sub['subprojects']?$row_sub['subprojects']:'0');
- print ')</em>';
- print "</li>\n";
-}
-print "</ul>";
-// ########### right column: root level
-print "</td>\n";
-print '<td id="project-tree-col2">';
-// here we print list of root level categories, and use open folder for current
-$res_rootcat = db_query_params ('
- SELECT trove_cat_id,fullname
+ print "<ul>";
+ while ($row_sub = db_fetch_array($res_sub)) {
+ print "<li>";
+ print '<a href="trove_list.php?form_cat=' . $row_sub['trove_cat_id'] . $discrim_url . '">';
+ print $row_sub['fullname'];
+ print '</a>';
+ print ' <em>(';
+ print sprintf(_('%1$s projects'), $row_sub['subprojects']?$row_sub['subprojects']:'0');
+ print ')</em>';
+ print "</li>\n";
+ }
+ print "</ul>";
+ // ########### right column: root level
+ print "</td>\n";
+ print '<td id="project-tree-col2">';
+ // here we print list of root level categories, and use open folder for current
+ $res_rootcat = db_query_params('
+ SELECT trove_cat_id,fullname
FROM trove_cat
WHERE parent=0
AND trove_cat_id!=0
ORDER BY fullname',
array ());
-echo db_error();
+ echo db_error();
-print "<p>";
-print _('Browse By').':';
-print "</p> \n";
+ print "<p>";
+ print _('Browse By').':';
+ print "</p> \n";
-print '<ul id="project-tree-branches">';
-while ($row_rootcat = db_fetch_array($res_rootcat)) {
- // print open folder if current, otherwise closed
- // also make anchor if not current
- if (($row_rootcat['trove_cat_id'] == $row_trove_cat['root_parent'])
- || ($row_rootcat['trove_cat_id'] == $row_trove_cat['trove_cat_id'])) {
- print '<li class="current-cat">' . $row_rootcat['fullname'] . "</li>\n";
- } else {
-
- print "<li>";
- print util_make_link ('/softwaremap/trove_list.php?form_cat=' .$row_rootcat['trove_cat_id'].$discrim_url, $row_rootcat['fullname']);
- print "</li>\n";
+ print '<ul id="project-tree-branches">';
+ while ($row_rootcat = db_fetch_array($res_rootcat)) {
+ // print open folder if current, otherwise closed
+ // also make anchor if not current
+ if (($row_rootcat['trove_cat_id'] == $row_trove_cat['root_parent'])
+ || ($row_rootcat['trove_cat_id'] == $row_trove_cat['trove_cat_id'])) {
+ print '<li class="current-cat">' . $row_rootcat['fullname'] . "</li>\n";
+ } else {
+ print "<li>";
+ print util_make_link ('/softwaremap/trove_list.php?form_cat=' .$row_rootcat['trove_cat_id'].$discrim_url, $row_rootcat['fullname']);
+ print "</li>\n";
+ }
}
-}
-print "</ul>\n";
-print "</td>\n</tr>\n</table>\n";
+ print "</ul>\n";
+ print "</td>\n</tr>\n</table>\n";
?>
<hr />
<?php
// one listing for each project
-$qpa = db_construct_qpa () ;
-$qpa = db_construct_qpa ($qpa, 'SELECT * FROM trove_agg') ;
-$qpa = db_join_qpa ($qpa, $qpa_alias) ;
-$qpa = db_construct_qpa ($qpa, ' WHERE trove_agg.trove_cat_id=$1', array ($form_cat)) ;
-$qpa = db_join_qpa ($qpa, $qpa_and) ;
-$qpa = db_construct_qpa ($qpa, ' ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC') ;
-$res_grp = db_query_qpa ($qpa, $TROVE_HARDQUERYLIMIT, 0, SYS_DB_TROVE);
+ $qpa = db_construct_qpa();
+ $qpa = db_construct_qpa($qpa, 'SELECT * FROM trove_agg') ;
+ $qpa = db_join_qpa($qpa, $qpa_alias) ;
+ $qpa = db_construct_qpa($qpa, ' WHERE trove_agg.trove_cat_id=$1', array($form_cat));
+ $qpa = db_join_qpa($qpa, $qpa_and) ;
+ $qpa = db_construct_qpa($qpa, ' ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC');
+ $res_grp = db_query_qpa($qpa, $TROVE_HARDQUERYLIMIT, 0, SYS_DB_TROVE);
-echo db_error();
-$querytotalcount = db_numrows($res_grp);
-
-// #################################################################
-// limit/offset display
+ echo db_error();
+ $querytotalcount = db_numrows($res_grp);
-// store this as a var so it can be printed later as well
-$html_limit = '';
-if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
- $html_limit .= 'More than ';
- $html_limit .= sprintf(_('More than <strong>%1$s</strong> projects in result set.'), $querytotalcount);
-
+ // #################################################################
+ // limit/offset display
+
+ // store this as a var so it can be printed later as well
+ $html_limit = '';
+ if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
+ $html_limit .= 'More than ';
+ $html_limit .= sprintf(_('More than <strong>%1$s</strong> projects in result set.'), $querytotalcount);
}
-$html_limit .= sprintf(ngettext('<strong>%1$s</strong> project in result set.', '<strong>%1$s</strong> projects in result set.', $querytotalcount), $querytotalcount);
+ $html_limit .= sprintf(ngettext('<strong>%1$s</strong> project in result set.', '<strong>%1$s</strong> projects in result set.', $querytotalcount), $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 />';
+ // 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 .= ' ';
- $displayed_i = '<'.$i.'>';
- if ($page == $i) {
- $html_limit .= "<strong>$displayed_i</strong>" ;
- } else {
- $html_limit .= util_make_link ('/softwaremap/trove_list.php?form_cat='.$form_cat.$discrim_url.'&page='.$i,
- $displayed_i
- ) ;
+ // display all the numbers
+ for ($i = 1; $i <= ceil($querytotalcount / $TROVE_BROWSELIMIT); $i++) {
+ $html_limit .= ' ';
+ $displayed_i = '<'.$i.'>';
+ if ($page == $i) {
+ $html_limit .= "<strong>$displayed_i</strong>";
+ } else {
+ $html_limit .= util_make_link('/softwaremap/trove_list.php?form_cat='.$form_cat.$discrim_url.'&page='.$i,
+ $displayed_i
+ ) ;
+ }
+ $html_limit .= ' ';
}
- $html_limit .= ' ';
}
-}
-print $html_limit."<hr />\n";
+ 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);
+ // #################################################################
+ // 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;
- }
+ // 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">';
- print "$i_proj. " ;
- print util_make_link_g ($row_grp['unix_group_name'],
+ if ($row_grp && $viewthisrow) {
+ print '<table border="0" cellpadding="0" width="100%"><tr valign="top"><td colspan="2">';
+ print "$i_proj. " ;
+ print util_make_link_g($row_grp['unix_group_name'],
$row_grp['group_id'],
"<strong>".htmlspecialchars($row_grp['group_name'])."</strong> ");
- if ($row_grp['short_description']) {
- print "- " . htmlspecialchars($row_grp['short_description']);
- }
+ if ($row_grp['short_description']) {
+ print "- " . htmlspecialchars($row_grp['short_description']);
+ }
- print '<br /> ';
- // extra description
- print "</td></tr>\n<tr valign=\"top\"><td>";
- // list all trove categories
- print trove_getcatlisting($row_grp['group_id'],1,0,1);
- print "</td>\n";
- print '<td style="text-align:right">'; // now the right side of the display
- if (group_get_object($row_grp['group_id'])->usesStats()) {
- 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 />'._('Registered: ').' <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong>';
- print "</td></tr></table>\n<hr />\n";
- } // end if for row and range chacking
-}
+ print '<br /> ';
+ // extra description
+ print "</td></tr>\n<tr valign=\"top\"><td>";
+ // list all trove categories
+ print trove_getcatlisting($row_grp['group_id'],1,0,1);
+ print "</td>\n";
+ print '<td style="text-align:right">'; // now the right side of the display
+ if (group_get_object($row_grp['group_id'])->usesStats()) {
+ 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 />'._('Registered: ').' <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong>';
+ print "</td></tr></table>\n<hr />\n";
+ } // 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 bottom navigation if there are more projects to display
+ if ($querytotalcount > $TROVE_BROWSELIMIT) {
+ print $html_limit;
+ }
+} elseif( $cat === 'h') {
+ plugin_hook('display_hierarchy');
}
// print '<p><FONT size="-1">This listing was produced by the following query: '
More information about the Fusionforge-commits
mailing list