3 * FusionForge Documentation Manager
5 * Copyright 2011, Franck Villaume - Capgemini
6 * Copyright 2012, Franck Villaume - TrivialDev
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 /* please do not add require here : use www/docman/index.php to add require */
26 /* global variables used */
27 global $group_id; // id of the group
28 global $g; // the group object
29 global $dirid; // id of doc_group
30 global $HTML; // Layout object
31 global $nested_pending_docs;
32 global $nested_groups;
33 global $redirecturl; // built url from listfile.php (handle the hierarchy)
34 global $actionlistfileurl; // built action url from listfile.php (handle the hierarchy)
36 if (!forge_check_perm('docman', $g->getID(), 'approve')) {
37 $return_msg= _('Document Manager Access Denied');
38 session_redirect($redirecturl.'&warning_msg='.urlencode($return_msg));
41 if (!isset($nested_pending_docs)) {
42 echo '<p class="information">'._('No pending documents.').'</p>';
46 <script language="JavaScript" type="text/javascript">//<![CDATA[
47 var controllerListPending;
49 jQuery(document).ready(function() {
50 controllerListPending = new DocManListFileController({
51 groupId: <?php echo $group_id ?>,
52 docManURL: '<?php util_make_uri("docman") ?>',
53 lockIntervalDelay: 60000, //in microsecond and if you change this value, please update the check value 600
54 divEditFile: jQuery('#editFile'),
55 divEditTitle: '<?php echo _("Edit document dialog box") ?>',
60 if (isset($nested_pending_docs[$dirid]) && is_array($nested_pending_docs[$dirid])) {
61 echo '<div class="docmanDiv">';
62 echo '<h4>'._('Pending files').'</h4>';
63 $tabletop = array('<input id="checkallpending" type="checkbox" onchange="controllerListPending.checkAll(\'checkeddocidpending\', \'pending\')" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
64 $classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
65 echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
67 foreach ($nested_pending_docs[$dirid] as $d) {
70 echo '<input type="checkbox" value="'.$d->getID().'" class="checkeddocidpending" onchange="controllerListPending.checkgeneral(\'pending\')" />';
72 switch ($d->getFileType()) {
74 $docurl = $d->getFileName();
75 $docurltitle = _('Visit this link');
79 $docurl = util_make_uri('/docman/view.php/'.$g->getID().'/'.$d->getID().'/'.urlencode($d->getFileName()));
80 $docurltitle = _('View this document');
83 echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'.$docurltitle.'" >';
84 echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
87 if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
88 $html_image_attr = array();
89 $html_image_attr['alt'] = _('new');
90 $html_image_attr['class'] = 'docman-newdocument';
91 $html_image_attr['title'] = _('Created or updated since less than 7 days');
92 echo html_image('docman/new.png', '14', '14', $html_image_attr);
94 echo ' '.$d->getFileName();
96 echo '<td>'.$d->getName().'</td>';
97 echo '<td>'.$d->getDescription().'</td>';
98 echo '<td>'.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).'</td>';
100 if ( $d->getUpdated() ) {
101 echo date(_('Y-m-d H:i'), $d->getUpdated());
103 echo date(_('Y-m-d H:i'), $d->getCreated());
107 echo $d->getStateName().'</td>';
109 switch ($d->getFileType()) {
115 echo human_readable_bytes($d->getFileSize());
122 $editfileaction = '?action=editfile&fromview=listfile&dirid='.$d->getDocGroupID();
123 if (isset($GLOBALS['childgroup_id']) && $GLOBALS['childgroup_id']) {
124 $editfileaction .= '&childgroup_id='.$GLOBALS['childgroup_id'];
126 $editfileaction .= '&group_id='.$GLOBALS['group_id'];
127 echo '<a class="tabtitle-ne" href="#" onclick="javascript:controllerListPending.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').', docgroupDict:'.$dm->getDocGroupList($nested_groups, 'json').', title:\''.htmlspecialchars($d->getName()).'\', filename:\''.$d->getFilename().'\', description:\''.htmlspecialchars($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>';
131 echo $HTML->listTableBottom();
133 echo '<span id="docman-massactionpendingmessage" class="tabtitle-nw" title="'. _('Actions availables for checked files, you need to check at least one file to get actions') . '">';
134 echo _('Mass actions for selected pending files:');
136 echo '<span id="massactionpending" class="docman-massaction-hide" style="display:none;" >';
137 echo '<a class="tabtitle" href="#" onclick="window.location.href=\'/docman/view.php/'.$g->getID().'/zip/selected/'.$dirid.'/\'+controllerListPending.buildUrlByCheckbox(\'pending\')" title="'. _('Download as a zip') . '" >' . html_image('docman/download-directory-zip.png', 22, 22, array('alt'=>'Download as Zip')). '</a>';
138 echo '<a class="tabtitle" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=validatefile&fileid=\'+controllerListPending.buildUrlByCheckbox(\'pending\')" title="'. _('Activate in this directory') . '" >' . html_image('docman/validate.png', 22, 22, array('alt'=>'Activate in this directory')). '</a>';