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 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
10 * http://fusionforge.org
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
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 along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 $g; // the Group object
34 $childgroup_id = getIntFromRequest('childgroup_id');
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));
41 // plugin projects-hierarchy
43 $g = group_get_object($childgroup_id);
46 $df = new DocumentFactory($g);
48 exit_error($df->getErrorMessage(), 'docman');
50 $dgf = new DocumentGroupFactory($g);
52 exit_error($dgf->getErrorMessage(), 'docman');
54 $dgh = new DocumentGroupHTML($g);
56 exit_error($dgh->getErrorMessage(), 'docman');
60 $d_arr =& $df->getDocuments();
61 $nested_groups =& $dgf->getNested('2');
62 $linkmenu = 'listtrashfile';
64 $nested_docs = array();
68 $ndg = new DocumentGroup($g, $dirid);
69 $DocGroupName = $ndg->getName();
71 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
73 if ($ndg->getState() != 2) {
74 $error_msg = _('Invalid folder.');
75 session_redirect('/docman/?group_id='.$group_id.'&view=listtrashfile&error_msg='.urlencode($error_msg));
79 if ($d_arr != NULL ) {
80 if (!$d_arr || count($d_arr) > 0) {
81 // Get the document groups info
82 //put the doc objects into an array keyed off the docgroup
83 foreach ($d_arr as $doc) {
84 $nested_docs[$doc->getDocGroupID()][] = $doc;
89 // $nested_groups has a system directory : .trash => so count < 2
90 if ((!$d_arr || count($d_arr) < 1) && (!$nested_groups || count($nested_groups) < 2)) {
91 echo '<p class="information">'._('Trash is empty.').'</p>';
95 <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
96 var controllerListTrash;
98 jQuery(document).ready(function() {
99 controllerListTrash = new DocManListFileController({
100 groupId: <?php echo $group_id ?>,
101 divEditDirectory: jQuery('#editdocgroup'),
102 buttonEditDirectory: jQuery('#docman-editdirectory'),
103 docManURL: '<?php util_make_uri("docman") ?>',
104 lockIntervalDelay: 60000, //in microsecond and if you change this value, please update the check value 600
105 divLeft: jQuery('#left'),
106 divHandle: jQuery('#handle'),
107 divRight: jQuery('#right'),
112 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
113 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents and folders with deleted status.') .'" >';
114 echo '</form></div>';
116 echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
117 include ($gfcommon.'docman/views/tree.php');
119 echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
120 echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
122 echo '<h3 class="docman_h3" >'._('Documents folder:').' <i>'.$DocGroupName.'</i> ';
123 if ($DocGroupName != '.trash') {
124 echo '<a href="#" id="docman-editdirectory" class="tabtitle" title="'._('Edit this folder').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
125 echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" title="'._('Delete permanently this folder and his content.').'" >'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
128 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
129 echo '<h4 class="docman_h4">'. _('Edit this folder') .'</h4>';
130 include ($gfcommon.'docman/views/editdocgroup.php');
134 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
135 $tabletop = array('<input id="checkallactive" title="'._('Select / Deselect all documents for massaction').'" class="tabtitle-w" type="checkbox" onchange="controllerListTrash.checkAll(\'checkeddocidactive\', \'active\')" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
136 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
137 echo '<div class="docmanDiv">';
138 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
140 foreach ($nested_docs[$dirid] as $d) {
143 echo '<input title="'._('Select / Deselect this document for massaction').'" class="checkeddocidactive tabtitle-w" type="checkbox" value="'.$d->getID().'" onchange="controllerListTrash.checkgeneral(\'active\')" />';
145 switch ($d->getFileType()) {
147 $docurl = $d->getFileName();
151 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
154 echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'._('View this document').'" >';
155 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
158 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
159 $html_image_attr = array();
160 $html_image_attr['alt'] = _('new');
161 $html_image_attr['class'] = 'docman-newdocument';
162 $html_image_attr['title'] = _('Updated since less than 7 days');
163 echo html_image('docman/new.png', '14', '14', $html_image_attr);
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 echo $d->getStateName().'</td>';
180 switch ($d->getFileType()) {
186 echo human_readable_bytes($d->getFileSize());
193 echo '<a 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>';
194 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>';
197 echo '<tr id="docid'.$d->getID().'" class="docman_editfile_nodisplay" ><td colspan="10" >';
201 echo $HTML->listTableBottom();
203 echo '<span class="tabtitle" id="docman-massactionmessage" title="'. _('Actions availables for selected documents, you need to check at least one document to get actions') . '" >';
204 echo _('Mass actions for selected documents:');
206 echo '<span id="massactionactive" style="display: none;" >';
207 echo '<a 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>';
208 echo '<a 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>';
214 echo '<p class="information">'._('No documents.').'</p>';
219 echo '<div style="clear: both;" />';