3 * FusionForge Documentation Manager
5 * Copyright 2000, Quentin Cregan/Sourceforge
6 * Copyright 2002-2003, Tim Perdue/GForge, LLC
7 * Copyright 2010-2011, Franck Villaume - Capgemini
8 * Copyright 2011, Franck Villaume - TrivialDev
9 * http://fusionforge.org
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 /* please do not add require here : use www/docman/index.php to add require */
28 /* global variables used */
29 global $df; // document factory
30 global $dgf; // document group factory
31 global $group_id; // id of the group
32 global $dirid; // id of doc_group
33 global $g; // the Group object
35 if (!forge_check_perm('docman', $group_id, 'approve')) {
36 $return_msg= _('Document Manager Access Denied');
37 session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
43 * var must be named d_arr & nested_groups
44 * because used by tree.php
46 $d_arr =& $df->getDocuments();
47 $nested_groups =& $dgf->getNested('2');
48 $linkmenu = 'listtrashfile';
50 $nested_docs = array();
54 $ndg = new DocumentGroup($g,$dirid);
55 $DocGroupName = $ndg->getName();
57 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
62 if ($d_arr != NULL ) {
63 if (!$d_arr || count($d_arr) > 0) {
64 // Get the document groups info
65 //put the doc objects into an array keyed off the docgroup
66 foreach ($d_arr as $doc) {
67 $nested_docs[$doc->getDocGroupID()][] = $doc;
72 // $nested_groups has a system directory : .trash => so count < 2
73 if ((!$d_arr || count($d_arr) < 1) && (!$nested_groups || count($nested_groups) < 2)) {
74 echo '<div class="warning">'._('Trash is empty').'</div>';
78 <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
79 var controllerListTrash;
81 jQuery(document).ready(function() {
82 controllerListTrash = new DocManListFileController({
83 groupId: <?php echo $group_id ?>,
84 divEditDirectory: jQuery('#editdocgroup'),
85 buttonEditDirectory: jQuery('#docman-editdirectory'),
86 docManURL: '<?php util_make_uri("docman") ?>',
87 lockIntervalDelay: 60000, //in microsecond and if you change this value, please update the check value 600
88 divLeft: jQuery('#left'),
89 divHandle: jQuery('#handle'),
90 divRight: jQuery('#right'),
95 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
96 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents with deleted status.') .'" >';
99 echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
100 include ($gfcommon.'docman/views/tree.php');
102 echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
103 echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
105 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
106 if ($DocGroupName != '.trash') {
107 echo '<a href="#" id="docman-editdirectory" class="tabtitle"title="'._('Edit this directory').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
108 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" title="'._('Delete permanently this directory and his content.').'" >'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
111 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
112 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
113 include ($gfcommon.'docman/views/editdocgroup.php');
117 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
118 $tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListTrash.checkAll()" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
119 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
120 echo '<div class="docmanDiv">';
121 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
123 foreach ($nested_docs[$dirid] as $d) {
126 echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListTrash.checkgeneral()" />';
128 switch ($d->getFileType()) {
130 $docurl = $d->getFileName();
134 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
137 echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'._('View this document').'" >';
138 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
141 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
142 $html_image_attr = array();
143 $html_image_attr['alt'] = _('new');
144 $html_image_attr['class'] = 'docman-newdocument';
145 $html_image_attr['title'] = _('Created or updated since less than 7 days');
146 echo html_image('docman/new.png', '14', '14', $html_image_attr);
148 echo ' '.$d->getFileName();
150 echo '<td>'.$d->getName().'</td>';
151 echo '<td>'.$d->getDescription().'</td>';
152 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
154 if ( $d->getUpdated() ) {
155 echo date(_('Y-m-d H:i'), $d->getUpdated());
157 echo date(_('Y-m-d H:i'), $d->getCreated());
161 echo $d->getStateName().'</td>';
163 switch ($d->getFileType()) {
170 $size = $d->getFileSize();
173 $size = floor($size/1024);
176 $size = floor($size/1024);
179 echo $size . $metric;
185 echo '<a class="docman-delete" class="tabtitle" href="?group_id='.$group_id.'&action=delfile&view=listtrashfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Delete permanently this document.') .'" >'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently this document.'))). '</a>';
186 echo '<a class="tabtitle-ne" href="#" onclick="javascript:controllerListTrash.toggleEditFileView(\''.$d->getID().'\')" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
190 echo $HTML->listTableBottom();
192 echo _('Mass actions for selected files:');
193 echo '<a class="docman-delete" class="tabtitle" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=delfile&view=listtrashfile&dirid='.$dirid.'&fileid=\'+controllerListTrash.buildUrlByCheckbox()" title="'. _('Delete permanently.') .'" >'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently.'))). '</a>';
194 echo '<a class="docman-downloadaszip" class="tabtitle" href="#" onClick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/\'+controllerListTrash.buildUrlByCheckbox()" title="'. _('Download as a zip') . '" >' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
196 include ($gfcommon.'docman/views/editfile.php');
200 echo '<p class="warning">'._('No documents to display').'</p>';
205 echo '<div style="clear: both;" />';