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 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
118 echo '<td><a href="'.$docurl.'">';
119 switch ($d->getFileType()) {
124 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
126 case "application/pdf":
127 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
130 echo html_image('docman/file_type_html.png',22,22,array('alt'=>$d->getFileType()));
133 echo html_image('docman/file_type_plain.png',22,22,array('alt'=>$d->getFileType()));
135 case "application/msword":
136 case "application/vnd.oasis.opendocument.text":
137 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
139 case "application/vnd.ms-excel":
140 case "application/vnd.oasis.opendocument.spreadsheet":
141 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
143 case "application/vnd.oasis.opendocument.presentation":
144 case "application/vnd.ms-powerpoint":
145 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
147 case "application/zip":
148 case "application/x-tar":
149 case "application/x-rpm":
150 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
153 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
157 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
158 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
160 echo ' '.$d->getFileName();
162 echo '<td>'.$d->getName().'</td>';
163 echo '<td>'.$d->getDescription().'</td>';
164 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
166 if ( $d->getUpdated() ) {
167 echo date(_('Y-m-d H:i'),$d->getUpdated());
169 echo date(_('Y-m-d H:i'),$d->getCreated());
172 echo '<td>'.$d->getStateName().'</td>';
175 $size = $d->getFileSize();
178 $size = floor ($size/1024);
181 $size = floor ($size/1024);
184 echo $size . $metric;
187 if (forge_check_perm ('docman', $group_id, 'approve')) {
189 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>';
190 echo '<a href="#" onclick="javascript:displayEditFile(\''.$d->getID().'\')" >'.html_image('docman/edit-file.png',22,22,array('alt'=>'editfile')). '</a>';
196 echo $HTML->listTableBottom();
198 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
199 include 'docman/views/editfile.php';