[Fusionforge-commits] r10291 - in trunk/src: common/docman common/docman/actions common/docman/include common/docman/views common/include db www/docman www/themes/gforge/images www/themes/gforge/images/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Fri Jul 30 15:18:49 CEST 2010


Author: nerville
Date: 2010-07-30 15:18:48 +0200 (Fri, 30 Jul 2010)
New Revision: 10291

Added:
   trunk/src/common/docman/actions/
   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/actions/updateenginesearch.php
   trunk/src/common/docman/include/
   trunk/src/common/docman/include/DocumentGroupHTML.class.php
   trunk/src/common/docman/include/utils.php
   trunk/src/common/docman/include/vtemplate.class.php
   trunk/src/common/docman/views/
   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/help.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/search.php
   trunk/src/common/docman/views/tree.php
   trunk/src/common/docman/views/views.php
   trunk/src/db/20100730-docman.sql
   trunk/src/www/themes/gforge/images/docman/
   trunk/src/www/themes/gforge/images/docman/configure-directory.png
   trunk/src/www/themes/gforge/images/docman/delete-directory.png
   trunk/src/www/themes/gforge/images/docman/directory.png
   trunk/src/www/themes/gforge/images/docman/edit-file.png
   trunk/src/www/themes/gforge/images/docman/file_type_image.png
   trunk/src/www/themes/gforge/images/docman/file_type_pdf.png
   trunk/src/www/themes/gforge/images/docman/file_type_unknown.png
   trunk/src/www/themes/gforge/images/docman/image-x-generic.png
   trunk/src/www/themes/gforge/images/docman/insert-directory.png
   trunk/src/www/themes/gforge/images/docman/insert-file.png
   trunk/src/www/themes/gforge/images/docman/new.png
   trunk/src/www/themes/gforge/images/docman/trash-empty.png
Removed:
   trunk/src/www/docman/admin/
   trunk/src/www/docman/include/
Modified:
   trunk/src/common/docman/Document.class.php
   trunk/src/common/docman/DocumentFactory.class.php
   trunk/src/common/docman/DocumentGroup.class.php
   trunk/src/common/docman/DocumentGroupFactory.class.php
   trunk/src/common/include/Group.class.php
   trunk/src/www/docman/index.php
   trunk/src/www/docman/search.php
   trunk/src/www/docman/search.tpl.html
Log:
docman UI enhancement

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/common/docman/Document.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -118,13 +118,6 @@
 			return false;
 		}
 
-/*
-		$perm =& $this->Group->getPermission ();
-		if (!$perm || !is_object($perm) || !$perm->isDocEditor()) {
-			$this->setPermissionDeniedError();
-			return false;
-		}
-*/
 		$user_id = ((session_loggedin()) ? user_getid() : 100);
 
 		$doc_initstatus = '3';
@@ -145,8 +138,12 @@
 		$data1 = $data;
 
 		// key words for in-document search
-		$kw = new Parsedata ($this->engine_path);
-		$kwords = $kw->get_parse_data ($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+		if ($this->Group->useDocmanSearch()) {
+			$kw = new Parsedata ($this->engine_path);
+			$kwords = $kw->get_parse_data ($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+		} else {
+			$kwords ='';
+		}
 
 		$filesize = strlen($data);
 
@@ -411,6 +408,29 @@
 	}
 
 	/**
+	 *  setState - set the stateid of the document.
+	 *
+	 *	@param	int	The state id of the doc_states table.
+	 *  @return boolean success.
+	 */
+	function setState($stateid) {
+		$res = db_query_params ('UPDATE doc_data SET
+								stateid=$1
+								WHERE group_id=$2
+								AND docid=$3',
+								array ($stateid,
+					       			$this->Group->getID(),
+									$this->getID())
+								);
+		if (!$res || db_affected_rows($res) < 1) {
+			$this->setOnUpdateError(db_error());
+			return false;
+		}
+		$this->sendNotice(false);
+		return true;
+	}
+
+	/**
 	 *	update - use this function to update an existing entry in the database.
 	 *
 	 *	@param	string	The filename of this document. Can be a URL.
@@ -469,8 +489,12 @@
 			$data1 = $data;
 
 			// key words for in-document search
-			$kw = new Parsedata ($this->engine_path);
-			$kwords = $kw->get_parse_data ($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+			if ($this->Group->useDocmanSearch()) {
+				$kw = new Parsedata ($this->engine_path);
+				$kwords = $kw->get_parse_data ($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+			} else {
+				$kwords = '';
+			}
 
 			$res = db_query_params ('UPDATE doc_data SET data=$1, filesize=$2, data_words=$3 WHERE group_id=$4 AND docid=$5',
 						array (base64_encode($data),

Modified: trunk/src/common/docman/DocumentFactory.class.php
===================================================================
--- trunk/src/common/docman/DocumentFactory.class.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/common/docman/DocumentFactory.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -43,7 +43,6 @@
 	 */
 	var $Documents;
 	var $stateid;
-	var $languageid;
 	var $docgroupid;
 	var $sort='group_name, title';
 
@@ -156,11 +155,6 @@
 					}
 				}
 				
-				if ($this->languageid && $doc->getLanguageID() != $this->languageid) {
-					$valid = false;
-				}
-				
-				
 				if ($valid) {
 					$return[] =& $doc;
 				}

Modified: trunk/src/common/docman/DocumentGroup.class.php
===================================================================
--- trunk/src/common/docman/DocumentGroup.class.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/common/docman/DocumentGroup.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -150,7 +150,6 @@
 	/**
 	 * delete - delete a DocumentGroup.
 	 *          delete is recursive and permanent
-	 *       TODO : use the delete status as document ?
 	 * @param integer Document Group Id, integer Project Group Id
 	 * @return boolean
 	 */
@@ -172,12 +171,13 @@
 						$project_group_id));
 
 		db_commit();
+
 		/* is there any subdir ? */
-		$result = db_query_params ('select doc_group from doc_groups where parent_doc_group = $1 and group_id = $2',
+		$subdir = db_query_params ('select doc_group from doc_groups where parent_doc_group = $1 and group_id = $2',
 					array($doc_groupid,
 						$project_group_id));
 		/* make a recursive call */
-		while ($arr = db_fetch_array($result)) {
+		while ($arr = db_fetch_array($subdir)) {
 			$this->delete($arr['doc_group'],$project_group_id);
 		}
 
@@ -242,6 +242,15 @@
 	}
 
 	/**
+	 *	getState - get the state id.
+	 *
+	 *	@return	Int	The state id.
+	 */
+	function getState() {
+		return $this->data_array['stateid'];
+	}
+
+	/**
 	 *  update - update a DocumentGroup.
 	 *
 	 *  @param	string	Name of the category.
@@ -366,6 +375,25 @@
 		
 		return false;
 	}
+
+	/**
+	 * setStateID - set the state id of this document group
+	 *
+	 * @param int State ID
+	 */
+	function setStateID($stateid) {
+		$res = db_query_params ('UPDATE doc_groups SET stateid=$1
+								WHERE doc_group=$2
+								AND group_id=$3',
+								array ($stateid,$this->getID(),$this->Group->getID()));
+
+		if (!$res || db_affected_rows($res) < 1) {
+			$this->setOnUpdateError(db_error());
+			return false;
+		}
+		return true;
+	}
+
 }
 
 // Local Variables:

Modified: trunk/src/common/docman/DocumentGroupFactory.class.php
===================================================================
--- trunk/src/common/docman/DocumentGroupFactory.class.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/common/docman/DocumentGroupFactory.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -5,6 +5,7 @@
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
  * Copyright 2009, Roland Mas
+ * Copyright 2010, Franck Villaume
  *
  * This file is part of FusionForge.
  *
@@ -72,15 +73,16 @@
 	/**
 	 *	getNested - Return an array of DocumentGroup objects arranged for nested views.
 	 *
+	 *	@param int		The stateid of DocumentGroup
 	 *	@return	array	The array of DocumentGroup.
 	 */
-	function &getNested() {
+	function &getNested($stateid=1) {
 		if ($this->nested_groups) {
 			return $this->nested_groups;
 		}
 		
-		$result = db_query_params ('SELECT * FROM doc_groups WHERE group_id=$1 ORDER BY groupname ASC',
-					   array ($this->Group->getID())) ;
+		$result = db_query_params ('SELECT * FROM doc_groups WHERE group_id=$1 AND stateid=$2 ORDER BY groupname ASC',
+					   array ($this->Group->getID(),$stateid)) ;
 		$rows = db_numrows($result);
 		
 		if (!$result || $rows < 1) {
@@ -106,15 +108,16 @@
 		/**
 	 *	getDocumentGroups - Return an array of DocumentGroup objects.
 	 *
+	 *	@param int		The stateid of DocumentGroups
 	 *	@return	array	The array of DocumentGroup.
 	 */
-	function &getDocumentGroups() {
+	function &getDocumentGroups($stateid=1) {
 		if ($this->flat_groups) {
 			return $this->flat_groups;
 		}
 		
-		$result = db_query_params ('SELECT * FROM doc_groups WHERE group_id=$1 ORDER BY groupname ASC',
-					   array ($this->Group->getID())) ;
+		$result = db_query_params ('SELECT * FROM doc_groups WHERE group_id=$1 AND stateid=$2 ORDER BY groupname ASC',
+					   array ($this->Group->getID(),$stateid)) ;
 		$rows = db_numrows($result);
 
 		if (!$result || $rows < 1) {

Added: trunk/src/common/docman/actions/addfile.php
===================================================================
--- trunk/src/common/docman/actions/addfile.php	                        (rev 0)
+++ trunk/src/common/docman/actions/addfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once $gfcommon.'docman/Document.class.php';
+
+$upload_dir = forge_get_config('ftp_upload_dir') . "/" . $g->getUnixName();
+
+$doc_group = getIntFromRequest('doc_group');
+$title = getStringFromRequest('title');
+$description = getStringFromRequest('description');
+$file_url = getStringFromRequest('file_url');
+//$ftp_filename = getStringFromRequest('ftp_filename');
+$uploaded_data = getUploadedFile('uploaded_data');
+$type = getStringFromRequest('type');
+$name = getStringFromRequest('name');
+
+if (!$doc_group || $doc_group == 100) {
+	//cannot add a doc unless an appropriate group is provided		
+	exit_error(_('Error'),_('No valid Document Group was selected.'));
+}
+	
+if (!$title || !$description || (!$uploaded_data && !$file_url && (!$editor && !$name ) )) {		
+	exit_missing_param();
+}
+
+$d = new Document($g, false, false,$sys_engine_path);
+if (!$d || !is_object($d)) {		
+	exit_error(_('Error'),_('Error getting blank document.'));
+} elseif ($d->isError()) {	
+	exit_error(_('Error'),$d->getErrorMessage());
+}
+	
+switch ($type) {
+	case 'editor' : {
+		$data = getStringFromRequest('data');
+		$uploaded_data_name = $name;
+		$sanitizer = new TextSanitizer();
+		$data = $sanitizer->SanitizeHtml($data);
+		if (strlen($data)<1) {
+			exit_error(_('Error'),_('Error getting blank document.'));
+		}
+		$uploaded_data_type='text/html';
+		break;
+	}
+	case 'pasteurl' : {
+		$data = '';
+		$uploaded_data_name=$file_url;
+		$uploaded_data_type='URL';		
+		break;
+	}
+	case 'httpupload' : {
+		if (!is_uploaded_file($uploaded_data['tmp_name'])) {			
+			exit_error(_('Error'),_('Invalid file name.'));
+		}
+		$data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
+		$file_url='';
+		$uploaded_data_name=$uploaded_data['name'];
+		$uploaded_data_type=$uploaded_data['type'];
+		break;
+	}
+	/*
+	case 'ftpupload' : {	
+		$uploaded_data_name=$upload_dir.'/'.$ftp_filename;
+		$data = fread(fopen($uploaded_data_name, 'r'), filesize($uploaded_data_name));
+	}
+	*/
+}
+
+if (!$d->create($uploaded_data_name,$uploaded_data_type,$data,$doc_group,$title,$description)) {
+		exit_error(_('Error'),$d->getErrorMessage());
+} else {		
+	if ($type == 'editor') {
+		//release the cookie for the document contents (should expire at the end of the session anyway)
+		setcookie ("gforgecurrentdocdata", "", time() - 3600);
+	}
+	// check if the user is docman's admin
+	if (forge_check_perm ('docman', $group_id, 'approve')) {
+		$feedback= _('Document submitted sucessfully');
+		Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group.'&feedback='.urlencode($feedback)));
+		exit;
+    } else {
+		$feedback= _('Document submitted sucessfully : pending state (need validation)');
+		Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&feedback='.urlencode($feedback)));
+		exit;
+	}
+}
+
+?>

Added: trunk/src/common/docman/actions/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/addsubdocgroup.php	                        (rev 0)
+++ trunk/src/common/docman/actions/addsubdocgroup.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once $gfcommon.'docman/DocumentGroup.class.php';
+
+$dirid = getIntFromRequest('dirid');
+$groupname = $_POST['groupname'];
+
+$dg = new DocumentGroup($g);
+
+if ($dg->isError())
+    exit_error('Error',$dg->getErrorMessage());
+
+if (!$dg->create($groupname, $dirid))
+    exit_error('Error',$dg->getErrorMessage());
+
+if ($dirid) {
+	$feedback = _('Document Sub Group successfully created');
+	Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($feedback)));
+	exit;
+} else {
+	$feedback = _('Document Group successfully created');
+	Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dg->getID().'&feedback='.urlencode($feedback)));
+	exit;
+}
+
+?>

