function multipleAssignedBox($name = 'assigned_to[]') { $result = $this->ProjectGroup->getTechnicians(); //get the data so we can mark items as SELECTED $arr2 =& $this->getAssignedTo(); return html_build_multiple_select_box($result, $name, $arr2); }
/** * Display the default value form for fields having a value function (e.g. group_members, artifact_submitters) * * @param field_id: the field id to edit * @param default_value: the default value * @param show_none,text_none,show_any,text_any,show_value: values used by html_build_select_box function * * @return void */ function displayDefaultValueFunctionForm($field_id, $default_value, $show_none = true, $text_none = false, $show_any = false, $text_any = false, $show_value = false) { global $ath, $art_field_fact, $Language; if (!$text_any) { $text_any = $Language->getText('global', 'any'); } if (!$text_none) { $text_none = $Language->getText('global', 'none'); } $field = $art_field_fact->getFieldFromId($field_id); if (!$field) { return; } echo '<h3>' . $Language->getText('tracker_include_type', 'def_default') . ' ' . help_button('TrackerAdministration.html#TrackerDefiningaDefaultFieldValue') . '</h3>'; echo ' <FORM ACTION="" METHOD="POST" name="artifact_form"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="update_default_value"> <INPUT TYPE="HIDDEN" NAME="field_id" VALUE="' . (int) $field_id . '"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $this->Group->getID() . '"> <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $this->getID() . '">'; //new stuff by MLS $field_value = $field->getDefaultValue(); $predefinedValues = $field->getFieldPredefinedValues($this->getID()); if ($field->isSelectBox()) { echo html_build_select_box($predefinedValues, "default_value", $default_value); } else { if ($field->isMultiSelectBox()) { echo html_build_multiple_select_box($predefinedValues, "default_value[]", $default_value, $field->getDisplaySize() != "" ? $field->getDisplaySize() : "6", $show_none, $text_none, $show_any, $text_any, false, '', $show_value); } else { echo 'Why are we in this case ??'; } } echo ' <INPUT type="submit" name="submit" value="' . $Language->getText('global', 'btn_update') . '"> </form><hr>'; }
function plugin_tracker_permission_fetch_selection_field($permission_type, $object_id, $group_id, $html_name = "ugroups[]", $html_disabled = false, $selected = array()) { $html = ''; // Get ugroups already defined for this permission_type if (empty($selected)) { $res_ugroups = permission_db_authorized_ugroups($permission_type, $object_id); $nb_set = db_numrows($res_ugroups); } else { $res_ugroups = $selected; $nb_set = count($res_ugroups); } // Now retrieve all possible ugroups for this project, as well as the default values $sql = "SELECT ugroup_id,is_default FROM permissions_values WHERE permission_type='{$permission_type}'"; $res = db_query($sql); $predefined_ugroups = ''; $default_values = array(); if (db_numrows($res) < 1) { $html .= "<p><b>" . $GLOBALS['Language']->getText('global', 'error') . "</b>: " . $GLOBALS['Language']->getText('project_admin_permissions', 'perm_type_not_def', $permission_type); return $html; } else { while ($row = db_fetch_array($res)) { if ($predefined_ugroups) { $predefined_ugroups .= ' ,'; } $predefined_ugroups .= $row['ugroup_id']; if ($row['is_default']) { $default_values[] = $row['ugroup_id']; } } } $sql = "SELECT * FROM ugroup WHERE group_id=" . $group_id . " OR ugroup_id IN (" . $predefined_ugroups . ") ORDER BY ugroup_id"; $res = db_query($sql); $array = array(); while ($row = db_fetch_array($res)) { $name = util_translate_name_ugroup($row[1]); $array[] = array('value' => $row[0], 'text' => $name); } if (empty($selected)) { if ($nb_set) { $res_ugroups = util_result_column_to_array($res_ugroups); } else { $res_ugroups = $default_values; } } $html .= html_build_multiple_select_box($array, $html_name, $res_ugroups, 8, false, util_translate_name_ugroup('ugroup_nobody_name_key'), false, '', false, '', false, CODENDI_PURIFIER_CONVERT_HTML, $html_disabled); return $html; }
function permission_display_selection_frs($permission_type, $object_id = null, $group_id) { $html = ''; // Get ugroups already defined for this permission_type $res_ugroups = permission_db_authorized_ugroups($permission_type, $object_id); $nb_set = db_numrows($res_ugroups); // Now retrieve all possible ugroups for this project, as well as the default values $sql = "SELECT ugroup_id,is_default FROM permissions_values WHERE permission_type='" . db_es($permission_type) . "'"; $res = db_query($sql); $predefined_ugroups = ''; $default_values = array(); if (db_numrows($res) < 1) { $html .= "<p><b>" . $GLOBALS['Language']->getText('global', 'error') . "</b>: " . $GLOBALS['Language']->getText('project_admin_permissions', 'perm_type_not_def', $permission_type); return $html; } else { while ($row = db_fetch_array($res)) { if ($predefined_ugroups) { $predefined_ugroups .= ' ,'; } $predefined_ugroups .= $row['ugroup_id']; if ($row['is_default']) { $default_values[] = $row['ugroup_id']; } } } $sql = "SELECT * FROM ugroup WHERE group_id=" . db_ei($group_id) . " OR ugroup_id IN (" . $predefined_ugroups . ") ORDER BY ugroup_id"; $res = db_query($sql); $array = array(); while ($row = db_fetch_array($res)) { $name = util_translate_name_ugroup($row[1]); $array[] = array('value' => $row[0], 'text' => $name); } $html .= html_build_multiple_select_box($array, "ugroups[]", $nb_set ? util_result_column_to_array($res_ugroups) : $default_values, 8, false, util_translate_name_ugroup('ugroup_nobody_name_key'), false, '', false, '', false); $html .= '<p>' . $GLOBALS['Language']->getText('project_admin_permissions', 'admins_create_modify_ug', array("/project/admin/editugroup.php?func=create&group_id={$group_id}", "/project/admin/ugroup.php?group_id={$group_id}")); echo $html; }
function bug_multiple_bug_depend_box($name = 'dependent_on_bug[]', $group_id = false, $bug_id = false) { if (!$group_id) { return 'ERROR - no group_id'; } else { if (!$bug_id) { return 'ERROR - no bug_id'; } else { $project =& project_get_object($group_id); if (!$project->usesBugDependencies()) { return '<B>This project has disabled bug dependencies</B>'; } $result = bug_data_get_valid_bugs($group_id, $bug_id); $result2 = bug_data_get_dependent_bugs($bug_id); return html_build_multiple_select_box($result, $name, util_result_column_to_array($result2)); } } }
/** * * Returns a multiplt select box populated with field values for this project * if box_name is given then impose this name in the select box * of the HTML form otherwise use the field_name) * * @param box_name: the selectbox name * @param group_artifact_id: the artifact type id * @param checked,show_none,text_none,show_any,text_any,show_value: values used by html_build_select_box function * @param display: define whether the MB will be displayed or not: In case of RO, it will not be displayed * @return string */ function multipleFieldBox($box_name = '', $group_artifact_id, $checked = false, $show_none = false, $text_none = 0, $show_any = false, $text_any = 0, $show_unchanged = false, $text_unchanged = 0, $show_value = false, $display = true) { global $Language; $hp = Codendi_HTMLPurifier::instance(); if (!$text_none) { $text_none = $Language->getText('global', 'none'); } if (!$text_any) { $text_any = $Language->getText('global', 'any'); } if (!$text_unchanged) { $text_unchanged = $Language->getText('global', 'unchanged'); } if (!$group_artifact_id) { return $Language->getText('tracker_include_field', 'error_no_atid'); } else { $result = $this->getFieldPredefinedValues($group_artifact_id, $checked, false, true, false, true); $array_values = array(); // $array_values is used to write javascript field dependencies // getFieldPredefinedValues doesn't always return the none value and the any value for the binded fields // so we add them everytime by precaution. if ($show_any) { $array_values[] = array(0, $text_any); } if ($show_none) { $array_values[] = array(100, $text_none); } while ($row = db_fetch_array($result)) { $array_values[] = $row; } if (db_numrows($result) > 0) { db_reset_result($result); } if ($box_name == '') { $box_name = $this->field_name . '[]'; } $output = ''; if ($display) { $output .= html_build_multiple_select_box($result, $box_name, $checked, $this->getDisplaySize() != "" ? $this->getDisplaySize() : "6", $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged, $show_value); } if ($this->isJavascriptEnabled) { $output .= '<script type="text/javascript">'; $output .= "\ncodendi.tracker.fields.add('" . (int) $this->getID() . "', '" . $hp->purify($this->getName(), CODENDI_PURIFIER_JS_QUOTE) . "', '" . $hp->purify(SimpleSanitizer::unsanitize($this->getLabel()), CODENDI_PURIFIER_JS_QUOTE) . "')"; $output .= $this->_getValuesAsJavascript($array_values, $checked); $output .= ";\n"; $output .= "</script>"; } return $output; } }
function pm_multiple_assigned_box($name = 'assigned_to[]', $group_id = false, $project_task_id = false) { if (!$group_id) { return 'ERROR - no group_id'; } else { $result = pm_data_get_technicians($group_id); if ($project_task_id) { //get the data so we can mark items as SELECTED $result2 = pm_data_get_assigned_to($project_task_id); return html_build_multiple_select_box($result, $name, util_result_column_to_array($result2)); } else { return html_build_multiple_select_box($result, $name, array()); } } }