setDocGroupID($dirid);
/**
* var must be named d_arr & nested_groups
* because used by tree.php
*/
$d_arr =& $df->getDocuments();
$nested_groups = $dgf->getNested();
$linkmenu = 'listfile';
$nested_docs = array();
$DocGroupName = 0;
if ($dirid) {
$ndg = new DocumentGroup($g,$dirid);
$DocGroupName = $ndg->getName();
if (!$DocGroupName) {
session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
}
}
if ($d_arr != NULL ) {
if (!$d_arr || count($d_arr) > 0) {
// Get the document groups info
//put the doc objects into an array keyed off the docgroup
foreach ($d_arr as $doc) {
$nested_docs[$doc->getDocGroupID()][] = $doc;
}
}
}
$df->setStateID('3');
$d_pending_arr =& $df->getDocuments();
$nested_pending_groups =& $dgf->getNested();
if ($d_pending_arr != NULL ) {
if (!$d_pending_arr || count($d_pending_arr) > 0) {
// Get the document groups info
//put the doc objects into an array keyed off the docgroup
foreach ($d_pending_arr as $doc) {
$nested_pending_docs[$doc->getDocGroupID()][] = $doc;
}
}
}
?>
';
include ($gfcommon.'docman/views/tree.php');
echo '';
echo '
';
if ($DocGroupName) {
echo '
';
if (forge_check_perm('docman', $group_id, 'approve')) {
echo '
';
echo '
'. _('Edit this directory') .' ';
include ($gfcommon.'docman/views/editdocgroup.php');
echo '';
}
if (forge_check_perm('docman', $group_id, 'submit')) {
echo '
';
echo '
'. _('Add a new item') .' ';
include ($gfcommon.'docman/views/additem.php');
echo '';
}
}
if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
$tabletop = array('
', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '');
if (forge_check_perm('docman', $group_id, 'approve')) {
$tabletop[] = _('Actions');
$classth[] = 'unsortable';
}
echo '
';
echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
$time_new = 604800;
foreach ($nested_docs[$dirid] as $d) {
echo '
';
echo '';
if (!$d->getLocked() && !$d->getReserved()) {
echo ' ';
} else {
if (session_loggedin() && ($d->getReservedBy() != $u->getID())) {
echo ' ';
}
}
echo ' ';
switch ($d->getFileType()) {
case "URL": {
$docurl = $d->getFileName();
break;
}
default: {
$docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
}
}
echo '';
echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
echo ' ';
echo '';
if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
$html_image_attr = array();
$html_image_attr['alt'] = _('new');
$html_image_attr['class'] = 'tabtitle-ne';
$html_image_attr['title'] = _('Created or updated since less than 7 days');
echo html_image('docman/new.png', '14', '14', $html_image_attr);
}
echo ' '.$d->getFileName();
echo ' ';
echo ''.$d->getName().' ';
echo ''.$d->getDescription().' ';
echo ''.make_user_link($d->getCreatorUserName(), $d->getCreatorRealName()).' ';
echo '';
if ( $d->getUpdated() ) {
echo date(_('Y-m-d H:i'), $d->getUpdated());
} else {
echo date(_('Y-m-d H:i'), $d->getCreated());
}
echo ' ';
echo '';
if ($d->getReserved()) {
$html_image_attr = array();
$html_image_attr['alt'] = _('Reserved Document');
$html_image_attr['class'] = 'tabtitle';
$html_image_attr['title'] = _('Reserved Document');
echo html_image('docman/document-reserved.png', '22', '22', $html_image_attr);
} else {
echo $d->getStateName().' ';
}
echo '';
switch ($d->getFileType()) {
case "URL": {
echo "--";
break;
}
default: {
$metric = 'B';
$size = $d->getFileSize();
if ($size > 1024 ) {
$metric = 'KB';
$size = floor($size/1024);
if ($size > 1024 ) {
$metric = 'MB';
$size = floor($size/1024);
}
}
echo $size . $metric;
echo ' ';
}
}
if (forge_check_perm('docman', $group_id, 'approve')) {
echo '';
/* should we steal the lock on file ? */
if ($d->getLocked()) {
if ($d->getLockedBy() == $u->getID()) {
$d->setLock(0);
/* if you change the 60000 value above, please update here too */
} elseif ((time() - $d->getLockdate()) > 600) {
$d->setLock(0);
}
}
if (!$d->getLocked() && !$d->getReserved()) {
echo ''.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). ' ';
if (session_loggedin()) {
echo ''.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). ' ';
echo ''.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). ' ';
}
} else {
if (session_loggedin() && $d->getReservedBy() != $u->getID()) {
if (forge_check_perm('docman', $group_id, 'admin')) {
echo ''.html_image('docman/enforce-document.png',22,22,array('alt'=>_('Enforce reservation')));
}
} else {
echo ' '.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). ' ';
echo ''.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). ' ';
echo ''.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). ' ';
}
}
if (session_loggedin()) {
if ($d->isMonitoredBy($u->getID())) {
$option = 'remove';
$titleMonitor = _('Stop monitoring this document');
} else {
$option = 'add';
$titleMonitor = _('Start monitoring this document');
}
echo ''.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). ' ';
}
echo ' ';
}
echo ' ';
}
echo $HTML->listTableBottom();
echo '
';
echo '';
echo _('Mass actions for selected files:');
echo ' ';
echo '';
if (forge_check_perm('docman', $group_id, 'approve')) {
echo ''.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash'))). ' ';
if (session_loggedin()) {
echo ''.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve'))). ' ';
echo ''.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). ' ';
echo ''.html_image('docman/monitor-adddocument.png',22,22,array('alt'=>_('Start monitoring'))). ' ';
echo ''.html_image('docman/monitor-removedocument.png',22,22,array('alt'=>_('Stop monitoring'))). ' ';
}
}
echo '' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). ' ';
echo ' ';
echo '
';
echo '
';
} else {
if ($dirid) {
echo '
'._('No documents to display').'
';
}
}
if (forge_check_perm('docman', $group_id, 'approve') && $DocGroupName) {
include ($gfcommon.'docman/views/pendingfiles.php');
include ($gfcommon.'docman/views/editfile.php');
}
echo '
';
echo '