Added: trunk/src/common/docman/actions/deldir.php
===================================================================
--- trunk/src/common/docman/actions/deldir.php	                        (rev 0)
+++ trunk/src/common/docman/actions/deldir.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$dirid = getIntFromRequest('dirid');
+
+$dg = new DocumentGroup($g,$dirid);
+if ($dg->isError())
+	exit_error('Error',$dg->getErrorMessage());
+
+if (!$dg->delete($dirid,$group_id))
+	exit_error('Error',$dg->getErrorMessage());
+
+$feedback = _('Document Group deleted successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&feedback='.urlencode($feedback)));
+exit;
+
+?>
+

Added: trunk/src/common/docman/actions/editdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/editdocgroup.php	                        (rev 0)
+++ trunk/src/common/docman/actions/editdocgroup.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$dirid = getIntFromRequest('dirid');
+
+$groupname = getStringFromRequest('groupname');
+$parent_dirid = getIntFromRequest('parent_dirid');
+
+$dg = new DocumentGroup($g,$dirid);
+if ($dg->isError())
+	exit_error('Error',$dg->getErrorMessage());
+
+if (!$dg->update($groupname,$parent_dirid))
+	exit_error('Error',$dg->getErrorMessage());
+
+$feedback = _('Document Group Updated successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($feedback)));
+exit;
+
+?>
+

Added: trunk/src/common/docman/actions/editfile.php
===================================================================
--- trunk/src/common/docman/actions/editfile.php	                        (rev 0)
+++ trunk/src/common/docman/actions/editfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,90 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once ('include/TextSanitizer.class.php'); // to make the HTML input by the user safe to store
+require_once ('docman/Document.class.php');
+
+$doc_group = getIntFromRequest('doc_group');
+
+$docid = getIntFromRequest('docid');
+$title = getStringFromRequest('title');
+$description = getStringFromRequest('description');
+$data = getStringFromRequest('data');
+$file_url = getStringFromRequest('file_url');
+//$ftp_filename = getStringFromRequest('ftp_filename');
+$uploaded_data = getUploadedFile('uploaded_data');
+$stateid = getIntFromRequest('stateid');
+$filetype = getStringFromRequest('filetype');
+$editor = getStringFromRequest('editor');
+
+$d= new Document($g,$docid,false,$sys_engine_path);
+if ($d->isError())
+	exit_error(_('Error'),$d->getErrorMessage());
+
+$sanitizer = new TextSanitizer();
+$data = $sanitizer->SanitizeHtml($data);
+if (($editor) && ($d->getFileData()!=$data) && (!$uploaded_data['name'])) {
+	$filename = $d->getFileName();
+	if (!$filetype)
+		$filetype = $d->getFileType();
+
+} elseif ($uploaded_data['name']) {
+	if (!is_uploaded_file($uploaded_data['tmp_name']))
+		exit_error(_('Error'),sprintf(_('Invalid file attack attempt %1$s'), $uploaded_data['name']));
+
+	$data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
+	$filename=$uploaded_data['name'];
+	$filetype=$uploaded_data['type'];
+} elseif ($file_url) {
+	$data = '';
+	$filename=$file_url;
+	$filetype='URL';
+	/*
+} elseif (forge_get_config('use_ftp_uploads') && $ftp_filename!=100) { //100==None
+	$filename=$upload_dir.'/'.$ftp_filename;
+	$data = fread(fopen($filename, 'r'), filesize($filename));
+	$filetype=$uploaded_data_type;
+} elseif (forge_get_config('use_manual_uploads') && $uploaded_filename!=100 && util_is_valid_filename($uploaded_filename)) { //100==None
+	$incoming = forge_get_config('groupdir_prefix')."/".$g->getUnixName()."/incoming" ;
+	$filename = $incoming.'/'.$uploaded_filename;
+	$data = addslashes(fread(fopen($filename, 'r'), filesize($filename)));
+	$finfo = finfo_open (FILEINFO_MIME_TYPE) ;
+	$filetype = finfo_file($finfo, $filename) ;
+	finfo_close ($finfo) ;
+*/
+} else {
+	$filename=$d->getFileName();
+	$filetype=$d->getFileType();
+}
+if (!$d->update($filename,$filetype,$data,$doc_group,$title,$description,$stateid))
+	exit_error('Error',$d->getErrorMessage());
+
+$feedback = _('Document Updated successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group.'&feedback='.urlencode($feedback)));
+exit;
+
+?>
+

Added: trunk/src/common/docman/actions/emptytrash.php
===================================================================
--- trunk/src/common/docman/actions/emptytrash.php	                        (rev 0)
+++ trunk/src/common/docman/actions/emptytrash.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$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());
+}
+$emptyDir = db_query_params('DELETE FROM doc_groups WHERE stateid=$1 and group_id=$2',array('2',$group_id));
+if (!$emptyDir) {
+	exit_error(_('Error'),db_error());
+}
+
+$feedback = _('Emptied Trash successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($feedback)));
+exit;
+
+?>
+

Added: trunk/src/common/docman/actions/forcereindexenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/forcereindexenginesearch.php	                        (rev 0)
+++ trunk/src/common/docman/actions/forcereindexenginesearch.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+if ($_POST['status']) {
+	$status = 1;
+	$feedback= _('Search Engine Reindex Forced : search results will be available within 24h');
+}
+
+if (!$g->setDocmanForceReindexSearch($status))
+	exit_error('Error',$g->getErrorMessage());
+
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($feedback)));
+exit;
+
+?>

Added: trunk/src/common/docman/actions/trashdir.php
===================================================================
--- trunk/src/common/docman/actions/trashdir.php	                        (rev 0)
+++ trunk/src/common/docman/actions/trashdir.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+/* when moving a document group to trash, it's recursive and it's applied to documents that belong to these document groups */
+
+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
+$trashnested_groups =& $dgf->getNested();
+$trashnested_docs=array();
+//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);
+
+$dg = new DocumentGroup($g,$dirid);
+$dg->setStateID('2');
+
+$feedback = _('Document Group moved to trash successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&feedback='.urlencode($feedback)));
+exit;
+
+?>

Added: trunk/src/common/docman/actions/trashfile.php
===================================================================
--- trunk/src/common/docman/actions/trashfile.php	                        (rev 0)
+++ trunk/src/common/docman/actions/trashfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once $gfcommon.'docman/Document.class.php';
+$fileid = getIntFromRequest('fileid');
+$dirid = getIntFromRequest('dirid');
+
+$d= new Document($g,$fileid);
+
+if ($d->isError())
+	exit_error('Error',$d->getErrorMessage());
+
+
+if ( !$d->setState('2') )
+	exit_error('Error',$d->getErrorMessage());
+
+$feedback = _('Document moved to trash successfully');
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($feedback)));
+exit;
+
+?>

Added: trunk/src/common/docman/actions/updateenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/updateenginesearch.php	                        (rev 0)
+++ trunk/src/common/docman/actions/updateenginesearch.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+if ($_POST['status']) {
+	$status = 1;
+	$feedback= _('Search Engine Status updated successfully : Active');
+} else {
+	$status = 0;
+	$feedback= _('Search Engine Status updated successfully : Off');
+}
+
+if (!$g->setDocmanSearchStatus($status))
+	exit_error('Error',$g->getErrorMessage());
+
+Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($feedback)));
+exit;
+
+?>

