';
include ($gfcommon.'docman/views/tree.php');
echo '';
// plugin projects-hierarchy
$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
if (!forge_check_perm('docman', $childgroup_id, 'read')) {
$return_msg= _('Document Manager Access Denied');
session_redirect($baseredirecturl.'&warning_msg='.urlencode($return_msg));
}
$redirecturl .= '&childgroup_id='.$childgroup_id;
$actionlistfileurl .= '&childgroup_id='.$childgroup_id;
$g = group_get_object($childgroup_id);
}
$df = new DocumentFactory($g);
if ($df->isError())
exit_error($df->getErrorMessage(), 'docman');
$dgf = new DocumentGroupFactory($g);
if ($dgf->isError())
exit_error($dgf->getErrorMessage(), 'docman');
$dgh = new DocumentGroupHTML($g);
if ($dgh->isError())
exit_error($dgh->getErrorMessage(), 'docman');
$df->setDocGroupID($dirid);
$df->setStateID('1');
$d_arr_active =& $df->getDocuments();
if ($d_arr_active != NULL)
$d_arr = $d_arr_active;
$df->setStateID('4');
$d_arr_hidden =& $df->getDocuments();
if ($d_arr != NULL && $d_arr_hidden != NULL) {
$d_arr = array_merge($d_arr, $d_arr_hidden);
} else if ($d_arr_hidden != NULL) {
$d_arr = $d_arr_hidden;
}
$df->setStateID('5');
$d_arr_private =& $df->getDocuments();
if ($d_arr != NULL && $d_arr_private != NULL) {
$d_arr = array_merge($d_arr, $d_arr_private);
} else if ($d_arr_private != NULL) {
$d_arr = $d_arr_private;
}
$nested_groups = $dgf->getNested();
$nested_docs = array();
$DocGroupName = 0;
if ($dirid) {
$ndg = new DocumentGroup($g, $dirid);
$DocGroupName = $ndg->getName();
$dgpath = $ndg->getPath(true, false);
if (!$DocGroupName) {
session_redirect($baseredirecturl.'&error_msg='.urlencode($g->getErrorMessage()));
}
if ($ndg->getState() != 1) {
$error_msg = _('Invalid folder');
session_redirect($baseredirecturl.'&view=listfile&error_msg='.urlencode($error_msg));
}
}
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;
}
}
}
?>
';
echo '
';
if ($DocGroupName) {
$headerPath = '
';
if ($childgroup_id)
$headerPath .= _('Subproject').' '.':'.' '.util_make_link('/docman/?group_id='.$g->getID(),$g->getPublicName()).' ';
$headerPath .= _('Path:').' '.$dgpath.'
';
echo $headerPath;
echo '
';
if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
echo '
';
echo '
'. _('Edit this folder') .'
';
include ($gfcommon.'docman/views/editdocgroup.php');
echo '';
}
if (forge_check_perm('docman', $ndg->Group->getID(), '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', $ndg->Group->getID(), '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/'.$d->Group->getID().'/'.$d->getID().'/'.urlencode($d->getFileName()));
}
}
echo '';
echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
echo ' | '."\n";
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 ' | ';
echo '';
switch ($d->getFileType()) {
case "URL": {
echo "--";
break;
}
default: {
echo human_readable_bytes($d->getFileSize());
break;
}
}
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', $ndg->Group->getID(), '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 '
'."\n";
if (forge_check_perm('docman', $d->Group->getID(), 'approve')) {
echo '
';
$d->editFile();
echo ' |
';
}
}
echo $HTML->listTableBottom();
echo '
';
echo '';
echo _('Mass actions for selected documents:');
echo '';
echo '';
if (forge_check_perm('docman', $ndg->Group->getID(), '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.').'
';
}
}
if (forge_check_perm('docman', $group_id, 'approve') && $DocGroupName) {
include ($gfcommon.'docman/views/pendingfiles.php');
}
echo '
';
echo '