* Copyright (C) 2010 Alcatel-Lucent
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
/* global variables used */
global $group_id; // id of the group
global $dirid; // id of doc_group
-global $dgf; // document group factory
global $HTML; // Layout object
global $u; // User object
global $g; // the Group object
+$linkmenu = 'listfile';
+$baseredirecturl = '/docman/?group_id='.$group_id;
+$redirecturl = $baseredirecturl.'&view=listfile&dirid='.$dirid;
+$actionlistfileurl = '?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
if (!forge_check_perm('docman', $group_id, 'read')) {
$return_msg= _('Document Manager Access Denied');
- session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+ session_redirect($baseredirecturl.'&warning_msg='.urlencode($return_msg));
+}
+
+echo '<div id="left" style="float:left; width:17%; min-width: 50px; overflow: auto;">';
+include ($gfcommon.'docman/views/tree.php');
+echo '</div>';
+
+// 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);
-/**
- * var must be named d_arr & nested_groups
- * because used by tree.php
- */
-$d_arr =& $df->getDocuments();
+$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();
-$linkmenu = 'listfile';
$nested_docs = array();
$DocGroupName = 0;
if ($dirid) {
- $ndg = new DocumentGroup($g,$dirid);
+ $ndg = new DocumentGroup($g, $dirid);
$DocGroupName = $ndg->getName();
+ $dgpath = $ndg->getPath(true, false);
if (!$DocGroupName) {
- session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
+ 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));
}
}
}
$df->setStateID('3');
-
$d_pending_arr =& $df->getDocuments();
$nested_pending_groups =& $dgf->getNested();
buttonAddItem: jQuery('#docman-additem'),
buttonEditDirectory: jQuery('#docman-editdirectory'),
docManURL: '<?php util_make_uri("docman") ?>',
- lockIntervalDelay: 60000, //in microsecond and if you change this value, please update the check value 600
+ lockIntervalDelay: 60000, //in millisecond and if you change this value, please update the check value 600
divLeft: jQuery('#left'),
divHandle: jQuery('#handle'),
divRight: jQuery('#right'),
+ childGroupId: <?php echo util_ifsetor($childgroup_id, 0) ?>
});
});
/* ]]> */</script>
<?php
-echo '<div id="left" style="float:left; width:17%; min-width: 50px;">';
-include ($gfcommon.'docman/views/tree.php');
-echo '</div>';
echo '<div id="handle" style="float:left; height:100px; margin:3px; width:3px; background: #000; cursor:e-resize;"></div>';
echo '<div id="right" style="float:left; width: 80%; overflow: auto; max-width: 90%;">';
if ($DocGroupName) {
- echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
- if (forge_check_perm('docman', $group_id, 'approve')) {
- echo '<a href="#" class="tabtitle" id="docman-editdirectory" title="'._('Edit this directory').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
- echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'" class="tabtitle" id="docman-trashdirectory" title="'._('Move this directory and his content to trash').'" >'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
+ $headerPath = '<h4>';
+ if ($childgroup_id)
+ $headerPath .= _('Subproject').' '.':'.' '.util_make_link('/docman/?group_id='.$g->getID(),$g->getPublicName()).' ';
+
+ $headerPath .= _('Path:').' <i>'.$dgpath.'</i></h4>';
+ echo $headerPath;
+ echo '<h3 class="docman_h3" >'._('Document Folder:').' <i>'.$DocGroupName.'</i> ';
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
+ echo '<a href="#" class="tabtitle" id="docman-editdirectory" title="'._('Edit this folder').'" >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
+ echo '<a href="'.$actionlistfileurl.'&action=trashdir" class="tabtitle" id="docman-trashdirectory" title="'._('Move this folder and his content to trash').'" >'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]) && !isset($nested_pending_docs[$dirid])) {
- echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" class="tabtitle" id="docman-deletedirectory" title="'._('Permanently delete this directory').'" >'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
+ echo '<a href="'.$actionlistfileurl.'&action=deldir" class="tabtitle" id="docman-deletedirectory" title="'._('Permanently delete this folder').'" >'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
}
}
if (forge_check_perm('docman', $group_id, 'submit')) {
- echo '<a href="#" class="tabtitle" id="docman-additem" title="'. _('Add a new item in this directory') . '" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'additem')). '</a>';
+ echo '<a href="#" class="tabtitle" id="docman-additem" title="'. _('Add a new item in this folder') . '" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'additem')). '</a>';
}
- echo '<a href="/docman/view.php/'.$group_id.'/zip/full/'.$dirid.'" class="tabtitle" title="'. _('Download this directory as a zip') . '" >' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'downloadaszip')). '</a>';
+ $numFiles = $ndg->getNumberOfDocuments(1);
+ if (forge_check_perm('docman', $group_id, 'approve'))
+ $numPendingFiles = $ndg->getNumberOfDocuments(3);
+ if ($numFiles || (isset($numPendingFiles) && $numPendingFiles))
+ echo '<a href="/docman/view.php/'.$ndg->Group->getID().'/zip/full/'.$dirid.'" class="tabtitle" title="'. _('Download this folder as a zip') . '" >' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'downloadaszip')). '</a>';
echo '</h3>';
- if (forge_check_perm('docman', $group_id, 'approve')) {
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
- echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
+ echo '<h4 class="docman_h4">'. _('Edit this folder') .'</h4>';
include ($gfcommon.'docman/views/editdocgroup.php');
echo '</div>';
}
- if (forge_check_perm('docman', $group_id, 'submit')) {
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'submit')) {
echo '<div class="docman_div_include" id="additem" style="display:none">';
echo '<h4 class="docman_h4">'. _('Add a new item') .'</h4>';
include ($gfcommon.'docman/views/additem.php');
if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
$tabletop = array('<input id="checkallactive" type="checkbox" title="'._('Select / Deselect all documents for massaction').'" class="tabtitle-w" onchange="controllerListFile.checkAll(\'checkeddocidactive\', \'active\')" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '');
- if (forge_check_perm('docman', $group_id, 'approve')) {
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
$tabletop[] = _('Actions');
$classth[] = 'unsortable';
}
echo '<tr>';
echo '<td>';
if (!$d->getLocked() && !$d->getReserved()) {
- echo '<input type="checkbox" value="'.$d->getID().'" class="checkeddocidactive tabtitle-w" title="'._('Select this document for massaction').'" onchange="controllerListFile.checkgeneral(\'active\')" />';
+ echo '<input type="checkbox" value="'.$d->getID().'" class="checkeddocidactive tabtitle-w" title="'._('Select / Deselect this document for massaction').'" onchange="controllerListFile.checkgeneral(\'active\')" />';
} else {
if (session_loggedin() && ($d->getReservedBy() != $u->getID())) {
echo '<input type="checkbox" name="disabled" disabled="disabled"';
} else {
- echo '<input type="checkbox" value="'.$d->getID().'" class="checkeddocidactive" onchange="controllerListFile.checkgeneral(\'active\')" />';
+ echo '<input type="checkbox" value="'.$d->getID().'" class="checkeddocidactive tabtitle-w" title="'._('Select / Deselect this document for massaction').'"" onchange="controllerListFile.checkgeneral(\'active\')" />';
}
}
echo '</td>';
break;
}
default: {
- $docurl = util_make_uri('/docman/view.php/'.$group_id.'/'.$d->getID().'/'.urlencode($d->getFileName()));
+ $docurl = util_make_uri('/docman/view.php/'.$d->Group->getID().'/'.$d->getID().'/'.urlencode($d->getFileName()));
}
}
echo '<td><a href="'.$docurl.'" class="tabtitle-nw" title="'._('View this document').'" >';
- echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));;
- echo '</a></td>';
+ echo html_image($d->getFileTypeImage(), '22', '22', array('alt'=>$d->getFileType()));
+ echo '</a></td>'."\n";
echo '<td>';
if (($d->getUpdated() && $time_new > (time() - $d->getUpdated())) || $time_new > (time() - $d->getCreated())) {
$html_image_attr = array();
$html_image_attr['title'] = _('Reserved Document');
echo html_image('docman/document-reserved.png', '22', '22', $html_image_attr);
} else {
- echo $d->getStateName().'</td>';
+ echo $d->getStateName();
}
+ echo '</td>';
echo '<td>';
switch ($d->getFileType()) {
case "URL": {
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 '</td>';
+ echo human_readable_bytes($d->getFileSize());
+ break;
}
}
+ echo '</td>';
if (forge_check_perm('docman', $group_id, 'approve')) {
echo '<td>';
}
}
if (!$d->getLocked() && !$d->getReserved()) {
- echo '<a class="tabtitle-ne" href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=trashfile&fileid='.$d->getID().'" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
if (session_loggedin()) {
echo '<a class="tabtitle-ne" href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
- echo '<a class="tabtitle-ne" href="?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Reserve this document for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=reservefile&fileid='.$d->getID().'" title="'. _('Reserve this document for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
}
} else {
if (session_loggedin() && $d->getReservedBy() != $u->getID()) {
- if (forge_check_perm('docman', $group_id, 'admin')) {
- echo '<a class="docman-enforcereservation" href="?group_id='.$group_id.'&action=enforcereserve&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Enforce reservation') .'" >'.html_image('docman/enforce-document.png',22,22,array('alt'=>_('Enforce reservation')));
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'admin')) {
+ echo '<a class="docman-enforcereservation" href="'.$actionlistfileurl.'&action=enforcereserve&fileid='.$d->getID().'" title="'. _('Enforce reservation') .'" >'.html_image('docman/enforce-document.png',22,22,array('alt'=>_('Enforce reservation')));
}
} else {
- echo '<a class="tabtitle-ne" href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=trashfile&fileid='.$d->getID().'" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
echo '<a class="tabtitle-ne" href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
- echo '<a class="tabtitle-ne" href="?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'. _('Release reservation') .'" >'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=releasefile&fileid='.$d->getID().'" title="'. _('Release reservation') .'" >'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
}
}
if (session_loggedin()) {
$option = 'add';
$titleMonitor = _('Start monitoring this document');
}
- echo '<a class="tabtitle-ne" href="?group_id='.$group_id.'&action=monitorfile&option='.$option.'&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" title="'.$titleMonitor.'" >'.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). '</a>';
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=monitorfile&option='.$option.'&fileid='.$d->getID().'" title="'.$titleMonitor.'" >'.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). '</a>';
}
echo '</td>';
}
- echo '</tr>';
+ echo '</tr>'."\n";
+ if (forge_check_perm('docman', $d->Group->getID(), 'approve')) {
+ echo '<tr id="docid'.$d->getID().'" class="docman_editfile_nodisplay" ><td colspan="10" >';
+ $d->editFile();
+ echo '</td></tr>';
+ }
}
echo $HTML->listTableBottom();
echo '<p>';
- echo '<span class="tabtitle" id="docman-massactionmessage" title="'. _('Actions availables for checked files, you need to check at least one file to get actions') . '" >';
- echo _('Mass actions for selected files:');
+ echo '<span class="tabtitle" id="docman-massactionmessage" title="'. _('Actions availables for selected documents, you need to check at least one document to get actions') . '" >';
+ echo _('Mass actions for selected documents:');
echo '</span>';
echo '<span id="massactionactive" style="display: none;" >';
- if (forge_check_perm('docman', $group_id, 'approve')) {
+ if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\'?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Move to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash'))). '</a>';
if (session_loggedin()) {
- echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\'?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Reserve for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve'))). '</a>';
- echo '<a class="tabtitle-ne" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Release reservation') .'">'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
- echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\'?group_id='.$group_id.'&action=monitorfile&option=add&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Start monitoring') .'" >'.html_image('docman/monitor-adddocument.png',22,22,array('alt'=>_('Start monitoring'))). '</a>';
- echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\'?group_id='.$group_id.'&action=monitorfile&option=remove&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Stop monitoring') .'" >'.html_image('docman/monitor-removedocument.png',22,22,array('alt'=>_('Stop monitoring'))). '</a>';
+ echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=reservefile&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Reserve for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve'))). '</a>';
+ echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=releasefile&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Release reservation') .'">'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
+ echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=monitorfile&option=add&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Start monitoring') .'" >'.html_image('docman/monitor-adddocument.png',22,22,array('alt'=>_('Start monitoring'))). '</a>';
+ echo '<a class="tabtitle-ne" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=monitorfile&option=remove&fileid=\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Stop monitoring') .'" >'.html_image('docman/monitor-removedocument.png',22,22,array('alt'=>_('Stop monitoring'))). '</a>';
}
}
echo '<a class="tabtitle" href="#" onclick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/'.$dirid.'/\'+controllerListFile.buildUrlByCheckbox(\'active\')" title="'. _('Download as a zip') . '" >' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
echo '</div>';
} else {
if ($dirid) {
- echo '<p class="warning">'._('No documents to display').'</p>';
+ echo '<p class="information">'._('No documents.').'</p>';
}
}
if (forge_check_perm('docman', $group_id, 'approve') && $DocGroupName) {
include ($gfcommon.'docman/views/pendingfiles.php');
- include ($gfcommon.'docman/views/editfile.php');
}
echo '</div>';
echo '<div style="clear: both;" />';
-?>
\ No newline at end of file
+?>