Copied: trunk/src/common/docman/include/DocumentGroupHTML.class.php (from rev 10290, trunk/src/www/docman/include/DocumentGroupHTML.class.php)
===================================================================
--- trunk/src/common/docman/include/DocumentGroupHTML.class.php	                        (rev 0)
+++ trunk/src/common/docman/include/DocumentGroupHTML.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,141 @@
+<?php
+/**
+ * GForge Doc Mgr Facility
+ *
+ * Copyright 2002 GForge, LLC
+ * http://gforge.org/
+ *
+ */
+
+
+require_once $gfcommon.'include/pre.php';
+require_once $gfwww.'include/note.php';
+
+/**
+ *	Wrap many group display related functions
+ */
+class DocumentGroupHTML extends Error {
+	var $Group;
+
+	function DocumentGroupHTML(&$Group) {
+		$this->Error();
+		
+		if (!$Group || !is_object($Group)) {
+			$this->setError("DocumentGroupHTML:: Invalid Group");
+			return false;
+		}
+		if ($Group->isError()) {
+			$this->setError('DocumentGroupHTML:: '.$Group->getErrorMessage());
+			return false;
+		}
+		$this->Group =& $Group;
+
+
+		return true;
+	}
+
+	/**
+	 * showTableNestedGroups - Display the tree of document groups
+	 *
+	 * This is a recursive function that is used to display the tree
+	 *
+	 * @param array Array of groups. This array contains information about the groups and their childs.
+	 * @param int The number of row that is currently being showed. It is used for formatting purposes
+	 * @param int The ID of the parent whose childs are being showed (0 for root groups)
+	 * @param int The current level
+	 */
+	function showTableNestedGroups (&$group_arr, &$rowno, $parent=0, $level=0) {
+		// No childs to display
+		if (!is_array($group_arr) || !array_key_exists("$parent", $group_arr)) return;
+
+		$child_count = count($group_arr["$parent"]);
+		for ($i = 0; $i < $child_count; $i++) {
+			$rowno++;
+			$doc_group =& $group_arr["$parent"][$i];
+			
+			$margin = str_repeat("&nbsp;&nbsp;&nbsp;", $level);
+			
+			$img = "cfolder15.png";
+/*
+			// Display the folder icon opened or closed?
+			if (array_key_exists("".$doc_group->getID(),$group_arr)) $img = "ofolder15.png";
+			else $img = "cfolder15.png";
+*/
+
+			echo '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowno) .'>'.
+				'<td>'.$doc_group->getID().'</td>'.
+				'<td>'.$margin.html_image('ic/'.$img,"15","13",array("border"=>"0")).' '.
+				'<a href="index.php?editgroup=1&amp;doc_group='.
+					$doc_group->getID().'&amp;group_id='.$doc_group->Group->getID().'">'.
+					$doc_group->getName().'</a></td>'.
+				'<td><a href="index.php?deletegroup=1&amp;doc_group='.$doc_group->getID().'&amp;group_id='.$doc_group->Group->getID().'">'.
+				'<img src="/images/ic/trash.png"/></a></td></tr>';
+			// Show childs (if any)
+			$this->showTableNestedGroups($group_arr, $rowno, $doc_group->getID(), $level+1);
+		}
+	}
+	
+	/**
+	 * showSelectNestedGroups - Display the tree of document groups inside a <select> tag
+	 *
+	 * @param array	Array of groups.
+	 * @param string	The name that will be assigned to the input
+	 * @param bool	Allow selection of "None"
+	 * @param int	The ID of the group that should be selected by default (if any)
+	 * @param array	Array of IDs of groups that should not be displayed
+	 */
+	function showSelectNestedGroups (&$group_arr, $select_name, $allow_none=true, $selected_id=0, $dont_display=array()) {
+		// Build arrays for calling html_build_select_box_from_arrays()
+		$id_array = array();
+		$text_array = array();
+		
+		if ($allow_none) {
+			// First option to be displayed
+			$id_array[] = 0;
+			$text_array[] = "(None)";
+		}
+		
+		// Recursively build the document group tree
+		$this->buildArrays($group_arr, $id_array, $text_array, $dont_display);
+		
+		echo html_build_select_box_from_arrays($id_array,$text_array,$select_name,$selected_id,false);
+	}
+	
+	/**
+	 * buildArrays - Build the arrays to call html_build_select_box_from_arrays()
+	 *
+	 * @param array Array of groups.
+	 * @param array Reference to the array of ids that will be build
+	 * @param array Reference to the array of group names
+	 * @param array	Array of IDs of groups that should not be displayed
+	 * @param int The ID of the parent whose childs are being showed (0 for root groups)
+	 * @param int The current level
+	 */
+	function buildArrays(&$group_arr, &$id_array, &$text_array, &$dont_display, $parent=0, $level=0) {
+		if (!is_array($group_arr) || !array_key_exists("$parent", $group_arr)) return;
+
+		$child_count = count($group_arr["$parent"]);
+		for ($i = 0; $i < $child_count; $i++) {
+			$doc_group =& $group_arr["$parent"][$i];
+			
+			// Should we display this element?
+			if (in_array($doc_group->getID(), $dont_display)) continue;
+
+			$margin = str_repeat("--", $level);
+			
+			$id_array[] = $doc_group->getID();
+			$text_array[] = $margin.$doc_group->getName();
+			
+			// Show childs (if any)
+			$this->buildArrays($group_arr, $id_array, $text_array, $dont_display, $doc_group->getID(), $level+1);
+		}
+
+	}
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/src/common/docman/include/utils.php
===================================================================
--- trunk/src/common/docman/include/utils.php	                        (rev 0)
+++ trunk/src/common/docman/include/utils.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,277 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 1999-2001, VA Linux Systems
+ * Copyright 2000, Quentin Cregan/SourceForge
+ * Copyright 2002-2004, GForge Team
+ * 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
+ */
+
+/* tooling library */
+
+function getNameDocGroup($id,$group) {
+	$res = db_query_params ('SELECT groupname FROM doc_groups WHERE doc_group=$1 AND group_id=$2',
+							array ($id,$group));
+	if (!$res || db_numrows($res) < 1) {
+		$this->setError(_('DocumentGroup: Invalid DocumentGroup ID'));
+		return false;
+	} else {
+		return (db_result($res,0,'groupname'));
+	}
+}
+
+function getStateDocGroup($id,$group) {
+	$res = db_query_params ('SELECT stateid FROM doc_groups WHERE doc_group=$1 AND group_id=$2',
+							array ($id,$group));
+	if (!$res || db_numrows($res) < 1) {
+		$this->setError(_('DocumentGroup: Invalid DocumentGroup ID'));
+		return false;
+	} else {
+		return (db_result($res,0,'stateid'));
+	}
+}
+
+function doc_get_state_box($checkedval='xzxz') {
+    $res_states=db_query_params ('select * from doc_states', array());
+    echo html_build_select_box ($res_states,'stateid',$checkedval,false);
+
+}
+
+function docman_recursive_display($docgroup) {
+	global $nested_groups,$group_id;
+	global $idExposeTreeIndex,$dirid,$idhtml;
+
+    if (is_array(@$nested_groups[$docgroup])) {
+        foreach ($nested_groups[$docgroup] as $dg) {
+            $idhtml++;
+
+            if ($dirid == $dg->getID())
+                $idExposeTreeIndex = $idhtml;
+
+            echo "
+                ['".'<span class="JSCookTreeFolderClosed"><i><img alt="" src="\' + ctThemeXPBase + \'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="\' + ctThemeXPBase + \'folderopen1.gif"></i></span>'."', '".addslashes($dg->getName())."', '?group_id=".$group_id."&view=listfile&dirid=".$dg->getID()."', '', '',";
+	            docman_recursive_display($dg->getID());
+            echo ",
+                    ],";
+        }
+    }
+}
+
+function docman_recursive_stateid($docgroup,$nested_groups,$nested_docs,$stateid=2) {
+    if (is_array(@$nested_groups[$docgroup])) {
+        foreach ($nested_groups[$docgroup] as $dg) {
+		$dg->setStateID($stateid);
+        }
+    }
+	if (isset($nested_docs[$docgroup]) && is_array($nested_docs[$docgroup])) {
+		foreach ($nested_docs[$docgroup] as $d) {
+			$d->setStateID($stateid);
+		}
+	}
+}
+
+/**
+ * docman_display_documents - Recursive function to show the documents inside the groups tree
+ */
+function docman_display_trash(&$document_factory,$parent_group=0) {
+	$nested_groups =& $document_factory->getNested(2);
+	$child_count = count($nested_groups["$parent_group"]);
+	echo "<ul style='list-style-type: none'>\n";
+	for ($i=0; $i < $child_count; $i++) {
+		$doc_group =& $nested_groups["$parent_group"][$i];
+		echo "<li>".$doc_group->getName()."</li>";
+	}
+	echo "</ul>";
+}
+
+function docman_display_documents(&$nested_groups, &$document_factory, $is_editor, $stateid=0, $parent_group=0) {
+	if (!array_key_exists("$parent_group",$nested_groups) || !is_array($nested_groups["$parent_group"])) {
+		return;
+	}
+	
+	echo '<script language="javascript">';
+	echo 'function EditData(iddiv) {';
+	echo '	if ( "none" == document.getElementById(iddiv).style.display ) {';
+	echo '		document.getElementById(iddiv).style.display = "inline";';
+	echo '	} else {';
+	echo '		document.getElementById(iddiv).style.display = "none";';
+	echo '	}';
+	echo '}';
+	echo '</script>';
+	echo "<ul style='list-style-type: none'>\n";
+	$child_count = count($nested_groups["$parent_group"]);
+	
+	for ($i=0; $i < $child_count; $i++) {		
+		$doc_group =& $nested_groups["$parent_group"][$i];
+		
+		if ($doc_group->hasDocuments($nested_groups, $document_factory, $stateid)) {
+			$icon = 'ofolder15.png';
+			echo "<li>".html_image('docman/directory.png',"22","22",array("border"=>"0"))."&nbsp;".$doc_group->getName()."</li>";
+			docman_display_documents($nested_groups, $document_factory, $is_editor, $stateid, $doc_group->getID());
+		}
+
+		// Display this group's documents
+		// Retrieve all the docs from this category			
+		if ($stateid) {
+			$document_factory->setStateID($stateid);
+		}
+		$document_factory->setDocGroupID($doc_group->getID());
+		$docs = $document_factory->getDocuments();
+		if (is_array($docs)) {
+			$docs_count = count($docs);
+			
+			echo "<ul style='list-style-type: none'>";
+			for ($j=0; $j < $docs_count; $j++) {
+				$tooltip = $docs[$j]->getFileName() . " (" .
+							($docs[$j]->getUpdated() ?
+							date(_('Y-m-d H:i'), $docs[$j]->getUpdated()) :
+							date(_('Y-m-d H:i'),$docs[$j]->getCreated()))  .
+							") ";
+				if ($docs[$j]->getFileSize() > 1024) {
+					$tooltip .= floor($docs[$j]->getFileSize()/1024) . "KB";
+				} else {
+					$tooltip .= $docs[$j]->getFileSize() . "B";
+				}
+				$tooltip = htmlspecialchars($tooltip);
+				echo '<li>'.  html_image('docman/file_type_unknown.png',"22","22",array("border"=>"0")). 
+					$docs[$j]->getName().  ' - ' . $tooltip . '&nbsp;<a href="#" onclick="javascript:EditData(\'editdata'.$docs[$j]->getID().'\')" >'. html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')) .'</a></li>';
+				echo "<i>".$docs[$j]->getDescription()."</i><br/>";
+				echo '<div id="editdata'.$docs[$j]->getID().'" style="display:none">';
+				document_editdata($docs[$j]);
+				echo '</div>';
+			}
+			echo "</ul>";
+		}
+	}
+	echo "</ul>\n";
+}
+
+function document_editdata(&$document) {
+	global $g,$dirid,$group_id;
+	$dgh = new DocumentGroupHTML($g);
+        if ($dgh->isError())
+                exit_error('Error',$dgh->getErrorMessage());
+
+	$dgf = new DocumentGroupFactory($g);
+        if ($dgf->isError())
+                exit_error('Error',$dgf->getErrorMessage());
+
+
+?>
+<p>
+<?php echo _("<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.") ?>
+</p>
+<?php
+	if ($g->useDocmanSearch())
+		echo '<p>'. _('Both fields are used by document search engine.'). '</p>';
+?>
+
+	<form id="editdata<?php echo $document->getID(); ?>" name="editdata<?php echo $document->getID(); ?>" action="?group_id=<?php echo $group_id; ?>&action=editfile&dirid=<?php echo $dirid; ?>" method="post" enctype="multipart/form-data">
+
+<table border="0">
+	<tr>
+		<td>
+			<strong><?php echo _('Document Title') ?>: </strong><?php echo utils_requiredField(); ?> <?php printf(_('(at least %1$s characters)'), 5) ?><br />
+			<input type="text" name="title" size="40" maxlength="255" value="<?php echo $document->getName(); ?>" />
+			<br />
+		</td>
+	</tr>
+
+    <tr>
+        <td>
+        <strong><?php echo _('Description') ?></strong><?php echo utils_requiredField(); ?> <?php printf(_('(at least %1$s characters)'), 10) ?><br />
+        <input type="text" name="description" size="50" maxlength="255" value="<?php echo $document->getDescription(); ?>" />
+        <br /></td>
+    </tr>
+
+    <tr>
+        <td>
+        <strong><?php echo _('File')?></strong><?php echo utils_requiredField(); ?><br />
+        <?php if ($document->isURL()) {
+            echo '<a href="'.inputSpecialchars($d->getFileName()).'">[View File URL]</a>';
+        } else { ?>
+        <a target="_blank" href="../view.php/<?php echo $group_id.'/'.$document->getID().'/'.urlencode($document->getFileName()) ?>"><?php echo $document->getName(); ?></a>
+        <?php } ?>
+        </td>
+    </tr>
+
+<?php
+
+    if ((!$document->isURL()) && ($document->isText())) {
+        echo '<tr>
+	                <td>
+		                ';
+	
+		echo _('Edit the contents to your desire or leave them as they are to remain unmodified.');
+		echo '<textarea name="data" rows="15" cols="100" wrap="soft">'. $document->getFileData()  .'</textarea><br />';
+		echo '<input type="hidden" name="filetype" value="text/plain">';
+		echo '</td>
+		            </tr>';
+	}
+
+?>
+
+    <tr>
+        <td>
+        <strong><?php echo _('Group that document belongs in') ?></strong><br />
+        <?php
+				$dgh->showSelectNestedGroups($dgf->getNested(), 'doc_group', false, $document->getDocGroupID());
+
+	     ?></td>
+    </tr>
+
+    <tr>
+        <td>
+        <br /><strong><?php echo _('State') ?>:</strong><br />
+        <?php
+		     doc_get_state_box($document->getStateID());
+        ?></td>
+    </tr>
+    <tr>
+        <td>
+        <?php if ($document->isURL()) { ?>
+        <strong><?php echo _('Specify an outside URL where the file will be referenced') ?> :</strong><?php echo utils_requiredField(); ?><br />
+        <input type="text" name="file_url" size="50" value="<?php echo $document->getFileName() ?>" />
+        <?php } else { ?>
+        <strong><?php echo _('OPTIONAL: Upload new file') ?></strong><br />
+        <input type="file" name="uploaded_data" size="30" /><br/><br />
+            <?php
+            	if (forge_get_config('use_ftp_uploads')) {
+                	echo '<strong>' ;
+                	printf(_('OR choose one form FTP %1$s.'), forge_get_config('ftp_upload_host'));
+                	echo '</strong><br />' ;
+                	$ftp_files_arr=array_merge($arr,ls($upload_dir,true));
+                	echo html_build_select_box_from_arrays($ftp_files_arr,$ftp_files_arr,'ftp_filename','');
+                	echo '<br /><br />';
+            	}
+			}
+	        ?>
+        </td>
+    </tr>
+    </table>
+
+    <input type="hidden" name="docid" value="<?php echo $document->getID(); ?>" />
+    <input type="submit" id="submiteditdata<?php echo $document->getID(); ?>" value="<?php echo _('Submit Edit') ?>" /><br /><br />
+    </form>
+
+<?php
+}
+?>

Copied: trunk/src/common/docman/include/vtemplate.class.php (from rev 10290, trunk/src/www/docman/include/vtemplate.class.php)
===================================================================
--- trunk/src/common/docman/include/vtemplate.class.php	                        (rev 0)
+++ trunk/src/common/docman/include/vtemplate.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,650 @@
+<?php
+/*****************************************************************
+ *			VIRTUAL-TEMPLATE
+ *
+ * Version : 1.3.2 Base Edition ( Decembre 2003 ) build 1
+ *
+ * Address : http://vtemplate.sourceforge.net
+ * 
+ * Authors: 
+ *   + THIEBAUT Jean-Baptiste(J.Baptiste at leweby.com)  -  http://www.leweby.com .
+ *   + CAMPANA François (fc at netouaibe.com).
+ * Licence: GPL.
+ * 
+ * 
+ *
+ *			  
+ *****************************************************************/ 
+
+if ( !isset($DEFINE_VTEMPLATE) ){
+define("ALL",1);
+define("VARTAG","{#"); // Tag d'ouverture des variables : vous pouvez changer ce paramètre.
+define("VTEMPLATE_VERSION","1.3.1");
+define("VTEMPLATE_TYPE","BA");
+define("VTEMPLATE_BUILD","6");
+
+
+class Err {
+var $msg;
+var $titre;
+
+function error($errno,$arg="",$code=0,$disp=0, $method=__METHOD__,$line=__LINE__){
+// Gestion des erreurs
+if (is_array($arg))
+{
+	$infos = "{ ".print_r($arg,true)." } ";
+}
+else
+{
+	$infos = $arg;
+}
+
+switch($errno){
+  case 1:
+    $this->titre="$method - Erreur $errno de session n° $code - ligne $line";
+    $this->msg = "La zone $arg est déjà ouverte.Avant d'ajouter une session sur cette zone, vous devez la fermer à l'aide de la fonction closeSession().<br>"	;
+  break;
+  case 2:
+    $this->titre="$method - Erreur $errno de session n° $code - ligne $line";
+    $this->msg = "Vous tentez de fermer une session de la zone $arg[1] alors qu'aucune session pour cette zone n'existe.Pour ouvrir une session, utilisez la fonction addSession().<br>";
+  break;
+  case 3:
+    $this->titre="$method - Erreur $errno de session n° $code - ligne $line";
+	$var = $arg[1];
+	$zone = $arg[0];
+    $this->msg = "Vous essayez de valoriser la variable $var sans avoir créer de session de la zone $zone.Utilisez la fonction addSession() pour créer une session, puis setVar pour valoriser une variable.<br>";
+  break;
+  case 4:
+    $this->titre="$method - Erreur $errno de session n° $code - ligne $line";
+	$var = $arg[1];
+	$zone = $arg[0];
+    $this->msg = "La variable $var que vous souhaitez valoriser n'existe pas dans la zone $zone.<br>";
+  break;
+  case 5:
+    $this->titre="$method - Erreur $errno de parsing n° $code - ligne $line";
+    $this->msg = "Vous utilisez des caractère non autorisés pour déclarer vos zones.Vous pouvez utiliser tous les caractères à l'exception de \'{\' , \'#\' \'}\' et \'|\'.<br>";
+  break;
+  case 6:
+    $this->titre="$method - Erreur $errno de parsing n° $code - ligne $line";
+    $this->msg = "Vous ne pouvez pas utiliser le même nom ($arg)de zone plusieurs fois.<br>";
+  break;
+  case 7:
+    $this->titre="$method - Erreur $errno de parsing n° $code - ligne $line";
+    $this->msg = "Vous avez oublié de fermer la zone $arg.<br>";
+  break;
+  case 8:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "Le fichier template $arg est introuvable.<br>";
+  break;
+  case 9:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "Impossible d'ouvrir le fichier $arg.Vérifiez les droits de ce fichier.<br>";
+  break;
+  case 10:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "Impossible de lire le fichier template $arg.<br>";
+  break;
+  case 11:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "La zone $arg est introuvable.Vérifiez la syntaxe de cette zone.<br>";
+  break;
+  case 12:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "La variable $arg est introuvable .Vérifiez la syntaxe de la variable.<br>";
+  break;
+  case 13:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+    $this->msg = "L'identifiant de fichier spécifié n'existe pas.Vérifiez les fonctions Open() de votre script.<br>";
+  break;
+  case 14:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+	$var = $arg[1];
+	$file = $arg[0];
+    $this->msg = "La variable $var dans le fichier $file est introuvable.Vérifiez la syntaxe de la variable.<br>";
+  break;
+  case 15:
+    $this->titre="$method - Erreur $errno de traitement n° $code - ligne $line";
+	$var = $arg[2];
+	$zone = $arg[1];
+	$fichier = $arg[0];
+    $this->msg = "La variable $var dans la zone $zone du fichier $fichier est introuvable.Vérifiez la syntaxe de la variable et du nom de la zone.<br>";
+  break;
+  default:
+	 $this->titre = "$method - Erreur $errno inconnue $code - ligne $line";
+     $this->msg = "Veuillez le rapporter aux auteurs de la classe.";
+}
+$this->titre .= ": <br>";
+if ($disp){
+//	$web = "Pour plus d'informations, consultez la <a href=\"http://www.virtual-solution.net/vtemplate/docs/debug-mod.php?version=".VTEMPLATE_VERSION."&build=".VTEMPLATE_BUILD."&type=".VTEMPLATE_TYPE."&error=$code\" target=\"_blank\">doc en ligne</a>";
+//	echo "<font face=verdana size=2 color=red><u>$this->titre</u><i>$this->msg</i>$web<br><br></font>";
+	echo "<font face=verdana size=2 color=red><u>$this->titre</u><i>$this->msg</i>$infos<br><br></font>";
+}
+return -1;
+}
+// Fin classe
+}
+
+class Session extends err{
+
+var $name;		// Name of the session
+var $globalvar = array();  // List of global variable of the session
+var $varlist = array();  // List of var in this session
+var $subzone = array(); // list of sub-zone
+var $temp; // Generated code for the current session
+var $generated = NULL; // The final code
+var $source; // Source code
+var $used=0; // Indicates if the session contain used variable
+var $stored; // Give the filename were is stored the session
+
+function Session($name,$source,$stored){
+ $this->name = $name;
+ $this->source = $source;
+ $this->stored = $stored;
+ $this->parseVar();
+}
+
+function parseVar_orig(){
+ // Récupération des noms des variables
+ $regle = "|".VARTAG."(.*)}|sU"; 
+ preg_match_all ($regle,$this->source,$var1);
+ // Création du tableau de variable  à partir de la liste parsée.
+ $this->varlist=@array_merge($var[1],$var1[1]);
+return 1;
+} 
+
+// la fonction parseVar a été reécrire ( voir l'origin parseVar_orig )
+// car des prblèmes se présentaient avec array_merge quand la classe
+// était utilisée avec php5 ( bogue dans php5beta4 ? )
+function parseVar(){
+ // Récupération des noms des variables
+ $regle = "|".VARTAG."(.*)}|sU"; 
+ $var1 = array(); $var1[1] = array();
+ preg_match_all ($regle,$this->source,$var1);
+ /* Création du tableau de variable  à partir de la liste parsée. */
+ foreach ($var1[1] as $v)
+ {
+ 	$this->varlist[] = $v;
+ }
+return 1;
+} 
+
+function init(){
+if($this->used) return $this->error(1,array($this->stored,$this->name),"SESSION1",1,"init",__LINE__);
+// Reset generated code
+$this->temp = $this->source;
+$this->used = 1;
+}
+function closeSession(){
+// Check if the zone has been used.    
+if(!$this->used) return $this->error(2,array($this->stored,$this->name),"SESSION2",1,"closeSession",__LINE__);
+// Set Globals vars.
+$this->generateCode();
+$this->used=0;
+return 1;
+}
+
+function reset(){
+$this->used = 0;
+$this->generated = NULL;
+return 1;
+}
+
+function addSubZone(&$subzone){
+$this->subzone[$subzone->name] = &$subzone;
+return 1;
+}
+
+function setVar($varname,$value){
+if (!$this->used) return $this->error(3,array($this->stored,$this->name,$varname),"SESSION3",1,"setVar",__LINE__);
+if (!in_array($varname,$this->varlist)) return $this->error(4,array($this->name,$varname),"SESSION4",1,"setVar",__LINE__);
+$regle = "(\\".VARTAG."$varname\})";
+$this->temp = preg_replace($regle,$value,$this->temp);
+return 1;
+}
+
+
+// pour débogage
+function message ($text)
+{
+	$t = ereg_replace("\n", "", $text);
+  if (defined("FICHIER_MESSAGES_DEBUG"))
+	{
+	  $fichier = FICHIER_MESSAGES_DEBUG;
+  }
+	else
+	{
+	    // le fichier destination n'est pas défini
+			// valeur par défaut
+			$fichier = "/var/log/janus.log";
+	}
+	error_log(date("d/m/Y H:i:s > ")."$t\n",3,$fichier);
+}
+
+
+function dispVar(){
+ echo "Liste variables de $this->name:<br>";
+ foreach ( $this->varlist as $vars )
+    echo "$vars <br>";
+}
+
+function setGlobalVar($varname,$value){
+$set = 0;
+if (in_array($varname,$this->varlist)){
+  // Replace the var into this session 
+  $this->globalvar[$varname]=$value;   
+  $set = 1;
+}
+  // Replace the var into sub zones
+  foreach(array_keys($this->subzone) as $subzone){
+      $set = $this->subzone[$subzone]->setGlobalVar($varname,$value) || $set;
+  }
+  return $set;
+}
+
+function replaceGlobalVar(){
+if ( count($this->globalvar) )
+foreach($this->globalvar as $varname => $value){
+  $regle = "(\\".VARTAG."$varname\})";
+  $this->temp = preg_replace($regle,$value,$this->temp);
+}
+}
+
+
+function generateCode(){
+    if ($this->used == 0) return $this->generated;
+    // Replace global var.
+	if ( count($this->globalvar) ) $this->replaceGlobalVar();
+	// Replace all unused variable by ""
+    $regle = "|\\".VARTAG."([^}]*)\}|";
+	$this->temp = preg_replace($regle,"",$this->temp);
+	// Generate the subzone(s) code
+	if(count($this->subzone)){
+	  foreach(array_keys($this->subzone) as $subzone){
+		$text = ($this->subzone[$subzone]->used) ? $this->subzone[$subzone]->generateCode() : $this->subzone[$subzone]->generated;
+		$this->temp = preg_replace("(\|$subzone\|)",$text,$this->temp); 	
+		$this->subzone[$subzone]->reset();
+	  }
+    }
+$this->generated .= $this->temp;
+return $this->generated;
+}
+
+function inVarList($varname){
+return in_array($varname,$this->varlist);
+}
+
+// Fin classe
+}
+
+class VTemplate_Private extends Err{
+/****************************************
+*	   Private Class.		*
+* ***************************************/
+
+var $sources=array(); // Sources des zones issues de la premiere partie du parsing.
+var $sessions=array(); // Tableau de sessions
+var $v_global=array(); // Globla var array.
+
+/****************************************************************
+	    Parsing Functions for Template files.  ( PF 1.0 )
+ ****************************************************************/
+
+function getNom($code){
+// Retourne le premier nom de zone qu'il trouve dans le code
+
+   preg_match("(<!--VTP_([^()]+)-->)sU",$code,$reg);
+   
+   // Tester la présence des caratère invalides dans le nom ( | et {});
+   if (@count(explode("|",$reg[1]))>1 || @count(explode("{",$reg[1]))>1 || @count(explode("}",$reg[1]))>1) exit($this->error(5,$reg[1],"PARSE1",1,"getNom",__LINE__));
+   
+   return @$reg[1];
+}
+
+function endTag($code,$nom){
+// Renvoie TRUE(1) si le tag de fermeture est présent.
+
+   preg_match("(<!--/VTP_$nom-->)sU",$code,$reg);
+
+return ($reg[0]!="<!--/VTP_$nom-->") ? 0 : 1;
+}
+
+function getSource($code,$nom,$type=0){
+// Retourne le source de la zone de nom $nom
+
+   preg_match_all ("(<!--VTP_$nom-->(.*)<!--/VTP_$nom-->)sU",$code,$reg);
+
+return $reg[$type][0];
+}
+
+function parseZone($code_source,$nom_zone="|root|"){
+// Fonction récursive de parsing du fichier template
+   // Vérification que la zone n'existe pas
+   if (isset($this->sources[$nom_zone])) exit($this->error(6,$nom_zone,"PARSE2",1,"parseZone",__LINE__));
+
+   // Enregistrement du code source
+   $this->sources[$nom_zone]["source"]=$code_source;
+
+   // Rappel de la fonction pour chaque fils.
+   while($nom_fils=$this->getNom($this->sources[$nom_zone]["source"])){
+
+     // Vérification que le tag de fin est présent.
+     if (!$this->endTag($code_source,$nom_fils)) exit($this->error(7,$nom_fils,"PARSE3",1,"parseZone",__LINE__));
+
+     // Parse le fils
+     $this->parseZone($this->getSource($this->sources[$nom_zone]["source"],$nom_fils,1),$nom_fils);
+
+     // Enregistre le nom du fils dans la liste des fils
+     $this->sources[$nom_zone]["fils"][]=$nom_fils;
+
+     // Remplace le code du fils dans le source du père
+     $this->sources[$nom_zone]["source"]=str_replace(
+				     $this->getSource($this->sources[$nom_zone]["source"],$nom_fils,0),
+				     "|$nom_fils|",
+				     $this->sources[$nom_zone]["source"]
+				     );
+     // Teste si la zone $nom_fils n'existe pas plusieurs fois dans la zone $nom_zone
+     if (count(explode("|$nom_fils|",$this->sources[$nom_zone]["source"]))>2) exit($this->error(6,$nom_fils,"PARSE4",1,"parseZone",__LINE__));
+   }// fin While
+
+return 1;
+}
+
+/****************************************************************
+	    Session Management functions ( SMF 1.0 )
+ ****************************************************************/
+
+function createSession($handle,$zone = "|root|"){
+// Create a new session of the zone
+$this->sessions[$handle][$zone] = new Session($zone,$this->sources[$zone]["source"],$this->file_name[$handle]);
+
+// Create sub-zone
+if (@count($this->sources[$zone]["fils"])){
+   foreach($this->sources[$zone]["fils"] as $subzone){	  
+    $this->createSession($handle,$subzone);
+    $this->sessions[$handle][$zone]->addSubZone($this->sessions[$handle][$subzone]);
+   }
+}
+				  
+//end createSession
+}
+
+
+/****************************************************************
+	    Global Variable Management Functions ( GVMF 1.0 )
+ ****************************************************************/
+
+ function setGZone($handle,$zone,$var,$value){
+ // Define Global var for $zone and its sub-zone.
+   // Set global value to $zone vars.
+  return $this->sessions[$handle][$zone]->setGlobalVar($var,$value);
+}
+
+function setGFile($handle,$var,$value) {
+  return $this->sessions[$handle]["|root|"]->setGlobalVar($var,$value);
+}
+
+function setGAll($var,$value){
+$declare = 0;
+$this->v_global[$var]=$value;
+if (is_array($this->sessions)){
+    foreach($this->sessions as $handle => $v){
+		$declare = $this->setGFile($handle,$var,$value) || $declare;
+		}	
+  } 
+return $declare;
+}
+
+function setGOpened($handle){
+// Set Global var into the opened file
+foreach($this->v_global as $name => $val){
+  $this->setGFile($handle,$name,$val);
+}
+return 1;
+}
+ 
+// Fin VTemplate_Private
+}
+
+
+class VTemplate extends VTemplate_Private{
+/****************************************
+*	   Public Class.		*
+* ***************************************/
+
+
+/****************************************************************
+	    Core Functions 
+*****************************************************************/
+
+
+function Open($nomfichier){
+// Ouverture d'un fichier source et retourne le handle de ce fichier
+// Création du handle:
+$handle =  "{".count($this->sessions)."}" ;
+
+
+// Récupération du source à parser
+if (!@file_exists($nomfichier)) return $this->error(8,$nomfichier,"TTT1",1,"Open",__LINE__);
+if (!$f_id=@fopen($nomfichier,"r")) return $this->error(9,$nomfichier,"TTT2",1,"Open",__LINE__);
+if (!$source=@fread($f_id, filesize($nomfichier))) return $this->error(10,$nomfichier,"TTT3",1,"Open",__LINE__);
+clearstatcache();
+fclose($f_id);
+
+// Store the filename
+$this->file_name[$handle]=$nomfichier;
+
+// Parse les zones
+$this->parseZone($source);
+
+// Création du tableau de session
+$this->createSession($handle);
+
+//Nettoyage des variables temporaires
+$this->sources=NULL;
+
+// Set global var.
+$this->setGOpened($handle);
+
+$this->addSession($handle);
+return $handle;
+}
+
+function newSession($handle="{0}",$nom_zone = "|root|"){
+global $cache,$time,$num_session;
+if ( $this->sessions[$handle][$nom_zone]->used ) $this->closeSession($handle,$nom_zone);
+$this->addSession($handle,$nom_zone,$cache,$time,$num_session);
+return 1;
+}
+
+function addSession($handle="{0}",$nom_zone = "|root|"){
+	// Does the zone exist ?
+   if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT4",1,"addSession",__LINE__);
+   $this->sessions[$handle][$nom_zone]->init();
+   return 1;
+}
+
+function closeSession($handle="{0}",$nom_zone = "|root|"){ 
+// Close the current session and all his sub-session
+	  // Check if the zone exists.
+	if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT5",1,"closeSession",__LINE__);
+     // Closing sub-zone
+     $this->sessions[$handle][$nom_zone]->closeSession();	
+   return 1;
+}
+
+function setGlobalVar($arg1,$arg2,$arg3){
+if ($arg1 == 1){
+  if (!$this->setGAll($arg2,$arg3)) return $this->error(12,$arg2,"TTT6",1,"setGlobalVar",__LINE__);
+  return 1; 
+}
+if (!isset($this->sessions[$arg1])) return $this->error(13,$arg1,"TTT7",1,"setGlobalVar",__LINE__);
+ $tab=explode(".",$arg2);
+ if (count($tab)==1){
+    if (!$this->setGFile($arg1,$arg2,$arg3)) return $this->error(14,array($this->file_name[$arg1],$arg2),"TTT8",1,"setGlobalVar",__LINE__);
+ }
+ else if (count($tab==2)){
+    if (!isset($this->sessions[$arg1][$tab[0]])) return $this->error(11,array($tab[0],$this->file_name[$arg1],"TTT9",1),"setGlobalVar",__LINE__);
+    if (!$this->setGZone($arg1,$tab[0],$tab[1],$arg3)) return $this->error(15,array($this->file_name[$arg1],$tab[0],$tab[1]),"TTT10",1,"setGlobalVar",__LINE__);
+ }
+return 1;
+}
+
+function setVar($handle,$zone_var,$val){
+ // Fill the variable
+$tab=explode(".",$zone_var);
+ if(count($tab)==2){
+   $zone=$tab[0];
+   $var=$tab[1];
+ }
+ else
+ {
+  $zone="|root|";
+  $var=$tab[0];
+ }
+
+ // Teste l'existence de la zone dans la liste
+ if (!isset($this->sessions[$handle][$zone])) return $this->error(11,array($this->file_name[$handle],$zone),"TTT11",1,"setVar",__LINE__);
+
+ //Enregistre la variable
+ return $this->sessions[$handle][$zone]->setVar($var,$val);
+}
+
+function Parse($handle_dest,$zone_var_dest,$handle_source,$zone_source="|root|"){
+	if($this->sessions[$handle_source][$zone_source]->used == 1) $this->closeSession($handle_source,$zone_source);
+	  $this->setVar($handle_dest,$zone_var_dest, $this->sessions[$handle_source][$zone_source]->generated);
+}
+
+function setVarF($handle,$zone_var,$file){
+// Fonction qui ouvre le fichier file et copie ce qu'il y a dedans dans une variable.
+$tab=explode(".",$zone_var);
+
+// Récupération nom de la zone et de la variable.
+ if(count($tab)==2){
+   $zone=$tab[0];
+   $var=$tab[1];
+ }
+ else
+ {
+  $zone="|root|";
+  $var=$tab[0];
+ }
+// Teste l'existence de la zone dans la liste
+ if (!is_object($this->sessions[$handle][$zone])) return $this->error(11,array($handle,$zone),"TTT12",1,"setVarF",__LINE__);
+
+ // Récupération du source à lire
+if (!@file_exists($file)) return $this->error(8,$file,"TTT13",1,"setVarF",__LINE__);
+if (!$f_id=@fopen($file,"r")) return $this->error(9,$file,"TTT14",1,"setVarF",__LINE__);
+if (!$val=@fread($f_id, filesize($file))) return $this->error(10,$file,"TTT15",1,"setVarF",__LINE__);
+clearstatcache();
+fclose($f_id);
+
+//Enregistre la variable
+return $this->sessions[$handle][$zone]->setVar($var,$val);
+}
+
+
+
+
+
+function isZone($handle, $zone="|root|") 
+{ 
+return isset($this->sessions[$handle][$zone]) ; 
+} 
+
+function Display($handle="{0}",$display=1,$zone="|root|"){
+	$this->closeSession($handle,$zone);
+	$c_genere = $this->sessions[$handle][$zone]->generated; 
+	
+	if ($display) echo $c_genere; else return ($c_genere);
+}
+//fonction complementaire version BETA
+
+/*
+* 
+On peut l'utiliser : 
+- SetVarTab($array): tout les couples clef/valeur sont valorisées 
+- SetVarTab($array,$index) seuls les couples clef/valeur dont la clef est dans le tableau index ou dont la valeur == $index (si pas tableau) 
+Si $index contient ou est une clef de type zone.clef, la clef sera extraite du texte est servira d'index pour $array 
+
+Vincent 
+*/
+
+function setVarTab($handle,$zones,$index = array()){ 
+	if (is_array($index)) 
+	{ 
+		if (count($index)>0) 
+		{ 
+			reset($index); 
+			while (list (, $key) = each ($index)) 
+			{ 
+				$tab=explode(".",$key); 
+				if(count($tab)==2){ 
+					$var=$tab[1]; 
+				} 
+				else 
+				{ 
+					$var=$tab[0]; 
+				} 
+				setVar($handle,$key,$zones[$var]); 
+			} 
+		} 
+		else 
+		{ 
+			reset($zones); 
+			while (list ($key, $val) = each ($zones)) 
+			{ 
+				setVar($handle,$key,$val); 
+			} 
+		} 
+	} 
+	else 
+	{ 
+		setVar($handle,$index,$zones[$index]); 
+	} 
+} 
+
+function setGlobalVarTab($handle,$zones,$index = array()){ 
+
+	if (is_array($index)) 
+	{ 
+		if (count($index)>0) 
+		{ 
+			reset($index); 
+			while (list (, $key) = each ($index)) 
+			{ 
+				$tab=explode(".",$key); 
+				if(count($tab)==2){ 
+					$var=$tab[1]; 
+				} 
+				else 
+				{ 
+					$var=$tab[0]; 
+				} 
+				setGlobalVar($handle,$key,$zones[$var]); 
+			} 
+		} 
+		else 
+		{ 
+			reset($zones); 
+			while (list ($key, $val) = each ($zones)) 
+			{
+				GlobalVar($handle,$key,$val); 
+			} 
+		} 
+	} 
+	else 
+	{ 
+		setBlobalVar($handle,$index,$zones[$index]); 
+	} 
+} 
+
+
+
+
+
+
+// End VTemplate
+}
+$DEFINE_VTEMPLATE = 1;
+}
+?>

Added: trunk/src/common/docman/views/addfile.php
===================================================================
--- trunk/src/common/docman/views/addfile.php	                        (rev 0)
+++ trunk/src/common/docman/views/addfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+/* display the add new documentation form */
+
+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') ;
+
+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()) 
+	echo '<p>'. _('Both fields are used by document search engine.'). '</p>';
+
+echo '<form name="adddata" action="?group_id='.$group_id.'&action=addfile" method="post" enctype="multipart/form-data">
+		<table border="0" width="75%">
+			<tr>
+				<td>
+					<strong>'. _('Document Title').' :</strong>'. utils_requiredField(). sprintf(_('(at least %1$s characters)'), 5).'<br />
+					<input type="text" name="title" size="40" maxlength="255" />
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<strong>'. _('Description') .' :</strong>'. utils_requiredField() . sprintf(_('(at least %1$s characters)'), 10).'<br />
+					<input type="text" name="description" size="50" maxlength="255" />
+				</td>
+			</tr>';
+echo '
+			<tr>
+				<td>
+					<strong>'. _('Upload File') .' :</strong>'. utils_requiredField() .'<br />
+					<input type="file" name="uploaded_data" size="30" /><br /><br />
+					<input type="hidden" name="type" value="httpupload">
+				</td>
+			</tr>';
+if ($dirid) {
+	echo '<input type="hidden" name="doc_group" value="'.$dirid.'">';
+} else {
+	echo '
+			<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>
+			</tr>';
+}
+echo '
+		</table>
+		<input type="submit" name="submit" value="'. _('Submit Information').' " />
+	</form>';
+?>

