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.
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 $df; // document factory
31 global $dgf; // document group factory
32 global $group_id; // id of the group
33 global $dirid; // id of doc_group
34 global $g; // the Group object
36 if (!forge_check_perm('docman', $group_id, 'approve')) {
37 $return_msg= _('Document Manager Access Denied');
38 session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
44 * var must be named d_arr & nested_groups
45 * because used by tree.php
47 $d_arr =& $df->getDocuments();
48 $nested_groups =& $dgf->getNested('2');
49 $linkmenu = 'listtrashfile';
51 $nested_docs = array();
55 $ndg = new DocumentGroup($g,$dirid);
56 $DocGroupName = $ndg->getName();
58 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
63 if ($d_arr != NULL ) {
64 if (!$d_arr || count($d_arr) > 0) {
65 // Get the document groups info
66 //put the doc objects into an array keyed off the docgroup
67 foreach ($d_arr as $doc) {
68 $nested_docs[$doc->getDocGroupID()][] = $doc;
73 // $nested_groups has a system directory : .trash => so count < 2
74 if ((!$d_arr || count($d_arr) < 1) && (!$nested_groups || count($nested_groups) < 2)) {
75 echo '<div class="warning">'._('Trash is empty').'</div>';
79 <script type="text/javascript">
80 var controllerListTrash;
82 jQuery(document).ready(function() {
83 controllerListTrash = new DocManListFileController({
84 groupId: <?php echo $group_id ?>,
86 {selector: '#docman-editdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
87 {selector: '#docman-deletedirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
88 {selector: '#docman-trashdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
89 {selector: '.docman-downloadaszip', options:{delayIn: 500, delayOut: 0, fade: true}},
90 {selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
91 {selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
94 divEditDirectory: jQuery('#editdocgroup'),
95 buttonEditDirectory: jQuery('#docman-editdirectory'),
96 docManURL: '<?php util_make_uri("docman") ?>',
97 lockIntervalDelay: 60000 //in microsecond and if you change this value, please update the check value 600
102 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
103 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents with deleted status.') .'" >';
104 echo '</form></div>';
106 echo '<div style="float:left; width:17%; padding-right:3px; margin-right:2px; border-right: dashed 1px black;">';
107 include ($gfcommon.'docman/views/tree.php');
109 echo '<div style="float:left; width:82%;">';
111 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
112 if ($DocGroupName != '.trash') {
113 echo '<a href="#" id="docman-editdirectory" ';
115 echo 'title="'._('Edit this directory').'"';
117 echo ' >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
118 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" ';
120 echo ' title="'._('Delete permanently this directory and his content.').'" ';
122 echo '>'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
127 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
128 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
129 include ($gfcommon.'docman/views/editdocgroup.php');
133 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
134 $tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListTrash.checkAll()" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
135 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
136 echo '<div class="docmanDiv">';
137 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
139 foreach ($nested_docs[$dirid] as $d) {
142 echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListTrash.checkgeneral()" />';
144 switch ($d->getFileType()) {
146 $docurl = $d->getFileName();
150 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
153 echo '<td><a href="'.$docurl.'" class="docman-viewfile"';
155 echo ' title="'._('View this document').'"';
158 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
161 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
162 $html_image_attr = array();
163 $html_image_attr['alt'] = _('new');
164 $html_image_attr['class'] = 'docman-newdocument';
166 $html_image_attr['title'] = _('Created or updated since less than 7 days');
167 echo html_image('docman/new.png', '14', '14', $html_image_attr);
169 echo ' '.$d->getFileName();
171 echo '<td>'.$d->getName().'</td>';
172 echo '<td>'.$d->getDescription().'</td>';
173 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
175 if ( $d->getUpdated() ) {
176 echo date(_('Y-m-d H:i'), $d->getUpdated());
178 echo date(_('Y-m-d H:i'), $d->getCreated());
182 echo $d->getStateName().'</td>';
184 switch ($d->getFileType()) {
191 $size = $d->getFileSize();
194 $size = floor($size/1024);
197 $size = floor($size/1024);
200 echo $size . $metric;
206 echo '<a class="docman-delete" href="?group_id='.$group_id.'&action=deletefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
208 echo ' title="'. _('Delete permanently this document.') .'"';
210 echo ' >'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently this document.'))). '</a>';
212 echo '<a class="docman-editfile" href="#" onclick="javascript:controllerListTrash.toggleEditFileView(\''.$d->getID().'\')" ';
214 echo ' title="'. _('Edit this document') .'" ';
216 echo '>'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
220 echo $HTML->listTableBottom();
222 echo '<div class="docmanDiv"><p>';
223 echo _('Mass Actions for selected files:');
224 echo '<a class="docman-delete" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=delfile&view=listtrashfile&dirid='.$dirid.'&fileid=\'+controllerListTrash.buildUrlByCheckbox()" ';
226 echo ' title="'. _('Delete permanently.') .'" ';
228 echo '>'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently.'))). '</a>';
229 echo '<a class="docman-downloadaszip" href="#" onClick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/\'+controllerListTrash.buildUrlByCheckbox()" ';
231 echo ' title="'. _('Download as a zip') . '" ';
233 echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
235 include ($gfcommon.'docman/views/editfile.php');
237 echo '<p class="warning">'._('No documents to display').'</p>';
241 echo '<div style="clear:both"; />';