3 * FusionForge Documentation Manager
5 * Copyright 2000, Quentin Cregan/Sourceforge
6 * Copyright 2002-2003, Tim Perdue/GForge, LLC
7 * Copyright 2010, Franck Villaume
9 * This file is part of FusionForge.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../env.inc.php');
27 require_once $gfwww.'include/pre.php';
28 require_once $gfwww.'docman/include/doc_utils.php';
29 require_once $gfcommon.'docman/DocumentFactory.class.php';
30 require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
33 EXPERIMENTAL CODE TO USE JAVASCRIPT TREE
35 function docman_recursive_display($docgroup) {
36 global $nested_groups,$nested_docs,$group_id;
37 if (is_array(@$nested_groups[$docgroup])) {
38 foreach ($nested_groups[$docgroup] as $dg) {
39 if (isset($nested_docs[$dg->getID()]) && is_array($nested_docs[$dg->getID()])) {
41 ['".'<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())."', '#', '', '',";
42 docman_recursive_display($dg->getID());
43 foreach ($nested_docs[$dg->getID()] as $d) {
44 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
45 $docname=addslashes($d->getName())." (".htmlspecialchars($d->getFileName(), ENT_QUOTES).")";
46 $docdesc=addslashes($d->getDescription());
47 echo ",['','".$docname."','".$docurl."','','".$docdesc."' ]";
57 $group_id = getIntFromRequest('group_id');
58 $feedback = getStringFromRequest('feedback');
63 $g =& group_get_object($group_id);
64 if (!$g || !is_object($g) || $g->isError()) {
68 $df = new DocumentFactory($g);
70 exit_error(_('Error'),$df->getErrorMessage());
73 $dgf = new DocumentGroupFactory($g);
74 if ($dgf->isError()) {
75 exit_error(_('Error'),$dgf->getErrorMessage());
79 // check if the user is docman's admin
80 if (forge_check_perm ('docman', $group_id, 'approve')) {
86 docman_header(_('Document Manager: Display Document'),_('Project: %1$s'));
87 echo '<h1>'.sprintf(_('Documents for %1$s'), $g->getPublicName()) .'</h1>';
89 $d_arr =& $df->getDocuments();
90 if (!$d_arr || count($d_arr) <1){
91 $d_arr = &$df->getDocuments();
94 if (!$d_arr || count($d_arr) < 1) {
95 print '<div class="warning_msg">'._('This project has no visible documents').'</div>';
97 // Get the document groups info
98 $nested_groups =& $dgf->getNested();
100 $nested_docs=array();
101 //put the doc objects into an array keyed off the docgroup
102 foreach ($d_arr as $doc) {
103 $nested_docs[$doc->getDocGroupID()][] = $doc;
106 <script language="JavaScript"><!--
107 var myThemeXPBase = "<?php echo util_make_uri ('/jscook/ThemeXP/'); ?>";
109 <script language="JavaScript" src="<?php echo util_make_uri ('/jscook/JSCookTree.js'); ?>"></script>
110 <link rel="stylesheet" href="<?php echo util_make_uri ('/jscook/ThemeXP/theme.css'); ?>" type="text/css" />
111 <script src="<?php echo util_make_uri ('/jscook/ThemeXP/theme.js'); ?>" type="text/javascript"></script>
115 <input style="width: 100px" type="button" value="<?php echo _('expand all'); ?>" onclick="ctExpandTree('myMenuID',9);" />
116 <input style="width: 100px" type="button" value="<?php echo _('collapse all'); ?>" onclick="ctCollapseTree('myMenuID');" />
119 <div id="myMenuID"></div>
121 <script language="JavaScript"><!--
124 ['<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); ?>
127 ctDraw ('myMenuID', myMenu, ctThemeXP1, 'ThemeXP', 0, 1);
131 <?php docman_display_documents($nested_groups,$df,$is_editor); ?>
135 docman_footer(array());
139 // c-file-style: "bsd"