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-delete', 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
98 divLeft: jQuery('#left'),
99 divHandle: jQuery('#handle'),
100 divRight: jQuery('#right'),
105 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
106 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents with deleted status.') .'" >';
107 echo '</form></div>';
109 echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
110 include ($gfcommon.'docman/views/tree.php');
112 echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
113 echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
115 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
116 if ($DocGroupName != '.trash') {
117 echo '<a href="#" id="docman-editdirectory" ';
119 echo 'title="'._('Edit this directory').'"';
121 echo ' >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
122 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" ';
124 echo ' title="'._('Delete permanently this directory and his content.').'" ';
126 echo '>'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
131 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
132 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
133 include ($gfcommon.'docman/views/editdocgroup.php');
137 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
138 $tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListTrash.checkAll()" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
139 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
140 echo '<div class="docmanDiv">';
141 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
143 foreach ($nested_docs[$dirid] as $d) {
146 echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListTrash.checkgeneral()" />';
148 switch ($d->getFileType()) {
150 $docurl = $d->getFileName();
154 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
157 echo '<td><a href="'.$docurl.'" class="docman-viewfile"';
159 echo ' title="'._('View this document').'"';
162 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
165 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
166 $html_image_attr = array();
167 $html_image_attr['alt'] = _('new');
168 $html_image_attr['class'] = 'docman-newdocument';
170 $html_image_attr['title'] = _('Created or updated since less than 7 days');
171 echo html_image('docman/new.png', '14', '14', $html_image_attr);
173 echo ' '.$d->getFileName();
175 echo '<td>'.$d->getName().'</td>';
176 echo '<td>'.$d->getDescription().'</td>';
177 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
179 if ( $d->getUpdated() ) {
180 echo date(_('Y-m-d H:i'), $d->getUpdated());
182 echo date(_('Y-m-d H:i'), $d->getCreated());
186 echo $d->getStateName().'</td>';
188 switch ($d->getFileType()) {
195 $size = $d->getFileSize();
198 $size = floor($size/1024);
201 $size = floor($size/1024);
204 echo $size . $metric;
210 echo '<a class="docman-delete" href="?group_id='.$group_id.'&action=deletefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
212 echo ' title="'. _('Delete permanently this document.') .'"';
214 echo ' >'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently this document.'))). '</a>';
216 echo '<a class="docman-editfile" href="#" onclick="javascript:controllerListTrash.toggleEditFileView(\''.$d->getID().'\')" ';
218 echo ' title="'. _('Edit this document') .'" ';
220 echo '>'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
224 echo $HTML->listTableBottom();
226 echo '<div class="docmanDiv"><p>';
227 echo _('Mass Actions for selected files:');
228 echo '<a class="docman-delete" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=delfile&view=listtrashfile&dirid='.$dirid.'&fileid=\'+controllerListTrash.buildUrlByCheckbox()" ';
230 echo ' title="'. _('Delete permanently.') .'" ';
232 echo '>'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently.'))). '</a>';
233 echo '<a class="docman-downloadaszip" href="#" onClick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/\'+controllerListTrash.buildUrlByCheckbox()" ';
235 echo ' title="'. _('Download as a zip') . '" ';
237 echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
239 include ($gfcommon.'docman/views/editfile.php');
241 echo '<p class="warning">'._('No documents to display').'</p>';
245 echo '<div style="clear:both"; />';