[Fusionforge-commits] FusionForge branch 6.1 updated. v6.1alpha0-27-gd4f3963

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Oct 22 18:03:08 CEST 2017


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, 6.1 has been updated
       via  d4f39638870b18a552c3f45fcc7cc30e13100f1c (commit)
       via  4136baa2cd26ea35865b4bf07380e069f52980b5 (commit)
      from  89fad10cd59a5b239b465da3d1eafcdbc2fbb86c (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=d4f39638870b18a552c3f45fcc7cc30e13100f1c

commit d4f39638870b18a552c3f45fcc7cc30e13100f1c
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Oct 22 18:02:38 2017 +0200

    adjut Widget MyMonitoredDocuments to include monitored folders

diff --git a/src/common/widget/Widget_MyMonitoredDocuments.class.php b/src/common/widget/Widget_MyMonitoredDocuments.class.php
index 49fba77..42c41e9 100644
--- a/src/common/widget/Widget_MyMonitoredDocuments.class.php
+++ b/src/common/widget/Widget_MyMonitoredDocuments.class.php
@@ -2,7 +2,7 @@
 /**
  * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
  * Copyright 2010, Franck Villaume - Capgemini
- * Copyright 2011-2014, Franck Villaume - TrivialDev
+ * Copyright 2011-2014,2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is a part of FusionForge.
@@ -37,24 +37,31 @@ class Widget_MyMonitoredDocuments extends Widget {
 	}
 
 	function getTitle() {
-		return _('Monitored Documents');
+		return _('Monitored Documents/Folders');
 	}
 
 	function getContent() {
 		global $HTML;
 		$html_my_monitored_documents = '';
-		$monitorElementObject = new MonitorElement('docdata');
-		$distinctMonitorGroupIdsArray = $monitorElementObject->getMonitoredDistinctGroupIdsByUserIdInArray(user_getid());
-		if (!$distinctMonitorGroupIdsArray || count($distinctMonitorGroupIdsArray) < 1) {
-			$html_my_monitored_documents .= $HTML->warning_msg(_('You are not monitoring any documents.')).html_e('p', array(), _("If you monitor documents, you will be sent new update in the form of an email.")).html_e('p', array(), _("You can monitor documents by clicking on the appropriate icon action in the directory itself."));
+		$monitorElementObjectDoc = new MonitorElement('docdata');
+		$distinctMonitorGroupIdsArrayDoc = $monitorElementObjectDoc->getMonitoredDistinctGroupIdsByUserIdInArray(user_getid());
+		$monitorElementObjectDocGroup = new MonitorElement('docgroup');
+		$distinctMonitorGroupIdsArrayDocGroup = $monitorElementObjectDocGroup->getMonitoredDistinctGroupIdsByUserIdInArray(user_getid());
+		$distinctMonitorGroupIdsArray = array();
+		if (is_array($distinctMonitorGroupIdsArrayDoc) && is_array($distinctMonitorGroupIdsArrayDocGroup)) {
+			$distinctMonitorGroupIdsArray = array_unique(array_merge($distinctMonitorGroupIdsArrayDoc, $distinctMonitorGroupIdsArrayDocGroup));
+		}
+		if (count($distinctMonitorGroupIdsArray) < 1) {
+			$html_my_monitored_documents .= $HTML->warning_msg(_('You are not monitoring any documents or folders.')).html_e('p', array(), _("If you monitor documents, you will be sent new update in the form of an email.")).html_e('p', array(), _("You can monitor documents by clicking on the appropriate icon action in the directory itself."));
 		} else {
 			$validDistinctMonitorGroupIdsArray = array();
 			foreach ($distinctMonitorGroupIdsArray as $distinctMonitorGroupId) {
 				if (forge_check_perm('docman', $distinctMonitorGroupId, 'read')) {
 					$validDistinctMonitorGroupIdsArray[] = $distinctMonitorGroupId;
 				} else {
-					// Oh ho! we found some monitored documents where user has no read access. Let's clean the situation
-					$monitorElementObject->disableMonitoringForGroupIdByUserId($distinctMonitorGroupId, user_getid());
+					// Oh ho! we found some monitored documents/folders where user has no read access. Let's clean the situation
+					$monitorElementObjectDoc->disableMonitoringForGroupIdByUserId($distinctMonitorGroupId, user_getid());
+					$monitorElementObjectDocGroup->disableMonitoringForGroupIdByUserId($distinctMonitorGroupId, user_getid());
 				}
 			}
 			if (count($validDistinctMonitorGroupIdsArray)) {
@@ -74,11 +81,12 @@ class Widget_MyMonitoredDocuments extends Widget {
 				} else {
 					$hide_document = null;
 				}
-				foreach ($distinctMonitorGroupIdsArray as $distinctMonitorGroupId) {
+				foreach ($validDistinctMonitorGroupIdsArray as $distinctMonitorGroupId) {
 					$groupObject = group_get_object($distinctMonitorGroupId);
-					$monitorElementIds = $monitorElementObject->getMonitoredIdsByGroupIdByUserIdInArray($distinctMonitorGroupId, user_getid());
-
-					list($hide_now, $count_diff, $hide_url) = my_hide_url('document', $distinctMonitorGroupId, $hide_item_id, count($monitorElementIds), $hide_document);
+					$monitorElementDocIds = $monitorElementObjectDoc->getMonitoredIdsByGroupIdByUserIdInArray($distinctMonitorGroupId, user_getid());
+					$monitorElementDocGroupIds = $monitorElementObjectDocGroup->getMonitoredIdsByGroupIdByUserIdInArray($distinctMonitorGroupId, user_getid());
+					$monitorElementIds = count($monitorElementDocIds) + count($monitorElementDocGroupIds);
+					list($hide_now, $count_diff, $hide_url) = my_hide_url('document', $distinctMonitorGroupId, $hide_item_id, $monitorElementIds, $hide_document);
 					$count_new = max(0, $count_diff);
 					$cells = array();
 					$cells[] = array($hide_url.util_make_link('/docman/?group_id='.$distinctMonitorGroupId, $groupObject->getPublicName()).'    '.
@@ -86,24 +94,30 @@ class Widget_MyMonitoredDocuments extends Widget {
 					$html_hdr = $HTML->multiTableRow(array('class' => 'boxitem'), $cells);
 					$html = '';
 					if (!$hide_now) {
-						foreach ($monitorElementIds as $key => $monitorElementId) {
-							$documentObject = document_get_object($monitorElementId, $distinctMonitorGroupId);
+						foreach ($monitorElementDocGroupIds as $key => $monitorElementDocGroupId) {
+							$documentGroupObject = documentgroup_get_object($monitorElementDocGroupId, $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('   - (d) '.util_make_link('/docman/?group_id='.$distinctMonitorGroupId.'&view=listfile&dirid='.$monitorElementDocGroupId, stripslashes($documentGroupObject->getName())), 'style' => 'width:99%');
+							$cells[] = array(util_make_link('/docman/?group_id='.$distinctMonitorGroupId.'&action=monitordirectory&option=stop&view=listfile&dirid='.$monitorElementDocGroupId.'&directoryid='.$monitorElementDocGroupId,
+									$HTML->getDeletePic(_('Stop monitoring'), _('Stop monitoring'), array('onClick' => 'return confirm("'._('Stop monitoring this folder?').'")'))),
+									'class' => 'align-center');
+							$html .= $HTML->multiTableRow(array(), $cells);
+						}
+						foreach ($monitorElementDocIds as $key => $monitorElementDocId) {
+							$documentObject = document_get_object($monitorElementDocId, $distinctMonitorGroupId);
+							$cells = array();
+							$cells[] = array('   - (f) '.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(),
 									$HTML->getDeletePic(_('Stop monitoring'), _('Stop monitoring'), array('onClick' => 'return confirm("'._('Stop monitoring this document?').'")'))),
 									'class' => 'align-center');
 							$html .= $HTML->multiTableRow(array(), $cells);
-
 						}
 					}
-
-
 					$html_my_monitored_documents .= $html_hdr.$html;
 				}
 				$html_my_monitored_documents .= $HTML->listTableBottom();
 			} else {
-				$html_my_monitored_documents .= $HTML->warning_msg(_('You are not monitoring any documents.')).html_e('p', array(), _("If you monitor documents, you will be sent new update in the form of an email.")).html_e('p', array(), _("You can monitor documents by clicking on the appropriate icon action in the directory itself."));
+				$html_my_monitored_documents .= $HTML->warning_msg(_('You are not monitoring any documents/folders.')).html_e('p', array(), _("If you monitor documents/folders, you will be sent new update in the form of an email.")).html_e('p', array(), _("You can monitor documents by clicking on the appropriate icon action in the directory itself."));
 			}
 		}
 		return $html_my_monitored_documents;
@@ -114,9 +128,9 @@ class Widget_MyMonitoredDocuments extends Widget {
 	}
 
 	function getDescription() {
-		return _("List documents that you are currently monitoring, by project.")
-				. '<br />'
-				. _("To cancel any of the monitored items just click on the trash icon next to the item label.");
+		return _('List documents that you are currently monitoring, by project.')
+			.'<br />'
+			._('To cancel any of the monitored items just click on the trash icon next to the item label.');
 	}
 
 	function isAvailable() {

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=4136baa2cd26ea35865b4bf07380e069f52980b5

commit 4136baa2cd26ea35865b4bf07380e069f52980b5
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Oct 22 18:02:06 2017 +0200

    MonitorElement: fix SQL query. Missing element

diff --git a/src/common/include/MonitorElement.class.php b/src/common/include/MonitorElement.class.php
index 062b838..68d5070 100644
--- a/src/common/include/MonitorElement.class.php
+++ b/src/common/include/MonitorElement.class.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge MonitorElement Object
  *
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014,2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -64,7 +64,7 @@ class MonitorElement extends FFError {
 				$this->_getMonitorCounterIntegerQuery = 'select count(docgroup_monitored_docman.user_id) as count from docgroup_monitored_docman, users where users.user_id = docgroup_monitored_docman.user_id and docgroup_id = $1 and users.status = $2';
 				$this->_getMonitorUsersIdsInArrayQuery = 'select docgroup_monitored_docman.user_id from docgroup_monitored_docman, users where users.user_id = docgroup_monitored_docman.user_id and docgroup_id = $1 and users.status = $2';
 				$this->_getMonitoredByUserIdInArrayQuery = 'select docgroup_id from docgroup_monitored_docman where user_id = $1';
-				$this->_getMonitoredDistinctGroupIdsByUserIdInArrayQuery = 'select distinct doc_groups.group_id from groups, doc_groups, docgroup_monitored_docman where docgroup_monitored_docman.docgroup_id = doc_groups.doc_group and groups.group_id = doc_groups.group_id and docgroup_monitored_docman.user_id = $1';
+				$this->_getMonitoredDistinctGroupIdsByUserIdInArrayQuery = 'select distinct doc_groups.group_id from groups, doc_groups, docgroup_monitored_docman where docgroup_monitored_docman.docgroup_id = doc_groups.doc_group and groups.group_id = doc_groups.group_id and docgroup_monitored_docman.user_id = $1 and groups.status = $2';
 				$this->_getMonitoredIdsByGroupIdByUserIdInArrayQuery = 'select doc_groups.doc_group from doc_groups, docgroup_monitored_docman where doc_groups.doc_group = docgroup_monitored_docman.docgroup_id and doc_groups.group_id = $1 and docgroup_monitored_docman.user_id = $2';
 				$this->_isMonitoredByAnyQuery = 'select docgroup_id, docgroup_monitored_docman.user_id from docgroup_monitored_docman, users where users.user_id = docgroup_monitored_docman.user_id and docgroup_id = $1 and users.status = $2';
 				$this->_isMonitoredByUserIdQuery = 'select docgroup_id from docgroup_monitored_docman where docgroup_id = $1 and user_id = $2';

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/MonitorElement.class.php        |  4 +-
 .../widget/Widget_MyMonitoredDocuments.class.php   | 58 ++++++++++++++--------
 2 files changed, 38 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list