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-2012, 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 $linkmenu = 'listtrashfile';
63 $nested_docs = array();
67 $ndg = new DocumentGroup($g, $dirid);
68 $DocGroupName = $ndg->getName();
70 session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
72 if ($ndg->getState() != 2) {
73 $error_msg = _('Invalid folder.');
74 session_redirect('/docman/?group_id='.$group_id.'&view=listtrashfile&error_msg='.urlencode($error_msg));
78 if ($d_arr != NULL ) {
79 if (!$d_arr || count($d_arr) > 0) {
80 // Get the document groups info
81 //put the doc objects into an array keyed off the docgroup
82 foreach ($d_arr as $doc) {
83 $nested_docs[$doc->getDocGroupID()][] = $doc;
88 <script language="JavaScript" type="text/javascript">//<![CDATA[
89 var controllerListTrash;
91 jQuery(document).ready(function() {
92 controllerListTrash = new DocManListFileController({
93 groupId: <?php echo $group_id ?>,
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'),
101 divEditFile: jQuery('#editFile'),
102 divEditTitle: '<?php echo _("Edit document dialog box") ?>',
107 echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
108 echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents and folders with deleted status.') .'" >';
109 echo '</form></div>';
111 echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
112 include ($gfcommon.'docman/views/tree.php');
114 echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
115 echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
117 echo '<h3 class="docman_h3" >'._('Documents folder:').' <i>'.$DocGroupName.'</i> ';
118 if ($DocGroupName != '.trash') {
119 echo '<a href="#" id="docman-editdirectory" class="tabtitle" title="'._('Edit this folder').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
120 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>';
123 echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
124 echo '<h4 class="docman_h4">'. _('Edit this folder') .'</h4>';
125 include ($gfcommon.'docman/views/editdocgroup.php');
129 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
130 $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'));
131 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
132 echo '<div class="docmanDiv">';
133 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
135 foreach ($nested_docs[$dirid] as $d) {
138 echo '<input title="'._('Select / Deselect this document for massaction').'" class="checkeddocidactive tabtitle-w" type="checkbox" value="'.$d->getID().'" onchange="controllerListTrash.checkgeneral(\'active\')" />';
140 switch ($d->getFileType()) {
142 $docurl = $d->getFileName();
143 $docurltitle = _('Visit this link');
147 $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
148 $docurltitle = _('View this document');
151 echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'.$docurltitle.'" >';
152 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
155 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
156 $html_image_attr = array();
157 $html_image_attr['alt'] = _('new');
158 $html_image_attr['class'] = 'docman-newdocument';
159 $html_image_attr['title'] = _('Updated since less than 7 days');
160 echo html_image('docman/new.png', '14', '14', $html_image_attr);
162 echo ' '.$d->getFileName();
164 echo '<td>'.$d->getName().'</td>';
165 echo '<td>'.$d->getDescription().'</td>';
166 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
168 if ( $d->getUpdated() ) {
169 echo date(_('Y-m-d H:i'), $d->getUpdated());
171 echo date(_('Y-m-d H:i'), $d->getCreated());
175 echo $d->getStateName().'</td>';
177 switch ($d->getFileType()) {
183 echo human_readable_bytes($d->getFileSize());
190 $newdgf = new DocumentGroupFactory($d->Group);
191 $editfileaction = '?action=editfile&fromview=listfile&dirid='.$d->getDocGroupID().'&group_id='.$group_id;
192 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>';
193 echo '<a class="tabtitle-ne" href="#" onclick="javascript:controllerListTrash.toggleEditFileView({action:\''.$editfileaction.'\', lockIntervalDelay: 60000, childGroupId: '.util_ifsetor($childgroup_id, 0).' ,id:'.$d->getID().', groupId:'.$d->Group->getID().', docgroupId:'.$d->getDocGroupID().', statusId:'.$d->getStateID().', statusDict:'.$dm->getStatusNameList('json','2').', docgroupDict:'.$dm->getDocGroupList($newdgf->getNested(), 'json').', title:\''.$d->getName().'\', filename:\''.$d->getFilename().'\', description:\''.$d->getDescription().'\', isURL:\''.$d->isURL().'\', isText:\''.$d->isText().'\', useCreateOnline:'.$d->Group->useCreateOnline().', docManURL:\''.util_make_uri("docman").'\'})" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
197 echo $HTML->listTableBottom();
199 echo '<span class="tabtitle" id="docman-massactionmessage" title="'. _('Actions availables for selected documents, you need to check at least one document to get actions') . '" >';
200 echo _('Mass actions for selected documents:');
202 echo '<span id="massactionactive" style="display: none;" >';
203 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>';
204 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>';
210 echo '<p class="information">'._('No documents.').'</p>';
215 echo '<div style="clear: both;" />';
216 if (forge_check_perm('docman', $g->getID(), 'approve')) {
217 include ($gfcommon.'docman/views/editfile.php');