This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via 333bec2f4f99bc15f5264fae2655618a6eaf16a7 (commit)
via 14720d6ea06506086b9c0d023ba42c57acdd41ba (commit)
via cdc1180117d039084391a43b35108958ff13ff00 (commit)
via c292fb4bda471d03c7c3202dbbabab014c601e7a (commit)
from 539a10e9be2b0cfafb688cdada21e19ce08bbf11 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=333bec2f4f99bc15f5264fae2655618a6eaf16a7
commit 333bec2f4f99bc15f5264fae2655618a6eaf16a7
Author: Franck Villaume <[email protected]>
Date: Sun Dec 20 19:35:32 2015 +0100
docman search: better display if document is URL
diff --git a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
index cc26091..a9d78fa 100644
--- a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
+++ b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
@@ -98,7 +98,7 @@ class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
<?php
echo html_ac(html_ap() - 1);
}
- for($i = 0; $i < $rowsCount; $i++) {
+ for ($i = 0; $i < $rowsCount; $i++) {
$document = document_get_object(db_result($result, $i,
'docid'), db_result($result, $i, 'group_id'));
$currentDocGroup =
documentgroup_get_object($document->getDocGroupID(), $document->Group->getID());
//section changed
@@ -124,7 +124,11 @@ class DocsHtmlSearchRenderer extends
HtmlGroupSearchRenderer {
$cells[][] = html_e('input',
array('type' => 'checkbox', 'value' =>
$document->Group->getID().'-'.$document->getID(), 'class' =>
'checkeddocidactive', 'title' => _('Select / Deselect this document for
massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
}
}
- $cells[][] =
util_make_link('/docman/view.php/'.$document->Group->getID().'/'.$document->getID().'/'.urlencode($document->getFileName()),
html_image($document->getFileTypeImage(), 22, 22), array('title' => _('View
this document')));
+ if ($document->isURL()) {
+ $cells[][] =
util_make_link($document->getFileName(),
html_image($document->getFileTypeImage(), 22, 22), array('title' => _('Follow
this link')), true);
+ } else {
+ $cells[][] =
util_make_link('/docman/view.php/'.$document->Group->getID().'/'.$document->getID().'/'.urlencode($document->getFileName()),
html_image($document->getFileTypeImage(), 22, 22), array('title' => _('View
this document')));
+ }
$cells[][] = db_result($result, $i, 'title');
$cells[][] = db_result($result, $i, 'description');
if (forge_check_perm('docman',
$document->Group->getID(), 'approve')) {
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=14720d6ea06506086b9c0d023ba42c57acdd41ba
commit 14720d6ea06506086b9c0d023ba42c57acdd41ba
Author: Franck Villaume <[email protected]>
Date: Sun Dec 20 19:11:13 2015 +0100
docman: documentgroup_get_object uses group_id to ensure coherent data
diff --git a/src/common/docman/Document.class.php
b/src/common/docman/Document.class.php
index a509070..6c5d7e3 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -161,7 +161,7 @@ class Document extends Error {
}
}
- $dg = documentgroup_get_object($doc_group);
+ $dg = documentgroup_get_object($doc_group,
$this->Group->getID());
if ($dg->hasDocument($filename)) {
$this->setError(_('Document already published in this
folder').' '.$dg->getPath());
return false;
@@ -244,7 +244,7 @@ class Document extends Error {
}
if ($perm->isDocEditor()) {
- $localDg = documentgroup_get_object($doc_group);
+ $localDg = documentgroup_get_object($doc_group,
$this->Group->getID());
if (!$localDg->update($localDg->getName(),
$localDg->getParentID(), 1)) {
$this->setError(_('Error updating document
group')._(': ').$localDg->getErrorMessage());
if ($filesize) {
@@ -870,7 +870,7 @@ class Document extends Error {
if ($this->isMonitoredBy('ALL')) {
$BCC .= $this->getMonitoredUserEmailAddress();
}
- $dg = documentgroup_get_object($this->getDocGroupID());
+ $dg = documentgroup_get_object($this->getDocGroupID(),
$this->Group->getID());
if ($dg->isMonitoredBy('ALL')) {
$BCC .= $dg->getMonitoredUserEmailAddress();
}
@@ -1064,7 +1064,7 @@ class Document extends Error {
$this->setOnUpdateError(db_error());
return false;
}
- $localDg = documentgroup_get_object($this->getDocGroupID());
+ $localDg = documentgroup_get_object($this->getDocGroupID(),
$this->Group->getID());
if (!$localDg->update($localDg->getName(),
$localDg->getParentID(), 1)) {
$this->setError(_('Error updating document group')._(':
').$localDg->getErrorMessage());
return false;
diff --git a/src/common/docman/DocumentGroup.class.php
b/src/common/docman/DocumentGroup.class.php
index b0cb4e7..09c7d37 100644
--- a/src/common/docman/DocumentGroup.class.php
+++ b/src/common/docman/DocumentGroup.class.php
@@ -37,23 +37,23 @@ $DOCUMENTGROUP_OBJ = array();
* You should always use this instead of instantiating the object directly
*
* @param int $docgroup_id The ID of the document group -
required
+ * @param int $group_id Group ID of the project -
required
* @param int|bool $res The result set handle ("SELECT * FROM
doc_groups WHERE doc_group = $1")
* @return DocumentGroup a document group object or false on failure
*/
-function &documentgroup_get_object($docgroup_id, $res = false) {
+function &documentgroup_get_object($docgroup_id, $group_id, $res = false) {
global $DOCUMENTGROUP_OBJ;
if (!isset($DOCUMENTGROUP_OBJ["_".$docgroup_id."_"])) {
if ($res) {
//the db result handle was passed in
} else {
- $res = db_query_params('SELECT * FROM doc_groups WHERE
doc_group = $1',
- array($docgroup_id));
+ $res = db_query_params('SELECT * FROM doc_groups WHERE
doc_group = $1 and group_id = $2',
+ array($docgroup_id, $group_id));
}
if (!$res || db_numrows($res) < 1) {
$DOCUMENTGROUP_OBJ["_".$docgroup_id."_"] = false;
} else {
- $Group =
&group_get_object(db_result($res,0,'group_id'));
- $DOCUMENTGROUP_OBJ["_".$docgroup_id."_"] = new
DocumentGroup($Group, db_fetch_array($res));
+ $DOCUMENTGROUP_OBJ["_".$docgroup_id."_"] = new
DocumentGroup(group_get_object($group_id), db_fetch_array($res));
}
}
return $DOCUMENTGROUP_OBJ["_".$docgroup_id."_"];
@@ -227,7 +227,7 @@ class DocumentGroup extends Error {
}
/* update the parent */
- $parentDg = documentgroup_get_object($this->getParentID());
+ $parentDg = documentgroup_get_object($this->getParentID(),
$this->Group->getID());
$parentDg->update($parentDg->getName(),
$parentDg->getParentID(), 1);
/* is there any subdir ? */
$subdir = db_query_params('select doc_group from doc_groups
where parent_doc_group = $1 and group_id = $2',
@@ -644,7 +644,7 @@ class DocumentGroup extends Error {
$returnPath = '';
if ($this->getParentID()) {
- $parentDg =
documentgroup_get_object($this->getParentID());
+ $parentDg =
documentgroup_get_object($this->getParentID(), $this->Group->getID());
$returnPath = $parentDg->getPath($url);
}
if ($includename) {
@@ -950,7 +950,7 @@ class DocumentGroup extends Error {
$this->data_array['lockdate'] = $thistime;
$subGroupArray = $this->getSubgroup($this->getID(),
$this->getState());
foreach ($subGroupArray as $docgroupId) {
- $ndg = documentgroup_get_object($docgroupId);
+ $ndg = documentgroup_get_object($docgroupId,
$this->Group->getID());
$ndg->setLock($stateLock, $userid, $thistime);
}
return true;
diff --git a/src/common/docman/DocumentManager.class.php
b/src/common/docman/DocumentManager.class.php
index 789ec55..74f2b79 100644
--- a/src/common/docman/DocumentManager.class.php
+++ b/src/common/docman/DocumentManager.class.php
@@ -168,7 +168,7 @@ class DocumentManager extends Error {
* @param int $docGroupId the doc_group to start: default 0
*/
function getTree($selecteddir, $linkmenu, $docGroupId = 0) {
- global $g; // the master group of all the groups .... anyway.
+ global $g; // the master group of all the groups .... anyway.
Needed to support projects-hierarchy plugin
$dg = new DocumentGroup($this->Group);
switch ($linkmenu) {
case 'listtrashfile': {
@@ -183,11 +183,12 @@ class DocumentManager extends Error {
$subGroupIdArr = $dg->getSubgroup($docGroupId, $stateId);
if (sizeof($subGroupIdArr)) {
foreach ($subGroupIdArr as $subGroupIdValue) {
- $localDg =
documentgroup_get_object($subGroupIdValue);
+ $localDg =
documentgroup_get_object($subGroupIdValue, $this->Group->getID());
$liclass = 'docman_li_treecontent';
if ($selecteddir == $localDg->getID()) {
$liclass =
'docman_li_treecontent_selected';
}
+ // support projects-hierarchy plugin
if ($this->Group->getID() != $g->getID()) {
$link =
'/docman/?group_id='.$g->getID().'&view='.$linkmenu.'&dirid='.$localDg->getID().'&childgroup_id='.$this->Group->getID();
} else {
diff --git a/src/common/docman/actions/deldir.php
b/src/common/docman/actions/deldir.php
index a981150..695f233 100644
--- a/src/common/docman/actions/deldir.php
+++ b/src/common/docman/actions/deldir.php
@@ -48,7 +48,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
session_redirect($urlredirect.'&dirid='.$dirid);
}
-$dg = documentgroup_get_object($dirid);
+$dg = documentgroup_get_object($dirid, $g->getID());
if ($dg->isError() || !$dg->delete($dirid, $g->getID())) {
$error_msg = $dg->getErrorMessage();
diff --git a/src/common/docman/actions/editdocgroup.php
b/src/common/docman/actions/editdocgroup.php
index 9f2288a..65b02df 100644
--- a/src/common/docman/actions/editdocgroup.php
+++ b/src/common/docman/actions/editdocgroup.php
@@ -46,7 +46,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$groupname = getStringFromRequest('groupname');
$parent_dirid = getIntFromRequest('parent_dirid');
-$dg = documentgroup_get_object($dirid);
+$dg = documentgroup_get_object($dirid, $g->getID());
if ($dg->isError()) {
$error_msg = $dg->getErrorMessage();
session_redirect($urlredirect);
diff --git a/src/common/docman/actions/injectzip.php
b/src/common/docman/actions/injectzip.php
index 8dd6a74..031e952 100644
--- a/src/common/docman/actions/injectzip.php
+++ b/src/common/docman/actions/injectzip.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014,2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -29,11 +29,9 @@ global $group_id; // id of group
global $feedback;
global $error_msg;
global $warning_msg;
+global $dirid;
-$doc_group = getIntFromRequest('dirid');
-$return_url = '/docman/?group_id='.$group_id;
-if ($doc_group)
- $return_url .= '&dirid='.$doc_group;
+$return_url = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
if (!forge_check_perm('docman', $group_id, 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
@@ -41,7 +39,7 @@ if (!forge_check_perm('docman', $group_id, 'approve')) {
}
$uploaded_zip = getUploadedFile('uploaded_zip');
-$dg = documentgroup_get_object($doc_group);
+$dg = documentgroup_get_object($dirid, $group_id);
if (!$dg || $dg->isError() || !$dg->injectArchive($uploaded_zip)) {
$error_msg = $dg->getErrorMessage();
diff --git a/src/common/docman/actions/monitordirectory.php
b/src/common/docman/actions/monitordirectory.php
index b1eba37..6e441f4 100644
--- a/src/common/docman/actions/monitordirectory.php
+++ b/src/common/docman/actions/monitordirectory.php
@@ -34,7 +34,7 @@ if (!forge_check_perm('docman', $group_id, 'read')) {
$directoryid = getStringFromRequest('directoryid');
$option = getStringFromRequest('option');
-$dg = documentgroup_get_object($directoryid);
+$dg = documentgroup_get_object($directoryid, $group_id);
if (!$dg || $dg->isError()) {
$error_msg = _('Docman Error: unable to get folder object');
session_redirect('/docman/?group_id='.$group_id);
diff --git a/src/common/docman/actions/trashdir.php
b/src/common/docman/actions/trashdir.php
index a2b9c2d..2e2def7 100644
--- a/src/common/docman/actions/trashdir.php
+++ b/src/common/docman/actions/trashdir.php
@@ -5,7 +5,7 @@
* Copyright 2000, Quentin Cregan/Sourceforge
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013-2014 Franck Villaume - TrivialDev
+ * Copyright 2013-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -26,30 +26,30 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
global $feedback;
global $error_msg;
global $warning_msg;
+global $childgroup_id;
$redirecturl = '/docman/?group_id='.$group_id;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl.'&dirid='.$dirid);
-}
// plugin projects-hierarchy handler
$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
- if (!forge_check_perm('docman', $childgroup_id, 'approve')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl.'&dirid='.$dirid);
- }
+ $g = group_get_object($childgroup_id);
$redirecturl .= '&childgroup_id='.$childgroup_id;
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Action Denied.');
+ session_redirect($redirecturl.'&dirid='.$dirid);
+}
+
/* set this dirid to trash */
-$dg = documentgroup_get_object($dirid);
+$dg = documentgroup_get_object($dirid, $g->getID());
$currentParent = $dg->getParentID();
if ($dg->isError() || !$dg->trash()) {
diff --git a/src/common/docman/views/listfile.php
b/src/common/docman/views/listfile.php
index 7806606..0e74c23 100644
--- a/src/common/docman/views/listfile.php
+++ b/src/common/docman/views/listfile.php
@@ -96,7 +96,7 @@ $nested_docs = array();
$DocGroupName = 0;
if ($dirid) {
- $ndg = documentgroup_get_object($dirid);
+ $ndg = documentgroup_get_object($dirid, $g->getID());
$DocGroupName = $ndg->getName();
$dgpath = $ndg->getPath(true, false);
if (!$DocGroupName) {
diff --git a/src/common/docman/views/listtrashfile.php
b/src/common/docman/views/listtrashfile.php
index 247126e..8087a4b 100644
--- a/src/common/docman/views/listtrashfile.php
+++ b/src/common/docman/views/listtrashfile.php
@@ -73,7 +73,7 @@ $nested_docs = array();
$DocGroupName = 0;
if ($dirid) {
- $ndg = documentgroup_get_object($dirid);
+ $ndg = documentgroup_get_object($dirid, $g->getID());
$DocGroupName = $ndg->getName();
if (!$DocGroupName) {
$error_msg = $g->getErrorMessage();
diff --git a/src/common/docman/views/reporting.php
b/src/common/docman/views/reporting.php
index 7af550e..7b99566 100644
--- a/src/common/docman/views/reporting.php
+++ b/src/common/docman/views/reporting.php
@@ -164,7 +164,7 @@ if ($report->isError()) {
$classth = array('', '', '', '');
echo $HTML->listTableTop($tabletop, false,
'sortable_docman_listfile', 'sortable', $classth);
for ($i = 0; $i < count($data); $i++) {
- $ndg = documentgroup_get_object($data[$i][3]);
+ $ndg = documentgroup_get_object($data[$i][3],
$group_id);
$cells = array();
$cells[][] = $ndg->getPath(true);
$cells[][] = $data[$i][0];
diff --git a/src/common/widget/Widget_ProjectLatestDocuments.class.php
b/src/common/widget/Widget_ProjectLatestDocuments.class.php
index 18a130a..e990f53 100644
--- a/src/common/widget/Widget_ProjectLatestDocuments.class.php
+++ b/src/common/widget/Widget_ProjectLatestDocuments.class.php
@@ -93,7 +93,7 @@ class Widget_ProjectLatestDocuments extends Widget {
$filetype = $documentObject->getFileType();
$docid = $documentObject->getID();
$docgroup = $documentObject->getDocGroupID();
- $ndg = documentgroup_get_object($docgroup);
+ $ndg = documentgroup_get_object($docgroup,
$group_id);
$path = $ndg->getPath(true, true);
switch ($filetype) {
case "URL": {
diff --git a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
index e0edf70..cc26091 100644
--- a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
+++ b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
@@ -100,7 +100,7 @@ class DocsHtmlSearchRenderer extends
HtmlGroupSearchRenderer {
}
for($i = 0; $i < $rowsCount; $i++) {
$document = document_get_object(db_result($result, $i,
'docid'), db_result($result, $i, 'group_id'));
- $currentDocGroup =
documentgroup_get_object($document->getDocGroupID());
+ $currentDocGroup =
documentgroup_get_object($document->getDocGroupID(), $document->Group->getID());
//section changed
if ($lastDocGroupID != $currentDocGroup->getID()) {
//project changed
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=cdc1180117d039084391a43b35108958ff13ff00
commit cdc1180117d039084391a43b35108958ff13ff00
Author: Franck Villaume <[email protected]>
Date: Sun Dec 20 18:37:00 2015 +0100
docman search: fix all words or one word filter
diff --git a/src/common/docman/views/search.php
b/src/common/docman/views/search.php
index 58d27e8..48f362e 100644
--- a/src/common/docman/views/search.php
+++ b/src/common/docman/views/search.php
@@ -58,8 +58,10 @@ $date_format = _('Y-m-d');
if (getStringFromPost('search_type') == 'one') {
$attrsInputSearchOne['checked'] = 'checked';
+ $isExact = false;
} else {
$attrsInputSearchAll['checked'] = 'checked';
+ $isExact = true;
}
echo html_ao('div', array('id' => 'docman_search', 'class' =>
'docmanDivIncluded'));
@@ -175,7 +177,7 @@ if(!isset($paging) || !$paging)
$paging = 25;
if ($searchString) {
- $docsHtmlSearchRenderer = new DocsHtmlSearchRenderer($searchString,
$start, getStringFromPost('search_type'), $group_id, SEARCH__ALL_SECTIONS,
$paging, $search_options);
+ $docsHtmlSearchRenderer = new DocsHtmlSearchRenderer($searchString,
$start, $isExact, $group_id, SEARCH__ALL_SECTIONS, $paging, $search_options);
$docsHtmlSearchRenderer->searchQuery->executeQuery();
$nbDocs = $docsHtmlSearchRenderer->searchQuery->getRowsCount();
$max = $docsHtmlSearchRenderer->searchQuery->getRowsTotalCount();
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=c292fb4bda471d03c7c3202dbbabab014c601e7a
commit c292fb4bda471d03c7c3202dbbabab014c601e7a
Author: Franck Villaume <[email protected]>
Date: Sun Dec 20 18:21:45 2015 +0100
docman:
- global clean up
- declare more global vars
- use group_id to validate document_get_object
- better support for projects-hierarchy plugin
diff --git a/src/common/docman/Document.class.php
b/src/common/docman/Document.class.php
index ee3f00c..a509070 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -40,23 +40,24 @@ $DOCUMENT_OBJ = array();
* document_get_object is useful so you can pool document objects/save
database queries
* You should always use this instead of instantiating the object directly
*
- * @param int $doc_id The ID of the document - required
- * @param int|bool $res The result set handle ("SELECT * FROM
docdata_vw WHERE docid=$1")
+ * @param int $doc_id The ID of the document -
required
+ * @param int $group_id Group ID of the project -
required
+ * @param int|bool $res The result set handle ("SELECT
* FROM docdata_vw WHERE docid=$1")
* @return Document a document object or false on failure
*/
-function &document_get_object($doc_id, $res = false) {
+function &document_get_object($doc_id, $group_id, $res = false) {
global $DOCUMENT_OBJ;
if (!isset($DOCUMENT_OBJ["_".$doc_id."_"])) {
if ($res) {
//the db result handle was passed in
} else {
- $res = db_query_params('SELECT * FROM docdata_vw WHERE
docid = $1',
- array($doc_id));
+ $res = db_query_params('SELECT * FROM docdata_vw WHERE
docid = $1 and group_id = $2',
+ array($doc_id, $group_id));
}
if (!$res || db_numrows($res) < 1) {
$DOCUMENT_OBJ["_".$doc_id."_"] = false;
} else {
- $DOCUMENT_OBJ["_".$doc_id."_"] = new
Document(group_get_object(db_result($res,0,'group_id')), $doc_id,
db_fetch_array($res));
+ $DOCUMENT_OBJ["_".$doc_id."_"] = new
Document(group_get_object($group_id), $doc_id, db_fetch_array($res));
}
}
return $DOCUMENT_OBJ["_".$doc_id."_"];
diff --git a/src/common/docman/DocumentGroup.class.php
b/src/common/docman/DocumentGroup.class.php
index 55cd1af..b0cb4e7 100644
--- a/src/common/docman/DocumentGroup.class.php
+++ b/src/common/docman/DocumentGroup.class.php
@@ -260,11 +260,11 @@ class DocumentGroup extends Error {
}
switch ($uploaded_data_type) {
- case "application/zip": {
+ case 'application/zip': {
$returned = $this->injectZip($uploaded_data);
break;
}
- case "application/x-rar-compressed": {
+ case 'application/x-rar-compressed': {
$returned = $this->injectRar($uploaded_data);
break;
}
diff --git a/src/common/docman/DocumentGroupFactory.class.php
b/src/common/docman/DocumentGroupFactory.class.php
index 615e30f..e453e93 100644
--- a/src/common/docman/DocumentGroupFactory.class.php
+++ b/src/common/docman/DocumentGroupFactory.class.php
@@ -26,10 +26,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/*
- Document Groups
-*/
-
require_once $gfcommon.'include/Error.class.php';
class DocumentGroupFactory extends Error {
diff --git a/src/common/docman/DocumentManager.class.php
b/src/common/docman/DocumentManager.class.php
index 8154105..789ec55 100644
--- a/src/common/docman/DocumentManager.class.php
+++ b/src/common/docman/DocumentManager.class.php
@@ -2,7 +2,7 @@
/**
* FusionForge document manager
*
- * Copyright 2011-2014, Franck Villaume - TrivialDev
+ * Copyright 2011-2015, Franck Villaume - TrivialDev
* Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2013, French Ministry of National Education
* http://fusionforge.org
@@ -133,9 +133,27 @@ class DocumentManager extends Error {
* @return boolean success or not
*/
function isTrashEmpty() {
- $res = db_query_params('select ( select count(*) from
doc_groups where group_id = $1 and stateid = 2 and groupname !=$2 )
- + ( select count(*) from docdata_vw
where group_id = $3 and stateid = 2 ) as c',
- array($this->Group->getID(), '.trash',
$this->Group->getID()));
+ if ($this->Group->usesPlugin('projects-hierarchy')) {
+ $projectsHierarchy =
plugin_get_object('projects-hierarchy');
+ $projectIDsArray =
$projectsHierarchy->getFamily($this->Group->getID(), 'child', true,
'validated');
+ }
+
+
+ if (isset($projectIDsArray) && is_array($projectIDsArray)) {
+ foreach ($projectIDsArray as $projectID) {
+ $groupObject = group_get_object($projectID);
+ if ($groupObject->usesDocman() &&
$projectsHierarchy->getDocmanStatus($groupObject->getID())
+ && forge_check_perm('docman',
$groupObject->getID(), 'approve')) {
+ $groupIdArr[] = $projectID;
+ }
+ }
+ }
+ $groupIdArr[] = $this->Group->getID();
+
+ $res = db_query_params('select ( select count(*) from
doc_groups where group_id = ANY ($1) and stateid = 2 and groupname !=$2 )
+ + ( select count(*) from docdata_vw
where group_id = ANY ($3) and stateid = 2 ) as c',
+
array(db_int_array_to_any_clause($groupIdArr), '.trash',
db_int_array_to_any_clause($groupIdArr)));
+
if (!$res) {
return false;
}
diff --git a/src/common/docman/DocumentStorage.class.php
b/src/common/docman/DocumentStorage.class.php
index 3a979ef..c18b9a8 100644
--- a/src/common/docman/DocumentStorage.class.php
+++ b/src/common/docman/DocumentStorage.class.php
@@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/*
+/**
* Standard Alcatel-Lucent disclaimer for contributing to open source
*
* "The Artifact ("Contribution") has not been tested and/or
diff --git a/src/common/docman/Parsedata.class.php
b/src/common/docman/Parsedata.class.php
index a0b1b5a..8473c7c 100644
--- a/src/common/docman/Parsedata.class.php
+++ b/src/common/docman/Parsedata.class.php
@@ -48,8 +48,8 @@ class Parsedata {
* @return string the analysed content
*/
function get_parse_data($data, $filetype) {
- $parser = "";
- $rep = "";
+ $parser = '';
+ $rep = '';
if (array_key_exists($filetype, $this->parsers)) {
// parse data if good parser exists
$parser = $this->p_path.$this->parsers[$filetype];
@@ -72,8 +72,8 @@ class Parsedata {
$arrayLines = file($file, FILE_SKIP_EMPTY_LINES);
if (is_array($arrayLines) && count($arrayLines)) {
foreach ($arrayLines as $a) {
- if (trim($a) != "" && substr($a, 0,1) != "#") {
- $a2 = explode ("|", $a);
+ if (trim($a) != '' && substr($a, 0,1) != '#') {
+ $a2 = explode ('|', $a);
$rep[$a2[0]] = trim($a2[1]);
}
}
diff --git a/src/common/docman/actions/addfile.php
b/src/common/docman/actions/addfile.php
index 6d17483..97f1afc 100644
--- a/src/common/docman/actions/addfile.php
+++ b/src/common/docman/actions/addfile.php
@@ -8,7 +8,7 @@
* Copyright 2011, Roland Mas
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
* Copyright 2012, Thorsten Glaser - tarent solutions GmbH
- * Copyright 2012,2014, Franck Villaume - TrivialDev
+ * Copyright 2012,2014-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -29,9 +29,13 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of group
global $dirid;
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
$doc_group = getIntFromRequest('doc_group');
$title = trim(getStringFromRequest('title'));
@@ -48,16 +52,11 @@ if (!$doc_group) {
}
$baseurl = '/docman/?group_id='.$group_id;
-$redirecturl = $baseurl.'&view=listfile&dirid='.$doc_group;
+$redirecturl = $baseurl.'&dirid='.$doc_group;
// plugin projects-hierarchy handler
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
$redirecturl .= '&childgroup_id='.$childgroup_id;
- if (!forge_check_perm('docman', $childgroup_id, 'submit')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl);
- }
$g = group_get_object($childgroup_id);
}
diff --git a/src/common/docman/actions/addsubdocgroup.php
b/src/common/docman/actions/addsubdocgroup.php
index 619b04c..f64180f 100644
--- a/src/common/docman/actions/addsubdocgroup.php
+++ b/src/common/docman/actions/addsubdocgroup.php
@@ -33,10 +33,10 @@ global $group_id; // id of group
global $feedback;
global $error_msg;
global $warning_msg;
-global $childgroup_id;
+global $childgroup_id; // id of child group if any
if ($dirid) {
- $urlredirect =
'/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
+ $urlredirect = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
} else {
$urlredirect = '/docman/?group_id='.$group_id;
}
@@ -67,4 +67,4 @@ if ($dirid) {
}
$feedback = _('Document folder successfully created.');
-session_redirect($urlredirect.'&view=listfile&dirid='.$dg->getID());
+session_redirect($urlredirect.'&dirid='.$dg->getID());
diff --git a/src/common/docman/actions/deldir.php
b/src/common/docman/actions/deldir.php
index 2382846..a981150 100644
--- a/src/common/docman/actions/deldir.php
+++ b/src/common/docman/actions/deldir.php
@@ -6,7 +6,7 @@
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014,2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -27,14 +27,17 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
$urlredirect = '/docman/?group_id='.$group_id;
// plugin projects-hierarchy handler
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
$g = group_get_object($childgroup_id);
$urlredirect .= '&childgroup_id='.$childgroup_id;
@@ -42,23 +45,23 @@ if ($childgroup_id) {
if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
-
session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+ session_redirect($urlredirect.'&dirid='.$dirid);
}
$dg = documentgroup_get_object($dirid);
if ($dg->isError() || !$dg->delete($dirid, $g->getID())) {
$error_msg = $dg->getErrorMessage();
- session_redirect($urlredirect.'&view=listfile&dirid='.$dirid);
+ session_redirect($urlredirect.'&dirid='.$dirid);
}
if ($dg->getState() != 2) {
$parentId = $dg->getParentID();
- $view='listfile';
+ $view = '';
} else {
$parentId = 0;
- $view='listtrashfile';
+ $view = '&view=listtrashfile';
}
$feedback = sprintf(_('Document folder %s deleted successfully.'),
$dg->getName());
-session_redirect($urlredirect.'&view='.$view.'&dirid='.$parentId);
+session_redirect($urlredirect.$view.'&dirid='.$parentId);
diff --git a/src/common/docman/actions/delfile.php
b/src/common/docman/actions/delfile.php
index 0939ba0..ea1200c 100644
--- a/src/common/docman/actions/delfile.php
+++ b/src/common/docman/actions/delfile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014-2015 Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,28 +24,37 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+
+$urlredirect =
'/docman/?group_id='.$group_id.'&view=listtrashfile&dirid='.$dirid;
+
+// plugin projects-hierarchy handler
+if ($childgroup_id) {
+ $g = group_get_object($childgroup_id);
+ $urlredirect .= '&childgroup_id='.$childgroup_id;
+}
if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
-
session_redirect('/docman/?group_id='.$group_id.'&view=listtrashfile&dirid='.$dirid);
+ session_redirect($urlredirect);
}
$arr_fileid = explode(',', getStringFromRequest('fileid'));
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $group_id);
if ($d->isError() || !$d->delete()) {
$error_msg = $d->getErrorMessage();
-
session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+ session_redirect($urlredirect);
}
} else {
$warning_msg = _('No action to perform');
-
session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+ session_redirect($urlredirect);
}
}
$count = count($arr_fileid);
$feedback = sprintf(ngettext('%s document deleted successfully.', '%s
documents deleted successfully.', $count), $count);
-session_redirect('/docman/?group_id='.$group_id.'&view=listtrashfile&dirid='.$dirid);
+session_redirect($urlredirect);
diff --git a/src/common/docman/actions/editdocgroup.php
b/src/common/docman/actions/editdocgroup.php
index 6110d76..9f2288a 100644
--- a/src/common/docman/actions/editdocgroup.php
+++ b/src/common/docman/actions/editdocgroup.php
@@ -26,8 +26,8 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
global $childgroup_id; // plugin projects hierarchy handler
diff --git a/src/common/docman/actions/editfile.php
b/src/common/docman/actions/editfile.php
index 6c6e866..4b0b89d 100644
--- a/src/common/docman/actions/editfile.php
+++ b/src/common/docman/actions/editfile.php
@@ -5,7 +5,7 @@
* Copyright 2000, Quentin Cregan/Sourceforge
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2012,2014, Franck Villaume - TrivialDev
+ * Copyright 2012,2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -26,12 +26,13 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
$urlparam = '/docman/?group_id='.$group_id;
-if (isset($childgroup_id) && $childgroup_id) {
+
+if ($childgroup_id) {
$g = group_get_object($childgroup_id);
$urlparam .= '&childgroup_id='.$childgroup_id;
}
@@ -45,7 +46,7 @@ switch ($fromview) {
break;
}
default: {
- $urlparam .= '&view=listfile&dirid='.$doc_group;
+ $urlparam .= '&dirid='.$doc_group;
break;
}
}
@@ -70,7 +71,7 @@ if (!$docid) {
session_redirect($urlparam);
}
-$d= document_get_object($docid);
+$d = document_get_object($docid, $g->getID());
if ($d->isError()) {
$error_msg = $d->getErrorMessage();
session_redirect($urlparam);
diff --git a/src/common/docman/actions/emptytrash.php
b/src/common/docman/actions/emptytrash.php
index 1d3759a..55df2a0 100644
--- a/src/common/docman/actions/emptytrash.php
+++ b/src/common/docman/actions/emptytrash.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013,2014, Franck Villaume - TrivialDev
+ * Copyright 2013-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,20 +24,31 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
-if ( !forge_check_perm('docman', $group_id, 'approve')) {
+$redirecturl = '/docman/?group_id='.$group_id;
+
+// plugin projects-hierarchy handler
+if ($childgroup_id) {
+ $redirecturl .= '&childgroup_id='.$childgroup_id;
+ $g = group_get_object($childgroup_id);
+}
+
+if (!forge_check_perm('docman', $g->getID(), 'submit')) {
$warning_msg = _('Document Manager Action Denied.');
- session_redirect('/docman/?group_id='.$group_id);
+ session_redirect($redirecturl);
}
$dm = new DocumentManager($g);
if (!$dm->cleanTrash()) {
$error_msg = _('Unable to clean trash');
- session_redirect('/docman/?group_id='.$group_id);
+ session_redirect($redirecturl);
}
$feedback = _('Emptied Trash successfully.');
-session_redirect('/docman/?group_id='.$group_id);
+session_redirect($redirecturl);
diff --git a/src/common/docman/actions/enforcereserve.php
b/src/common/docman/actions/enforcereserve.php
index 46d0d90..609da68 100644
--- a/src/common/docman/actions/enforcereserve.php
+++ b/src/common/docman/actions/enforcereserve.php
@@ -24,8 +24,8 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
if (!forge_check_perm('docman', $group_id, 'admin')) {
diff --git a/src/common/docman/actions/forcereindexenginesearch.php
b/src/common/docman/actions/forcereindexenginesearch.php
index aa7d722..6aa5b56 100644
--- a/src/common/docman/actions/forcereindexenginesearch.php
+++ b/src/common/docman/actions/forcereindexenginesearch.php
@@ -24,7 +24,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of group
if ( !forge_check_perm('docman', $group_id, 'admin')) {
diff --git a/src/common/docman/actions/getfile.php
b/src/common/docman/actions/getfile.php
index 125fa4c..0694588 100644
--- a/src/common/docman/actions/getfile.php
+++ b/src/common/docman/actions/getfile.php
@@ -23,13 +23,18 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
+global $g; // Group object
global $dirid; //id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
$sysdebug_enable = false;
$urlparam = '/docman/?group_id='.$group_id;
-if (isset($childgroup_id) && $childgroup_id) {
+if ($childgroup_id) {
$g = group_get_object($childgroup_id);
$urlparam .= '&childgroup_id='.$childgroup_id;
}
@@ -48,18 +53,15 @@ switch ($fromview) {
}
}
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
session_redirect($urlparam);
}
$itemid = getIntFromRequest('itemid');
-$childgroup_id = getIntFromRequest('childgroup_id');
$details = getIntFromRequest('details');
-if ($childgroup_id) {
- $g = group_get_object($childgroup_id);
-}
-$d = document_get_object($itemid);
+
+$d = document_get_object($itemid, $g->getID());
if ($d->isError()) {
$error_msg = $d->getErrorMessage();
session_redirect($urlparam);
diff --git a/src/common/docman/actions/injectzip.php
b/src/common/docman/actions/injectzip.php
index 112a316..8dd6a74 100644
--- a/src/common/docman/actions/injectzip.php
+++ b/src/common/docman/actions/injectzip.php
@@ -24,8 +24,11 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; // group object
+global $g; // Group object
global $group_id; // id of group
+global $feedback;
+global $error_msg;
+global $warning_msg;
$doc_group = getIntFromRequest('dirid');
$return_url = '/docman/?group_id='.$group_id;
diff --git a/src/common/docman/actions/monitorfile.php
b/src/common/docman/actions/monitorfile.php
index a4c6460..34f182b 100644
--- a/src/common/docman/actions/monitorfile.php
+++ b/src/common/docman/actions/monitorfile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2012-2014, Franck Villaume - TrivialDev
+ * Copyright 2012-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -27,11 +27,11 @@
global $dirid; //id of doc_group
global $group_id; // id of group
global $LUSER; //user object
+global $childgroup_id; // id of child group if any
$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
// plugin projects-hierarchy handler
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
$redirecturl .= '&childgroup_id='.$childgroup_id;
if (!forge_check_perm('docman', $childgroup_id, 'submit')) {
@@ -52,7 +52,7 @@ switch ($option) {
case 'start': {
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $g->getID());
if ($d->isError() ||
!$d->addMonitoredBy(user_getid())) {
$error_msg = $d->getErrorMessage();
session_redirect($redirecturl);
@@ -69,7 +69,7 @@ switch ($option) {
case 'stop': {
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $g->getID());
if ($d->isError() ||
!$d->removeMonitoredBy($LUSER->getID())) {
$error_msg = $d->getErrorMessage();
session_redirect($redirecturl);
diff --git a/src/common/docman/actions/movefile.php
b/src/common/docman/actions/movefile.php
index 9da1e91..63e3535 100644
--- a/src/common/docman/actions/movefile.php
+++ b/src/common/docman/actions/movefile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2012-2014, Franck Villaume - TrivialDev
+ * Copyright 2012-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,40 +24,39 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
-$baseurl = '/docman/?group_id='.$group_id;
-$redirecturl = $baseurl.'&view=listfile&dirid='.$dirid;
+$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
// plugin projects-hierarchy handler
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
$redirecturl .= '&childgroup_id='.$childgroup_id;
- if (!forge_check_perm('docman', $childgroup_id, 'submit')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl);
- }
$g = group_get_object($childgroup_id);
}
if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
- session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+ session_redirect($redirecturl);
}
$arr_fileid = explode(',', getStringFromRequest('fileid'));
$moveto_dirid = getIntFromRequest('moveto_dirid');
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $g->getID());
if ($d->isError() || !$d->update($d->getFilename(),
$d->getFileType(), NULL, $moveto_dirid, $d->getName(), $d->getDescription(),
$d->getStateID())) {
$error_msg = $d->getErrorMessage();
-
session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+ session_redirect($redirecturl);
}
}
}
$count = count($arr_fileid);
$feedback = sprintf(ngettext('%s document moved.', '%s documents moved.',
$count), $count);
-session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+session_redirect($redirecturl);
diff --git a/src/common/docman/actions/releasefile.php
b/src/common/docman/actions/releasefile.php
index a4cfc1d..c09ddaa 100644
--- a/src/common/docman/actions/releasefile.php
+++ b/src/common/docman/actions/releasefile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013-2014, Franck Villaume - TrivialDev
+ * Copyright 2013-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,24 +24,35 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
+
+// plugin projects-hierarchy handler
+if ($childgroup_id) {
+ $redirecturl .= '&childgroup_id='.$childgroup_id;
+ $g = group_get_object($childgroup_id);
+}
+
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$warning_msg = _('Document Manager Action Denied.');
- session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+ session_redirect($redirecturl);
}
$arr_fileid = explode(',', getStringFromRequest('fileid'));
-$feedback = _('Document(s)').' ';
foreach ($arr_fileid as $fileid) {
- $d= document_get_object($fileid);
- $feedback .= $d->getFilename().' ';
+ $d = document_get_object($fileid, $g->getID());
if ($d->isError() || !$d->setReservedBy(0)) {
- $feedback = '';
$error_msg = $d->getErrorMessage();
-
session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+ session_redirect($redirecturl);
}
}
-$feedback .= _('released successfully.');
-session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
+$count = count($arr_fileid);
+$feedback = sprintf(ngettext('%s document released.', '%s documents
released.', $count), $count);
+session_redirect($redirecturl);
diff --git a/src/common/docman/actions/reservefile.php
b/src/common/docman/actions/reservefile.php
index c1ae900..22ecc60 100644
--- a/src/common/docman/actions/reservefile.php
+++ b/src/common/docman/actions/reservefile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013-2014, Franck Villaume - TrivialDev
+ * Copyright 2013-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,6 +24,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
+global $g; // Group object
global $dirid; //id of doc_group
global $group_id; // id of group
global $feedback;
@@ -38,7 +39,7 @@ if (!forge_check_perm('docman', $group_id, 'approve')) {
$arr_fileid = explode(',', getStringFromRequest('fileid'));
$feedback = _('Document(s)').' ';
foreach ($arr_fileid as $fileid) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $group_id);
$feedback .= $d->getFilename().' ';
if ($d->isError() || !$d->setReservedBy('1', user_getid())) {
$feedback = '';
diff --git a/src/common/docman/actions/trashfile.php
b/src/common/docman/actions/trashfile.php
index a2b88c7..90ed693 100644
--- a/src/common/docman/actions/trashfile.php
+++ b/src/common/docman/actions/trashfile.php
@@ -5,7 +5,7 @@
* Copyright 2000, Quentin Cregan/Sourceforge
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -26,34 +26,31 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
global $warning_msg;
global $feedback;
global $error_msg;
$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl);
-}
// plugin projects-hierarchy handler
$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
- if (!forge_check_perm('docman', $childgroup_id, 'approve')) {
- $warning_msg = _('Document Manager Action Denied.');
- session_redirect($redirecturl);
- }
$redirecturl .= '&childgroup_id='.$childgroup_id;
$g = group_get_object($childgroup_id);
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Action Denied.');
+ session_redirect($redirecturl);
+}
+
$arr_fileid = explode(',', getStringFromRequest('fileid'));
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $g->getID());
if (!$d || $d->isError() || !$d->trash()) {
$error_msg = $d->getErrorMessage();
session_redirect($redirecturl);
diff --git a/src/common/docman/actions/updatecreateonline.php
b/src/common/docman/actions/updatecreateonline.php
index b1e4281..9e34f24 100644
--- a/src/common/docman/actions/updatecreateonline.php
+++ b/src/common/docman/actions/updatecreateonline.php
@@ -24,7 +24,7 @@
/* please do not add require here: use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of group
global $feedback;
global $error_msg;
diff --git a/src/common/docman/actions/updateenginesearch.php
b/src/common/docman/actions/updateenginesearch.php
index 6537426..16a6293 100644
--- a/src/common/docman/actions/updateenginesearch.php
+++ b/src/common/docman/actions/updateenginesearch.php
@@ -24,7 +24,7 @@
/* please do not add require here: use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of group
global $feedback;
global $error_msg;
diff --git a/src/common/docman/actions/updatewebdavinterface.php
b/src/common/docman/actions/updatewebdavinterface.php
index e61ab25..c85093f 100644
--- a/src/common/docman/actions/updatewebdavinterface.php
+++ b/src/common/docman/actions/updatewebdavinterface.php
@@ -24,7 +24,7 @@
/* please do not add require here: use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of group
global $feedback;
global $error_msg;
diff --git a/src/common/docman/actions/validatefile.php
b/src/common/docman/actions/validatefile.php
index b9e3285..d2fbbd6 100644
--- a/src/common/docman/actions/validatefile.php
+++ b/src/common/docman/actions/validatefile.php
@@ -3,7 +3,7 @@
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013-2014, Franck Villaume - TrivialDev
+ * Copyright 2013-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -24,13 +24,17 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
-global $dirid; //id of doc_group
+global $g; // Group object
+global $dirid; // id of doc_group
global $group_id; // id of group
+global $childgroup_id; // id of child group if any
+global $feedback;
+global $error_msg;
+global $warning_msg;
$urlredirect = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
+
// plugin projects-hierarchy handler
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
$g = group_get_object($childgroup_id);
$urlredirect .= '&childgroup_id='.$childgroup_id;
@@ -44,7 +48,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
$arr_fileid = explode(',', getStringFromRequest('fileid'));
foreach ($arr_fileid as $fileid) {
if (!empty($fileid)) {
- $d = document_get_object($fileid);
+ $d = document_get_object($fileid, $g->getID());
if ($d->isError() || !$d->setState('1')) {
$error_msg = $d->getErrorMessage();
session_redirect($urlredirect);
diff --git a/src/common/docman/include/utils.php
b/src/common/docman/include/utils.php
index 12b158c..09929c1 100644
--- a/src/common/docman/include/utils.php
+++ b/src/common/docman/include/utils.php
@@ -54,9 +54,9 @@ function docman_fill_zip($zip, $nested_groups,
$document_factory, $docgroup = 0,
if (is_array(@$nested_groups[$docgroup])) {
foreach ($nested_groups[$docgroup] as $dg) {
if ($parent_docname != '') {
- $path = iconv("UTF-8", "ASCII//TRANSLIT",
$parent_docname).'/'.iconv("UTF-8", "ASCII//TRANSLIT", $dg->getName());
+ $path = iconv('UTF-8', 'ASCII//TRANSLIT',
$parent_docname).'/'.iconv('UTF-8', 'ASCII//TRANSLIT', $dg->getName());
} else {
- $path = iconv("UTF-8", "ASCII//TRANSLIT",
$dg->getName());
+ $path = iconv('UTF-8', 'ASCII//TRANSLIT',
$dg->getName());
}
if (!$zip->addEmptyDir($path)) {
@@ -68,7 +68,7 @@ function docman_fill_zip($zip, $nested_groups,
$document_factory, $docgroup = 0,
if (is_array($docs) && count($docs)) {
foreach ($docs as $doc) {
if (!$doc->isURL()) {
- if
(!$zip->addFromString($path.'/'.iconv("UTF-8", "ASCII//TRANSLIT",
$doc->getFileName()), $doc->getFileData())) {
+ if
(!$zip->addFromString($path.'/'.iconv('UTF-8', 'ASCII//TRANSLIT',
$doc->getFileName()), $doc->getFileData())) {
return false;
}
}
diff --git a/src/common/docman/include/webdav.php
b/src/common/docman/include/webdav.php
index 9161209..99f0f26 100644
--- a/src/common/docman/include/webdav.php
+++ b/src/common/docman/include/webdav.php
@@ -289,6 +289,12 @@ class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server
{
}
}
+ /**
+ * PUT
+ * called by HTTP_WebDAV_Server
+ *
+ * @param array $options options passed by previous
functions in HTTP_WebDAV_Server
+ */
function PUT(&$options) {
$arr_path = explode('/', rtrim($options['path'], '/'));
$group_id = $arr_path[3];
@@ -313,7 +319,7 @@ class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server {
$docid = $dg->hasDocument($newfilename);
if ($docid) {
- $d = document_get_object($docid);
+ $d = document_get_object($docid, $g->getID());
if (!$d->getReserved() && !$d->getLocked()) {
if ($d->update($d->getFileName(),
$d->getFileType(), $tmpfile, $dgId, $d->getName(), $d->getDescription(),
$d->getStateID())) {
@unlink($tmpfile);
@@ -344,6 +350,12 @@ class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server
{
return '409';
}
+ /**
+ * DELETE
+ * called by HTTP_WebDAV_Server
+ *
+ * @param array $options options passed by previous
functions in HTTP_WebDAV_Server
+ */
function DELETE(&$options) {
$arr_path = explode('/', rtrim($options['path'], '/'));
$group_id = $arr_path[3];
@@ -391,6 +403,12 @@ class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server
{
return '404';
}
+ /**
+ * MKCOL
+ * called by HTTP_WebDAV_Server
+ *
+ * @param array $options options passed by previous
functions in HTTP_WebDAV_Server
+ */
function MKCOL(&$options) {
$arr_path = explode('/', rtrim($options['path'], '/'));
$group_id = $arr_path[3];
@@ -414,6 +432,12 @@ class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server
{
return '405';
}
+ /**
+ * MOVE
+ * called by HTTP_WebDAV_Server
+ *
+ * @param array $options options passed by previous
functions in HTTP_WebDAV_Server
+ */
function MOVE(&$options) {
$arr_path = explode('/', rtrim($options['path'], '/'));
$group_id = $arr_path[3];
diff --git a/src/common/docman/views/addfile.php
b/src/common/docman/views/addfile.php
index 7d07050..7149823 100644
--- a/src/common/docman/views/addfile.php
+++ b/src/common/docman/views/addfile.php
@@ -34,6 +34,7 @@ global $dirid; //id of the doc_group
global $dm; // the Document Manager object
global $HTML; // Layout object
global $warning_msg;
+global $error_msg;
global $childgroup_id;
$actionurl = '/docman/?group_id='.$group_id.'&action=addfile&dirid='.$dirid;
diff --git a/src/common/docman/views/addsubdocgroup.php
b/src/common/docman/views/addsubdocgroup.php
index 54e0a79..e77a65b 100644
--- a/src/common/docman/views/addsubdocgroup.php
+++ b/src/common/docman/views/addsubdocgroup.php
@@ -27,23 +27,27 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
+global $g; // Group object
global $group_id; // id of the group
global $dirid; // id of the doc_group
global $warning_msg;
global $childgroup_id;
-
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect('/docman/?group_id='.$group_id);
-}
+global $childgroup_id;
+global $HTML; // Layout object
$actionurl =
'/docman/?group_id='.$group_id.'&action=addsubdocgroup&dirid='.$dirid;
// plugin projects-hierarchy support
if ($childgroup_id) {
+ $g = group_get_object($childgroup_id);
$actionurl .= '&childgroup_id='.$childgroup_id;
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect('/docman/?group_id='.$group_id);
+}
+
echo html_ao('script', array('type' => 'text/javascript'));
?>
//<![CDATA[
diff --git a/src/common/docman/views/admin.php
b/src/common/docman/views/admin.php
index 741b679..d7fb21b 100644
--- a/src/common/docman/views/admin.php
+++ b/src/common/docman/views/admin.php
@@ -27,7 +27,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of the group
global $warning_msg;
global $HTML;
diff --git a/src/common/docman/views/editdocgroup.php
b/src/common/docman/views/editdocgroup.php
index 908e77b..7ed12ae 100644
--- a/src/common/docman/views/editdocgroup.php
+++ b/src/common/docman/views/editdocgroup.php
@@ -28,7 +28,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of the group
global $dirid; // id of doc_group
global $dgf; // document directory factory of this group
@@ -37,11 +37,6 @@ global $HTML;
global $warning_msg;
global $childgroup_id;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect('/docman/?group_id='.$group_id);
-}
-
$actionurl = '/docman/?group_id='.$group_id.'&action=editdocgroup';
// plugin projects-hierarchy support
@@ -50,6 +45,11 @@ if ($childgroup_id) {
$actionurl .= '&childgroup_id='.$childgroup_id;
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect('/docman/?group_id='.$group_id);
+}
+
$dg = new DocumentGroup($g, $dirid);
if ($dg->isError()) {
$error_msg = $dg->getErrorMessage();
diff --git a/src/common/docman/views/editfile.php
b/src/common/docman/views/editfile.php
index 96a8099..c14b77e 100644
--- a/src/common/docman/views/editfile.php
+++ b/src/common/docman/views/editfile.php
@@ -23,7 +23,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of the group
global $HTML;
global $warning_msg;
diff --git a/src/common/docman/views/help.php b/src/common/docman/views/help.php
index 621adef..d897193 100644
--- a/src/common/docman/views/help.php
+++ b/src/common/docman/views/help.php
@@ -29,21 +29,20 @@ global $g; // the project object
global $warning_msg;
global $childgroup_id;
-if (!forge_check_perm('docman', $group_id, 'read')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect('/docman/?group_id='.$group_id);
-}
-
// plugin hierarchy support
if ($childgroup_id) {
- $group_id = $childgroup_id;
$g = group_get_object($childgroup_id);
}
+if (!forge_check_perm('docman', $g->getID(), 'read')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect('/docman/?group_id='.$group_id);
+}
+
echo html_ao('div', array('class' => 'docmanDivIncluded'));
plugin_hook('blocks', 'doc help');
if (forge_get_config('use_webdav') && $g->useWebdav()) {
echo html_e('p', array(), _('Documents parsing is also available
through webdav. Only for registered users.'), false);
- echo html_e('p', array(),
util_make_link('/docman/view.php/'.$group_id.'/webdav',_('Direct Webdav URL')),
false);
+ echo html_e('p', array(),
util_make_link('/docman/view.php/'.$g->getID().'/webdav',_('Direct Webdav
URL')), false);
}
echo html_ac(html_ap() - 1);
diff --git a/src/common/docman/views/listfile.php
b/src/common/docman/views/listfile.php
index 1a8cc97..7806606 100644
--- a/src/common/docman/views/listfile.php
+++ b/src/common/docman/views/listfile.php
@@ -41,10 +41,6 @@ global $start; // use to set the offset
$linkmenu = 'listfile';
$baseredirecturl = '/docman/?group_id='.$group_id;
$redirecturl = $baseredirecturl.'&view='.$linkmenu.'&dirid='.$dirid;
-if (!forge_check_perm('docman', $group_id, 'read')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect($baseredirecturl);
-}
echo html_ao('div', array('id' => 'leftdiv'));
include ($gfcommon.'docman/views/tree.php');
@@ -53,14 +49,15 @@ echo html_ac(html_ap() - 1);
// plugin projects-hierarchy support
$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
- if (!forge_check_perm('docman', $childgroup_id, 'read')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect($baseredirecturl);
- }
$redirecturl .= '&childgroup_id='.$childgroup_id;
$g = group_get_object($childgroup_id);
}
+if (!forge_check_perm('docman', $g->getID(), 'read')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect($baseredirecturl);
+}
+
if (session_loggedin()) {
if (getStringFromRequest('setpaging')) {
/* store paging preferences */
@@ -262,12 +259,12 @@ if (isset($nested_docs[$dirid]) &&
is_array($nested_docs[$dirid])) {
}
}
if (!$d->getLocked() && !$d->getReserved()) {
- $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $d->getID(), 'class' => 'checkeddocidactive', 'title' =>
_('Select / Deselect this document for massaction'), 'onClick' =>
'controllerListFile.checkgeneral("active")'));
+ $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $d->Group->getID().'-'.$d->getID(), 'class' =>
'checkeddocidactive', 'title' => _('Select / Deselect this document for
massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
} else {
if (session_loggedin() && ($d->getReservedBy() !=
$LUSER->getID())) {
$cells[][] = html_e('input', array('type' =>
'checkbox', 'name' => 'disabled', 'disabled' => 'disabled'));
} else {
- $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $d->getID(), 'class' => 'checkeddocidactive', 'title' =>
_('Select / Deselect this document for massaction'), 'onClick' =>
'controllerListFile.checkgeneral("active")'));
+ $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $d->Group->getID().'-'.$d->getID(), 'class' =>
'checkeddocidactive', 'title' => _('Select / Deselect this document for
massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
}
}
switch ($d->getFileType()) {
@@ -398,7 +395,7 @@ if ($DocGroupName) {
include ($gfcommon.'docman/views/editfile.php');
$directViewFileRequestedID = getIntFromRequest('filedetailid',
null);
if ($directViewFileRequestedID) {
- $localDocumentObject =
document_get_object($directViewFileRequestedID);
+ $localDocumentObject =
document_get_object($directViewFileRequestedID, $group_id);
echo html_ao('script', array('type' =>
'text/javascript'));
echo '//<![CDATA['."\n";
echo 'jQuery(document).ready(function()
{javascript:controllerListFile.toggleEditFileView({action:\''.util_make_uri($editfileaction).'\',
diff --git a/src/common/docman/views/listtrashfile.php
b/src/common/docman/views/listtrashfile.php
index 6115799..247126e 100644
--- a/src/common/docman/views/listtrashfile.php
+++ b/src/common/docman/views/listtrashfile.php
@@ -29,32 +29,33 @@
/* global variables used */
global $group_id; // id of the group
global $dirid; // id of doc_group
+global $HTML; // Layout object
+global $LUSER; // User object
global $g; // the Group object
+global $dm; // the docman manager
+global $warning_msg;
+global $start; // use to set the offset
$linkmenu = 'listtrashfile';
$childgroup_id = getIntFromRequest('childgroup_id');
$baseredirecturl = '/docman/?group_id='.$group_id;
$redirecturl = $baseredirecturl.'&view='.$linkmenu.'&dirid='.$dirid;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect($baseredirecturl);
-}
echo html_ao('div', array('id' => 'leftdiv'));
include ($gfcommon.'docman/views/tree.php');
echo html_ac(html_ap() - 1);
// plugin projects-hierarchy
-$childgroup_id = getIntFromRequest('childgroup_id');
if ($childgroup_id) {
- if (!forge_check_perm('docman', $childgroup_id, 'read')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect($baseredirecturl);
- }
$redirecturl .= '&childgroup_id='.$childgroup_id;
$g = group_get_object($childgroup_id);
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect($baseredirecturl);
+}
+
$df = new DocumentFactory($g);
if ($df->isError())
exit_error($df->getErrorMessage(), 'docman');
@@ -149,7 +150,7 @@ if (isset($nested_docs[$dirid]) &&
is_array($nested_docs[$dirid])) {
$cells = array();
$cells[][] = html_e('input', array('type' => 'checkbox',
'class' => 'checkeddocidactive', 'value' => $d->getID(), 'title' => _('Select /
Deselect this document for massaction'), 'onClick' =>
'controllerListTrash.checkgeneral("active")'));
switch ($d->getFileType()) {
- case "URL": {
+ case 'URL': {
$cells[][] = util_make_link($d->getFileName(),
html_image($d->getFileTypeImage(), '22', '22', array('alt' =>
$d->getFileType())), array('title' => _('Visit this link')));
break;
}
@@ -172,8 +173,8 @@ if (isset($nested_docs[$dirid]) &&
is_array($nested_docs[$dirid])) {
}
$cells[][] = $d->getStateName();
switch ($d->getFileType()) {
- case "URL": {
- $cells[][] = "--";
+ case 'URL': {
+ $cells[][] = '--';
break;
}
default: {
diff --git a/src/common/docman/views/movefile.php
b/src/common/docman/views/movefile.php
index 50888c5..32be6cb 100644
--- a/src/common/docman/views/movefile.php
+++ b/src/common/docman/views/movefile.php
@@ -23,7 +23,7 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
-global $g; //group object
+global $g; // Group object
global $group_id; // id of the group
global $dirid; // id of doc_group
global $dgf; // document directory factory of this group
@@ -32,11 +32,6 @@ global $HTML; // Layout object
global $warning_msg;
global $childgroup_id;
-if (!forge_check_perm('docman', $group_id, 'approve')) {
- $warning_msg = _('Document Manager Access Denied');
- session_redirect('/docman/?group_id='.$group_id);
-}
-
$actionurl =
'/docman/?group_id='.$group_id.'&dirid='.$dirid.'&action=movefile';
// plugin projects-hierarchy support
if ($childgroup_id) {
@@ -44,6 +39,11 @@ if ($childgroup_id) {
$actionurl .= '&childgroup_id='.$childgroup_id;
}
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
+ $warning_msg = _('Document Manager Access Denied');
+ session_redirect('/docman/?group_id='.$group_id);
+}
+
echo html_ao('div', array('class' => 'docmanDivIncluded'));
echo $HTML->openForm(array('name' => 'movefile', 'action' =>
util_make_uri($actionurl), 'method' => 'post'));
echo html_e('input', array('type' => 'hidden', 'name' => 'fileid', 'id' =>
'movefileinput'));
diff --git a/src/common/docman/views/reporting.php
b/src/common/docman/views/reporting.php
index 773ccd9..7af550e 100644
--- a/src/common/docman/views/reporting.php
+++ b/src/common/docman/views/reporting.php
@@ -45,9 +45,8 @@
/* please do not add require here : use www/docman/index.php to add require */
/* global variables used */
global $HTML; // Layout object
-global $d_arr; // document array
global $group_id; // id of group
-global $g; // the group object
+global $g; // Group object
global $warning_msg;
if ( !forge_check_perm('docman', $group_id, 'admin')) {
diff --git a/src/common/docman/views/search.php
b/src/common/docman/views/search.php
index 0cac6d9..58d27e8 100644
--- a/src/common/docman/views/search.php
+++ b/src/common/docman/views/search.php
@@ -41,7 +41,7 @@ if (!forge_check_perm('docman', $group_id, 'read')) {
}
$is_editor = forge_check_perm('docman', $g->getID(), 'approve');
-$searchString = trim(getStringFromPost('textsearch', null));
+$searchString = trim(getStringFromRequest('textsearch', null));
$insideDocuments = getStringFromPost('insideDocuments');
$subprojectsIncluded = getStringFromPost('includesubprojects');
$limitByStartDate = getIntFromPost('limitByStartDate', 0);
@@ -179,8 +179,8 @@ if ($searchString) {
$docsHtmlSearchRenderer->searchQuery->executeQuery();
$nbDocs = $docsHtmlSearchRenderer->searchQuery->getRowsCount();
$max = $docsHtmlSearchRenderer->searchQuery->getRowsTotalCount();
- echo $HTML->paging_top($start, $paging, $nbDocs, $max,
$redirect_url.'&view=search');
+ echo $HTML->paging_top($start, $paging, $nbDocs, $max,
$redirect_url.'&view=search&textsearch='.$searchString);
$docsHtmlSearchRenderer->writeBody();
- echo $HTML->paging_bottom($start, $paging, $nbDocs,
$redirect_url.'&view=search');
+ echo $HTML->paging_bottom($start, $paging, $nbDocs,
$redirect_url.'&view=search&textsearch='.$searchString);
}
echo html_ac(html_ap() -2);
diff --git a/src/common/widget/Widget_MyMonitoredDocuments.class.php
b/src/common/widget/Widget_MyMonitoredDocuments.class.php
index b52877b..9c15dd3 100644
--- a/src/common/widget/Widget_MyMonitoredDocuments.class.php
+++ b/src/common/widget/Widget_MyMonitoredDocuments.class.php
@@ -87,7 +87,7 @@ class Widget_MyMonitoredDocuments extends Widget {
$html = '';
if (!$hide_now) {
foreach ($monitorElementIds as
$key => $monitorElementId) {
- $documentObject =
document_get_object($monitorElementId);
+ $documentObject =
document_get_object($monitorElementId, $distinctMonitorGroupId);
$cells = array();
$cells[] =
array(' - '.util_make_link('/docman/?group_id='.$distinctMonitorGroupId.'&view=listfile&dirid='.$documentObject->getDocGroupID(),
stripslashes($documentObject->getFileName())), 'style' => 'width:99%');
$cells[] =
array(util_make_link('/docman/?group_id='.$distinctMonitorGroupId.'&action=monitorfile&option=stop&view=listfile&dirid='.$documentObject->getDocGroupID().'&fileid='.$documentObject->getID(),
diff --git a/src/common/widget/Widget_ProjectLatestDocuments.class.php
b/src/common/widget/Widget_ProjectLatestDocuments.class.php
index 7d4748c..18a130a 100644
--- a/src/common/widget/Widget_ProjectLatestDocuments.class.php
+++ b/src/common/widget/Widget_ProjectLatestDocuments.class.php
@@ -45,17 +45,19 @@ class Widget_ProjectLatestDocuments extends Widget {
function getContent() {
$result = '';
-
+
global $HTML;
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$qpa = db_construct_qpa();
- $qpa = db_construct_qpa($qpa, 'SELECT docid FROM doc_data WHERE
group_id=$1 AND stateid=$2',
- array($group_id, '1'));
+ $qpa = db_construct_qpa($qpa, 'SELECT docid FROM doc_data WHERE
group_id = $1',
+ array($group_id));
if (session_loggedin() && forge_check_perm('docman', $group_id,
'approve')) {
$qpa = db_construct_qpa($qpa, ' AND stateid IN ($1, $2,
$3, $4)', array('1', '3', '4', '5'));
+ } else {
+ $qpa = db_construct_qpa($qpa, ' AND stateid = $1',
array('1'));
}
$qpa = db_construct_qpa($qpa, ' ORDER BY updatedate,createdate
DESC LIMIT 5',array());
@@ -79,7 +81,7 @@ class Widget_ProjectLatestDocuments extends Widget {
}
$result .= $HTML->listTableTop($tabletop, false,
'sortable_widget_docman_listfile full', 'sortable', $classth);
for ($f=0; $f < $rows_files; $f++) {
- $documentObject =
document_get_object(db_result($res_files, $f, 'docid'));
+ $documentObject =
document_get_object(db_result($res_files, $f, 'docid'), $group_id);
$updatedate = $documentObject->getUpdated();
$createdate = $documentObject->getCreated();
$realdate = ($updatedate >= $createdate) ?
$updatedate : $createdate;
diff --git a/src/www/docman/view.php b/src/www/docman/view.php
index 636fb0b..28f814f 100644
--- a/src/www/docman/view.php
+++ b/src/www/docman/view.php
@@ -151,7 +151,7 @@ if (is_numeric($docid)) {
require_once $gfcommon.'docman/include/webdav.php';
$_SERVER['SCRIPT_NAME'] = '';
/* we need the group id for check authentification. */
- $_SERVER["AUTH_TYPE"] = $group_id;
+ $_SERVER['AUTH_TYPE'] = $group_id;
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Webdav Access
(No anonymous access)"');
header('HTTP/1.0 401 Unauthorized');
@@ -236,7 +236,15 @@ if (is_numeric($docid)) {
}
} elseif ( $arr[5] === 'selected' ) {
$dirid = $arr[6];
- $arr_fileid = explode(',',$arr[7]);
+ $arr_groupIdfileId = explode(',',$arr[7]);
+ foreach ($arr_groupIdfileId as $groupIdfileId) {
+ $splited_val = explode('-', $groupIdfileId);
+ $arr_groupid[] = $splited_val[0];
+ $arr_fileid[] = $splited_val[1];
+ }
+ if (count($arr_groupid) != count($arr_fileid)) {
+ exit_error(_('Cannot build ZIP archive for
download as ZIP'), 'docman');
+ }
$filename =
'docman-'.$g->getUnixName().'-selected-'.time().'.zip';
$file =
forge_get_config('data_path').'/docman/'.$filename;
@unlink($file);
@@ -245,9 +253,9 @@ if (is_numeric($docid)) {
@unlink($file);
exit_error(_('Unable to open ZIP archive for
download as ZIP'), 'docman');
}
-
- foreach($arr_fileid as $docid) {
+ foreach ($arr_fileid as $key => $docid) {
if (!empty($docid)) {
+ $g =
group_get_object($arr_groupid[$key]);
$d = new Document($g, $docid);
if (!$d || !is_object($d)) {
@unlink($file);
@@ -259,7 +267,7 @@ if (is_numeric($docid)) {
if ($d->isURL()) {
continue;
}
- if (!$zip->addFromString(iconv("UTF-8",
"ASCII//TRANSLIT", $d->getFileName()), $d->getFileData())) {
+ if (!$zip->addFromString(iconv('UTF-8',
'ASCII//TRANSLIT', $d->getFileName()), $d->getFileData())) {
@unlink($file);
exit_error(_('Unable to fill
ZIP file.'), 'docman');
}
@@ -274,6 +282,7 @@ if (is_numeric($docid)) {
session_redirect($redirect_url);
}
}
+
if ( !$zip->close()) {
@unlink($file);
exit_error(_('Unable to close ZIP archive for
download as ZIP'), 'docman');
diff --git a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
index 6b9756f..e0edf70 100644
--- a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
+++ b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
@@ -99,7 +99,7 @@ class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
echo html_ac(html_ap() - 1);
}
for($i = 0; $i < $rowsCount; $i++) {
- $document = document_get_object(db_result($result, $i,
'docid'));
+ $document = document_get_object(db_result($result, $i,
'docid'), db_result($result, $i, 'group_id'));
$currentDocGroup =
documentgroup_get_object($document->getDocGroupID());
//section changed
if ($lastDocGroupID != $currentDocGroup->getID()) {
@@ -116,12 +116,12 @@ class DocsHtmlSearchRenderer extends
HtmlGroupSearchRenderer {
}
$cells = array();
if (!$document->getLocked() &&
!$document->getReserved()) {
- $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $document->getID(), 'class' => 'checkeddocidactive',
'title' => _('Select / Deselect this document for massaction'), 'onClick' =>
'controllerListFile.checkgeneral("active")'));
+ $cells[][] = html_e('input', array('type' =>
'checkbox', 'value' => $document->Group->getID().'-'.$document->getID(),
'class' => 'checkeddocidactive', 'title' => _('Select / Deselect this document
for massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
} else {
if (session_loggedin() &&
($document->getReservedBy() != $LUSER->getID())) {
$cells[][] = html_e('input',
array('type' => 'checkbox', 'name' => 'disabled', 'disabled' => 'disabled'));
} else {
- $cells[][] = html_e('input',
array('type' => 'checkbox', 'value' => $document->getID(), 'class' =>
'checkeddocidactive', 'title' => _('Select / Deselect this document for
massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
+ $cells[][] = html_e('input',
array('type' => 'checkbox', 'value' =>
$document->Group->getID().'-'.$document->getID(), 'class' =>
'checkeddocidactive', 'title' => _('Select / Deselect this document for
massaction'), 'onClick' => 'controllerListFile.checkgeneral("active")'));
}
}
$cells[][] =
util_make_link('/docman/view.php/'.$document->Group->getID().'/'.$document->getID().'/'.urlencode($document->getFileName()),
html_image($document->getFileTypeImage(), 22, 22), array('title' => _('View
this document')));
-----------------------------------------------------------------------
Summary of changes:
src/common/docman/Document.class.php | 21 +++++++-------
src/common/docman/DocumentGroup.class.php | 20 ++++++-------
src/common/docman/DocumentGroupFactory.class.php | 4 ---
src/common/docman/DocumentManager.class.php | 31 ++++++++++++++++----
src/common/docman/DocumentStorage.class.php | 2 +-
src/common/docman/Parsedata.class.php | 8 +++---
src/common/docman/actions/addfile.php | 15 +++++-----
src/common/docman/actions/addsubdocgroup.php | 6 ++--
src/common/docman/actions/deldir.php | 23 ++++++++-------
src/common/docman/actions/delfile.php | 25 ++++++++++------
src/common/docman/actions/editdocgroup.php | 6 ++--
src/common/docman/actions/editfile.php | 13 +++++----
src/common/docman/actions/emptytrash.php | 25 +++++++++++-----
src/common/docman/actions/enforcereserve.php | 4 +--
.../docman/actions/forcereindexenginesearch.php | 2 +-
src/common/docman/actions/getfile.php | 16 ++++++-----
src/common/docman/actions/injectzip.php | 15 +++++-----
src/common/docman/actions/monitordirectory.php | 2 +-
src/common/docman/actions/monitorfile.php | 8 +++---
src/common/docman/actions/movefile.php | 25 ++++++++--------
src/common/docman/actions/releasefile.php | 33 ++++++++++++++--------
src/common/docman/actions/reservefile.php | 5 ++--
src/common/docman/actions/trashdir.php | 22 +++++++--------
src/common/docman/actions/trashfile.php | 21 ++++++--------
src/common/docman/actions/updatecreateonline.php | 2 +-
src/common/docman/actions/updateenginesearch.php | 2 +-
.../docman/actions/updatewebdavinterface.php | 2 +-
src/common/docman/actions/validatefile.php | 14 +++++----
src/common/docman/include/utils.php | 6 ++--
src/common/docman/include/webdav.php | 26 ++++++++++++++++-
src/common/docman/views/addfile.php | 1 +
src/common/docman/views/addsubdocgroup.php | 14 +++++----
src/common/docman/views/admin.php | 2 +-
src/common/docman/views/editdocgroup.php | 12 ++++----
src/common/docman/views/editfile.php | 2 +-
src/common/docman/views/help.php | 13 ++++-----
src/common/docman/views/listfile.php | 21 ++++++--------
src/common/docman/views/listtrashfile.php | 27 +++++++++---------
src/common/docman/views/movefile.php | 12 ++++----
src/common/docman/views/reporting.php | 5 ++--
src/common/docman/views/search.php | 10 ++++---
.../widget/Widget_MyMonitoredDocuments.class.php | 2 +-
.../widget/Widget_ProjectLatestDocuments.class.php | 12 ++++----
src/www/docman/view.php | 19 +++++++++----
.../renderers/DocsHtmlSearchRenderer.class.php | 16 +++++++----
45 files changed, 334 insertions(+), 238 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits