[Fusionforge-commits] FusionForge branch master updated. 6.0.4-1153-g4dcb2d8

Franck Villaume nerville at libremir.placard.fr.eu.org
Tue Nov 15 14:56:04 CET 2016


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  4dcb2d82d4320690c667273f874a4e3a5f0d779a (commit)
       via  0624fb39ebcc35734c353a0ee6c381c85be5f96b (commit)
      from  d1c7a1f03b2d1054f73110d767db60c728bba5a0 (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=4dcb2d82d4320690c667273f874a4e3a5f0d779a

commit 4dcb2d82d4320690c667273f874a4e3a5f0d779a
Author: St├ęphane-Eymeric Bredthauer <sebredthauer at gmail.com>
Date:   Tue Nov 15 14:42:04 2016 +0100

    Tracker: fix php warning about missing argument

diff --git a/src/common/tracker/views/form-addextrafieldoption.php b/src/common/tracker/views/form-addextrafieldoption.php
index c624666..c718bc5 100644
--- a/src/common/tracker/views/form-addextrafieldoption.php
+++ b/src/common/tracker/views/form-addextrafieldoption.php
@@ -74,7 +74,7 @@ if (!$ac || !is_object($ac)) {
 			}
 			echo $HTML->openForm(array('action' => '/tracker/admin/?group_id='.$group_id.'&atid='.$ath->getID().'&boxid='.$boxid, 'method' => 'post'));
 			echo html_e('input', array('type'=>'hidden', 'name'=>'update_checked_opt', 'value'=>'y'));
-			echo html_build_checkboxes_from_array($vals, 'element', $checked_array, true);
+			echo html_build_checkboxes_from_array($vals, 'element', $checked_array, true, false);
 			echo html_e('input', array('type'=>'submit', 'name'=>'post_changes', 'value'=>_('Submit')));
 			echo $HTML->closeForm();
 			break;
@@ -96,7 +96,7 @@ if (!$ac || !is_object($ac)) {
 			}
 			echo $HTML->openForm(array('action' => '/tracker/admin/?group_id='.$group_id.'&atid='.$ath->getID().'&boxid='.$boxid, 'method' => 'post'));
 			echo html_e('input', array('type'=>'hidden', 'name'=>'update_checked_opt', 'value'=>'y'));
-			echo html_build_checkboxes_from_array($vals, 'element', $checked_array, true);
+			echo html_build_checkboxes_from_array($vals, 'element', $checked_array, true, false);
 			echo html_e('input', array('type'=>'submit', 'name'=>'post_changes', 'value'=>_('Submit')));
 			echo $HTML->closeForm();
 			break;
diff --git a/src/common/tracker/views/form-updateextrafieldelement.php b/src/common/tracker/views/form-updateextrafieldelement.php
index 744396d..3857aeb 100644
--- a/src/common/tracker/views/form-updateextrafieldelement.php
+++ b/src/common/tracker/views/form-updateextrafieldelement.php
@@ -74,7 +74,7 @@ if (!$ac || !is_object($ac)) {
 				$parentFieldElmntVals[$parentFieldElmnt['element_id']] = $parentFieldElmnt['element_name'];
 			}
 			$checkedElmntsArr = $ao->getParentElements();
-			echo html_build_checkboxes_from_array($parentFieldElmntVals, 'parent_elements', $checkedElmntsArr, true);
+			echo html_build_checkboxes_from_array($parentFieldElmntVals, 'parent_elements', $checkedElmntsArr, true, false);
 		}
 		if ($ac->isAutoAssign()) {
 			echo html_e('strong',array(),_('Auto assign to')._(':')).html_e('br');
diff --git a/src/www/include/html.php b/src/www/include/html.php
index 373429d..0ca0ad7 100644
--- a/src/www/include/html.php
+++ b/src/www/include/html.php
@@ -906,13 +906,13 @@ function html_build_checkbox($name, $value, $checked, $attrs=array()) {
  * @param	bool	$show_100
  * @return	string	html code for checkbox control
  */
-function html_build_checkboxes_from_array($vals, $check_name, $checked=array(), $checkall=false, $show_100) {
+function html_build_checkboxes_from_array($vals, $check_name, $checked=array(), $checkall=false, $show_100=true, $text_100='none', $allowed=false, $attrs=array(), $checkbox_attrs=array(), $attrs_100=array()) {
 	$values = array_keys($vals);
 	$texts =  array_values($vals);
-	return html_build_checkboxes_from_arrays($values, $texts, $check_name, $checked, $checkall, false);
+	return html_build_checkboxes_from_arrays($values, $texts, $check_name, $checked, $checkall, $show_100, $text_100, $allowed, $attrs, $checkbox_attrs, $attrs_100);
 }
 
-function html_build_checkboxes_from_arrays($vals, $texts, $check_name, $checked=array(), $checkall=false, $show_100=true, $text_100='none', $allowed=false, $attrs=array(),$checkbox_attrs=array(),$attrs_100=array()) {
+function html_build_checkboxes_from_arrays($vals, $texts, $check_name, $checked=array(), $checkall=false, $show_100=true, $text_100='none', $allowed=false, $attrs=array(), $checkbox_attrs=array(), $attrs_100=array()) {
 	if ($text_100 == 'none') {
 		$text_100 = _('None');
 	}

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

commit 0624fb39ebcc35734c353a0ee6c381c85be5f96b
Author: St├ęphane-Eymeric Bredthauer <sebredthauer at gmail.com>
Date:   Tue Nov 15 13:48:25 2016 +0100

    Tracker: fix bug on required checkbox group

diff --git a/src/www/include/html.php b/src/www/include/html.php
index 733048a..373429d 100644
--- a/src/www/include/html.php
+++ b/src/www/include/html.php
@@ -924,6 +924,8 @@ function html_build_checkboxes_from_arrays($vals, $texts, $check_name, $checked=
 
 	$title = (empty($attrs['title']) ? array() : array('title' => $attrs['title']));
 	if ($checkall) {
+		$attrs_checkall = $attrs;
+		unset($attrs_checkall['required']);
 		$javascript = '//<![CDATA[
 							$(window).load(function(){
 								$("#checkall_'.$check_name.'").change(function () {
@@ -933,12 +935,38 @@ function html_build_checkboxes_from_arrays($vals, $texts, $check_name, $checked=
 						//]]';
 		$return .= html_e('script', array( 'type'=>'text/javascript'), $javascript);
 		$return .= html_ao('p');
-		$return .= html_e('input', array_merge( array( 'type' => 'checkbox', 'name' => 'checkall_'.$check_name, 'id' => 'checkall_'.$check_name ), $attrs));
+		$return .= html_e('input', array_merge( array( 'type' => 'checkbox', 'name' => 'checkall_'.$check_name, 'id' => 'checkall_'.$check_name ), $attrs_checkall));
 		$return .= html_e('label', array_merge( array( 'for' => 'checkall_'.$check_name), $title), _('Check all'), false);
 		$return .= html_ac(html_ap() - 1);
 	}
-	$return .= html_ao('p');
 
+	if (isset($attrs['required']) && $attrs['required']=='required') {
+		$javascript = '//<![CDATA[
+							$(function() {
+								$("input[name=\''.$check_name.'[]\']:checkbox[required]").on("change", function() {
+									var requiredCheckboxes = $(this).parent().children(":checkbox");
+									if (requiredCheckboxes.is(":checked")) {
+										requiredCheckboxes.prop("required", false);
+										requiredCheckboxes.each(function() {
+											this.setCustomValidity("");
+										});
+									} else {
+										requiredCheckboxes.prop("required", true)
+									}
+								});
+								$("input[name=\''.$check_name.'[]\']:checkbox[required]").each(function() {
+									$(this).on("invalid", function() {
+										this.setCustomValidity("");
+										if (!this.validity.valid) {
+											this.setCustomValidity("'._("Please, select at least one of these options").'");
+										}
+									})
+								});
+							});
+						//]]';
+		$return .= html_e('script', array( 'type'=>'text/javascript'), $javascript);
+	}
+	$return .= html_ao('p');
 	if ($show_100) {
 		if (in_array('100', $checked)) {
 			$attrs_100['checked']='checked';

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

Summary of changes:
 .../tracker/views/form-addextrafieldoption.php     |  4 +--
 .../tracker/views/form-updateextrafieldelement.php |  2 +-
 src/www/include/html.php                           | 38 +++++++++++++++++++---
 3 files changed, 36 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list