[Fusionforge-commits] r10296 - in trunk/src: common/docman/actions common/docman/views www/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sun Aug 1 18:53:24 CEST 2010


Author: nerville
Date: 2010-08-01 18:53:24 +0200 (Sun, 01 Aug 2010)
New Revision: 10296

Modified:
   trunk/src/common/docman/actions/addfile.php
   trunk/src/common/docman/actions/addsubdocgroup.php
   trunk/src/common/docman/actions/deldir.php
   trunk/src/common/docman/actions/editdocgroup.php
   trunk/src/common/docman/actions/editfile.php
   trunk/src/common/docman/actions/emptytrash.php
   trunk/src/common/docman/actions/forcereindexenginesearch.php
   trunk/src/common/docman/actions/trashdir.php
   trunk/src/common/docman/actions/trashfile.php
   trunk/src/common/docman/views/addfile.php
   trunk/src/common/docman/views/addsubdocgroup.php
   trunk/src/common/docman/views/admin.php
   trunk/src/common/docman/views/editdocgroup.php
   trunk/src/common/docman/views/editfile.php
   trunk/src/common/docman/views/listfile.php
   trunk/src/common/docman/views/listpendingfile.php
   trunk/src/common/docman/views/listtrashfile.php
   trunk/src/common/docman/views/menu.php
   trunk/src/common/docman/views/tree.php
   trunk/src/www/docman/index.php
   trunk/src/www/docman/view.php
Log:
various fix :
- cleanup global variables
- general require
- fix view.php
- copyright

Modified: trunk/src/common/docman/actions/addfile.php
===================================================================
--- trunk/src/common/docman/actions/addfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/addfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,7 +24,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once $gfcommon.'docman/Document.class.php';
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of group
+global $sys_engine_path; // path to the docman search engine
 
 $upload_dir = forge_get_config('ftp_upload_dir') . "/" . $g->getUnixName();
 
@@ -46,6 +50,9 @@
 	exit_missing_param();
 }
 
