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 $nested_groups; // flat document directories array
34 global $HTML; // Layout object
36 $DocGroupName = getNameDocGroup($dirid,$group_id);
38 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
42 <script language="javascript">
43 function displaySubGroup() {
44 if ( 'none' == document.getElementById('addsubdocgroup').style.display ) {
45 document.getElementById('addsubdocgroup').style.display = 'block';
46 document.getElementById('addfile').style.display = 'none';
47 document.getElementById('editdocgroup').style.display = 'none';
49 document.getElementById('addsubdocgroup').style.display = 'none';
52 function displayAddFile() {
53 if ( 'none' == document.getElementById('addfile').style.display ) {
54 document.getElementById('addfile').style.display = 'block';
55 document.getElementById('addsubdocgroup').style.display = 'none';
56 document.getElementById('editdocgroup').style.display = 'none';
58 document.getElementById('addfile').style.display = 'none';
61 function displayEditDocGroup() {
62 if ( 'none' == document.getElementById('editdocgroup').style.display ) {
63 document.getElementById('editdocgroup').style.display = 'block';
64 document.getElementById('addsubdocgroup').style.display = 'none';
65 document.getElementById('addfile').style.display = 'none';
67 document.getElementById('editdocgroup').style.display = 'none';
70 function displayEditFile(id) {
71 var divid = 'editfile'+id;
72 if ( 'none' == document.getElementById(divid).style.display ) {
73 document.getElementById(divid).style.display = 'block';
75 document.getElementById(divid).style.display = 'none';
81 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
82 if (forge_check_perm ('docman', $group_id, 'approve')) {
83 echo '<a href="#" onclick="javascript:displayEditDocGroup()" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
84 echo '<a href="#" onclick="javascript:displaySubGroup()" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
85 //echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
86 if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
87 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'">'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
90 echo '<a href="#" onclick="javascript:displayAddFile()" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
94 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
95 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
96 include ('docman/views/editdocgroup.php');
98 echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
99 echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
100 include ('docman/views/addsubdocgroup.php');
102 echo '<div class="docman_div_include" id="addfile" style="display:none">';
103 echo '<h4 class="docman_h4">'. _('Add a new document') .'</h4>';
104 include ('docman/views/addfile.php');
107 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
108 $tabletop = array('','Filename','Title','Description','Author','Last time','Status','Size');
109 if (forge_check_perm ('docman', $group_id, 'approve'))
110 $tabletop[] = 'Actions';
111 echo '<div class="docmanDiv">';
112 echo $HTML->listTableTop($tabletop);
115 foreach ($nested_docs[$dirid] as $d) {
116 echo '<tr ' . $HTML->boxGetAltRowStyle($rowid).'>';
117 switch ($d->getFileType()) {
119 $docurl=$d->getFileName();
122 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
124 echo '<td><a href="'.$docurl.'">';
125 switch ($d->getFileType()) {
130 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
132 case "application/pdf":
133 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
137 echo html_image('docman/file_type_html.png',22,22,array('alt'=>$d->getFileType()));
140 echo html_image('docman/file_type_plain.png',22,22,array('alt'=>$d->getFileType()));
142 case "application/msword":
143 case "application/vnd.oasis.opendocument.text":
144 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
146 case "application/vnd.ms-excel":
147 case "application/vnd.oasis.opendocument.spreadsheet":
148 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
150 case "application/vnd.oasis.opendocument.presentation":
151 case "application/vnd.ms-powerpoint":
152 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
154 case "application/zip":
155 case "application/x-tar":
156 case "application/x-rpm":
157 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
160 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
164 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
165 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
167 echo ' '.$d->getFileName();
169 echo '<td>'.$d->getName().'</td>';
170 echo '<td>'.$d->getDescription().'</td>';
171 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
173 if ( $d->getUpdated() ) {
174 echo date(_('Y-m-d H:i'),$d->getUpdated());
176 echo date(_('Y-m-d H:i'),$d->getCreated());
179 echo '<td>'.$d->getStateName().'</td>';
181 switch ($d->getFileType()) {
187 $size = $d->getFileSize();
190 $size = floor ($size/1024);
193 $size = floor ($size/1024);
196 echo $size . $metric;
200 if (forge_check_perm ('docman', $group_id, 'approve')) {
202 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>';
203 echo '<a href="#" onclick="javascript:displayEditFile(\''.$d->getID().'\')" >'.html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')). '</a>';
209 echo $HTML->listTableBottom();
211 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
212 include 'docman/views/editfile.php';