gforge/www/themes/ultralite/images/forum_delete.gif -text
gforge/www/themes/ultralite/images/forum_edit.gif -text
gforge/www/themes/ultralite/images/new.png -text
+gforge/www/trove/TroveCategory.class.php -text
+gforge/www/trove/TroveCategoryAdmin.class.php -text
+gforge/www/trove/TroveCategoryFactory.class.php -text
+gforge/www/trove/TroveCategoryLabel.class.php -text
+gforge/www/trove/admin/trove_cat_add.php -text
+gforge/www/trove/admin/trove_cat_edit.php -text
+gforge/www/trove/admin/trove_cat_list.php -text
+gforge/www/trove/include/trove.php -text
+gforge/www/trove/include/utils.php -text
+gforge/www/trove/index.php -text
tools/export-tracker.tcl -text
tools/make-mo.sh -text
tools/update-gettext-files.sh -text
--- /dev/null
+<?php
+
+/**
+ *
+ * GForge Trove facility
+ *
+ * Copyright 2004 (c) Guillaume Smet
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+require_once('TroveCategoryLabel.class.php');
+
+// should extend observable
+class TroveCategory extends Error {
+
+ /**
+ * Associative array of data from db.
+ *
+ * @var array $dataArray.
+ */
+ var $dataArray;
+
+ /**
+ * Selected Trove category id
+ *
+ * @var int $categoryId
+ */
+ var $categoryId;
+
+ var $labels;
+ var $children;
+ var $parents;
+ var $parent;
+
+ var $filter;
+ var $filterQueryAlias = '';
+ var $filterQueryAnd = '';
+
+ /**
+ * Constructor.
+ *
+ * @param int The trove_cat_id.
+ * @param array The associative array of data.
+ * @return boolean success.
+ */
+ function TroveCategory($categoryId = false, $dataArray = false) {
+ if ($categoryId) {
+ $this->categoryId = $categoryId;
+ if (!$dataArray || !is_array($dataArray)) {
+ if (!$this->fetchData($categoryId)) {
+ $this->setError(
+ $Language->getText('trove_list','invalid_category_title'),
+ $Language->getText('trove_list','invalid_category_text').': '.db_error()
+ );
+ }
+ } else {
+ $this->dataArray =& $dataArray;
+ }
+ } else {
+ $this->setError($Language->getText('global','error'), $GLOBALS['Language']->getText('admin_trove_cat_edit','no_such_category'));
+ }
+ }
+
+ /**
+ * fetchData - re-fetch the data for this category from the database.
+ *
+ * @param int The category_id.
+ * @return boolean success.
+ */
+ function fetchData($categoryId) {
+ global $Language;
+ $res=db_query("SELECT *
+ FROM trove_cat
+ WHERE trove_cat_id='".$categoryId."'", -1, 0, SYS_DB_TROVE);
+ if (!$res || db_numrows($res) < 1) {
+ return false;
+ }
+ $this->dataArray =& db_fetch_array($res);
+ db_free_result($res);
+ return true;
+ }
+
+ function update($shortName, $fullName, $description) {
+ $shortName = trim($shortName);
+ $fullName = trim($fullName);
+ $description = trim($description);
+ if(empty($shortName) || empty($fullName)) {
+ $this->setError($Language->getText('general','error'), 'empty strings');
+ return false;
+ } else {
+ db_begin();
+ $result = db_query("UPDATE trove_cat
+ SET shortname='".htmlspecialchars($shortName)."',
+ fullname='".htmlspecialchars($fullName)."',
+ description='".htmlspecialchars($description)."',
+ version='".date('Ymd',time())."01'
+ WHERE trove_cat_id='".$this->categoryId."'"
+ );
+ if(!$result || db_affected_rows($result) != 1) {
+ $this->setError($Language->getText('general','error'), 'cannot update');
+ db_rollback();
+ return false;
+ } else {
+ db_commit();
+ $this->fetchData($this->categoryId);
+ return true;
+ }
+ }
+ }
+
+ function move() {
+ }
+
+ function getId() {
+ return $this->categoryId;
+ }
+
+ // returns a localized label if available
+ function & getLabel($languageId) {
+ if(!isset($this->labels)) {
+ $this->getLabels();
+ }
+ if(isset($this->labels[$languageId])) {
+ return $this->labels[$languageId];
+ } else {
+ //return false;
+ return $this->labels;
+ }
+ }
+
+ function getLocalizedLabel() {
+ global $Language;
+ $languageId = choose_language_from_context();
+ $label = $this->getLabel($languageId);
+ if($label) {
+ return $label->getLabel();
+ } else {
+ return $this->getFullName();
+ }
+ }
+
+ function & getLabels() {
+ if(!isset($this->labels)) {
+ $this->labels = array();
+ $sql = 'SELECT trove_category_labels.*, supported_languages.name AS language_name FROM trove_category_labels, supported_languages WHERE category_id='.$this->categoryId.' AND supported_languages.language_id=trove_category_labels.language_id';
+ $res = db_query($sql);
+
+ if (!$res) {
+ //$this->setError($Language->getText('general', 'error_getting', array($Language->getText('mail_common', 'mailing_list'))));
+ //return false;
+ return $this->labels;
+ }
+ while($data =& db_fetch_array($res)) {
+ $this->labels[$data['language_id']] = new TroveCategoryLabel($this, $data['label_id'], $data);
+ }
+ db_free_result($res);
+ }
+ return $this->labels;
+ }
+
+ function & getParents() {
+ return $this->parents;
+ }
+
+ function & getChildren() {
+ if(!isset($this->children)) {
+ $this->children = array();
+
+ $result = db_query("
+ SELECT trove_cat.*,
+ 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='".$this->categoryId."'
+ ORDER BY fullname
+ ", -1, 0, SYS_DB_TROVE);
+
+ if(!$result) {
+ $this->setError();
+ return false;
+ } else {
+ while ($array = db_fetch_array($result)) {
+ $this->children[] = new TroveCategory($array['trove_cat_id'], $array);
+ }
+ }
+ }
+ return $this->children;
+ }
+
+ function getRootCategory() {
+ }
+
+ function getRootParentId() {
+ return $this->dataArray['root_parent'];
+ }
+
+ function getFullName() {
+ return $this->dataArray['fullname'];
+ }
+
+ function getShortName() {
+ return $this->dataArray['shortname'];
+ }
+
+ function getDescription() {
+ return $this->dataArray['description'];
+ }
+
+ function getSubProjectsCount() {
+ return ($this->dataArray['subprojects'] ? $this->dataArray['subprojects'] : 0);
+ }
+
+ function setFilter($filterArray) {
+ $this->filter = $filterArray;
+
+ for($i = 0, $count = sizeof($filterArray); $i < $count; $i++) {
+ $this->filterQueryAlias .= ', trove_agg trove_agg_'.$i.' ';
+ $this->filterQueryAlias .= 'AND trove_agg_'.$i.'.trove_cat_id='
+ .$filterArray[$i].' AND trove_agg_'.$i.'.group_id='
+ .'trove_agg.group_id ';
+ }
+ }
+
+ function getProjects($offset) {
+ $result = db_query('
+ SELECT *
+ FROM trove_agg, '.$this->filterQueryAlias.'
+ WHERE trove_agg.trove_cat_id='.$this->categoryId.' '.$this->filterQueryAnd.'
+ ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC
+ ', TROVE__PROJECTS_PER_PAGE, '.$offset.', SYS_DB_TROVE);
+ return $result;
+ }
+
+ function addProject() {
+ }
+
+ function removeProject() {
+ }
+
+}
+
+?>
--- /dev/null
+<?php
+
+class TroveCategoryAdmin extends TroveCategory {
+
+function TroveCategoryAdmin() {
+
+// access management
+
+}
+
+function create() {
+}
+
+function update() {
+}
+
+function move() {
+}
+
+function remove() {
+}
+
+function removeTree() {
+}
+
+function import() {
+ // SAX
+}
+
+function export() {
+ // DOM
+}
+
+function updateChildren() {
+}
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * GForge Trove Browsing Facility
+ *
+ * Copyright 2004 Guillaume Smet / Open Wide
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+require_once('TroveCategory.class.php');
+
+class TroveCategoryFactory {
+
+ /**
+ * getRootCategories - get an array of root TroveCategory objects
+ *
+ * @return array The array of TroveCategory objects.
+ */
+ function & getRootCategories() {
+ $result = db_query('
+ SELECT *
+ FROM trove_cat
+ WHERE parent = 0
+ AND trove_cat_id != 0
+ ORDER BY fullname
+ ');
+
+ if(!$result) {
+ $this->setError();
+ return false;
+ } else {
+ $rootCategories = array();
+ while ($array = db_fetch_array($result)) {
+ $rootCategories[] = new TroveCategory($array['trove_cat_id'], $array);
+ }
+ return $rootCategories;
+ }
+ }
+
+ function & getCategories($ids) {
+ $result = db_query('
+ SELECT *
+ FROM trove_cat
+ WHERE trove_cat_id IN('.implode(',', $ids).')
+ ORDER BY fullname
+ ');
+ if(!$result) {
+ $this->setError();
+ return false;
+ } else {
+ $categories = array();
+ while ($array = db_fetch_array($result)) {
+ $categories[] = new TroveCategory($array['trove_cat_id'], $array);
+ }
+ return $categories;
+ }
+ }
+}
+
+?>
--- /dev/null
+<?php
+
+/**
+ *
+ * GForge Trove facility
+ *
+ * Copyright 2004 (c) Guillaume Smet
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/**
+CREATE TABLE trove_category_labels (
+label_id serial,
+category_id int REFERENCES trove_cat ON UPDATE CASCADE ON DELETE CASCADE,
+language_id int REFERENCES supported_languages ON UPDATE CASCADE ON DELETE CASCADE,
+label varchar(255),
+PRIMARY KEY(label_id));
+**/
+
+class TroveCategoryLabel extends Error {
+
+ var $labelId;
+ var $category;
+ var $dataArray = false;
+
+ function TroveCategoryLabel(& $category, $labelId = false, $dataArray = false) {
+ global $Language;
+ $this->Error();
+ if (!$category || !is_object($category)) {
+ //$this->setError($Language->getText('general', 'error_no_valid_group_object', array('MailingList')));
+ return false;
+ }
+ if ($category->isError()) {
+ //$this->setError('MailingList:: '.$Group->getErrorMessage());
+ return false;
+ }
+ $this->category =& $category;
+
+ if ($labelId) {
+ $this->labelId = $labelId;
+ if (!$dataArray || !is_array($dataArray)) {
+ if (!$this->fetchData($labelId)) {
+ return false;
+ }
+ } else {
+ $this->dataArray =& $dataArray;
+ if ($this->dataArray['category_id'] != $this->category->getId()) {
+ //$this->setError($Language->getText('general', 'error_group_id'));
+ $this->dataArray = null;
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function create($label, $languageId) {
+ global $Language;
+ if(strlen($label) == 0) {
+ // set error
+ return false;
+ }
+
+ $sql = 'INSERT INTO trove_category_labels '
+ . '(category_id, label, language_id) VALUES ('
+ . $this->category->getId(). ', '
+ . "'".$label."',"
+ . "'".$languageId."')";
+
+ db_begin();
+ $result = db_query($sql);
+ echo db_error();
+ if (!$result) {
+ db_rollback();
+ //$this->setError($Language->getText('general', 'error_creating', array($Language->getText('mail_common', 'mailing_list'))).db_error());
+ return false;
+ }
+ $this->labelId = db_insertid($result, 'trove_category_labels', 'label_id');
+ $this->fetchData($this->labelId);
+ db_commit();
+ }
+
+ function update() {
+ }
+
+ function fetchData($labelId) {
+ global $Language;
+ $res=db_query("SELECT trove_category_labels.*, supported_languages.name AS language_name FROM trove_category_labels, supported_languages "
+ . "WHERE trove_category_labels.label_id='".$labelId."' "
+ . "AND trove_category_labels.category_id='". $this->category->getId() ."' "
+ . "AND supported_languages.language_id=trove_category_labels.language_id"
+ );
+
+ if (!$res || db_numrows($res) < 1) {
+ //$this->setError($Language->getText('general', 'error_getting', array($Language->getText('mail_common', 'mailing_list'))));
+ return false;
+ }
+ $this->dataArray =& db_fetch_array($res);
+ db_free_result($res);
+ return true;
+ }
+
+ function remove() {
+ global $Language;
+ db_begin();
+ $res = db_query('DELETE FROM trove_category_labels WHERE label_id='.$this->labelId);
+ if(!res || db_affected_rows($res) != 1) {
+ // $this->setError();
+ db_rollback();
+ return false;
+ } else {
+ db_commit();
+ return true;
+ }
+ }
+
+ function getId() {
+ return $this->labelId;
+ }
+
+ function getLabel() {
+ return $this->dataArray['label'];
+ }
+
+ function getLanguageId() {
+ return $this->dataArray['language_id'];
+ }
+
+ function getLanguageName() {
+ return $this->dataArray['language_name'];
+ }
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ *
+ * Site Admin: Trove Admin: add new leaf category
+ *
+ * SourceForge: Breaking Down the Barriers to Open Source Development
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://sourceforge.net
+ *
+ * @version $Id: trove_cat_add.php,v 1.17 2001/04/10 16:10:30 pfalcon Exp $
+ *
+ */
+
+require_once('pre.php');
+require_once('www/include/trove.php');
+require_once('www/admin/admin_utils.php');
+
+session_require(array('group'=>'1','admin_flags'=>'A'));
+
+// ########################################################
+
+if ($GLOBALS['submit']) {
+ $newroot = trove_getrootcat($GLOBALS['form_parent']);
+
+ if ($GLOBALS[form_shortname]) {
+ $res = db_query("
+ INSERT INTO trove_cat
+ (shortname,fullname,description,parent,version,root_parent)
+ VALUES (
+ '".htmlspecialchars($form_shortname)."',
+ '".htmlspecialchars($form_fullname)."',
+ '".htmlspecialchars($form_description)."',
+ '$form_parent',
+ '".date("Ymd",time())."01',
+ '$newroot'
+ )
+ ");
+
+ if (!$res || db_affected_rows($res)<1) {
+ exit_error(
+ $Language->getText('admin_trove_cat_add','error_in_trove_openration'),
+ db_error()
+ );
+ }
+ }
+
+ // update full paths now
+ trove_genfullpaths($newroot,trove_getfullname($newroot),$newroot);
+
+ session_redirect("/admin/trove/trove_cat_list.php");
+}
+
+site_admin_header(array('title'=>$Language->getText('admin_trove_cat_add','title')));
+?>
+
+<h3><?php echo $Language->getText('admin_trove_cat_add','add_new_trove_category'); ?></h3>
+
+<form action="trove_cat_add.php" method="post">
+<p><?php echo $Language->getText('admin_trove_cat_add','parent_category'); ?>:<?php echo utils_requiredField(); ?>
+<br /><select name="form_parent">
+
+<?php
+
+// generate list of possible parents
+// <paul@zootweb.com> 4/2/2003 - If we were given a parent trove use it
+// in the "Parent Category" box otherwise give them the complete list.
+if (isset($parent_trove_cat_id)) {
+ if ($parent_trove_cat_id == 0) {
+ print ('<option value="0">root</option>\n');
+ } else {
+ $res_cat = db_query("SELECT shortname,fullname,trove_cat_id FROM trove_cat WHERE trove_cat_id=$parent_trove_cat_id");
+ while ($row_cat = db_fetch_array($res_cat)) {
+ print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
+ }
+ }
+} else {
+ print ('<option value="0">root</option>\n');
+ $res_cat = db_query("SELECT shortname,fullname,trove_cat_id FROM trove_cat");
+ while ($row_cat = db_fetch_array($res_cat)) {
+ print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
+ }
+}
+
+?>
+
+</select></p>
+<p><?php echo $Language->getText('admin_trove_cat_add','new_category_short_name'); ?>:<?php echo utils_requiredField(); ?>
+<br /><input type="text" name="form_shortname" /></p>
+<p><?php echo $Language->getText('admin_trove_cat_add','new_category_full_name'); ?>:<?php echo utils_requiredField(); ?>
+<br /><input type="text" name="form_fullname" /></p>
+<p><?php echo $Language->getText('admin_trove_cat_add','new_category_description'); ?>:<?php echo utils_requiredField(); ?>
+<br /><input type="text" size="80" name="form_description" />
+<br /><input type="submit" name="submit" value="<?php echo $Language->getText('admin_trove_cat_add','add'); ?>" /></p>
+</form>
+
+<?php
+
+site_admin_footer(array());
+
+?>
--- /dev/null
+<?php
+/**
+ *
+ * Site Admin: Trove Admin: edit category
+ *
+ * This page is linked from trove_cat_list.php, page to browse full
+ * Trove tree.
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2004 (c) Guillaume Smet
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+require_once('pre.php');
+require_once('www/admin/admin_utils.php');
+require_once('../include/utils.php');
+
+require_once('common/include/escapingUtils.php');
+require_once('common/trove/TroveCategory.class.php');
+
+$categoryId = getIntFromGet('trove_cat_id');
+$category = new TroveCategory($categoryId);
+
+if($category->isError()) {
+ exit_error($Language->getText('global','error'), $category->getErrorMessage());
+}
+
+$do = getStringFromRequest('do');
+
+switch($do) {
+ case 'addTranslation' :
+ $label = new TroveCategoryLabel($category);
+ $label->create(getStringFromPost('label'), getIntFromPost('language_id'));
+ // TODO : gestion d'erreurs, affichage d'un flag
+ break;
+ case 'removeTranslation' :
+ $label = new TroveCategoryLabel($category, getIntFromRequest('label_id'));
+ $label->remove();
+ // TODO : gestion d'erreurs, affichage d'un flag
+ break;
+ case 'updateCategory' :
+ if(!$category->update(getStringFromPost('shortName'), getStringFromPost('fullName'), getStringFromPost('description'))) {
+ echo $category->getErrorMessage();
+ }
+ break;
+ case 'moveCategory' :
+ break;
+ case 'removeCategory' :
+ break;
+ case 'createSubcategory' :
+ break;
+}
+
+/*
+if ($GLOBALS["submit"]) {
+
+ $newroot = trove_getrootcat($GLOBALS['form_parent']);
+
+ if ($GLOBALS[form_shortname]) {
+ if ($form_trove_cat_id == $form_parent) {
+ exit_error($Language->getText(
+ 'admin_trove_cat_edit','error_tove_equal_parent'),
+ db_error()
+ );
+ } else {
+ $res = db_query("
+ UPDATE trove_cat
+ SET shortname='".htmlspecialchars($form_shortname)."',
+ fullname='".htmlspecialchars($form_fullname)."',
+ description='".htmlspecialchars($form_description)."',
+ parent='$form_parent',
+ version='".date("Ymd",time())."01',
+ root_parent='$newroot'
+ WHERE trove_cat_id='$form_trove_cat_id'
+ ");
+ }
+
+ if (!$res || db_affected_rows($res)<1) {
+ exit_error(
+ $Language->getText('admin_trove_cat_edit','error_in_trove_operation'),
+ db_error()
+ );
+ }
+ }
+ // update full paths now
+ if($newroot!=0) {
+ trove_genfullpaths($newroot,trove_getfullname($newroot),$newroot);
+ trove_updaterootparent($form_trove_cat_id,$newroot);
+ }
+ else {
+ trove_genfullpaths($form_trove_cat_id,trove_getfullname($form_trove_cat_id),$form_trove_cat_id);
+ trove_updaterootparent($form_trove_cat_id,$form_trove_cat_id);
+ }
+ db_query("update trove_group_link set trove_cat_root=(select root_parent from trove_cat where trove_cat_id=trove_group_link.trove_cat_id)");
+
+ session_redirect("/admin/trove/trove_cat_list.php");
+}
+
+if ($GLOBALS["delete"]) {
+ if ($form_trove_cat_id==$default_trove_cat){
+ exit_error( $Language->getText('admin_trove_cat_edit','error_in_trove_operation_cant_delete'));
+ }
+ $sql = "select count(*) from trove_group_link where trove_cat_id='$form_trove_cat_id'";
+ $res = db_numrows(db_query($sql));
+ if ($res > 0) {
+ exit_error($Language->getText('admin_trove_cat_edit','error_in_trove_operation'), $Language->getText('admin_trove_cat_edit','error_in_trove_operation_cant_delete_in_use'));
+ }
+
+ $res = db_query("
+ SELECT trove_cat_id FROM trove_cat WHERE parent='$form_trove_cat_id'
+ ");
+
+ if (!$res) {
+ exit_error( $Language->getText('admin_trove_cat_edit','error_in_trove_operation'), db_error());
+ }
+ if (db_numrows($res)>0) {
+ exit_error( $Language->getText('admin_trove_cat_edit','cant_delete_has_subcategories'), db_error());
+ } else {
+ $res=db_query(" DELETE FROM trove_treesums WHERE trove_cat_id='$form_trove_cat_id'");
+ if (!$res || db_affected_rows($res)<1) {
+ exit_error( $Language->getText('admin_trove_cat_edit','error_in_trove_operation'), db_error());
+ }
+ $res=db_query(" DELETE FROM trove_cat WHERE trove_cat_id='$form_trove_cat_id'");
+ if (!$res || db_affected_rows($res)<1) {
+ exit_error( $Language->getText('admin_trove_cat_edit','error_in_trove_operation'), db_error());
+ }
+ $res=db_query(" DELETE FROM trove_group_link WHERE trove_cat_id='$form_trove_cat_id'");
+ if (!$res) {
+ exit_error( $Language->getText('admin_trove_cat_edit','error_in_trove_operation'), db_error());
+ }
+ }
+ session_redirect("/admin/trove/trove_cat_list.php");
+}
+*/
+/*
+ Main Code
+*/
+
+site_admin_header(array('title'=>$Language->getText('admin_trove_cat_edit','title')));
+?>
+
+<table width="100%" border="0">
+ <tr>
+ <td width="60%" valign="top">
+<h3><?php echo $Language->getText('admin_trove_cat_edit','edit_trove_category'); ?></h3>
+
+<form action="trove_cat_edit.php?trove_cat_id=<?php echo $category->getId(); ?>" method="post">
+<input type="hidden" name="do" value="updateCategory" />
+
+<p><?php echo $Language->getText('admin_trove_cat_edit','new_category_short_name'); ?>:
+<br /><input type="text" name="shortName" value="<?php echo $category->getShortName(); ?>" /></p>
+
+<p><?php echo $Language->getText('admin_trove_cat_edit','new_category_full_name'); ?>:
+<br /><input type="text" name="fullName" value="<?php echo $category->getFullName(); ?>" /></p>
+
+<p><?php echo $Language->getText('admin_trove_cat_edit','new_category_description'); ?>:
+<br /><input type="text" name="description" size="80" value="<?php echo $category->getDescription(); ?>" /></p>
+
+<br /><input type="submit" name="submit" value="<?php echo $Language->getText('admin_trove_cat_edit','update'); ?>" /><input type="submit" name="delete" value="<?php echo $Language->getText('admin_trove_cat_edit','delete'); ?>" />
+</form>
+<?php
+ $tableHeaders = array(
+ 'Label',
+ 'Language',
+ 'Actions'
+ );
+ ?>
+ <h3>Localization</h3>
+ <form method="post" action="trove_cat_edit.php?trove_cat_id=<?php echo $category->getId(); ?>">
+ <input type="hidden" name="do" value="addTranslation" />
+ <?php
+ echo $HTML->listTableTop($tableHeaders);
+
+ $labels =& $category->getLabels();
+ $alreadyDefined = array();
+
+ $keys = array_keys($labels);
+ $count =0;
+
+ foreach($keys AS $key) {
+ $currentLabel =& $labels[$key];
+ $alreadyDefined[] = $currentLabel->getLanguageId();
+ echo '<tr '. $HTML->boxGetAltRowStyle($count) .'>';
+ echo '<td width="60%">'.$currentLabel->getLabel().'</td>';
+ echo '<td width="20%">'.$currentLabel->getLanguageName().'</td>';
+ echo '<td width="20%" align="center"><a href="trove_cat_edit.php?trove_cat_id='.$category->getId().'&do=removeTranslation&label_id='.$currentLabel->getId().'">Remove</td>';
+ echo '</tr>';
+ $count++;
+ }
+ ?>
+ <tr <?php echo $HTML->boxGetAltRowStyle($count); ?>>
+ <td width="60%"><input type="text" name="label" size="40" /></td>
+ <td width="20%"><?php echo getLanguageSelectionPopup ($alreadyDefined); ?></td>
+ <td width="20%"><input type="submit" value="Add a translation" /></td>
+ </tr>
+ <?php
+ echo $HTML->listTableBottom();
+ ?>
+ </form>
+<form>
+<h3>Move the category</h3>
+<p><?php echo $Language->getText('admin_trove_cat_edit','parent_category'); ?>
+<br /><select name="form_parent">
+<?php
+// generate list of possible parents
+$res_parent = db_query("SELECT shortname,fullname,trove_cat_id FROM trove_cat");
+
+// Place the root node at the start of the list
+print('<option value="0"');
+if ($row_cat["parent"] == 0) {
+ print(' selected="selected"');
+}
+print('>root</option>');
+while ($row_parent = db_fetch_array($res_parent)) {
+ print ('<option value="'.$row_parent["trove_cat_id"].'"');
+ if ($row_cat["parent"] == $row_parent["trove_cat_id"]) print ' selected="selected"';
+ print ('>'.$row_parent["fullname"]."</option>\n");
+}
+
+?>
+</select>
+</form>
+ <h3>Remove the category</h3>
+ Remove category and subcategories
+ </td>
+ <td width="40%" valign="top">
+ <?php
+ $tableHeaders = array('Subcategories');
+ echo $HTML->listTableTop($tableHeaders);
+ $childrenCategories = $category->getChildren();
+ for($i = 0, $max = count($childrenCategories); $i < $max; $i++) {
+ $childCategory =& $childrenCategories[$i];
+ echo '<tr '. $HTML->boxGetAltRowStyle($count) .'>';
+ echo '<td><a href="trove_cat_edit.php?trove_cat_id='.$childCategory->getId().'">'.$childCategory->getFullName().'</td>';
+ echo '</tr>';
+ }
+ if($max == 0) {
+ echo '<tr '. $HTML->boxGetAltRowStyle(0) .'>';
+ echo '<td>None found</td>';
+ echo '</tr>';
+ }
+ echo $HTML->listTableBottom();
+ ?>
+ </td>
+ </tr>
+ </table>
+<?php
+
+ site_admin_footer(array());
+
+?>
--- /dev/null
+<?php
+/**
+ *
+ * Site Admin: Trove Admin: browse entire Trove tree
+ *
+ * SourceForge: Breaking Down the Barriers to Open Source Development
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://sourceforge.net
+ *
+ * @version $Id: trove_cat_list.php,v 1.17 2001/04/10 16:10:30 pfalcon Exp $
+ *
+ */
+
+
+require_once('pre.php');
+require_once('www/include/trove.php');
+require_once('www/admin/admin_utils.php');
+
+session_require(array('group'=>'1','admin_flags'=>'A'));
+
+// #######################################################
+
+// print current node, then all subnodes
+function printnode ($nodeid,$text) {
+ global $Language;
+ print ('<br />');
+
+ for ($i=0;$i<$GLOBALS[depth];$i++) {
+ print " ";
+ }
+
+ print html_image('ic/cfolder15.png','15','13',array());
+ print (' '.$text." ");
+ if ($nodeid == 0) {
+ print ('<a href="trove_cat_add.php?parent_trove_cat_id='.$nodeid.'">['.$Language->getText('admin_trove_cat_list','add').']</a> ');
+ } else {
+ print ('<a href="trove_cat_edit.php?trove_cat_id='.$nodeid.'">['.$Language->getText('admin_trove_cat_list','edit').']</a> ');
+ print ('<a href="trove_cat_add.php?parent_trove_cat_id='.$nodeid.'">['.$Language->getText('admin_trove_cat_list','add').']</a> ');
+ print (help_button('trove_cat',$nodeid)."\n");
+ }
+
+ $GLOBALS['depth']++;
+ $res_child = db_query("
+ SELECT trove_cat_id,fullname FROM trove_cat
+ WHERE parent='$nodeid'
+ AND trove_cat_id!=0;
+ ");
+ while ($row_child = db_fetch_array($res_child)) {
+ printnode($row_child["trove_cat_id"],$row_child["fullname"]);
+ }
+ $GLOBALS["depth"]--;
+}
+
+// ########################################################
+
+site_admin_header(array('title'=>$Language->getText('admin_trove_cat_list','title')));
+
+?>
+
+<h3><?php echo $Language->getText('admin_trove_cat_list','browse_trove_tree'); ?></h3>
+
+<?php
+
+printnode(0,"root");
+
+site_admin_footer(array());
+
+?>
--- /dev/null
+<?php
+/**
+ * trove.php
+ *
+ * SourceForge: Breaking Down the Barriers to Open Source Development
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://sourceforge.net
+ *
+ * @version $Id: trove.php,v 1.47 2001/06/22 19:06:15 dbrogdon Exp $
+ */
+
+// ################################## Trove Globals
+
+$TROVE_MAXPERROOT = 3;
+$TROVE_BROWSELIMIT = 20;
+$TROVE_HARDQUERYLIMIT = -1;
+
+// ##################################
+
+/**
+ * trove_genfullpaths() - Regenerates full path entries for $node and all subnodes
+ *
+ * @param int The node
+ * @param string The full path for this node
+ * @param int The full path IDs
+ */
+function trove_genfullpaths($mynode,$myfullpath,$myfullpathids) {
+ // first generate own path
+ $res_update = db_query('UPDATE trove_cat SET fullpath=\''
+ .$myfullpath.'\',fullpath_ids=\''
+ .$myfullpathids.'\' WHERE trove_cat_id='.$mynode);
+ // now generate paths for all children by recursive call
+ if($mynode!=0)
+ {
+ $res_child = db_query("
+ SELECT trove_cat_id,fullname
+ FROM trove_cat
+ WHERE parent='$mynode'
+ AND trove_cat_id!=0;
+ ", -1, 0, SYS_DB_TROVE);
+
+ while ($row_child = db_fetch_array($res_child)) {
+ trove_genfullpaths($row_child['trove_cat_id'],
+ addslashes(quotemeta($myfullpath)) . ' :: ' . addslashes(quotemeta($row_child['fullname'])),
+ $myfullpathids.' :: '.$row_child['trove_cat_id']);
+ }
+ }
+}
+
+// ##################################
+
+/**
+ * trove_updaterootparent() - Regenerates full path entries for $node and all subnodes
+ *
+ * @param int The node
+ * @param int The root parent node
+ */
+function trove_updaterootparent($mynode,$rootnode) {
+ // first generate own path
+ if($mynode!=$rootnode) $res_update = db_query('UPDATE trove_cat SET root_parent=' .$rootnode. ' WHERE trove_cat_id='.$mynode);
+ else $res_update = db_query('UPDATE trove_cat SET root_parent=0 WHERE trove_cat_id='.$mynode);
+ // now generate paths for all children by recursive call
+ if($mynode!=0)
+ {
+ $res_child = db_query("
+ SELECT trove_cat_id
+ FROM trove_cat
+ WHERE parent='$mynode'
+ AND trove_cat_id!=0;
+ ", -1, 0, SYS_DB_TROVE);
+
+ while ($row_child = db_fetch_array($res_child)) {
+ trove_updaterootparent($row_child['trove_cat_id'],$rootnode);
+ }
+ }
+}
+
+// #########################################
+
+/**
+ * trove_setnode() - Adds a group to a trove node
+ *
+ * @param int The group ID
+ * @param int The trove category ID
+ * @param int The root node
+ */
+function trove_setnode($group_id,$trove_cat_id,$rootnode=0) {
+ // verify we were passed information
+ if ((!$group_id) || (!$trove_cat_id)) return 1;
+
+ // verify trove category exists
+ $res_verifycat = db_query("
+ SELECT trove_cat_id,fullpath_ids
+ FROM trove_cat
+ WHERE trove_cat_id='$trove_cat_id'
+ ", -1, 0, SYS_DB_TROVE);
+
+ if (db_numrows($res_verifycat) != 1) return 1;
+ $row_verifycat = db_fetch_array($res_verifycat);
+
+ // if we didnt get a rootnode, find it
+ if (!$rootnode) {
+ $rootnode = trove_getrootcat($trove_cat_id);
+ }
+
+ // must first make sure that this is not a subnode of anything current
+ $res_topnodes = db_query("
+ SELECT trove_cat.trove_cat_id AS trove_cat_id,
+ trove_cat.fullpath_ids AS fullpath_ids
+ FROM trove_cat,trove_group_link
+ WHERE trove_cat.trove_cat_id=trove_group_link.trove_cat_id
+ AND trove_group_link.group_id='$group_id'
+ AND trove_cat.root_parent='$rootnode'");
+
+ while($row_topnodes = db_fetch_array($res_topnodes)) {
+ $pathids = explode(' :: ',$row_topnodes['fullpath_ids']);
+ for ($i=0;$i<count($pathids);$i++) {
+ // anything here will invalidate this setnode
+ if ($pathids[$i] == $trove_cat_id) {
+ return 1;
+ }
+ }
+ }
+
+ // need to see if this one is more specific than another
+ // if so, delete the other and proceed with this insertion
+ $subnodeids = explode(' :: ',$row_verifycat['fullpath_ids']);
+ $res_checksubs = db_query("
+ SELECT trove_cat_id
+ FROM trove_group_link
+ WHERE group_id='$group_id'
+ AND trove_cat_root='$rootnode'");
+
+ while ($row_checksubs = db_fetch_array($res_checksubs)) {
+ // check against all subnodeids
+ for ($i=0;$i<count($subnodeids);$i++) {
+ if ($subnodeids[$i] == $row_checksubs['trove_cat_id']) {
+ // then delete subnode
+ db_query('DELETE FROM trove_group_link WHERE '
+ .'group_id='.$group_id.' AND trove_cat_id='
+ .$subnodeids[$i]);
+ }
+ }
+ }
+
+ // if we got this far, must be ok
+ db_query('INSERT INTO trove_group_link (trove_cat_id,trove_cat_version,'
+ .'group_id,trove_cat_root) VALUES ('.$trove_cat_id.','
+ .time().','.$group_id.','.$rootnode.')');
+ return 0;
+}
+
+/**
+ * trove_getrootcat() - Get the root categegory
+ *
+ * @param int Trove category ID
+ */
+function trove_getrootcat($trove_cat_id) {
+ $parent = 1;
+ $current_cat = $trove_cat_id;
+
+ while ($parent > 0) {
+ $res_par = db_query("
+ SELECT parent
+ FROM trove_cat
+ WHERE trove_cat_id='$current_cat'");
+
+ $row_par = db_fetch_array($res_par);
+ $parent = $row_par["parent"];
+ if ($parent == 0) return $current_cat;
+ $current_cat = $parent;
+ }
+
+ return 0;
+}
+
+/**
+ * trove_getallroots() - Returns an associative array of all project roots
+ */
+function trove_getallroots() {
+ $res = db_query("
+ SELECT trove_cat_id,fullname
+ FROM trove_cat
+ WHERE parent=0
+ AND trove_cat_id!=0");
+
+ while ($row = db_fetch_array($res)) {
+ $tmpcatid = $row["trove_cat_id"];
+ $CATROOTS[$tmpcatid] = $row["fullname"];
+ }
+ return $CATROOTS;
+}
+
+/**
+ * trove_catselectfull() - Returns full select output for a particular root
+ *
+ * @param int The node
+ * @param string The category to pre-select
+ * @param string THe select-box name
+ */
+function trove_catselectfull($node,$selected,$name) {
+ print "<br /><select name=\"$name\">";
+ print ' <option value="0">None Selected'."</option>\n";
+ $res_cat = db_query("
+ SELECT trove_cat_id,fullpath
+ FROM trove_cat
+ WHERE root_parent='$node'
+ ORDER BY fullpath");
+
+ while ($row_cat = db_fetch_array($res_cat)) {
+ print ' <option value="'.$row_cat['trove_cat_id'].'"';
+ if ($selected == $row_cat['trove_cat_id']) print (' selected="selected"');
+ print '>'.$row_cat['fullpath']."</option>\n";
+ }
+ print "</select>\n";
+}
+
+/**
+ * trove_getcatlisting() - Gets discriminator listing for a group
+ *
+ * @param int The group ID
+ * @param bool Whether filters have already been applied
+ * @param bool Whether to print category links
+ */
+function trove_getcatlisting($group_id,$a_filter,$a_cats) {
+ global $discrim_url;
+ global $expl_discrim;
+ global $form_cat;
+ global $Language;
+
+ $res_trovecat = db_query("
+ SELECT trove_cat.fullpath AS fullpath,
+ trove_cat.fullpath_ids AS fullpath_ids,
+ trove_cat.trove_cat_id AS trove_cat_id
+ FROM trove_cat,trove_group_link
+ WHERE trove_cat.trove_cat_id=trove_group_link.trove_cat_id
+ AND trove_group_link.group_id='$group_id'
+ ORDER BY trove_cat.fullpath");
+
+ $return = '';
+ if (db_numrows($res_trovecat) < 1) {
+ $return .= $Language->getText('trove','not_categorized')
+ .' <a href="/softwaremap/trove_list.php">'
+ . $Language->getText('trove','title')
+ .'</a>.<p />';
+ } else {
+ $return .= '<ul>';
+ $need_close_ul_tag = 1;
+ }
+
+ // first unset the vars were using here
+ $proj_discrim_used='';
+ $isfirstdiscrim = 1;
+ while ($row_trovecat = db_fetch_array($res_trovecat)) {
+ $folders = explode(" :: ",$row_trovecat['fullpath']);
+ $folders_ids = explode(" :: ",$row_trovecat['fullpath_ids']);
+ $folders_len = count($folders);
+ // if first in discrim print root category
+ if (!$proj_discrim_used[$folders_ids[0]]) {
+ if (!$isfirstdiscrim) {
+ $return .= "</li>\n";
+ }
+ $return .= ('<li> '.$folders[0].': ');
+ }
+
+ // filter links, to add discriminators
+ // first check to see if filter is already applied
+ $filterisalreadyapplied = 0;
+ for ($i=0;$i<sizeof($expl_discrim);$i++) {
+ if ($folders_ids[$folders_len-1] == $expl_discrim[$i]) {
+ $filterisalreadyapplied = 1;
+ }
+ }
+ // then print the stuff
+ if ($proj_discrim_used[$folders_ids[0]]) {
+ $return .= ', ';
+ }
+
+ if ($a_cats) {
+ $return .= '<a href="/softwaremap/trove_list.php?form_cat='
+ .$folders_ids[$folders_len-1].$discrim_url.'">';
+ }
+ $return .= ($folders[$folders_len-1]);
+ if ($a_cats) {
+ $return .= '</a>';
+ }
+
+ if ($a_filter) {
+ if ($filterisalreadyapplied) {
+ $return .= ' <strong>(Now Filtering)</strong> ';
+ } else {
+ $return .= ' <a href="/softwaremap/trove_list.php?form_cat='
+ .$form_cat;
+ if ($discrim_url) {
+ $return .= $discrim_url.','.$folders_ids[$folders_len-1];
+ } else {
+ $return .= '&discrim='.$folders_ids[$folders_len-1];
+ }
+ $return .= '">[Filter]</a> ';
+ }
+ }
+ $proj_discrim_used[$folders_ids[0]] = 1;
+ $isfirstdiscrim = 0;
+ }
+ if ($need_close_ul_tag)
+ {
+ $return .= '</li></ul>';
+ }
+ return $return;
+}
+
+/**
+ * trove_getfullname() - Returns cat fullname
+ *
+ * @param int The node
+ */
+function trove_getfullname($node) {
+ $res = db_query("
+ SELECT fullname
+ FROM trove_cat
+ WHERE trove_cat_id='$node'");
+ $row = db_fetch_array($res);
+ return $row['fullname'];
+}
+
+/**
+ * trove_getfullpath() - Returns a full path for a trove category
+ *
+ * @param int The node
+ */
+function trove_getfullpath($node) {
+ $currentcat = $node;
+ $first = 1;
+ $return = '';
+
+ while ($currentcat > 0) {
+ $res = db_query("
+ SELECT trove_cat_id,parent,fullname
+ FROM trove_cat
+ WHERE trove_cat_id='$currentcat'");
+ $row = db_fetch_array($res);
+ $return = $row["fullname"] . ($first ? "" : " :: ") . $return;
+ $currentcat = $row["parent"];
+ $first = 0;
+ }
+ return $return;
+}
+
+?>
--- /dev/null
+<?php
+
+/**
+ * GForge Trove Browsing Facility
+ *
+ * Copyright 2004 Guillaume Smet / Open Wide
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+function getLanguageSelectionPopup($alreadyDefined = array()) {
+ $where = '';
+ if(!empty($alreadyDefined)) {
+ $where = ' WHERE language_id NOT IN('.implode(',', $alreadyDefined).')';
+ }
+ $res = db_query('SELECT * FROM supported_languages'.$where.' ORDER BY name ASC');
+
+ return html_build_select_box ($res, 'language_id', 'xzxz', false);
+}
+
+function getFilterUrl($filterArray, $currentId = 0) {
+ $url = '';
+ if($currentId) {
+ $currentPosition = array_search($currentId, $filterArray);
+ if($currentPosition !== false) {
+ unset($filterArray[$currentPosition]);
+ }
+ }
+ if(sizeof($filterArray) > 0) {
+ $url = '&discrim='.implode(',', $filterArray);
+ }
+ return $url;
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?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,v 1.160 2001/05/22 16:12:12 pfalcon Exp $
+ *
+ */
+
+require_once('../env.inc.php');
+require_once('pre.php');
+require_once('trove.php');
+
+require_once('common/include/escapingUtils.php');
+require_once('TroveCategory.class.php');
+require_once('TroveCategoryFactory.class.php');
+require_once('include/utils.php');
+
+if (!$sys_use_trove) {
+ exit_disabled();
+}
+
+$categoryId = getIntFromGet('form_cat');
+
+// assign default if not defined
+if (!$categoryId) {
+ $categoryId = $default_trove_cat;
+}
+
+$category = new TroveCategory($categoryId);
+
+ $HTML->header(array('title'=>_('Trove Map')));
+
+echo '<hr />';
+
+// We check current filtering directives and display them
+
+$filter = getStringFromGet('discrim');
+
+if($filter) {
+
+ // check and clean the array
+ $filterArray = explode(',', $filter);
+ $cleanArray = array();
+ $count = max(6, sizeof($filterArray));
+ for ($i = 0; $i < $count; $i++) {
+ if(is_numeric($filterArray[$i]) && $filterArray[$i] != 0) {
+ $cleanArray[] = (int) $filterArray[$i];
+ }
+ }
+ $filterArray = array_unique($cleanArray);
+ if(!empty($filterArray)) {
+ $filterCategories = TroveCategoryFactory::getCategories($filterArray);
+
+ echo '<p><span style="color:red;">'._('Limiting View').'</span>';
+
+ for($i=0, $count = sizeof($filterCategories); $i < $count; $i++) {
+ $filterCategory =& $filterCategories[$i];
+ echo '<br /> '
+ .$filterCategory->getFullPath()
+ .' <a href="?form_cat='.$category->getId()
+ .getFilterUrl($filterArray, $filterCategory->getId()).'">['._('Remove Filter').']'
+ .'</a>';
+ }
+
+ echo '</p><hr />';
+ }
+
+ $category->setFilter($filterArray);
+}
+
+// We display the trove
+
+?>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr valign="top">
+ <td width="50%">
+ <?php
+ // here we print list of root level categories, and use open folder for current
+ $rootCategories = TroveCategoryFactory::getRootCategories();
+ echo _('Browse By').':';
+ for($i = 0, $count = sizeof($rootCategories); $i < $count; $i++) {
+ $rootCategory =& $rootCategories[$i];
+
+ // print open folder if current, otherwise closed
+ // also make anchor if not current
+
+ echo '<br />';
+ if (($rootCategory->getId() == $category->getRootParentId())
+ || ($rootCategory->getId() == $category->getId())) {
+
+ echo html_image('ic/ofolder15.png','15','13',array());
+ echo ' <strong>'.$rootCategory->getLocalizedLabel().'</strong>';
+ } else {
+ echo '<a href="?form_cat='.$rootCategory->getId().@$discrim_url.'">';
+ echo html_image('ic/cfolder15.png', '15', '13', array());
+ echo ' '.$rootCategory->getLocalizedLabel();
+ echo '</a>';
+ }
+ }
+ ?>
+ </td>
+ <td width="50%">
+ <?php
+ $currentIndent='';
+ $parentCategories =& $category->getParents();
+ for ($i=0, $count = sizeof($parentCategories); $i < $count; $i++) {
+ echo str_repeat(' ', $i * 2);
+
+ echo html_image('ic/ofolder15.png', '15', '13', array());
+ echo ' ';
+ if($parentCategories[$i]['id'] != $category->getId()) {
+ echo '<a href="?form_cat='.$parentCategories[$i]['id'].$discrim_url.'">';
+ } else {
+ echo '<strong>';
+ }
+ echo $parentCategories[$i]['name'];
+ if($parentCategories[$i]['id'] != $category->getId()) {
+ echo '</a>';
+ } else {
+ echo '</strong>';
+ }
+ echo '<br />';
+ }
+
+ $childrenCategories =& $category->getChildren();
+
+ $currentIndent .= str_repeat(' ', sizeof($parentCategories) * 2);
+
+ for($i = 0, $count = sizeof($childrenCategories); $i < $count; $i++) {
+ $childCategory =& $childrenCategories[$i];
+
+ echo $currentIndent;
+ echo '<a href="?form_cat='.$childCategory->getId().@$discrim_url.'">';
+ echo html_image('ic/cfolder15.png', '15', '13', array());
+ echo ' '.$childCategory->getLocalizedLabel().'</a>';
+ echo ' <em>('
+ .sprintf(_('%1$s projects'), $childCategory->getSubProjectsCount())
+ .')</em><br />';
+ }
+ ?>
+ </td>
+ </tr>
+</table>
+<hr />
+<?php
+
+// We display projects
+
+$offset = getIntFromGet('offset');
+
+$projectsResult = $category->getProjects($offset);
+/*
+$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";
+*/
+?><table border="0" cellpadding="0" width="100%"><?php
+while($project = db_fetch_array($projectsResult)) {
+ ?>
+ <tr valign="top">
+ <td colspan="2"><?php
+ echo $count.'. <a href="/projects/'.strtolower($project['unix_group_name']).'/"><strong>'
+ .htmlspecialchars($project['group_name']).'</strong></a>';
+ if ($project['short_description']) {
+ echo ' - '.htmlspecialchars($project['short_description']);
+ }
+ ?>
+ <br />
+ </td>
+ </tr>
+ <tr valign="top">
+ <td><?php
+ // list all trove categories
+ //print trove_getcatlisting($row_grp['group_id'],1,0);
+ ?></td>
+ <td align="right">
+ Activity Percentile: <strong><?php echo number_format($project['percentile'],2) ?></strong>
+ <br />Activity Ranking: <strong><?php echo number_format($project['ranking'],2) ?></strong>
+ <br />Register Date: <strong><?php echo date($sys_datefmt, $project['register_time']) ?></strong>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr /></td>
+ </tr>
+ <?php
+} ?>
+</table>
+<?php
+// print bottom navigation if there are more projects to display
+if ($querytotalcount > $TROVE_BROWSELIMIT) {
+ print $html_limit;
+}
+
+$HTML->footer(array());
+
+?>