Added: trunk/src/common/docman/views/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/views/addsubdocgroup.php	                        (rev 0)
+++ trunk/src/common/docman/views/addsubdocgroup.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$dirid = getIntFromRequest('dirid');
+
+?>
+<script language="javascript">
+function doItAddSubGroup() {
+	document.getElementById('addsubgroup').submit();
+	document.getElementById('submitaddsubgroup').disabled = true;
+}
+</script>
+<?php
+echo '<form id="addsubgroup" name="addsubgroup" method="post" action="?group_id='.$group_id.'&action=addsubdocgroup&dirid='.$dirid.'">';
+if ($dirid) {
+	echo _('Name of the document subgroup to create : ');
+} else {
+	echo _('Name of the document group to create : ');
+}
+echo '<input type="text" name="groupname" size="40" maxlength="255" >';
+echo '<input id="submitaddsubgroup" type="button" value="create" onclick="javascript:doItAddSubGroup()" />';
+echo '</form>';
+
+?>
+

Added: trunk/src/common/docman/views/admin.php
===================================================================
--- trunk/src/common/docman/views/admin.php	                        (rev 0)
+++ trunk/src/common/docman/views/admin.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,91 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once ('docman/include/DocumentGroupHTML.class.php');
+?>
+
+<script language="javascript">
+function displayAdminDiv(id) {
+	if ( 'none' == document.getElementById(id).style.display ) {
+		document.getElementById(id).style.display = 'inline';
+	} else {
+		document.getElementById(id).style.display = 'none';
+	}
+}
+function doIt(formid) {
+	document.getElementById(formid).submit();
+	document.getElementById('submit'+formid).disabled = true;
+}
+</script>
+<?php
+echo '<a href="#" onclick="javascript:displayAdminDiv(\'adminpending\')" ><h4>'. _('Admin Pending Files') .'</h4></a>';
+echo '<div id="adminpending" style="display:none">';
+include ('docman/views/listpendingfile.php');
+echo '</div>';
+
+echo '<a href="#" onclick="javascript:displayAdminDiv(\'admintrash\')" ><h4>'. _('Admin Trash') .'</h4></a>';
+echo '<div id="admintrash" style="display:none;" >';
+echo '<form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
+echo '<ul>';
+echo '<li>'. _('Delete permanenty all documents and document groups with deleted status ') .' <input id="submitemptytrash" type="button" value="Yes" onclick="javascript:doIt(\'emptytrash\')" ></li>';
+echo '</ul>';
+echo '</form>';
+echo '<ul>';
+echo '<li><a href="#" onclick="javascript:displayAdminDiv(\'listtrash\')">'. _('Select dir or files to be resurrected from deleted status') .'</a></li>';
+echo '</ul>';
+echo '<div id="listtrash" style="display:none;" >';
+include ('docman/views/listtrashfile.php');
+echo '</div>';
+echo '</div>';
+
+echo '<a href="#" onclick="javascript:displayAdminDiv(\'adminsearchengine\')" ><h4>'. _('Admin Engine Options') .'</h4></a>';
+echo '<div id="adminsearchengine" style="display:none;" >';
+echo '<form id="searchengine" name="searchengine" method="post" action="?group_id='.$group_id.'&action=updateenginesearch" >';
+echo '<ul>';
+
+$searchEngineStatus = '1';
+$labelSearchEngine = _('Enable Search Engine');
+if ($g->useDocmanSearch()) {
+	$searchEngineStatus='0';
+	$labelSearchEngine = _('Disable Search Engine');
+}
+
+echo '<li>'.$labelSearchEngine.' <input name="status" type="hidden" value="'.$searchEngineStatus.'"><input id="submitsearchengine" type="button" value="Yes" onclick="javascript:doIt(\'searchengine\')"></li>';
+echo '</ul>';
+echo '</form>';
+
+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">';
+		echo '<ul>';
+		echo '<li>'. _('Force reindexation search engine') .' <input name="status" type="hidden" value="1"><input id="submitreindexword" type="button" value="Yes" onclick="javascript:doIt(\'reindexword\')"></li>';
+		echo '</ul>';
+		echo '</form>';
+	}
+}
+echo '</div>';
+
+?>

