4 * FusionForge Documentation Manager
6 * Copyright 2000, Quentin Cregan/Sourceforge
7 * Copyright 2002-2003, Tim Perdue/GForge, LLC
8 * Copyright (C) 2010 Alcatel-Lucent
9 * Copyright 2010, Franck Villaume
11 * This file is part of FusionForge.
13 * FusionForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * FusionForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with FusionForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 /* please do not add require here : use www/docman/index.php to add require */
29 /* global variables used */
30 global $group_id; // id of the group
31 global $dirid; // id of doc_group
32 global $nested_docs; // flat docs array
36 <script language="javascript">
37 function displaySubGroup() {
38 if ( 'none' == document.getElementById('addsubdocgroup').style.display ) {
39 document.getElementById('addsubdocgroup').style.display = 'inline';
41 document.getElementById('addsubdocgroup').style.display = 'none';
44 function displayAddFile() {
45 if ( 'none' == document.getElementById('addfile').style.display ) {
46 document.getElementById('addfile').style.display = 'inline';
48 document.getElementById('addfile').style.display = 'none';
51 function displayEditDocGroup() {
52 if ( 'none' == document.getElementById('editdocgroup').style.display ) {
53 document.getElementById('editdocgroup').style.display = 'inline';
55 document.getElementById('editdocgroup').style.display = 'none';
58 function displayEditFile(id) {
59 var divid = 'editfile'+id;
60 if ( 'none' == document.getElementById(divid).style.display ) {
61 document.getElementById(divid).style.display = 'inline';
63 document.getElementById(divid).style.display = 'none';
69 echo '<h3>Directory : <i>'.getNameDocGroup($dirid,$group_id).'</i> ';
70 if (forge_check_perm ('docman', $group_id, 'approve')) {
71 echo '<a href="#" onclick="javascript:displayEditDocGroup()" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
72 echo '<a href="#" onclick="javascript:displaySubGroup()" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
73 echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
74 if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
75 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'">'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
78 if (forge_check_perm ('docman', $group_id, 'submit'))
79 echo '<a href="#" onclick="javascript:displayAddFile()" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
83 echo '<div id="editdocgroup" style="display:none">';
84 include ('docman/views/editdocgroup.php');
86 echo '<div id="addsubdocgroup" style="display:none">';
87 include ('docman/views/addsubdocgroup.php');
89 echo '<div id="addfile" style="display:none">';
90 include ('docman/views/addfile.php');
93 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
94 echo '<table style="width:100%">';
99 .'<td>Description</td>'
101 .'<td>Last time</td>'
105 if (forge_check_perm ('docman', $group_id, 'approve'))
106 echo '<td>Actions</td>';
110 foreach ($nested_docs[$dirid] as $d) {
112 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
113 echo '<td><a href="'.$docurl.'">';
114 switch ($d->getFileType()) {
117 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
119 case "application/pdf":
120 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
123 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
127 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
128 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
130 echo ' '.$d->getFileName();
132 echo '<td>'.$d->getName().'</td>';
133 echo '<td>'.$d->getDescription().'</td>';
134 echo '<td>'.$d->getCreatorRealName().'</td>';
136 if ( $d->getUpdated() ) {
137 echo date(_('Y-m-d H:i'),$d->getUpdated());
139 echo date(_('Y-m-d H:i'),$d->getCreated());
142 echo '<td>'.$d->getStateName().'</td>';
145 $size = $d->getFileSize();
148 $size = floor ($size/1024);
151 $size = floor ($size/1024);
154 echo $size . $metric;
157 if (forge_check_perm ('docman', $group_id, 'approve')) {
159 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>';
160 echo '<a href="#" onclick="javascript:displayEditFile(\''.$d->getID().'\')" >'.html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')). '</a>';
166 echo '<div >'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
167 include 'docman/views/editfile.php';