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
33 global $HTML; // Layout object
35 $DocGroupName = getNameDocGroup($dirid,$group_id);
37 $feedback = $g->getErrorMessage();
38 Header('Location: '.util_make_url('/docman/?group_id='.$group_id.'&feedback='.urlencode($feedback)));
43 <script language="javascript">
44 function displaySubGroup() {
45 if ( 'none' == document.getElementById('addsubdocgroup').style.display ) {
46 document.getElementById('addsubdocgroup').style.display = 'block';
47 document.getElementById('addfile').style.display = 'none';
48 document.getElementById('editdocgroup').style.display = 'none';
50 document.getElementById('addsubdocgroup').style.display = 'none';
53 function displayAddFile() {
54 if ( 'none' == document.getElementById('addfile').style.display ) {
55 document.getElementById('addfile').style.display = 'block';
56 document.getElementById('addsubdocgroup').style.display = 'none';
57 document.getElementById('editdocgroup').style.display = 'none';
59 document.getElementById('addfile').style.display = 'none';
62 function displayEditDocGroup() {
63 if ( 'none' == document.getElementById('editdocgroup').style.display ) {
64 document.getElementById('editdocgroup').style.display = 'block';
65 document.getElementById('addsubdocgroup').style.display = 'none';
66 document.getElementById('addfile').style.display = 'none';
68 document.getElementById('editdocgroup').style.display = 'none';
71 function displayEditFile(id) {
72 var divid = 'editfile'+id;
73 if ( 'none' == document.getElementById(divid).style.display ) {
74 document.getElementById(divid).style.display = 'block';
76 document.getElementById(divid).style.display = 'none';
82 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
83 if (forge_check_perm ('docman', $group_id, 'approve')) {
84 echo '<a href="#" onclick="javascript:displayEditDocGroup()" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
85 echo '<a href="#" onclick="javascript:displaySubGroup()" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
86 echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
87 if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
88 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'">'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
91 echo '<a href="#" onclick="javascript:displayAddFile()" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
95 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
96 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
97 include ('docman/views/editdocgroup.php');
99 echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
100 echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
101 include ('docman/views/addsubdocgroup.php');
103 echo '<div class="docman_div_include" id="addfile" style="display:none">';
104 echo '<h4 class="docman_h4">'. _('Add a new document') .'</h4>';
105 include ('docman/views/addfile.php');
108 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
109 $tabletop = array('','Filename','Title','Description','Author','Last time','Status','Size');
110 if (forge_check_perm ('docman', $group_id, 'approve'))
111 $tabletop[] = 'Actions';
112 echo '<div class="docmanDiv">';
113 echo $HTML->listTableTop($tabletop);
116 foreach ($nested_docs[$dirid] as $d) {
117 echo '<tr ' . $HTML->boxGetAltRowStyle($rowid).'>';
118 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
119 echo '<td><a href="'.$docurl.'">';
120 switch ($d->getFileType()) {
125 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
127 case "application/pdf":
128 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
130 case "application/msword":
131 case "application/vnd.oasis.opendocument.text":
132 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
134 case "application/vnd.ms-excel":
135 case "application/vnd.oasis.opendocument.spreadsheet":
136 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
138 case "application/vnd.oasis.opendocument.presentation":
139 case "application/vnd.ms-powerpoint":
140 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
142 case "application/zip":
143 case "application/x-tar":
144 case "application/x-rpm":
145 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
148 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
152 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
153 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
155 echo ' '.$d->getFileName();
157 echo '<td>'.$d->getName().'</td>';
158 echo '<td>'.$d->getDescription().'</td>';
159 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
161 if ( $d->getUpdated() ) {
162 echo date(_('Y-m-d H:i'),$d->getUpdated());
164 echo date(_('Y-m-d H:i'),$d->getCreated());
167 echo '<td>'.$d->getStateName().'</td>';
170 $size = $d->getFileSize();
173 $size = floor ($size/1024);
176 $size = floor ($size/1024);
179 echo $size . $metric;
182 if (forge_check_perm ('docman', $group_id, 'approve')) {
184 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>';
185 echo '<a href="#" onclick="javascript:displayEditFile(\''.$d->getID().'\')" >'.html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')). '</a>';
191 echo $HTML->listTableBottom();
193 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
194 include 'docman/views/editfile.php';