Added: trunk/src/common/docman/views/editdocgroup.php
===================================================================
--- trunk/src/common/docman/views/editdocgroup.php	                        (rev 0)
+++ trunk/src/common/docman/views/editdocgroup.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once 'docman/include/DocumentGroupHTML.class.php';
+
+$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; ?>" />
+<table>
+<tr>
+<th><?php echo _('Group Name') ?>:</th>
+<td><input type="text" name="groupname" value="<?php echo $dg->getName(); ?>" /></td>
+<td>&nbsp;</td>
+</tr>
+<tr>
+<th><?php echo _('Belongs to') ?>:</th>
+<td>
+<?php
+$dgh->showSelectNestedGroups($dgf->getNested(), "parent_dirid", true, $dg->getParentId(), array($dg->getID()));
+?>
+</td>
+<td><input type="submit" value="<?php echo _('Edit') ?>" name="submit" /></td>
+</tr>
+</table>
+<p>
+<?php echo _('Group name will be used as a title, so it should be formatted correspondingly.') ?>
+</p>
+</form>

Added: trunk/src/common/docman/views/editfile.php
===================================================================
--- trunk/src/common/docman/views/editfile.php	                        (rev 0)
+++ trunk/src/common/docman/views/editfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+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(); ?>() {
+		document.getElementById('editdata<?php echo $d->getID(); ?>').submit();
+		document.getElementById('submiteditdata<?php echo $d->getID(); ?>').disabled = true;
+	}
+</script>
+<div id="editfile<?php echo $d->getID(); ?>" style="display:none">
+<p>
+<?php echo _("<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.") ?>
+</p>
+<?php
+	if ($g->useDocmanSearch())
+		echo '<p>'. _('Both fields are used by document search engine.'). '</p>';
+?>
+
+	<form id="editdata<?php echo $d->getID(); ?>" name="editdata<?php echo $d->getID(); ?>" action="?group_id=<?php echo $group_id; ?>&action=editfile&dirid=<?php echo $dirid; ?>" method="post" enctype="multipart/form-data">
+
+<table border="0">
+	<tr>
+		<td>
+			<strong><?php echo _('Document Title') ?>: </strong><?php echo utils_requiredField(); ?> <?php printf(_('(at least %1$s characters)'), 5) ?><br />
+			<input type="text" name="title" size="40" maxlength="255" value="<?php echo $d->getName(); ?>" />
+			<br />
+		</td>
+	</tr>
+
+    <tr>
+        <td>
+        <strong><?php echo _('Description') ?></strong><?php echo utils_requiredField(); ?> <?php printf(_('(at least %1$s characters)'), 10) ?><br />
+        <input type="text" name="description" size="50" maxlength="255" value="<?php echo $d->getDescription(); ?>" />
+        <br /></td>
+    </tr>
+
+    <tr>
+        <td>
+        <strong><?php echo _('File')?></strong><?php echo utils_requiredField(); ?><br />
+        <?php if ($d->isURL()) {
+            echo '<a href="'.inputSpecialchars($d->getFileName()).'">[View File URL]</a>';
+        } else { ?>
+        <a target="_blank" href="../view.php/<?php echo $group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()) ?>"><?php echo $d->getName(); ?></a>
+        <?php } ?>
+        </td>
+    </tr>
+
+<?php
+
+    if ((!$d->isURL()) && ($d->isText())) {
+        echo '<tr>
+	                <td>
+		                ';
+	
+		echo _('Edit the contents to your desire or leave them as they are to remain unmodified.');
+		echo '<textarea name="data" rows="15" cols="100" wrap="soft">'. $d->getFileData()  .'</textarea><br />';
+		echo '<input type="hidden" name="filetype" value="text/plain">';
+		echo '</td>
+		            </tr>';
+	}
+
+?>
+
+    <tr>
+        <td>
+        <strong><?php echo _('Group that document belongs in') ?></strong><br />
+        <?php
+				$dgh->showSelectNestedGroups($dgf->getNested(), 'doc_group', false, $d->getDocGroupID());
+
+	     ?></td>
+    </tr>
+
+    <tr>
+        <td>
+        <br /><strong><?php echo _('State') ?>:</strong><br />
+        <?php
+		     doc_get_state_box($d->getStateID());
+        ?></td>
+    </tr>
+    <tr>
+        <td>
+        <?php if ($d->isURL()) { ?>
+        <strong><?php echo _('Specify an outside URL where the file will be referenced') ?> :</strong><?php echo utils_requiredField(); ?><br />
+        <input type="text" name="file_url" size="50" value="<?php echo $d->getFileName() ?>" />
+        <?php } else { ?>
+        <strong><?php echo _('OPTIONAL: Upload new file') ?></strong><br />
+        <input type="file" name="uploaded_data" size="30" /><br/><br />
+            <?php
+            	if (forge_get_config('use_ftp_uploads')) {
+                	echo '<strong>' ;
+                	printf(_('OR choose one form FTP %1$s.'), forge_get_config('ftp_upload_host'));
+                	echo '</strong><br />' ;
+                	$ftp_files_arr=array_merge($arr,ls($upload_dir,true));
+                	echo html_build_select_box_from_arrays($ftp_files_arr,$ftp_files_arr,'ftp_filename','');
+                	echo '<br /><br />';
+            	}
+			}
+	        ?>
+        </td>
+    </tr>
+    </table>
+
+    <input type="hidden" name="docid" value="<?php echo $d->getID(); ?>" />
+    <input type="button" id="submiteditdata<?php echo $d->getID(); ?>" value="<?php echo _('Submit Edit') ?>" onclick="javascript:doItEditData<?php echo $d->getID(); ?>()" /><br /><br />
+    </form>
+</div>
+
+<?php
+}
+?>

