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 - Capgemini
10 * http://fusionforge.org
12 * This file is part of FusionForge.
14 * FusionForge is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * FusionForge is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with FusionForge; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 /* please do not add require here : use www/docman/index.php to add require */
30 /* global variables used */
31 global $group_id; // id of the group
32 global $dirid; // id of doc_group
33 global $nested_docs; // flat docs array
34 global $nested_groups; // flat document directories array
35 global $HTML; // Layout object
36 global $LUSER; // User object
38 $DocGroupName = getNameDocGroup($dirid,$group_id);
40 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
44 <!-- do not use : text/javascript : it's broken -->
45 <script language="javascript">
48 jQuery(document).ready(function() {
49 controller = new DocManListFileController({
50 groupId: <?php echo $group_id ?>,
52 {selector: '#docman-addnewfile', options:{delayIn: 1000, delayOut: 500, fade: true}},
53 {selector: '#docman-addsubdirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
54 {selector: '#docman-editdirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
55 {selector: '#docman-deletedirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
56 {selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 1000, delayOut: 500, fade: true}},
57 {selector: '.docman-reserveddocument', options:{delayIn: 1000, delayOut: 500, fade: true}},
58 {selector: '.docman-movetotrash', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, fade: true}},
59 {selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, fade: true}},
60 {selector: '.docman-releasereservation', options:{gravity: 'ne',delayIn: 1000, delayOut: 500, fade: true}},
61 {selector: '.docman-reservefile', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, fade: true}}
64 divAddDirectory: jQuery('#addsubdocgroup'),
65 divAddFile: jQuery('#addfile'),
66 divEditDirectory: jQuery('#editdocgroup'),
67 buttonAddDirectory: jQuery('#docman-addsubdirectory'),
68 buttonAddNewFile: jQuery('#docman-addnewfile'),
69 buttonEditDirectory: jQuery('#docman-editdirectory'),
70 docManURL: '<?php util_make_url("docman") ?>',
71 lockIntervalDelay: 60000 //ms
78 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
79 if (forge_check_perm ('docman', $group_id, 'approve')) {
80 echo '<a href="#" id="docman-editdirectory" title="'._('Edit this directory').'">'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
81 echo '<a href="#" id="docman-addsubdirectory" title="'._('Add a new subdirectory').'">'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
82 //echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
83 if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
84 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" title="'._('Permanently delete this directory').'" >'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
87 if (forge_check_perm ('docman', $group_id, 'submit')) {
88 echo '<a href="#" id="docman-addnewfile" title="'. _('Add a new file') . '" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
93 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
94 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
95 include ($gfcommon.'docman/views/editdocgroup.php');
97 echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
98 echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
99 include ($gfcommon.'docman/views/addsubdocgroup.php');
101 echo '<div class="docman_div_include" id="addfile" style="display:none">';
102 echo '<h4 class="docman_h4">'. _('Add a new document') .'</h4>';
103 include ($gfcommon.'docman/views/addfile.php');
106 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
107 $tabletop = array('','Filename','Title','Description','Author','Last time','Status','Size');
108 if (forge_check_perm ('docman', $group_id, 'approve'))
109 $tabletop[] = 'Actions';
110 echo '<div class="docmanDiv">';
111 echo $HTML->listTableTop($tabletop);
114 foreach ($nested_docs[$dirid] as $d) {
115 echo '<tr ' . $HTML->boxGetAltRowStyle($rowid).'>';
116 switch ($d->getFileType()) {
118 $docurl=$d->getFileName();
121 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
123 echo '<td><a href="'.$docurl.'" class="docman-viewfile" title="'._('View this file').'" >';
124 switch ($d->getFileType()) {
129 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
131 case "application/pdf":
132 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
136 echo html_image('docman/file_type_html.png',22,22,array('alt'=>$d->getFileType()));
139 echo html_image('docman/file_type_plain.png',22,22,array('alt'=>$d->getFileType()));
141 case "application/msword":
142 case "application/vnd.oasis.opendocument.text":
143 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
145 case "application/vnd.ms-excel":
146 case "application/vnd.oasis.opendocument.spreadsheet":
147 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
149 case "application/vnd.oasis.opendocument.presentation":
150 case "application/vnd.ms-powerpoint":
151 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
153 case "application/zip":
154 case "application/x-tar":
155 case "application/x-rpm":
156 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
159 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
163 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
164 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
166 echo ' '.$d->getFileName();
168 echo '<td>'.$d->getName().'</td>';
169 echo '<td>'.$d->getDescription().'</td>';
170 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
172 if ( $d->getUpdated() ) {
173 echo date(_('Y-m-d H:i'),$d->getUpdated());
175 echo date(_('Y-m-d H:i'),$d->getCreated());
179 if ($d->getReserved()) {
180 echo html_image('docman/document-reserved.png',22,22,array('alt'=>_('Reserved Document'),'title'=>_('Reserved Document'),'class'=>'docman-reserveddocument'));
182 echo $d->getStateName().'</td>';
185 switch ($d->getFileType()) {
191 $size = $d->getFileSize();
194 $size = floor ($size/1024);
197 $size = floor ($size/1024);
200 echo $size . $metric;
204 if (forge_check_perm ('docman', $group_id, 'approve')) {
206 /* should we steal the lock on file ? */
207 if ($d->getLocked()) {
208 if ($d->getLockedBy() == $LUSER->getID()) {
210 } elseif ((time() - $d->getLockdate()) > 600) {
214 if (!$d->getLocked() && !$d->getReserved()) {
215 echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this file to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this file'))). '</a>';
216 echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this file') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this file'))). '</a>';
217 echo '<a href="?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-reservefile" title="'. _('Reserve this file for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
219 if ($d->getReservedBy() != $LUSER->getID()) {
220 if (forge_check_perm ('docman', $group_id, 'admin')) {
221 echo '<a href="?group_id='.$group_id.'&action=enforcereserve&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-enforcereservation" title="'. _('Enforce reservation') .'" >'.html_image('docman/enforce-document.png',22,22,array('alt'=>_('Enforce reservation')));
224 echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this file to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this file'))). '</a>';
225 echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this file') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this file'))). '</a>';
226 echo '<a href="?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-releasereservation" title="'. _('Release reservation') .'" >'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
234 echo $HTML->listTableBottom();
236 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
237 include ($gfcommon.'docman/views/editfile.php');