3 * FusionForge Documentation Manager
5 * Copyright 2000, Quentin Cregan/Sourceforge
6 * Copyright 2002-2003, Tim Perdue/GForge, LLC
7 * Copyright (C) 2010 Alcatel-Lucent
8 * Copyright 2010, Franck Villaume - Capgemini
9 * http://fusionforge.org
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
35 global $LUSER; // User object
37 $DocGroupName = getNameDocGroup($dirid,$group_id);
39 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
43 <script type="text/javascript">
46 jQuery(document).ready(function() {
47 controller = new DocManListFileController({
48 groupId: <?php echo $group_id ?>,
50 {selector: '#docman-addnewfile', options:{delayIn: 500, delayOut: 0, fade: true}},
51 {selector: '#docman-addsubdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
52 {selector: '#docman-editdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
53 {selector: '#docman-deletedirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
54 {selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
55 {selector: '.docman-reserveddocument', options:{delayIn: 500, delayOut: 0, fade: true}},
56 {selector: '.docman-movetotrash', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
57 {selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
58 {selector: '.docman-releasereservation', options:{gravity: 'ne',delayIn: 500, delayOut: 0, fade: true}},
59 {selector: '.docman-reservefile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
60 {selector: '.docman-monitorfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}}
63 divAddDirectory: jQuery('#addsubdocgroup'),
64 divAddFile: jQuery('#addfile'),
65 divEditDirectory: jQuery('#editdocgroup'),
66 buttonAddDirectory: jQuery('#docman-addsubdirectory'),
67 buttonAddNewFile: jQuery('#docman-addnewfile'),
68 buttonEditDirectory: jQuery('#docman-editdirectory'),
69 docManURL: '<?php util_make_url("docman") ?>',
70 lockIntervalDelay: 60000 //in microsecond and if you change this value, please update the check value 600
77 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
78 if (forge_check_perm ('docman', $group_id, 'approve')) {
79 echo '<a href="#" id="docman-editdirectory" title="'._('Edit this directory').'">'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
80 echo '<a href="#" id="docman-addsubdirectory" title="'._('Add a new subdirectory').'">'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
81 // do not uncomment the line : trash directory is not correctly implemented
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 document') . '" >'. 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 document').'" >';
124 switch ($d->getFileType()) {
129 case "image/vnd.microsoft.icon":
130 case "image/svg+xml":
131 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
133 case "application/pdf":
134 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
138 echo html_image('docman/file_type_html.png',22,22,array('alt'=>$d->getFileType()));
141 echo html_image('docman/file_type_plain.png',22,22,array('alt'=>$d->getFileType()));
143 case "application/msword":
144 case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
145 case "application/vnd.oasis.opendocument.text":
146 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
148 case "application/vnd.ms-excel":
149 case "application/vnd.oasis.opendocument.spreadsheet":
150 case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
151 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
153 case "application/vnd.oasis.opendocument.presentation":
154 case "application/vnd.ms-powerpoint":
155 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
157 case "application/zip":
158 case "application/x-tar":
159 case "application/x-rpm":
160 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
163 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
167 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
168 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
170 echo ' '.$d->getFileName();
172 echo '<td>'.$d->getName().'</td>';
173 echo '<td>'.$d->getDescription().'</td>';
174 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
176 if ( $d->getUpdated() ) {
177 echo date(_('Y-m-d H:i'),$d->getUpdated());
179 echo date(_('Y-m-d H:i'),$d->getCreated());
183 if ($d->getReserved()) {
184 echo html_image('docman/document-reserved.png',22,22,array('alt'=>_('Reserved Document'),'title'=>_('Reserved Document'),'class'=>'docman-reserveddocument'));
186 echo $d->getStateName().'</td>';
189 switch ($d->getFileType()) {
195 $size = $d->getFileSize();
198 $size = floor ($size/1024);
201 $size = floor ($size/1024);
204 echo $size . $metric;
208 if (forge_check_perm ('docman', $group_id, 'approve')) {
210 /* should we steal the lock on file ? */
211 if ($d->getLocked()) {
212 if ($d->getLockedBy() == $LUSER->getID()) {
214 /* if you change the 60000 value above, please update here too */
215 } elseif ((time() - $d->getLockdate()) > 600) {
219 if (!$d->getLocked() && !$d->getReserved()) {
220 echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
221 echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
222 echo '<a href="?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-reservefile" title="'. _('Reserve this document for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
224 if ($d->getReservedBy() != $LUSER->getID()) {
225 if (forge_check_perm ('docman', $group_id, 'admin')) {
226 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')));
229 echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
230 echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
231 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 if ($d->isMonitoredBy($LUSER->getID())) {
236 $titleMonitor= _('Stop monitoring this document');
239 $titleMonitor= _('Start monitoring this document');
241 echo '<a href="?group_id='.$group_id.'&action=monitorfile&option='.$option.'&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-monitorfile" title="'.$titleMonitor.'" >'.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). '</a>';
247 echo $HTML->listTableBottom();
249 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
250 include ($gfcommon.'docman/views/editfile.php');