Added: trunk/src/common/docman/views/help.php
===================================================================
--- trunk/src/common/docman/views/help.php	                        (rev 0)
+++ trunk/src/common/docman/views/help.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+echo 'this is help';
+
+?>

Added: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	                        (rev 0)
+++ trunk/src/common/docman/views/listfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2000, Quentin Cregan/Sourceforge
+ * Copyright 2002-2003, Tim Perdue/GForge, LLC
+ * Copyright (C) 2010 Alcatel-Lucent
+ * 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
+ */
+
+require_once ('docman/include/utils.php');
+
+$dirid = getIntFromRequest('dirid');
+
+?>
+
+<script language="javascript">
+function displaySubGroup() {
+	if ( 'none' == document.getElementById('addsubdocgroup').style.display ) {
+		document.getElementById('addsubdocgroup').style.display = 'inline';
+	} else {
+		document.getElementById('addsubdocgroup').style.display = 'none';
+	}
+}
+function displayAddFile() {
+	if ( 'none' == document.getElementById('addfile').style.display ) {
+		document.getElementById('addfile').style.display = 'inline';
+	} else {
+		document.getElementById('addfile').style.display = 'none';
+	}
+}
+function displayEditDocGroup() {
+	if ( 'none' == document.getElementById('editdocgroup').style.display ) {
+		document.getElementById('editdocgroup').style.display = 'inline';
+	} else {
+		document.getElementById('editdocgroup').style.display = 'none';
+	}
+}
+function displayEditFile(id) {
+	var divid = 'editfile'+id;
+	if ( 'none' == document.getElementById(divid).style.display ) {
+		document.getElementById(divid).style.display = 'inline';
+	} else {
+		document.getElementById(divid).style.display = 'none';
+	}
+}
+</script>
+
+<?php
+echo '<h3>Directory : <i>'.getNameDocGroup($dirid,$group_id).'</i>&nbsp;';
+if (forge_check_perm ('docman', $group_id, 'approve')) {
+	echo '<a href="#" onclick="javascript:displayEditDocGroup()" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
+	echo '<a href="#" onclick="javascript:displaySubGroup()" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
+	echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
+	if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
+		echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'">'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
+}
+
+if (forge_check_perm ('docman', $group_id, 'submit'))
+	echo '<a href="#" onclick="javascript:displayAddFile()" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
+
+echo '</h3>';
+
+echo '<div id="editdocgroup" style="display:none">';
+include ('docman/views/editdocgroup.php');
+echo '</div>';
+echo '<div id="addsubdocgroup" style="display:none">';
+include ('docman/views/addsubdocgroup.php');
+echo '</div>';
+echo '<div id="addfile" style="display:none">';
+include ('docman/views/addfile.php');
+echo '</div>';
+
+if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
+	echo '<table style="width:100%">';
+	echo '<tr>';
+	echo '<td>Type</td>'
+		.'<td>Filename</td>'
+		.'<td>Title</td>'
+		.'<td>Description</td>'
+		.'<td>Author</td>'
+		.'<td>Last time</td>'
+		.'<td>Etat</td>'
+		.'<td>Size</td>';
+
+	if (forge_check_perm ('docman', $group_id, 'approve'))
+		echo '<td>Actions</td>';
+
+	echo '</tr>';
+	$time_new = 604800;
+	foreach ($nested_docs[$dirid] as $d) {
+		echo '<tr>';
+		$docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
+		echo '<td><a href="'.$docurl.'">';
+		switch ($d->getFileType()) {
+			case "image/png":
+			case "image/jpeg":
+				echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
+				break;
+			case "application/pdf":
+				echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
+				break;
+			default:
+				echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
+		}
+		echo '</a></td>';
+		echo '<td>';
+		if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
+			echo html_image('docman/new.png',14,14,array('alt'=>'new'));
+		}
+		echo '&nbsp;'.$d->getFileName();
+		echo '</td>';
+		echo '<td>'.$d->getName().'</td>';
+		echo '<td>'.$d->getDescription().'</td>';
+		echo '<td>'.$d->getCreatorRealName().'</td>';
+		echo '<td>';
+		if ( $d->getUpdated() ) {
+			echo date(_('Y-m-d H:i'),$d->getUpdated());
+		} else {
+			echo date(_('Y-m-d H:i'),$d->getCreated());
+		}
+		echo '</td>';
+		echo '<td>'.$d->getStateName().'</td>';
+		echo '<td>';
+		if ($d->getFileSize() > 1024 ) {
+			echo floor ($d->getFilesize()/1024) . "KB";
+		} else {
+			echo $d->getFilesize() . "B";
+		}
+		echo '</td>';
+
+		if (forge_check_perm ('docman', $group_id, 'approve')) {
+			echo '<td>';
+			echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'">'.html_image('docman/trash-empty.png',22,22,array('alt'=>'trashfile')). '</a>';
+			echo '<a href="#" onclick="javascript:displayEditFile(\''.$d->getID().'\')" >'.html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')). '</a>';
+			echo '</td>';
+		}
+		echo '</tr>';
+	}
+	echo '</table>';
+	echo '<div >'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
+	include 'docman/views/editfile.php';
+}
+
+?>

Added: trunk/src/common/docman/views/listpendingfile.php
===================================================================
--- trunk/src/common/docman/views/listpendingfile.php	                        (rev 0)
+++ trunk/src/common/docman/views/listpendingfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$df = new DocumentFactory($g);
+if ($df->isError())
+    exit_error(_('Error'),$df->getErrorMessage());
+
+$df->setStateID('3');
+
+$d_arr =& $df->getDocuments();
+
+if (!$d_arr || count($d_arr) < 1) {
+    echo '<div class="warning_msg">'._('No pending documents').'</div>';
+} else {
+	docman_display_documents($nested_groups,$df,true,3,0);
+}
+
+?>

