[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1415-gdc19137

Franck Villaume nerville at libremir.placard.fr.eu.org
Tue Jan 31 22:00:35 CET 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, master has been updated
       via  dc191376fea91cafd9c59218cd5554b94daaa560 (commit)
      from  8adad06140b2730b467f45925ea441ae47be4a57 (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=dc191376fea91cafd9c59218cd5554b94daaa560

commit dc191376fea91cafd9c59218cd5554b94daaa560
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jan 31 22:00:08 2017 +0100

    document review fixes & enhancements:
    - fix multiline in comment, description
    - fix add button when review already started
    - add comment on notification
    - add more information in notification (review due date, mandatory vs. optional action)

diff --git a/src/common/docman/DocumentReview.class.php b/src/common/docman/DocumentReview.class.php
index 28262ec..8d83929 100644
--- a/src/common/docman/DocumentReview.class.php
+++ b/src/common/docman/DocumentReview.class.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2016, Franck Villaume - TrivialDev
+ * Copyright 2016,2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -208,7 +208,7 @@ class DocumentReview extends FFError {
 		if ($edit) {
 			return util_make_link('#', $HTML->getConfigurePic(_('Edit this review'), 'editreview'),
 					array('id' => 'review_action_edit', 'onclick' => 'javascript:controllerListFile.toggleEditReviewView({review: '.$this->getID().', title: \''.addslashes($this->getTitle()).'\',
-																		description: \''.addslashes($this->getDescription()).'\',
+																		description: \''.addslashes(str_replace(array("\r\n", "\r", "\n"), "\\n", $this->getDescription())).'\',
 																		endreviewdate: \''.util_html_encode($enddate).'\',
 																		serialid: '.$this->getSerialID().',
 																		mandatoryusers: '.json_encode($mandatoryUsers).',
@@ -218,7 +218,7 @@ class DocumentReview extends FFError {
 		} else {
 			return util_make_link('#', $HTML->getClosedTicketPic(_('Complete this review'), 'completereview'),
 					array('id' => 'review_action_complete', 'onclick' => 'javascript:controllerListFile.toggleEditReviewView({review: '.$this->getID().', title: \''.addslashes($this->getTitle()).'\',
-																		description: \''.addslashes($this->getDescription()).'\',
+																		description: \''.addslashes(str_replace(array("\r\n", "\r", "\n"), "\\n", $this->getDescription())).'\',
 																		endreviewdate: \''.util_html_encode($enddate).'\',
 																		serialid: '.$this->getSerialID().',
 																		mandatoryusers: '.json_encode($mandatoryUsers).',
@@ -240,7 +240,7 @@ class DocumentReview extends FFError {
 
 	function getCommentAction() {
 		global $HTML;
-		return util_make_link('#', $HTML->getEditFilePic(_('Comment the review'), 'remindercomment'), array('id' => 'review_action_comment', 'onclick' => 'javascript:controllerListFile.toggleCommentReviewView({review: '.$this->getID().', groupId: '.$this->Document->Group->getID().', docid: '.$this->Document->getID().'})'), true);
+		return util_make_link('#', $HTML->getEditFilePic(_('Comment the review and/or view the existing comments if any.'), 'remindercomment'), array('id' => 'review_action_comment', 'onclick' => 'javascript:controllerListFile.toggleCommentReviewView({review: '.$this->getID().', groupId: '.$this->Document->Group->getID().', docid: '.$this->Document->getID().'})'), true);
 	}
 
 	function showCompleteFormHTML() {
@@ -318,6 +318,10 @@ class DocumentReview extends FFError {
 			$cells[][] = html_e('p', array(), html_build_multiple_select_box_from_arrays($userIDArray, $userNameArray, 'review-select-optional-users[]', array(), 8, false, 'none', false, array('id' => 'review-select-optional-users')));
 			$return .= $HTML->multiTableRow(array('id' => 'tr-optional-reviewers'), $cells);
 			$cells = array();
+			$cells[][] = _('Notification comment')._(':');
+			$cells[][] = html_e('textarea', array('id' => 'review-notificationcomment', 'name' => 'review-notificationcomment', 'style' => 'width: 100%; box-sizing: border-box;', 'rows' => 3, 'pattern' => '.{10,}', 'placeholder' => _('Add a specific comment for the mail notification here'), 'maxlength' => DOCMAN__REVIEW_DESCRIPTION_MAX_SIZE), '', false);
+			$return .= $HTML->multiTableRow(array('id' => 'review-notificationcomment-row'), $cells);
+			$cells = array();
 			$return .= $HTML->listTableBottom();
 			$return .= $HTML->addRequiredFieldsInfoBox();
 			$return .= html_e('input', array('type' => 'hidden', 'id' => 'new_review', 'name' => 'new_review', 'value' => 0));
@@ -402,7 +406,7 @@ class DocumentReview extends FFError {
 		return $return;
 	}
 
-	function create($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers = array()) {
+	function create($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers = array(), $reviewnotificationcomment = false) {
 		if (!is_int($reviewversionserialid) && $reviewversionserialid < 1) {
 			$this->setError(_('Missing Version ID to create review'));
 			return false;
@@ -420,7 +424,7 @@ class DocumentReview extends FFError {
 			return false;
 		}
 		if ((is_array($reviewmandatoryusers) && count($reviewmandatoryusers) == 0) || (!is_array($reviewmandatoryusers))) {
-			$this->setError(_('Missing mandatory reviewers').$reviewmandatoryusers);
+			$this->setError(_('Missing mandatory reviewers'));
 			return false;
 		}
 		if (!is_array($reviewoptionalusers)) {
@@ -451,7 +455,7 @@ class DocumentReview extends FFError {
 				$notifyUsers[] = $arg;
 
 			}
-			$this->sendNotice($notifyUsers, true);
+			$this->sendNotice($notifyUsers, true, $reviewnotificationcomment);
 			db_commit();
 			return true;
 		} else {
@@ -468,7 +472,7 @@ class DocumentReview extends FFError {
 	 * @param	boolean	true = new review, false = reminder
 	 * @return	bool
 	 */
-	function sendNotice($users, $new = false) {
+	function sendNotice($users, $new = false, $reviewnotificationcomment = false) {
 		if (count($users) > 0) {
 			$createdbyuser = user_get_object($this->getCreatedBy());
 			if ($new) {
@@ -484,13 +488,24 @@ class DocumentReview extends FFError {
 			$body .= _('Document version title')._(': ').$dv->getTitle()."\n";
 			$body .= _('Document version description')._(': ').util_unconvert_htmlspecialchars($dv->getDescription())."\n";
 			$body .= _('Review submitter')._(': ').$createdbyuser->getRealName().' ('.$createdbyuser->getUnixName().") \n";
-			$body .= "\n\n-------------------------------------------------------\n".
+			$body .= _('Review due date')._(': ').strftime(_('%Y-%m-%d'), $this->getEnddate())."\n";
+			if ($reviewnotificationcomment) {
+				$body .= _('Specific comment from submitter')._(':')."\n";
+				$body .= '-------------------------------------------------------'."\n";
+				$body .= $reviewnotificationcomment;
+			}
+			$body2 = "\n\n-------------------------------------------------------\n".
 				_('Please review, visit')._(':').
 				"\n\n" . util_make_url($this->Document->getPermalink());
 
 			foreach ($users as $user) {
 				$userObject = user_get_object($user[1]);
-				util_send_message($userObject->getEmail(), $subject, $body, 'noreply@'.forge_get_config('web_host'), '', _('Docman'));
+				if ($user[2] == 1) {
+					$sub_label = "\n"._('Your review is MANDATORY')."\n";
+				} elseif ($user[2] == 2) {
+					$sub_label = "\n"._('Your review is optional')."\n";
+				}
+				util_send_message($userObject->getEmail(), $subject, $body.$sub_label.$body2, 'noreply@'.forge_get_config('web_host'), '', _('Docman'));
 			}
 			return true;
 		}
diff --git a/src/common/docman/DocumentReviewFactory.class.php b/src/common/docman/DocumentReviewFactory.class.php
index 1195f49..10a65db 100644
--- a/src/common/docman/DocumentReviewFactory.class.php
+++ b/src/common/docman/DocumentReviewFactory.class.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2016, Franck Villaume - TrivialDev
+ * Copyright 2016,2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -73,6 +73,7 @@ class DocumentReviewFactory extends FFError {
 		global $HTML;
 		$return = '';
 		$this->getReviews($serialids);
+		$add_button = true;
 		if ($this->getReviewsCounter() > 0) {
 			$titleArr = array('ID', _('Version'), _('Title'), _('Created By'), _('Status'), _('Start date'), _('End date'), _('Progress'), _('Comments'), _('Actions'));
 			$classth = array('', '', '', '', '', 'unsortable');
@@ -113,12 +114,17 @@ class DocumentReviewFactory extends FFError {
 
 				$cells[][] = $actions;
 				$return .= $HTML->multiTableRow(array('id' => 'docreview'.$thereview[0]), $cells);
+				if ($dr->getStatusID() == 1) {
+					$add_button = false;
+				}
 			}
 			$return .= $HTML->listTableBottom();
 		} else {
 			$return = $HTML->information(_('No Reviews.'));
 		}
-		$return .= html_e('button', array('id' => 'doc_review_addbutton', 'type' => 'button', 'onclick' => 'javascript:controllerListFile.toggleAddReviewView()'), _('Add new review'));
+		if ($add_button) {
+			$return .= html_e('button', array('id' => 'doc_review_addbutton', 'type' => 'button', 'onclick' => 'javascript:controllerListFile.toggleAddReviewView()'), _('Add new review'));
+		}
 		return $return;
 	}
 
diff --git a/src/common/docman/actions/editfile.php b/src/common/docman/actions/editfile.php
index dc31db1..6aa8dc3 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,2016, Franck Villaume - TrivialDev
+ * Copyright 2012,2016-2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -207,10 +207,11 @@ switch ($subaction) {
 		$reviewcomment = getStringFromRequest('review-comment');
 		$reviewcomment = $sanitizer->SanitizeHtml($reviewcomment);
 		$reviewdone = getIntFromRequest('review-done');
+		$reviewnotificationcomment = getStringFromRequest('review-notificationcomment');
 		if ($reviewversionserialid) {
 			if ($new_review) {
 				$dr = new DocumentReview($d);
-				if ($dr->create($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers)) {
+				if ($dr->create($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers, $reviewnotificationcomment)) {
 					$feedback = _('Review created');
 				} else {
 					$error_msg = $dr->getErrorMessage();
diff --git a/src/www/docman/scripts/DocManController.js b/src/www/docman/scripts/DocManController.js
index 843bcc5..abe39b1 100644
--- a/src/www/docman/scripts/DocManController.js
+++ b/src/www/docman/scripts/DocManController.js
@@ -4,7 +4,7 @@
  * Copyright 2010, Antoine Mercadal - Capgemini
  * Copyright 2010-2011, Franck Villaume - Capgemini
  * Copyright 2011, Alain Peyrat
- * Copyright 2011-2016, Franck Villaume - TrivialDev
+ * Copyright 2011-2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -449,7 +449,7 @@ DocManListFileController.prototype =
 							versionactiontdcontent += val.versionactions[i];
 						}
 						// please sync with the editfile.php widths if you change it here.
-						var htmlString = '<tr id="docversion'+val.version.substr(1)+'" ><td style="width: 60px">'+val.version.substr(1)+currenttdcontent+'</td><td style="width: 150px">'+filenametdcontent[0].outerHTML+'</td><td style="width: 150px">'+val.title+'</td><td style="width: 150px">'+val.new_description.replace('\\n', '<br />')+'</td><td style="width: 110px">'+val.vcomment.replace('\\n', '<br />')+'</td><td style="width: 100px">'+val.created_by_username+'</td><td style="width: 100px">'+val.lastdate+'</td><td style="width: 50px">'+val.filesize_readable+'</td><td style="width: 50px">'+versionactiontdcontent+'</td></tr>'
+						var htmlString = '<tr id="docversion'+val.version.substr(1)+'" ><td style="width: 60px">'+val.version.substr(1)+currenttdcontent+'</td><td style="width: 150px">'+filenametdcontent[0].outerHTML+'</td><td style="width: 150px">'+val.title+'</td><td style="width: 150px">'+val.new_description.replace(/\\n/g, '<br />')+'</td><td style="width: 110px">'+val.vcomment.replace(/\\n/g, '<br />')+'</td><td style="width: 100px">'+val.created_by_username+'</td><td style="width: 100px">'+val.lastdate+'</td><td style="width: 50px">'+val.filesize_readable+'</td><td style="width: 50px">'+versionactiontdcontent+'</td></tr>'
 						jQuery('#sortable_doc_version_table > tbody:last-child').append(htmlString);
 						});
 				}
@@ -531,6 +531,7 @@ DocManListFileController.prototype =
 		jQuery('#review_newcomment').val(0);
 		jQuery('#review-title').val('');
 		jQuery('#review-description').val('');
+		jQuery('#review-notificationcomment').val('');
 		jQuery('#datepicker_end_review_date').val('');
 		jQuery('#review-serialid').val();
 		jQuery('[class^=gentle]').remove();
@@ -547,6 +548,7 @@ DocManListFileController.prototype =
 		} else {
 			jQuery('#new_review').val(1);
 			jQuery('#editfile-createreview').show();
+			jQuery('#review-notificationcomment-row').show();
 		}
 	},
 
@@ -564,7 +566,7 @@ DocManListFileController.prototype =
 		} else {
 			jQuery('#review_id').val(this.review.review);
 			jQuery('#review-title').val(this.review.title);
-			jQuery('#review-description').val(this.review.description);
+			jQuery('#review-description').val(this.review.description.replace(/\\n/g, String.fromCharCode(13,10)));
 			jQuery('#datepicker_end_review_date').val(this.review.endreviewdate);
 			jQuery('#review-serialid').val(this.review.serialid);
 			if (this.review.complete) {
@@ -594,6 +596,7 @@ DocManListFileController.prototype =
 			}, this.review));
 			jQuery('#new_review').val(0);
 			jQuery('#editfile-createreview').show();
+			jQuery('#review-notificationcomment-row').hide();
 		}
 	},
 
@@ -655,8 +658,8 @@ DocManListFileController.prototype =
 				jQuery('#editButtonFile').prop('checked', true);
 			}
 			jQuery('#title').val(this.version.title);
-			jQuery('#description').val(this.version.description.replace('\\n', String.fromCharCode(13,10)));
-			jQuery('#vcomment').val(this.version.vcomment.replace('\\n', String.fromCharCode(13,10)));
+			jQuery('#description').val(this.version.description.replace(/\\n/g, String.fromCharCode(13,10)));
+			jQuery('#vcomment').val(this.version.vcomment.replace(/\\n/g, String.fromCharCode(13,10)));
 			jQuery('#edit_version').val(this.version.version);
 			if (this.version.current_version == 1) {
 				jQuery('#current_version').attr('checked', 'checked').prop('checked', true);

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

Summary of changes:
 src/common/docman/DocumentReview.class.php        | 35 ++++++++++++++++-------
 src/common/docman/DocumentReviewFactory.class.php | 10 +++++--
 src/common/docman/actions/editfile.php            |  5 ++--
 src/www/docman/scripts/DocManController.js        | 13 +++++----
 4 files changed, 44 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list