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 <script language="text/javascript">
48 controller = new DocManListFileController({
49 groupId: <?php echo $group_id ?>,
51 {selector: '#docman-addnewfile', options:{delayIn: 1000, delayOut: 500, fade: true}},
52 {selector: '#docman-addsubdirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
53 {selector: '#docman-editdirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
54 {selector: '#docman-deletedirectory', options:{delayIn: 1000, delayOut: 500, fade: true}},
55 {selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 1000, delayOut: 500, fade: true}},
56 {selector: '.docman-reserveddocument', options:{delayIn: 1000, delayOut: 500, fade: true}},
57 {selector: '.docman-movetotrash', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, fade: true}},
58 {selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, fade: true}},
59 {selector: '.docman-releasereservation', options:{gravity: 'ne',delayIn: 1000, delayOut: 500, fade: true}},
60 {selector: '.docman-reservefile', options:{gravity: 'ne', delayIn: 1000, delayOut: 500, 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 //ms
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 //echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
82 if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
83 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>';
86 if (forge_check_perm ('docman', $group_id, 'submit')) {
87 echo '<a href="#" id="docman-addnewfile" title="'. _('Add a new file') . '" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
92 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
93 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
94 include ($gfcommon.'docman/views/editdocgroup.php');
96 echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
97 echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
98 include ($gfcommon.'docman/views/addsubdocgroup.php');
100 echo '<div class="docman_div_include" id="addfile" style="display:none">';
101 echo '<h4 class="docman_h4">'. _('Add a new document') .'</h4>';
102 include ($gfcommon.'docman/views/addfile.php');
105 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
106 $tabletop = array('','Filename','Title','Description','Author','Last time','Status','Size');
107 if (forge_check_perm ('docman', $group_id, 'approve'))
108 $tabletop[] = 'Actions';
109 echo '<div class="docmanDiv">';
110 echo $HTML->listTableTop($tabletop);
113 foreach ($nested_docs[$dirid] as $d) {
114 echo '<tr ' . $HTML->boxGetAltRowStyle($rowid).'>';
115 switch ($d->getFileType()) {
117 $docurl=$d->getFileName();
120 $docurl=util_make_url ('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
122 echo '<td><a href="'.$docurl.'" class="docman-viewfile" title="'._('View this file').'" >';
123 switch ($d->getFileType()) {
128 echo html_image('docman/file_type_image.png',22,22,array('alt'=>$d->getFileType()));
130 case "application/pdf":
131 echo html_image('docman/file_type_pdf.png',22,22,array('alt'=>$d->getFileType()));
135 echo html_image('docman/file_type_html.png',22,22,array('alt'=>$d->getFileType()));
138 echo html_image('docman/file_type_plain.png',22,22,array('alt'=>$d->getFileType()));
140 case "application/msword":
141 case "application/vnd.oasis.opendocument.text":
142 echo html_image('docman/file_type_writer.png',22,22,array('alt'=>$d->getFileType()));
144 case "application/vnd.ms-excel":
145 case "application/vnd.oasis.opendocument.spreadsheet":
146 echo html_image('docman/file_type_spreadsheet.png',22,22,array('alt'=>$d->getFileType()));
148 case "application/vnd.oasis.opendocument.presentation":
149 case "application/vnd.ms-powerpoint":
150 echo html_image('docman/file_type_presentation.png',22,22,array('alt'=>$d->getFileType()));
152 case "application/zip":
153 case "application/x-tar":
154 case "application/x-rpm":
155 echo html_image('docman/file_type_archive.png',22,22,array('alt'=>$d->getFileType()));
158 echo html_image('docman/file_type_unknown.png',22,22,array('alt'=>$d->getFileType()));
162 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
163 echo html_image('docman/new.png',14,14,array('alt'=>'new'));
165 echo ' '.$d->getFileName();
167 echo '<td>'.$d->getName().'</td>';
168 echo '<td>'.$d->getDescription().'</td>';
169 echo '<td>'.make_user_link($d->getCreatorUserName(),$d->getCreatorRealName()).'</td>';
171 if ( $d->getUpdated() ) {
172 echo date(_('Y-m-d H:i'),$d->getUpdated());
174 echo date(_('Y-m-d H:i'),$d->getCreated());
178 if ($d->getReserved()) {
179 echo html_image('docman/document-reserved.png',22,22,array('alt'=>_('Reserved Document'),'title'=>_('Reserved Document'),'class'=>'docman-reserveddocument'));
181 echo $d->getStateName().'</td>';
184 switch ($d->getFileType()) {
190 $size = $d->getFileSize();
193 $size = floor ($size/1024);
196 $size = floor ($size/1024);
199 echo $size . $metric;
203 if (forge_check_perm ('docman', $group_id, 'approve')) {
205 /* should we steal the lock on file ? */
206 if ($d->getLocked()) {
207 if ($d->getLockedBy() == $LUSER->getID()) {
209 } elseif ((time() - $d->getLockdate()) > 600) {
213 if (!$d->getLocked() && !$d->getReserved()) {
214 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>';
215 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>';
216 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>';
218 if ($d->getReservedBy() != $LUSER->getID()) {
219 if (forge_check_perm ('docman', $group_id, 'admin')) {
220 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')));
223 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>';
224 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>';
225 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>';
233 echo $HTML->listTableBottom();
235 echo '<div class="docmanDiv">'.html_image('docman/new.png',14,14,array('alt'=>'new')).' : ' . _('Created or updated since less than 7 days') .'</div>';
236 include ($gfcommon.'docman/views/editfile.php');