+if (!isset($sys_engine_path))
+	$sys_engine_path = dirname(__FILE__).'/../engine/';
+
 $d = new Document($g, false, false,$sys_engine_path);
 if (!$d || !is_object($d)) {		
 	exit_error(_('Error'),_('Error getting blank document.'));

Modified: trunk/src/common/docman/actions/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/addsubdocgroup.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/addsubdocgroup.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,9 +24,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once $gfcommon.'docman/DocumentGroup.class.php';
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; // group object
+global $dirid; // id of doc_group
+global $group_id; // id of group
 
-$dirid = getIntFromRequest('dirid');
 $groupname = $_POST['groupname'];
 
 $dg = new DocumentGroup($g);

Modified: trunk/src/common/docman/actions/deldir.php
===================================================================
--- trunk/src/common/docman/actions/deldir.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/deldir.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,7 +24,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$dirid = getIntFromRequest('dirid');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
 
 $dg = new DocumentGroup($g,$dirid);
 if ($dg->isError())

Modified: trunk/src/common/docman/actions/editdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/editdocgroup.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/editdocgroup.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,7 +24,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$dirid = getIntFromRequest('dirid');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
 
 $groupname = getStringFromRequest('groupname');
 $parent_dirid = getIntFromRequest('parent_dirid');

Modified: trunk/src/common/docman/actions/editfile.php
===================================================================
--- trunk/src/common/docman/actions/editfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/editfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,8 +24,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once ('include/TextSanitizer.class.php'); // to make the HTML input by the user safe to store
-require_once ('docman/Document.class.php');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
 
 $doc_group = getIntFromRequest('doc_group');
 

Modified: trunk/src/common/docman/actions/emptytrash.php
===================================================================
--- trunk/src/common/docman/actions/emptytrash.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/emptytrash.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -22,6 +22,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
+
+/* you must first delete files before dirs because of database constraints */
 $emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2',array('2',$group_id));
 if (!$emptyFile) {
 	exit_error(_('Error'),db_error());

Modified: trunk/src/common/docman/actions/forcereindexenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/forcereindexenginesearch.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/forcereindexenginesearch.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -22,6 +22,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of group
+
 if ($_POST['status']) {
 	$status = 1;
 	$feedback= _('Search Engine Reindex Forced : search results will be available within 24h');

Modified: trunk/src/common/docman/actions/trashdir.php
===================================================================
--- trunk/src/common/docman/actions/trashdir.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/trashdir.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,36 +24,27 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/* when moving a document group to trash, it's recursive and it's applied to documents that belong to these document groups */
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
+global $dgf; // document group factory of this group
+global $d_arr; // documents array of this group
 
-require_once ('docman/DocumentFactory.class.php');
-require_once ('docman/DocumentGroupFactory.class.php');
-require_once ('docman/include/utils.php');
-
-$dirid = getIntFromRequest('dirid');
-
-$df = new DocumentFactory($g);
-if ($df->isError())
-	exit_error(_('Error'),$df->getErrorMessage());
-
-$dgf = new DocumentGroupFactory($g);
-if ($dgf->isError())
-	exit_error(_('Error'),$dgf->getErrorMessage());
-
-$d_arr =& $df->getDocuments();
-if (!$d_arr || count($d_arr) <1)
-	$d_arr = &$df->getDocuments();
-
-// Get the document groups info
+/* when moving a document group to trash, it's recursive and it's applied to documents that belong to these document groups */
+/* Get the document groups info */
 $trashnested_groups =& $dgf->getNested();
 $trashnested_docs=array();
-//put the doc objects into an array keyed off the docgroup
+/* put the doc objects into an array keyed off the docgroup */
 foreach ($d_arr as $doc) {
 	$trashnested_docs[$doc->getDocGroupID()][] = $doc;
 }
 
-docman_recursive_stateid($dirid,$trashnested_groups,$trashnested_docs);
+/* set to trash content of this dirid */
+docman_recursive_stateid($dirid,$trashnested_groups,$trashnested_docs,2);
 
+/* set this dirid to trash */
 $dg = new DocumentGroup($g,$dirid);
 $dg->setStateID('2');
 

Modified: trunk/src/common/docman/actions/trashfile.php
===================================================================
--- trunk/src/common/docman/actions/trashfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/actions/trashfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,9 +24,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once $gfcommon.'docman/Document.class.php';
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $dirid; //id of doc_group
+global $group_id; // id of group
+
 $fileid = getIntFromRequest('fileid');
-$dirid = getIntFromRequest('dirid');
 
 $d= new Document($g,$fileid);
 

Modified: trunk/src/common/docman/views/addfile.php
===================================================================
--- trunk/src/common/docman/views/addfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/addfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,15 +24,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/* display the add new documentation form */
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; // group object
+global $group_id; // id of the group
+global $dirid; //id of the doc_group
+global $dgh; // document group html object
 
-require_once ('docman/DocumentGroupFactory.class.php');
-require_once ('docman/include/DocumentGroupHTML.class.php');
-
-$group_id = getIntFromRequest('group_id');
-$dirid = getIntFromRequest('dirid');
-//session_require_perm ('docman', $group_id, 'submit') ;
-
+/* display the add new documentation form */
 echo '<p>'. _('<strong>Document Title</strong>:  Refers to the relatively brief title of the document (e.g. How to use the download server)<br /><strong>Description:</strong> A brief description to be placed just under the title<br />') .'</p>';
 
 if ($g->useDocmanSearch()) 
@@ -67,16 +66,6 @@
 			<tr>
 				<td>
 					<strong>'. _('Group that document belongs in').' :</strong><br />';
-	$dgf = new DocumentGroupFactory($g);
-
-	if ($dgf->isError())
-		exit_error('Error',$dgf->getErrorMessage());
-
-	$dgh = new DocumentGroupHTML($g);
-
-	if ($dgh->isError())
-		exit_error('Error',$dgh->getErrorMessage());
-
 	$dgh->showSelectNestedGroups($dgf->getNested(), 'doc_group', false, $dirid);
 	echo '
 				</td>

Modified: trunk/src/common/docman/views/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/views/addsubdocgroup.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/addsubdocgroup.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,7 +24,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$dirid = getIntFromRequest('dirid');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $group_id; // id of the group
+global $dirid; //id of the doc_group
 
 ?>
 <script language="javascript">

Modified: trunk/src/common/docman/views/admin.php
===================================================================
--- trunk/src/common/docman/views/admin.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/admin.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,9 +24,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once ('docman/include/DocumentGroupHTML.class.php');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
 global $g; //group object
 global $group_id; // id of the group
+global $d_arr; // documents array of this group
 ?>
 
 <script language="javascript">
@@ -79,16 +81,6 @@
 echo '</ul>';
 echo '</form>';
 
-$df = new DocumentFactory($g);
-if ($df->isError()) {
-	exit_error(_('Error'),$df->getErrorMessage());
-}
-
-$d_arr =& $df->getDocuments();
-if (!$d_arr || count($d_arr) <1){
-	    $d_arr = &$df->getDocuments();
-}
-
 if ($g->useDocmanSearch()) {
 	if ($d_arr || count($d_arr) > 1) {
 		echo '<form id="reindexword" name="reindexword" method="post" action="?group_id='.$group_id.'&action=forcereindexenginesearch">';

Modified: trunk/src/common/docman/views/editdocgroup.php
===================================================================
--- trunk/src/common/docman/views/editdocgroup.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/editdocgroup.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,22 +24,18 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once 'docman/include/DocumentGroupHTML.class.php';
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of the group
+global $dirid; // id of doc_group
+global $dgf; // document group factory of this group
+global $dgh; // document group html
 
-$dirid = getIntFromRequest('dirid');
-
 $dg = new DocumentGroup($g,$dirid);
 if ($dg->isError())
     exit_error('Error',$dg->getErrorMessage());
 
-$dgf = new DocumentGroupFactory($g);
-if ($dgf->isError())
-	exit_error('Error',$dgf->getErrorMessage());
-
-$dgh = new DocumentGroupHTML($g);
-if ($dgh->isError())
-	exit_error('Error',$dgh->getErrorMessage());
-
 ?>
 <form name="editgroup" action="?group_id=<?php echo $group_id; ?>&action=editdocgroup" method="post">
 <input type="hidden" name="dirid" value="<?php echo $dirid; ?>" />

Modified: trunk/src/common/docman/views/editfile.php
===================================================================
--- trunk/src/common/docman/views/editfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/editfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,15 +24,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of the group
+global $dirid; // id of doc_group
+global $dgf; // document group factory of this group
+global $dgh; // document group html
+global $nested_docs; // flat docs array
+
 foreach ($nested_docs[$dirid] as $d) {
-	$dgf = new DocumentGroupFactory($g);
-	if ($dgf->isError())
-		exit_error('Error',$dgf->getErrorMessage());
 
-	$dgh = new DocumentGroupHTML($g);
-	if ($dgh->isError())
-		exit_error('Error',$dgh->getErrorMessage());
-
 ?>
 <script language="javascript">
 	function doItEditData<?php echo $d->getID(); ?>() {

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/listfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -25,10 +25,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once ('docman/include/utils.php');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $group_id; // id of the group
+global $dirid; // id of doc_group
+global $nested_docs; // flat docs array
 
-$dirid = getIntFromRequest('dirid');
-
 ?>
 
 <script language="javascript">
@@ -139,11 +141,17 @@
 		echo '</td>';
 		echo '<td>'.$d->getStateName().'</td>';
 		echo '<td>';
-		if ($d->getFileSize() > 1024 ) {
-			echo floor ($d->getFilesize()/1024) . "KB";
-		} else {
-			echo $d->getFilesize() . "B";
+		$metric = 'B';
+		$size = $d->getFileSize();
+		if ($size > 1024 ) {
+			$metric = 'KB';
+			$size = floor ($size/1024);
+			if ($size > 1024 ) {
+				$metric = 'MB';
+				$size = floor ($size/1024);
+			}
 		}
+		echo $size . $metric;
 		echo '</td>';
 
 		if (forge_check_perm ('docman', $group_id, 'approve')) {

Modified: trunk/src/common/docman/views/listpendingfile.php
===================================================================
--- trunk/src/common/docman/views/listpendingfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/listpendingfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,15 +24,15 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$df = new DocumentFactory($g);
-if ($df->isError())
-    exit_error(_('Error'),$df->getErrorMessage());
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $df; // document factory
+global $nested_groups; // flat docs arrays
 
 $df->setStateID('3');
+$d_pending_arr =& $df->getDocuments();
 
-$d_arr =& $df->getDocuments();
-
-if (!$d_arr || count($d_arr) < 1) {
+if (!$d_pending_arr || count($d_pending_arr) < 1) {
     echo '<div class="warning_msg">'._('No pending documents').'</div>';
 } else {
 	docman_display_documents($nested_groups,$df,true,3,0);

Modified: trunk/src/common/docman/views/listtrashfile.php
===================================================================
--- trunk/src/common/docman/views/listtrashfile.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/listtrashfile.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,19 +24,15 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$df = new DocumentFactory($g);
-if ($df->isError())
-    exit_error(_('Error'),$df->getErrorMessage());
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $df; // document factory
+global $dgf; // document factory
 
-$dgf = new DocumentGroupFactory($g);
-if ($dgf->isError())
-    exit_error(_('Error'),$dgf->getErrorMessage());
-
 $df->setStateID('2');
+$d_trash_arr =& $df->getDocuments();
 
-$d_arr =& $df->getDocuments();
-
-if (!$d_arr || count($d_arr) < 1) {
+if (!$d_trash_arr || count($d_trash_arr) < 1) {
     echo '<div class="warning_msg">'._('Trash is empty').'</div>';
 } else {
 	docman_display_trash($dgf);

Modified: trunk/src/common/docman/views/menu.php
===================================================================
--- trunk/src/common/docman/views/menu.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/menu.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -25,6 +25,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $HTML; // html object
+global $d_arr; // document array
+global $group_id; // id of group
+
 /* create the submenu following role, rules and content */
 $menu_text=array();
 $menu_links=array();

Modified: trunk/src/common/docman/views/tree.php
===================================================================
--- trunk/src/common/docman/views/tree.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/common/docman/views/tree.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,35 +24,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once ('docman/DocumentFactory.class.php');
-require_once ('docman/DocumentGroupFactory.class.php');
-require_once ('docman/include/utils.php');
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $d_arr; // documents array
 
-$dirid = getIntFromRequest('dirid');
-if (empty($dirid))
-	$dirid = 0;
-
-$df = new DocumentFactory($g);
-if ($df->isError()) {
-	exit_error(_('Error'),$df->getErrorMessage());
-}
-
-$dgf = new DocumentGroupFactory($g);
-if ($dgf->isError()) {
-	exit_error(_('Error'),$dgf->getErrorMessage());
-}
-
-
-$d_arr =& $df->getDocuments();
-if (!$d_arr || count($d_arr) <1){
-	$d_arr = &$df->getDocuments();
-}
-
 if (!$d_arr || count($d_arr) < 1) {
 	print '<div class="warning_msg">'._('This project has no visible documents').'</div>';
 } else {
 	// Get the document groups info
-	$nested_groups =& $dgf->getNested();
 	$nested_docs=array();
 	$idExposeTreeIndex = 0;
 	$idhtml = 0;

Modified: trunk/src/www/docman/index.php
===================================================================
--- trunk/src/www/docman/index.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/www/docman/index.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -24,7 +24,14 @@
  */
 
 require_once('../env.inc.php');
-require_once $gfcommon.'include/pre.php';
+require_once ('include/pre.php');
+require_once ('docman/Document.class.php');
+require_once ('docman/DocumentFactory.class.php');
+require_once ('docman/DocumentGroup.class.php');
+require_once ('docman/DocumentGroupFactory.class.php');
+require_once ('docman/include/DocumentGroupHTML.class.php');
+require_once ('docman/include/utils.php');
+require_once ('include/TextSanitizer.class.php'); // to make the HTML input by the user safe to store
 
 /* are we using docman ? */
 if (!forge_get_config('use_docman'))
@@ -47,6 +54,29 @@
 if (!$g->usesDocman())
 	exit_error(_('Error'),_('This project has turned off the Doc Manager.'));
 
+$dirid = getIntFromRequest('dirid');
+if (empty($dirid))
+	$dirid = 0;
+
+$df = new DocumentFactory($g);
+if ($df->isError())
+	exit_error(_('Error'),$df->getErrorMessage());
+
+$dgf = new DocumentGroupFactory($g);
+if ($dgf->isError())
+	exit_error(_('Error'),$dgf->getErrorMessage());
+
+$nested_groups =& $dgf->getNested();
+
+$dgh = new DocumentGroupHTML($g);
+
+if ($dgh->isError())
+	exit_error('Error',$dgh->getErrorMessage());
+
+$d_arr =& $df->getDocuments();
+if (!$d_arr || count($d_arr) <1)
+	$d_arr = &$df->getDocuments();
+
 /* everything sounds ok, now let do the job */
 $action = getStringFromRequest('action');
 switch ($action) {

Modified: trunk/src/www/docman/view.php
===================================================================
--- trunk/src/www/docman/view.php	2010-08-01 13:25:51 UTC (rev 10295)
+++ trunk/src/www/docman/view.php	2010-08-01 16:53:24 UTC (rev 10296)
@@ -1,27 +1,33 @@
 <?php
 /**
- * GForge Doc Mgr Facility
+ * FusionForge Documentation Manager
  *
- * Copyright 2002 GForge, LLC
- * http://gforge.org/
+ * Copyright 2000, Quentin Cregan/Sourceforge
+ * Copyright 2002-2003, Tim Perdue/GForge, LLC
+ * Copyright 2010, Franck Villaume
  *
+ * 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
  */
 
-
-/*
-	Document Manager
-
-	by Quentin Cregan, SourceForge 06/2000
-
-	Complete OO rewrite by Tim Perdue 1/2003
-*/
-
 $no_gz_buffer=true;
 
 require_once('../env.inc.php');
-require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'docman/include/doc_utils.php';
-require_once $gfcommon.'docman/Document.class.php';
+require_once ('include/pre.php');
+require_once ('docman/Document.class.php');
 
 $arr=explode('/',getStringFromServer('REQUEST_URI'));
 $group_id=$arr[3];
@@ -57,7 +63,6 @@
 	if ($d->getFileName() != $docname) {
 		exit_error(_('No document data'),
 			   _('No document to display - invalid or inactive document number'));
-
 	}
 
 	Header ('Content-disposition: filename="'.str_replace('"', '', $d->getFileName()).'"');




More information about the Fusionforge-commits mailing list