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));
80 if ($d_arr != NULL ) {
81 if (!$d_arr || count($d_arr) > 0) {
82 // Get the document groups info
83 //put the doc objects into an array keyed off the docgroup
84 foreach ($d_arr as $doc) {
85 $nested_docs[$doc->getDocGroupID()][] = $doc;
90 // $nested_groups has a system directory : .trash => so count < 2
91 if ((!$d_arr || count($d_arr) < 1) && (!$nested_groups || count($nested_groups) < 2)) {
92 echo '<p class="information">'._('Trash is empty.').'</p>';
96 <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
97 var controllerListTrash;
99 jQuery(document).ready(function() {
100 controllerListTrash = new DocManListFileController({
101 groupId: <?php echo $group_id ?>,
102 divEditDirectory: jQuery('#editdocgroup'),
103 buttonEditDirectory: jQuery('#docman-editdirectory'),
104 docManURL: '<?php util_make_uri("docman") ?>',
105 lockIntervalDelay: 60000, //in microsecond and if you change this value, please update the check value 600
106 divLeft: jQuery('#left'),
107 divHandle: jQuery('#handle'),
108 divRight: jQuery('#right'),
113 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
114 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents and folders with deleted status.') .'" >';
115 echo '</form></div>';
117 echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
118 include ($gfcommon.'docman/views/tree.php');
120 echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
121 echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
123 echo '<h3 class="docman_h3" >'._('Documents folder:').' <i>'.$DocGroupName.'</i> ';
124 if ($DocGroupName != '.trash') {
125 echo '<a href="#" id="docman-editdirectory" class="tabtitle" title="'._('Edit this folder').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
126 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>';
129 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
130 echo '<h4 class="docman_h4">'. _('Edit this folder') .'</h4>';
131 include ($gfcommon.'docman/views/editdocgroup.php');
135 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
136 $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'));
137 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
138 echo '<div class="docmanDiv">';
139 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
141 foreach ($nested_docs[$dirid] as $d) {
144 echo '<input title="'._('Select / Deselect this document for massaction').'" class="checkeddocidactive tabtitle-w" type="checkbox" value="'.$d->getID().'" onchange="controllerListTrash.checkgeneral(\'active\')" />';
146 switch ($d->getFileType()) {
148 $docurl = $d->getFileName();
152 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
155 echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'._('View this document').'" >';
156 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
159 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
160 $html_image_attr = array();
161 $html_image_attr['alt'] = _('new');
162 $html_image_attr['class'] = 'docman-newdocument';
163 $html_image_attr['title'] = _('Updated since less than 7 days');
164 echo html_image('docman/new.png', '14', '14', $html_image_attr);
166 echo ' '.$d->getFileName();
168 echo '<td>'.$d->getName().'</td>';
169 echo '<td>'.$d->getDescription().'</td>';
170 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
172 if ( $d->getUpdated() ) {
173 echo date(_('Y-m-d H:i'), $d->getUpdated());
175 echo date(_('Y-m-d H:i'), $d->getCreated());
179 echo $d->getStateName().'</td>';
181 switch ($d->getFileType()) {
187 echo human_readable_bytes($d->getFileSize());
194 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>';
195 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>';
199 echo $HTML->listTableBottom();
201 echo '<span class="tabtitle" id="docman-massactionmessage" title="'. _('Actions availables for selected documents, you need to check at least one document to get actions') . '" >';
202 echo _('Mass actions for selected documents:');
204 echo '<span id="massactionactive" style="display: none;" >';
205 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>';
206 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>';
209 include ($gfcommon.'docman/views/editfile.php');
213 echo '<p class="information">'._('No documents.').'</p>';
218 echo '<div style="clear: both;" />';