Added: trunk/src/common/docman/views/listtrashfile.php
===================================================================
--- trunk/src/common/docman/views/listtrashfile.php	                        (rev 0)
+++ trunk/src/common/docman/views/listtrashfile.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$df = new DocumentFactory($g);
+if ($df->isError())
+    exit_error(_('Error'),$df->getErrorMessage());
+
+$dgf = new DocumentGroupFactory($g);
+if ($dgf->isError())
+    exit_error(_('Error'),$dgf->getErrorMessage());
+
+$df->setStateID('2');
+
+$d_arr =& $df->getDocuments();
+
+if (!$d_arr || count($d_arr) < 1) {
+    echo '<div class="warning_msg">'._('Trash is empty').'</div>';
+} else {
+	docman_display_trash($dgf);
+}
+
+?>

Added: trunk/src/common/docman/views/menu.php
===================================================================
--- trunk/src/common/docman/views/menu.php	                        (rev 0)
+++ trunk/src/common/docman/views/menu.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 1999-2001, VA Linux Systems
+ * Copyright 2000, Quentin Cregan/SourceForge
+ * Copyright 2002-2004, GForge Team
+ * 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
+ */
+
+/* create the submenu following role, rules and content */
+$menu_text=array();
+$menu_links=array();
+
+$menu_text[]=_('Submit new documentation');
+$menu_links[]='/docman/?group_id='.$group_id.'&view=addfile';
+if (session_loggedin()) {
+	$menu_text[]=_('Add new documentation group');
+	$menu_links[]='/docman/?group_id='.$group_id.'&view=addsubdocgroup';
+}
+
+if ($g->useDocmanSearch()) {
+	if ($d_arr || count($d_arr) > 1) {
+		$menu_text[]=_('Search in documents');
+		$menu_links[]='/docman/?group_id='.$group_id.'&view=search';
+	}
+}
+
+if (forge_check_perm ('docman', $group_id, 'approve')) {
+	$menu_text[]=_('Admin');
+	$menu_links[]='/docman/?group_id='.$group_id.'&view=admin';
+}
+
+echo $HTML->subMenu( $menu_text, $menu_links);
+
+plugin_hook ("blocks", "doc index");
+
+?>

Added: trunk/src/common/docman/views/search.php
===================================================================
--- trunk/src/common/docman/views/search.php	                        (rev 0)
+++ trunk/src/common/docman/views/search.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,187 @@
+<?php
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2000, Quentin Cregan/Sourceforge
+ * Copyright 2002-2003, Tim Perdue/GForge, LLC
+ * Copyright 2005, Fabio Bertagnin
+ * 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
+ */
+
+/* NEED A REAL REWRITE */
+require_once $gfwww.'docman/include/vtemplate.class.php';
+
+$is_editor = forge_check_perm ('docman', $g->getID(), 'admin') ;
+
+$vtp = new VTemplate;
+$handle = $vtp->Open("search.tpl.html");
+$vtp->NewSession($handle,"MAIN");
+
+$allchecked = ""; $onechecked = ""; 
+if (getStringFromPost('search_type') == "one") {$onechecked = "checked";}
+else {$allchecked = "checked";}
+$vtp->AddSession($handle,"FORMSEARCH");
+$vtp->SetVar($handle,"FORMSEARCH.TITLE",_('Search in documents'));
+$vtp->SetVar($handle,"FORMSEARCH.GROUP_ID",$_GET["group_id"]);
+$vtp->SetVar($handle,"FORMSEARCH.TEXTSEARCH",getStringFromPost("textsearch"));
+$vtp->SetVar($handle,"FORMSEARCH.ALLCHECKED",$allchecked);
+$vtp->SetVar($handle,"FORMSEARCH.ONECHECKED",$onechecked);
+$vtp->SetVar($handle,"FORMSEARCH.SUBMIT_PROMPT",_('Search'));
+$vtp->SetVar($handle,"FORMSEARCH.SEARCH_ALL_WORDS",_('With all the words'));
+$vtp->SetVar($handle,"FORMSEARCH.SEARCH_ONE_WORD",_('With at least one of words'));
+$vtp->CloseSession($handle,"FORMSEARCH");
+
+if (getStringFromPost('cmd') == "search")
+{
+	
+	$textsearch = getStringFromPost("textsearch");
+	$textsearch = prepare_search_text ($textsearch);
+	$mots = preg_split("/[\s,]+/",$textsearch);
+	$qpa = db_construct_qpa (false, 'SELECT filename, docid, doc_data.stateid as stateid, doc_states.name as statename, title, description, createdate, updatedate, doc_group, group_id FROM doc_data JOIN doc_states ON doc_data.stateid = doc_states.stateid') ;
+
+	if (getStringFromPost('search_type') == "one") {
+		if (count($mots) > 0) {
+			$qpa = db_construct_qpa ($qpa, ' AND (FALSE') ;
+			foreach ($mots as $mot) {
+				$mot = strtolower($mot); 
+				$qpa = db_construct_qpa ($qpa, ' OR title LIKE $1 OR description LIKE $1 OR data_words LIKE $1',
+							 array ("%$mot%")) ;
+			}
+			$qpa = db_construct_qpa ($qpa, ')') ;
+		}
+	} else {
+		// search_type = all
+		if (count($mots) > 0) {
+			$qpa = db_construct_qpa ($qpa, ' AND (TRUE') ;
+			foreach ($mots as $mot) {
+				$mot = strtolower($mot); 
+				$qpa = db_construct_qpa ($qpa, ' AND (title LIKE $1 OR description LIKE $1 OR data_words LIKE $1)',
+							 array ("%$mot%")) ;
+			}
+			$qpa = db_construct_qpa ($qpa, ')') ;
+		}
+	}
+
+	if (!$is_editor) {
+		$qpa = db_construct_qpa ($qpa, ' AND doc_data.stateid = 1') ;
+	} else {
+		$qpa = db_construct_qpa ($qpa, ' AND doc_data.stateid != 2') ;
+	}
+	
+	$qpa = db_construct_qpa ($qpa, 'AND group_id = $1',
+				 array (getIntFromRequest ('group_id'))) ;
+	$qpa = db_construct_qpa ($qpa, 'ORDER BY updatedate, createdate') ;
+	$resarr = array();
+	$result = db_query_qpa ($qpa);
+	if (!$result) {
+		$vtp->AddSession($handle,"MESSAGE");
+		$vtp->SetVar($handle,"MESSAGE.TEXT",_('Database query error'));
+		$vtp->CloseSession($handle,"MESSAGE");
+	} elseif (db_numrows($result) < 1) {
+		$vtp->AddSession($handle,"MESSAGE");
+		$vtp->SetVar($handle,"MESSAGE.TEXT",_('Your search did not match any documents'));
+		$vtp->CloseSession($handle,"MESSAGE");
+	} else {
+		while ($arr = db_fetch_array($result)) {
+			$resarr[] = $arr;
+		}
+	}
+	db_free_result($result);
+ 	// print_debug ($sql);
+	// need groups infos
+	$groupsarr = array();
+	$result = db_query_params ('SELECT doc_group, groupname, parent_doc_group FROM doc_groups WHERE group_id=$1',
+				   array (getIntFromRequest ('group_id')));
+	if ($result && db_numrows($result) > 0) {
+		while ($arr = db_fetch_array($result)) {
+			$groupsarr[] = $arr;
+		}
+	}
+	db_free_result($result);
+	
+	$vtp->AddSession($handle,"RESULTSEARCH");
+	$count = 0;
+	foreach ($resarr as $item) {
+		$count++;
+		$vtp->AddSession($handle,"RESULT");
+		$vtp->SetVar($handle,"RESULT.N",$count);
+		$vtp->SetVar($handle,"RESULT.SEARCHTITLE",$item["title"]);
+		$vtp->SetVar($handle,"RESULT.SEARCHCOMMENT",$item["description"]);
+		$s = get_path_document ($groupsarr, $item["doc_group"], "$_GET[group_id]");
+		$vtp->SetVar($handle,"RESULT.SEARCHPATH",$s);
+		$vtp->SetVar($handle,"RESULT.GROUP_ID",$_GET["group_id"]);
+		$vtp->SetVar($handle,"RESULT.DOC_ID",$item["docid"]);
+		$vtp->SetVar($handle,"RESULT.FILE_NAME",urlencode($item["filename"]));
+		if ($is_editor) $vtp->SetVar($handle,"RESULT.STATE",$item["statename"]);
+		$vtp->CloseSession($handle,"RESULT");
+	}
+	$vtp->CloseSession($handle,"RESULTSEARCH");
+}
+
+$vtp->CloseSession($handle,"MAIN");
+$vtp->Display();
+
+// print_debug (print_r($_POST,true));
+// print_debug (print_r($groupsarr,true));
+
+function print_debug ($text) {
+	echo "<pre>$text</pre>";
+}
+
+function get_path_document ($groupsarr, $doc_group, $group_id) {
+	$rep = "";
+	foreach ($groupsarr as $group) {
+		if ($group["doc_group"] == $doc_group)
+		{
+			if ($group["parent_doc_group"] == 0) 
+			{
+				$href = util_make_url ("docman/?group_id=$group_id&view=listfile&dirid=$group[doc_group]");
+				$rep .= "<a href=\"$href\" style=\"color:#00610A;\">$group[groupname]</a>";
+				break;
+			}
+			$s = get_path_document ($groupsarr,  $group["parent_doc_group"], $group_id);
+			$href = util_make_url ("docman/?group_id=$group_id&view=listfile&dirid=$group[doc_group]");
+			$rep .= "$s / <a href=\"$href\" style=\"color:#00610A;\">$group[groupname]</a>";
+			break;
+		}
+	}
+	return $rep;
+}
+
+function prepare_search_text ($text) {
+	
+	$rep = $text; 
+	$rep = utf8_decode($rep);
+	$rep = preg_replace ("/é/", "/e/", $rep);
+	$rep = preg_replace ("/è/", "/e/", $rep);
+	$rep = preg_replace ("/ê/", "/e/", $rep);
+	$rep = preg_replace ("/à/", "/a/", $rep);
+	$rep = preg_replace ("/ù/", "/u/", $rep);
+	$rep = preg_replace ("/ç/", "/c/", $rep);
+	$rep = preg_replace ("/é/", "/e/", $rep);
+	$rep = strtolower ($rep);
+	return $rep;
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/src/common/docman/views/tree.php
===================================================================
--- trunk/src/common/docman/views/tree.php	                        (rev 0)
+++ trunk/src/common/docman/views/tree.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+require_once ('docman/DocumentFactory.class.php');
+require_once ('docman/DocumentGroupFactory.class.php');
+require_once ('docman/include/utils.php');
+
+$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;
+	//put the doc objects into an array keyed off the docgroup
+	foreach ($d_arr as $doc) {
+		$nested_docs[$doc->getDocGroupID()][] = $doc;
+	}
+	echo '<div id="documenttree" style="height:100%">';
+	echo '<h3>Document Tree</h3>';
+?>
+<script language="JavaScript"><!--
+	var myThemeXPBase = "<?php echo util_make_uri ('/jscook/ThemeXP/'); ?>";
+--></script>
+<script language="JavaScript" src="<?php echo util_make_uri ('/jscook/JSCookTree.js'); ?>"></script>
+<link rel="stylesheet" href="<?php echo util_make_uri ('/jscook/ThemeXP/theme.css'); ?>" type="text/css" />
+<script src="<?php echo util_make_uri ('/jscook/ThemeXP/theme.js'); ?>" type="text/javascript"></script>
+
+<div id="myMenuID" style="overflow:auto; height:300px"></div>
+<!-- if someone wants to make it dynamic.... please do it -->
+	<!--<script language="Javascript">
+		var mymenuidDiv = document.getElementById("myMenuID");
+		var documenttreeDiv = document.getElementById("documenttree");
+		mymenuidDiv.style.height = documenttreeDiv.offsetHeight+"px";
+	</script>-->
+
+<script language="JavaScript"><!--
+	var myMenu =
+		[
+			['<span class="JSCookTreeFolderClosed"><i><img alt="" src="' + ctThemeXPBase + 'folder1.gif" /></i></span><span id="ctItemID0" class="JSCookTreeFolderOpen"><i><img alt="" src="' + ctThemeXPBase + 'folderopen1.gif" /></i></span>', '/', '#', '', '', <?php docman_recursive_display(0); ?>
+			]
+		];
+
+	var treeIndex = ctDraw ('myMenuID', myMenu, ctThemeXP1, 'ThemeXP', 0, 1);
+	ctExposeTreeIndex (treeIndex, <?php echo $idExposeTreeIndex ?>);
+	var openItem = ctGetSelectedItem (treeIndex)
+	ctOpenFolder (openItem)
+--></script>
+<?php
+	echo '</div>';
+}
+?>

Added: trunk/src/common/docman/views/views.php
===================================================================
--- trunk/src/common/docman/views/views.php	                        (rev 0)
+++ trunk/src/common/docman/views/views.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * FusionForge Documentation Manager
+ *
+ * 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
+ */
+
+$view = getStringFromRequest('view');
+switch ($view) {
+	case 'addfile':
+	case 'addsubdocgroup':
+	case 'admin':
+	case 'editdocgroup':
+	case 'editfile':
+	case 'listfile':
+	case 'trashdir':
+	case 'search':
+		include ("docman/views/$view.php");
+		break;
+	default:
+		include ("docman/views/help.php");
+}
+?>

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/common/include/Group.class.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -561,7 +561,7 @@
 
 		//XXX not yet actived logo_image_id='$logo_image_id', 
 		$res = db_query_params ('UPDATE groups
-			SET 	group_name=$1,
+			SET group_name=$1,
 				homepage=$2,
 				short_description=$3,
 				use_mail=$4,
@@ -572,7 +572,7 @@
 				use_scm=$9,
 				use_news=$10,
 				use_docman=$11,
-                                is_public=$12,
+				is_public=$12,
 				new_doc_address=$13,
 				send_all_docs=$14,
 				use_ftp=$15,
@@ -1144,7 +1144,20 @@
 			return false;
 		}
 	}
+	/**
+	 *  usesDocmanSearch - whether or not this group has opted to use docman search engine.
+	 *
+	 *  @return	boolean	use_docman_search.
+	 */
+	function useDocmanSearch() {
 
+		if (forge_get_config('use_docman')) {
+			return $this->data_array['use_docman_search'];
+		} else {
+			return false;
+		}
+	}
+
 	/**
 	 *  usesFTP - whether or not this group has opted to use FTP.
 	 *
@@ -2626,6 +2639,42 @@
 
 		return $users;
 	}
+
+	function setDocmanSearchStatus($status) {
+		db_begin();
+		/* if we activate search engine, we probably want to reindex */
+		$res = db_query_params ('UPDATE groups SET use_docman_search=$1, force_docman_reindex=$1 WHERE group_id=$2',
+					array ($status,
+					       $this->getID())) ;
+	
+		if (!$res) {
+			$this->setError(sprintf(_('ERROR - Could Not Update Group UseDocmanSearch Status: %s'),db_error()));
+			db_rollback();
+			return false;
+		} else {
+			$this->data_array['use_docman_search']=$status;
+			db_commit();
+			return true;
+		}
+	}
+
+	function setDocmanForceReindexSearch($status) {
+		db_begin();
+		/* if we activate search engine, we probably want to reindex */
+		$res = db_query_params ('UPDATE groups SET force_docman_reindex=$1 WHERE group_id=$2',
+					array ($status,
+					       $this->getID())) ;
+	
+		if (!$res) {
+			$this->setError(sprintf(_('ERROR - Could Not Update Group force_docman_reindex %s'),db_error()));
+			db_rollback();
+			return false;
+		} else {
+			$this->data_array['force_docman_reindex']=$status;
+			db_commit();
+			return true;
+		}
+	}
 }
 
 /**

Added: trunk/src/db/20100730-docman.sql
===================================================================
--- trunk/src/db/20100730-docman.sql	                        (rev 0)
+++ trunk/src/db/20100730-docman.sql	2010-07-30 13:18:48 UTC (rev 10291)
@@ -0,0 +1,9 @@
+ALTER TABLE GROUPS ADD COLUMN use_docman_search INT;
+ALTER TABLE GROUPS ALTER COLUMN use_docman_search SET DEFAULT 1;
+UPDATE GROUPS SET use_docman_search = 1;
+ALTER TABLE GROUPS ADD COLUMN force_docman_reindex INT;
+ALTER TABLE GROUPS ALTER COLUMN force_docman_reindex SET DEFAULT 0;
+UPDATE GROUPS SET force_docman_reindex = 0;
+ALTER TABLE DOC_GROUPS ADD COLUMN stateid INT;
+ALTER TABLE DOC_GROUPS ADD COLUMN stateid SET DEFAULT 1;
+UPDATE DOC_GROUPS SET stateid = 1;

Modified: trunk/src/www/docman/index.php
===================================================================
--- trunk/src/www/docman/index.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/www/docman/index.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -25,118 +25,59 @@
 
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'docman/include/doc_utils.php';
-require_once $gfcommon.'docman/DocumentFactory.class.php';
-require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
 
-/*
-	EXPERIMENTAL CODE TO USE JAVASCRIPT TREE
-*/
-function docman_recursive_display($docgroup) {
-	global $nested_groups,$nested_docs,$group_id;
-	if (is_array(@$nested_groups[$docgroup])) {
-		foreach ($nested_groups[$docgroup] as $dg) {
-			if (isset($nested_docs[$dg->getID()]) && is_array($nested_docs[$dg->getID()])) {
-				echo "
-		['".'<span class="JSCookTreeFolderClosed"><i><img alt="" src="\' + ctThemeXPBase + \'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="\' + ctThemeXPBase + \'folderopen1.gif"></i></span>'."', '".addslashes($dg->getName())."', '#', '', '',";
-				docman_recursive_display($dg->getID());
-				foreach ($nested_docs[$dg->getID()] as $d) {
-					$docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
-					$docname=addslashes($d->getName())." (".htmlspecialchars($d->getFileName(), ENT_QUOTES).")";
-					$docdesc=addslashes($d->getDescription());
-					echo ",['','".$docname."','".$docurl."','','".$docdesc."' ]";
-				}
-				echo ",
-		],";
-			}
-	
-		}
-	}
-}
+/* are we using docman ? */
+if (!forge_get_config('use_docman'))
+	exit_disabled();
 
+/* get informations from request or $_POST */
 $group_id = getIntFromRequest('group_id');
 $feedback = getStringFromRequest('feedback');
 
+/* validate group */
 if (!$group_id) {
-    exit_no_group();
+	exit_no_group();
 }
 $g =& group_get_object($group_id);
 if (!$g || !is_object($g) || $g->isError()) {
 	exit_no_group();
 }
 
-$df = new DocumentFactory($g);
-if ($df->isError()) {
-	exit_error(_('Error'),$df->getErrorMessage());
-}
+/* is this group using docman ? */
+if (!$g->usesDocman())
+	exit_error(_('Error'),_('This project has turned off the Doc Manager.'));
 
-$dgf = new DocumentGroupFactory($g);
-if ($dgf->isError()) {
-	exit_error(_('Error'),$dgf->getErrorMessage());
+/* everything sounds ok, now let do the job */
+$action = getStringFromRequest('action');
+switch ($action) {
+	case "addfile":
+	case "addsubdocgroup":
+	case "deldir":
+	case "editdocgroup":
+	case "editfile":
+	case "forcereindexenginesearch":
+	case "emptytrash":
+	case "trashdir":
+	case "trashfile":
+	case "updateenginesearch":
+		include ("docman/actions/$action.php");
+		;;
 }
 
+$title = _('Document Manager: Display Document');
 
-// check if the user is docman's admin
-if (forge_check_perm ('docman', $group_id, 'approve')) {
-	$is_editor = true;
-} else {
-	$is_editor = false;
-}
+site_project_header(array('title'=>$title,'group'=>$group_id,'toptab'=>'docman'));
 
-docman_header(_('Document Manager: Display Document'),_('Project: %1$s'));
-echo '<h1>'.sprintf(_('Documents for %1$s'), $g->getPublicName()) .'</h1>';
+echo '<div style="float:left; width:20%;">';
+include('docman/views/tree.php');
+echo '</div>';
 
-$d_arr =& $df->getDocuments();
-if (!$d_arr || count($d_arr) <1){
-	$d_arr = &$df->getDocuments();
-}
+echo '<div style="float:right; width:78%;">';
+include('docman/views/menu.php');
+include('docman/views/views.php');
+echo '</div>';
 
-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();	
+echo '<div style="clear:both; margin-bottom:5px;" />';
+site_project_footer(array());
 
-	$nested_docs=array();
-	//put the doc objects into an array keyed off the docgroup
-	foreach ($d_arr as $doc) {
-		$nested_docs[$doc->getDocGroupID()][] = $doc;
-	}
-	?>
-	<script language="JavaScript"><!--
-	var myThemeXPBase = "<?php echo util_make_uri ('/jscook/ThemeXP/'); ?>";
-	--></script>
-	<script language="JavaScript" src="<?php echo util_make_uri ('/jscook/JSCookTree.js'); ?>"></script>
-	<link rel="stylesheet" href="<?php echo util_make_uri ('/jscook/ThemeXP/theme.css'); ?>" type="text/css" />
-	<script src="<?php echo util_make_uri ('/jscook/ThemeXP/theme.js'); ?>" type="text/javascript"></script>
-
-	<br>
-	<form action="">
-		<input style="width: 100px" type="button" value="<?php echo _('expand all'); ?>" onclick="ctExpandTree('myMenuID',9);" />
-		<input style="width: 100px" type="button" value="<?php echo _('collapse all'); ?>" onclick="ctCollapseTree('myMenuID');" />
-	</form>
-	<br>
-	<div id="myMenuID"></div>
-
-	<script language="JavaScript"><!--
-	var myMenu =
-	[
-		['<span class="JSCookTreeFolderClosed"><i><img alt="" src="' + ctThemeXPBase + 'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="' + ctThemeXPBase + 'folderopen1.gif" /></i></span>', '/', '#', '', '', <?php docman_recursive_display(0); ?>
-		]
-	];
-	ctDraw ('myMenuID', myMenu, ctThemeXP1, 'ThemeXP', 0, 1);
-	--></script>
-
-	<noscript>
-		<?php docman_display_documents($nested_groups,$df,$is_editor); ?>
-	</noscript>
-	<?php
-}
-docman_footer(array());
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
 ?>

Modified: trunk/src/www/docman/search.php
===================================================================
--- trunk/src/www/docman/search.php	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/www/docman/search.php	2010-07-30 13:18:48 UTC (rev 10291)
@@ -95,9 +95,7 @@
 			}
 			$qpa = db_construct_qpa ($qpa, ')') ;
 		}
-	}
-	else
-	{
+	} else {
 		// search_type = all
 		if (count($mots) > 0)
 		{
@@ -111,9 +109,11 @@
 			$qpa = db_construct_qpa ($qpa, ')') ;
 		}
 	}
-	if (!$is_editor)
-	{
+
+	if (!$is_editor) {
 		$qpa = db_construct_qpa ($qpa, ' AND doc_data.stateid = 1') ;
+	} else {
+		$qpa = db_construct_qpa ($qpa, ' AND doc_data.stateid != 2') ;
 	}
 	
 	$qpa = db_construct_qpa ($qpa, 'AND group_id = $1',
@@ -197,12 +197,12 @@
 		{
 			if ($group["parent_doc_group"] == 0) 
 			{
-				$href = util_make_url ("/docman/index.php?group_id=$group_id&selected_doc_group_id=$group[doc_group]");
+				$href = util_make_url ("?group_id=$group_id&view=listfile&dirid=$group[doc_group]");
 				$rep .= "<a href=\"$href\" style=\"color:#00610A;\">$group[groupname]</a>";
 				break;
 			}
 			$s = get_path_document ($groupsarr,  $group["parent_doc_group"], $group_id);
-			$href = util_make_url ("/docman/index.php?group_id=$group_id&selected_doc_group_id=$group[doc_group]");
+			$href = util_make_url ("?group_id=$group_id&view=listfile&dirid=$group[doc_group]");
 			$rep .= "$s / <a href=\"$href\" style=\"color:#00610A;\">$group[groupname]</a>";
 			break;
 		}

Modified: trunk/src/www/docman/search.tpl.html
===================================================================
--- trunk/src/www/docman/search.tpl.html	2010-07-29 14:41:48 UTC (rev 10290)
+++ trunk/src/www/docman/search.tpl.html	2010-07-30 13:18:48 UTC (rev 10291)
@@ -1,6 +1,6 @@
 <!--VTP_MAIN-->
 <!--VTP_FORMSEARCH-->
-<form action="search.php?group_id={#GROUP_ID}" method="POST">
+<form action="?group_id={#GROUP_ID}&view=search" method="POST">
 <input type="hidden" name="cmd" value="search" />
 <table width="98%" cellpadding="2" cellspacing="0" border="0">
 <tr>

Added: trunk/src/www/themes/gforge/images/docman/configure-directory.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/configure-directory.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/delete-directory.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/delete-directory.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/directory.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/directory.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/edit-file.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/edit-file.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/file_type_image.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/file_type_image.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/file_type_pdf.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/file_type_pdf.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/file_type_unknown.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/file_type_unknown.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/image-x-generic.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/image-x-generic.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/insert-directory.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/insert-directory.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/insert-file.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/insert-file.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/new.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/new.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/www/themes/gforge/images/docman/trash-empty.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/www/themes/gforge/images/docman/trash-empty.png
___________________________________________________________________
Added: svn:mime-type
   + image/png




More information about the Fusionforge-commits mailing list