public static function getUserGroupDisplayName($name) { switch ($name) { case self::NOBODY: return $GLOBALS['Language']->getText('project_ugroup', 'ugroup_nobody'); case self::ANON: return $GLOBALS['Language']->getText('project_ugroup', 'ugroup_anonymous_users'); case self::AUTHENTICATED: $label = ForgeConfig::get(self::CONFIG_AUTHENTICATED_LABEL); if ($label == false) { $label = $GLOBALS['Language']->getText('project_ugroup', 'ugroup_authenticated_users'); } return $label; case self::REGISTERED: $label = ForgeConfig::get(self::CONFIG_REGISTERED_LABEL); if ($label == false) { $label = $GLOBALS['Language']->getText('project_ugroup', 'ugroup_registered_users'); } return $label; case self::PROJECT_MEMBERS: return $GLOBALS['Language']->getText('project_ugroup', 'ugroup_project_members'); case self::PROJECT_ADMINS: return $GLOBALS['Language']->getText('project_ugroup', 'ugroup_project_admins'); default: return util_translate_name_ugroup($name); } }
public function getUgroups() { if ($this->ugroups === null) { $result = ugroup_db_get_existing_ugroups($this->group->getId(), array($GLOBALS['UGROUP_ANONYMOUS'], $GLOBALS['UGROUP_REGISTERED'], $GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN'])); while ($row = db_fetch_array($result)) { $this->ugroups[$row['ugroup_id']] = util_translate_name_ugroup($row['name']); } } return $this->ugroups; }
public function getContent() { $content = ''; // Import very long user group may takes very long time. ini_set('max_execution_time', 0); $ugroupName = util_translate_name_ugroup($this->row['name']); $ldapGroup = $this->ldap_user_group_manager->getLdapGroupByGroupId($this->ugroup->getId()); $clean_ugroupName = $this->purifier->purify($ugroupName); $clean_ldapGroupName = $this->purifyLDAPGroupName($ldapGroup); $btn_update = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_btn_update'); $btn_unlink = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_btn_unlink'); $content .= '<h2>' . $GLOBALS['Language']->getText('project_admin_editugroup', 'ug_admin', $clean_ugroupName) . '</h2>'; if ($ldapGroup !== null) { $content .= '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_ugroup_linked', array($clean_ugroupName, $clean_ldapGroupName)) . '</p>'; } $content .= '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_you_can') . '</p>'; $content .= '<ul>'; if ($ldapGroup !== null) { $content .= '<li>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_resync') . '</li>'; $content .= '<li>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_remove') . '</li>'; } $content .= '<li>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_link') . '</li>'; $content .= '</ul>'; $content .= '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_synchro') . '</p>'; $content .= '<ul>'; $content .= '<li>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_synchro_del', $GLOBALS['sys_name']) . '</li>'; $content .= '<li>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_synchro_add', $GLOBALS['sys_name']) . '</li>'; $content .= '</ul>'; $content .= '<form name="plugin_ldap_edit_ugroup" method="post" action="">'; $content .= '<input type="hidden" name="ugroup_id" value="' . $this->ugroup->getId() . '" />'; $content .= '<input type="hidden" name="action" value="edit_directory" />'; $content .= '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_bind_with_group') . ' <input type="text" name="bind_with_group" id="group_add" value="' . $clean_ldapGroupName . '" size="60" /></p>'; $preservingChecked = ''; if ($this->ldap_user_group_manager->isMembersPreserving($this->ugroup->getId()) || $this->bindOption === LDAP_GroupManager::PRESERVE_MEMBERS_OPTION) { $preservingChecked = 'checked'; } $content .= '<p>'; $content .= '<label class="checkbox" for="preserve_members"><input type="checkbox" id="preserve_members" name="preserve_members" ' . $preservingChecked . '/>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_preserve_members_option') . ' (' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_preserve_members_info') . ')</label></p>'; $synchroChecked = ''; if ($this->ldap_user_group_manager->isSynchronizedUgroup($this->ugroup->getId()) || $this->synchro === LDAP_GroupManager::AUTO_SYNCHRONIZATION) { $synchroChecked = 'checked'; } $content .= '<p>'; $content .= '<label class="checkbox" for="synchronize"><input type="checkbox" id="synchronize" name="synchronize" ' . $synchroChecked . '/>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_synchronize_option') . ' (' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_synchronize_info') . ')</label></p>'; $content .= '<input type="submit" name="submit" value="' . $btn_update . '" />'; if ($ldapGroup !== null) { $content .= ' '; $content .= '<input type="submit" name="submit" value="' . $btn_unlink . '" />'; } $GLOBALS['Response']->includeFooterJavascriptFile($this->pluginPath . '/scripts/autocomplete.js'); $js = "new LdapGroupAutoCompleter('group_add',\n '" . $this->pluginPath . "',\n '" . util_get_dir_image_theme() . "',\n 'group_add',\n false);"; $GLOBALS['Response']->includeFooterJavascriptSnippet($js); $content .= '</form>'; return $content; }
public function fetchCriteriaValue($criteria) { $hp = Codendi_HTMLPurifier::instance(); $html = ''; $criteria_value = $this->getCriteriaValue($criteria); $multiple = ' '; $size = ' '; $name = "criteria[{$this->id}][values][]"; //Field values $permission_type = 'PLUGIN_TRACKER_ARTIFACT_ACCESS'; $object_id = 0; $group_id = $this->getTracker()->getGroupId(); //TODO :From permissions.php // 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='{$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_ugroup = util_translate_name_ugroup($row[1]); $array[] = array('value' => $row[0], 'text' => $name_ugroup); } //end permissions.php if ($criteria->is_advanced) { $multiple = ' multiple="multiple" '; $size = ' size="' . min(7, count($array) + 2) . '" '; } $html .= '<select id="tracker_report_criteria_' . ($criteria->is_advanced ? 'adv_' : '') . $this->id . '" name="' . $name . '" ' . $size . $multiple . '>'; //Any value $selected = count($criteria_value) ? '' : 'selected="selected"'; $html .= '<option value="" ' . $selected . '>' . $GLOBALS['Language']->getText('global', 'any') . '</option>'; //None value $selected = isset($criteria_value[100]) ? 'selected="selected"' : ''; $html .= '<option value="100" ' . $selected . '>' . $GLOBALS['Language']->getText('global', 'none') . '</option>'; foreach ($array as $value) { $id = $value['value']; $selected = isset($criteria_value[$id]) ? 'selected="selected"' : ''; $html .= '<option value="' . $value['value'] . '">'; $html .= $value['text']; $html .= '</option>'; } $html .= '</select>'; return $html; }
echo $Language->getText('project_admin_index', 'member_request_delegation_desc_private_group'); } else { echo $Language->getText('project_admin_index', 'member_request_delegation_desc_restricted_user'); } echo '</p></td></tr>'; //Retrieve the saved ugroups for notification from DB $dar = $pm->getMembershipRequestNotificationUGroup($group_id); if ($dar && !$dar->isError() && $dar->rowCount() > 0) { $selectedUgroup = array(); foreach ($dar as $row) { $selectedUgroup[] = $row['ugroup_id']; } } else { $selectedUgroup = array($GLOBALS['UGROUP_PROJECT_ADMIN']); } $ugroupList = array(array('value' => $GLOBALS['UGROUP_PROJECT_ADMIN'], 'text' => util_translate_name_ugroup('project_admin'))); $res = ugroup_db_get_existing_ugroups($group_id); while ($row = db_fetch_array($res)) { $ugroupList[] = array('value' => $row['ugroup_id'], 'text' => $row['name']); } echo '<tr><td colspan="2" style="text-align: center;">'; echo '<form method="post" action="permission_request.php">'; echo '<input type="hidden" name="func" value="member_req_notif_group" />'; echo '<input type="hidden" name="group_id" value="' . $group_id . '">'; echo html_build_multiple_select_box_from_array($ugroupList, "ugroups[]", $selectedUgroup, 8, false, '', false, '', false, '', false); echo '<br />'; echo '<input type="submit" name="submit" value="' . $Language->getText('global', 'btn_update') . '" />'; echo '</form>'; echo '</td></tr>'; echo '<tr><td colspan="2"><p>'; echo $Language->getText('project_admin_index', 'member_request_delegation_msg_desc');
/** * Build a multi-select box of ugroups and roles selectable to fill the new date field reminder. * It contains: all dynamic ugroups plus project members and admins and the defined tracker roles * * @params Integer $reminderId Id of the date reminder we want to customize its notified * * @return String */ protected function getAllowedNotifiedForTracker($reminderId = Null) { $res = ugroup_db_get_existing_ugroups($this->tracker->group_id, array($GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN'])); $selectedUgroups = ''; $ugroups = array(); $roles = array(); if (!empty($reminderId)) { $reminder = $this->dateReminderFactory->getReminder($reminderId); $ugroups = $reminder->getUgroups(true); $roles = $reminder->getRoles(); if ($roles) { foreach ($roles as $role) { $selected[] = $role->getIdentifier(); } } } $output = '<select name="reminder_notified[]" multiple size=7 >'; $output .= '<optgroup label="' . $GLOBALS['Language']->getText('project_admin_utils', 'tracker_date_reminder_optgroup_label_ugroup') . '" >'; while ($row = db_fetch_array($res)) { if ($ugroups && in_array($row['ugroup_id'], $ugroups)) { $output .= '<option value="u_' . intval($row['ugroup_id']) . '" selected>' . util_translate_name_ugroup($row['name']) . '</option>'; } else { $output .= '<option value="u_' . intval($row['ugroup_id']) . '">' . util_translate_name_ugroup($row['name']) . '</option>'; } } $output .= '</optgroup>'; $output .= '<optgroup label="' . $GLOBALS['Language']->getText('project_admin_utils', 'tracker_date_reminder_optgroup_label_role') . '">'; $all_possible_roles = array(new Tracker_DateReminder_Role_Submitter(), new Tracker_DateReminder_Role_Assignee(), new Tracker_DateReminder_Role_Commenter()); $purifier = Codendi_HTMLPurifier::instance(); foreach ($all_possible_roles as $role) { if ($roles && in_array($role, $roles)) { $output .= '<option value="r_' . $purifier->purify($role->getIdentifier()) . '" selected>' . $purifier->purify($role->getLabel()) . '</option>'; } else { $output .= '<option value="r_' . $purifier->purify($role->getIdentifier()) . '">' . $purifier->purify($role->getLabel()) . '</option>'; } } $output .= '</optgroup>'; $output .= '</select>'; return $output; }
header('Content-Disposition: filename=' . $name); header('Content-Type: text/csv'); echo build_csv_header($col_list, $lbl_list) . $eol; $ugs = ugroup_db_get_existing_ugroups($group_id, array($GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN'])); while ($ugrp = db_fetch_array($ugs)) { if ($ugrp['ugroup_id'] <= 100) { $sqlUsers = ugroup_db_get_dynamic_members($ugrp['ugroup_id'], false, $group_id); } else { $sqlUsers = ugroup_db_get_members($ugrp['ugroup_id']); } $users = db_query($sqlUsers); while ($user = db_fetch_array($users)) { $r = array('group' => util_translate_name_ugroup($ugrp['name']), 'username' => $user['user_name'], 'realname' => $um->getUserById($user['user_id'])->getRealname()); echo build_csv_record($col_list, $r) . $eol; } } break; case 'user_groups_format': echo '<h3>' . $Language->getText('project_export_user_groups', 'exp_format') . '</h3>'; echo '<p>' . $Language->getText('project_export_user_groups', 'exp_format_msg') . '</p>'; // Pick-up a random project member $sqlUsers = ugroup_db_get_dynamic_members($GLOBALS['UGROUP_PROJECT_MEMBERS'], false, $group_id); $users = db_query($sqlUsers); $uRow = db_fetch_array($users); $user = $um->getUserById($uRow['user_id']); $dsc_list = array('group' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_group_desc'), 'username' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_username_desc', array($GLOBALS['sys_name'])), 'realname' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_realname_desc')); $record = array('group' => util_translate_name_ugroup('project_members'), 'username' => $user->getName(), 'realname' => $user->getRealName()); display_exported_fields($col_list, $lbl_list, $dsc_list, $record); break; } }
protected function getUgroupLabel($ugroup_id) { return util_translate_name_ugroup($this->getUgroupName($ugroup_id)); }
while ($row = db_fetch_array($result)) { if ($project->usesDocman() || $row['name'] != 'ugroup_document_tech_name_key' && $row['name'] != 'ugroup_document_admin_name_key') { $ugroupRow[100] = util_translate_name_ugroup($row['name']) . ' *'; $ugroupRow[200] = util_translate_desc_ugroup($row['description']); $ugroupRow[300] = array('value' => '-', 'html_attrs' => 'align="center"'); $ugroupRow[400] = array('value' => '-', 'html_attrs' => 'align="center"'); $em->processEvent('ugroup_table_row', array('row' => $row, 'html_array' => &$ugroupRow)); ksort($ugroupRow); format_html_row($ugroupRow, $row_num); } } if ($group_id != 100) { $result = db_query("SELECT * FROM ugroup WHERE group_id={$group_id} ORDER BY name"); if (db_numrows($result) > 0) { while ($row = db_fetch_array($result)) { $ugroupRow[100] = '<a href="/project/admin/editugroup.php?group_id=' . $group_id . '&ugroup_id=' . $row['ugroup_id'] . '&func=edit">' . util_translate_name_ugroup($row['name']); $ugroupRow[200] = util_translate_desc_ugroup($row['description']); $res2 = db_query("SELECT count(*) FROM ugroup_user WHERE ugroup_id=" . $row['ugroup_id']); $nb_members = db_result($res2, 0, 0); if ($nb_members) { $ugroupRow[300] = array('value' => $nb_members, 'html_attrs' => 'align="center"'); } else { $ugroupRow[300] = array('value' => 0, 'html_attrs' => 'align="center"'); } $token = $csrf->getTokenName() . '=' . $csrf->getToken(); $link = '?group_id=' . $group_id . '&ugroup_id=' . $row['ugroup_id'] . '&func=delete&' . $token; $warn = $Language->getText('project_admin_ugroup', 'del_ug'); $alt = $Language->getText('project_admin_servicebar', 'del'); $ugroupRow[400] = html_trash_link($link, $warn, $alt); $em->processEvent('ugroup_table_row', array('row' => $row, 'html_array' => &$ugroupRow)); ksort($ugroupRow);
/** * Retrieve all dynamic groups' members except ANONYMOUS, NONE, REGISTERED * @param Integer $group_id * @param Integer $atid * @return Array */ function ugroup_get_all_dynamic_members($group_id, $atid = 0) { $members = array(); $sql = array(); $ugroups = array(); //retrieve dynamic ugroups id and name $rs = db_query("SELECT ugroup_id, name FROM ugroup WHERE ugroup_id IN (" . implode(',', $GLOBALS['UGROUPS']) . ") "); while ($row = db_fetch_array($rs)) { $ugroups[$row['ugroup_id']] = $row['name']; } foreach ($GLOBALS['UGROUPS'] as $ugroup_id) { if ($ugroup_id == $GLOBALS['UGROUP_ANONYMOUS'] || $ugroup_id == $GLOBALS['UGROUP_REGISTERED'] || $ugroup_id == $GLOBALS['UGROUP_NONE']) { continue; } $sql = ugroup_db_get_dynamic_members($ugroup_id, $atid, $group_id); $rs = db_query($sql); while ($row = db_fetch_array($rs)) { $members[] = array('ugroup_id' => $ugroup_id, 'name' => util_translate_name_ugroup($ugroups[$ugroup_id]), 'user_id' => $row['user_id'], 'user_name' => $row['user_name']); } } return $members; }
/** * Display Date Field Notification Settings form * * @param * @return void */ function displayDateFieldNotificationSettings(ArtifactType $at, ArtifactField $field) { //get date field reminder settings from database $tdrArtifactField = new TrackerDateReminder_ArtifactField(); $res = $tdrArtifactField->getDateFieldReminderSettings($field->getID(), $at->getID()); $enabled = db_numrows($res) == 1; $start = db_result($res, 0, 'notification_start'); $frequency = db_result($res, 0, 'frequency'); $recurse = db_result($res, 0, 'recurse'); $notified_people = db_result($res, 0, 'notified_people'); $notified_groups = array(); $notified_users = array(); if (trim($notified_people) != "") { $notif = explode(",", $notified_people); foreach ($notif as $value) { if (preg_match("/^g/", $value)) { array_push($notified_groups, $value); } else { array_push($notified_users, $value); } } } if (count($notified_groups) == 0) { $notified_groups[] = '100'; } if (count($notified_users) == 0) { $notified_users[] = '100'; } $notif_type = db_result($res, 0, 'notification_type'); if ($notif_type == 1) { $after = "selected"; $before = ""; } else { $after = ""; $before = "selected"; } $out = ''; $baseActionUrl = '/tracker/admin/index.php?func=date_field_notification&group_id=' . $at->Group->getID() . '&atid=' . $at->getID() . '&field_id=' . $field->getID(); if ($enabled) { $out .= '<H3>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_title') . '</H3>'; $out .= '<FORM ACTION="' . $baseActionUrl . '&delete_reminder=true" METHOD="POST">'; $out .= '<P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_desc') . '</P>'; $out .= '<INPUT TYPE="SUBMIT" NAME="reminder" VALUE="' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_button') . '" />'; $out .= '</FORM>'; } $out .= '<FORM ACTION="' . $baseActionUrl . '" METHOD="POST" name="date_field_notification_settings_form"> <INPUT TYPE="HIDDEN" NAME="field_id" VALUE="' . $field->getID() . '"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $at->Group->getID() . '"> <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . $at->getID() . '">'; $out .= '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_field', array($field->getLabel())) . '</h3>'; $out .= '<fieldset> <TABLE BORDER="0" WIDTH="930px"><TR height="30"><TD>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part1', array($field->getLabel())) . '</TD><TD> <INPUT TYPE="TEXT" NAME="start" SIZE="5" VALUE="' . $start . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'days') . '</TD><TD colspan=3"> <SELECT NAME="notif_type"> <OPTION VALUE="0" ' . $before . '>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notify_before') . ' <OPTION VALUE="1" ' . $after . '>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notify_after') . ' </SELECT> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part2') . '</TD></TR><TR><TD valign="top">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part3') . ' <INPUT TYPE="TEXT" NAME="recurse" SIZE="5" VALUE="' . $recurse . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part4') . '</TD><TD valign="top"> '; $artRoleNames = array(array('value' => '1', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_SUBMITTER_short_desc')), array('value' => '2', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_ASSIGNEE_short_desc')), array('value' => '3', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_CC_short_desc')), array('value' => '4', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_COMMENTER_short_desc'))); $out .= html_build_multiple_select_box_from_array($artRoleNames, 'notified_users[]', $notified_users, 4, true, '', false, '', false, '', false); $out .= '</TD><TD valign="top">' . $GLOBALS['Language']->getText('global', 'and') . ' </TD> <TD valign="top">'; $qry = sprintf('SELECT ugroup_id, name FROM ugroup' . ' WHERE (group_id = %d || group_id = 100)' . ' AND ugroup_id <> 1' . ' AND ugroup_id <> 2' . ' AND ugroup_id <> 100', db_ei($at->Group->getID())); $res = db_query($qry); while ($rows = db_fetch_array($res)) { $groupNames[] = array('value' => 'g' . $rows['ugroup_id'], 'text' => util_translate_name_ugroup($rows['name'])); } $out .= html_build_multiple_select_box_from_array($groupNames, 'notified_groups[]', $notified_groups, 8, true, '', false, '', false, '', false); $out .= '</SELECT></TD><TD valign="top">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part5') . ' <INPUT TYPE="TEXT" NAME="frequency" SIZE="5" VALUE="' . $frequency . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'days') . '.</TD></TR></TABLE><INPUT TYPE="SUBMIT" NAME="submit_notif_settings" value="' . $GLOBALS['Language']->getText('global', 'btn_update') . '"></P></FORM></fieldset><P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part6', array($field->getLabel())) . '<P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part7', array($field->getLabel())) . '</P>' . '<P>'; echo $out; }
Delegate notifications */ $HTML->box1_top($Language->getText('project_admin_index', 'member_request_delegation_title')); //Retrieve the saved ugroups for notification from DB $selectedUgroup = array(); $dar = $pm->getMembershipRequestNotificationUGroup($group_id); if ($dar && !$dar->isError() && $dar->rowCount() > 0) { foreach ($dar as $row) { if ($row['ugroup_id'] == $GLOBALS['UGROUP_PROJECT_ADMIN']) { $selectedUgroup[] = util_translate_name_ugroup('project_admin'); } else { $selectedUgroup[] = ugroup_get_name_from_id($row['ugroup_id']); } } } else { $selectedUgroup = array(util_translate_name_ugroup('project_admin')); } echo '<b>' . $Language->getText('project_admin_utils', 'selected_ugroups_title') . '</b>'; echo '<ul>'; foreach ($selectedUgroup as $ugroup) { echo '<li>' . $ugroup . '</li>'; } echo '</ul>'; $message = $GLOBALS['Language']->getText('project_admin_index', 'member_request_delegation_msg_to_requester'); $pm = ProjectManager::instance(); $dar = $pm->getMessageToRequesterForAccessProject($group_id); if ($dar && !$dar->isError() && $dar->rowCount() == 1) { $row = $dar->current(); if ($row['msg_to_requester'] != "member_request_delegation_msg_to_requester") { $message = $row['msg_to_requester']; }
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; }
protected function getUgroupLabel($u_group) { $row = $this->getDao()->searchByUGroupId($u_group)->getRow(); return util_translate_name_ugroup($row['name']); }
/** * Display the retrieved reult set * * @param Integer $group_id Id of the project * @param Array $res Contains the retrieved results * @param Boolean $export Switch CSV export mode or HTML display * @param unknown_type $i Line number indicator * * @return string html */ function displayProjectHistoryResults($group_id, $res, $export = false, &$i = 1) { global $Language; $html = ''; $hp = Codendi_HTMLPurifier::instance(); while ($row = $res['history']->getRow()) { $field = $row['field_name']; // see if there are any arguments after the message key // format is "msg_key ## arg1||arg2||... // If msg_key cannot be found in the localized message // catalog then display the msg has is because this is very // likely a legacy message (pre-localization version) if (strpos($field, " %% ") !== false) { list($msg_key, $args) = explode(" %% ", $field); if ($args) { $arr_args = explode('||', $args); } } else { $msg_key = $field; $arr_args = ""; } $msg = $Language->getText('project_admin_utils', $msg_key, $arr_args); if (!(strpos($msg, "*** Unkown msg") === false)) { $msg = $field; } if (!$export) { $html .= '<TR class="' . html_get_alt_row_color($i++) . '"><TD>' . $hp->purify($msg, CODENDI_PURIFIER_BASIC, $group_id) . '</TD><TD>'; } $val = $row['old_value']; //Translate dynamic ugroup name for permission entries if (strstr($msg_key, "perm_granted_for_") || strstr($msg_key, "perm_reset_for_") || strstr($msg_key, "membership_request_updated")) { $ugroupList = explode(",", $val); $val = ''; foreach ($ugroupList as $ugroup) { if ($val) { $val .= ', '; } $val .= util_translate_name_ugroup($ugroup); } } else { if ($msg_key == "group_type") { $template =& TemplateSingleton::instance(); $val = $template->getLabel($val); } } if ($export) { $documents_body = array('event' => $hp->purify($msg, CODENDI_PURIFIER_BASIC, $group_id), 'val' => $hp->purify($val), 'date' => format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['date']), 'by' => UserHelper::instance()->getDisplayNameFromUserName($row['user_name'])); $html .= build_csv_record(array('event', 'val', 'date', 'by'), $documents_body) . "\n"; } else { $html .= $hp->purify($val); $user = UserManager::instance()->getUserByUserName($row['user_name']); $html .= '</TD><TD>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['date']) . '</TD><TD>' . UserHelper::instance()->getLinkOnUser($user) . '</TD></TR>'; } } return $html; }
public function getTranslatedName() { return util_translate_name_ugroup($this->getName()); }
/** * Build a multi-select box of ugroup selectable to fill the new date field reminder. * It contains: all dynamic ugroups plus project members and admins. * * @params Integer $reminderId Id of the date reminder we want to customize its notified ugroups * * @return String */ protected function getUgroupsAllowedForTracker($reminderId = Null) { $res = ugroup_db_get_existing_ugroups($this->tracker->group_id, array($GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN'])); $selectedUgroups = ''; if (!empty($reminderId)) { $reminder = $this->dateReminderFactory->getReminder($reminderId); $selectedUgroups = $reminder->getUgroups(true); } $output = '<select name="reminder_ugroup[]" multiple>'; while ($row = db_fetch_array($res)) { if ($selectedUgroups && in_array($row['ugroup_id'], $selectedUgroups)) { $output .= '<option value="' . intval($row['ugroup_id']) . '" selected>' . util_translate_name_ugroup($row['name']) . '</option>'; } else { $output .= '<option value="' . intval($row['ugroup_id']) . '">' . util_translate_name_ugroup($row['name']) . '</option>'; } } $output .= '</select>'; return $output; }
/** * Retrieve the reminder notified ugroups as string * * @return String */ public function getUgroupsLabel() { $ugroupsLabel = ''; $ugroupManager = $this->getUGroupManager(); $ugroups = explode(',', $this->ugroups); if (!empty($ugroups)) { foreach ($ugroups as $ugroup) { $ugroupsLabel .= ' "' . util_translate_name_ugroup($ugroupManager->getById($ugroup)->getName()) . ' "'; } } return $ugroupsLabel; }
function frs_display_release_form($is_update, &$release, $group_id, $title, $url) { global $frspf, $frsrf, $frsff; $hp =& Codendi_HTMLPurifier::instance(); if (is_array($release)) { if (isset($release['date'])) { $release_date = $release['date']; } $release = new FRSRelease($release); } if ($is_update) { $files = $release->getFiles(); if (count($files) > 0) { for ($i = 0; $i < count($files); $i++) { if (!$frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'md5_fail', array(basename($files[$i]->getFileName()), $files[$i]->getComputedMd5()))); } } } } file_utils_admin_header(array('title' => $GLOBALS['Language']->getText('file_admin_editreleases', 'release_new_file_version'), 'help' => 'frs.html#delivery-manager-administration')); echo '<H3>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</H3>'; $sql = "SELECT * FROM frs_processor WHERE (group_id = 100 OR group_id = " . db_ei($group_id) . ") ORDER BY rank"; $result = db_query($sql); $processor_id = util_result_column_to_array($result, 0); $processor_name = util_result_column_to_array($result, 1); foreach ($processor_name as $key => $value) { $processor_name[$key] = $hp->purify($value, CODENDI_PURIFIER_JS_QUOTE); } $sql = "SELECT * FROM frs_filetype ORDER BY type_id"; $result1 = db_query($sql); $type_id = util_result_column_to_array($result1, 0); $type_name = util_result_column_to_array($result1, 1); $url_news = get_server_url() . "/file/showfiles.php?group_id=" . $group_id; echo '<script type="text/javascript">'; echo "var processor_id = ['" . implode("', '", $processor_id) . "'];"; echo "var processor_name = ['" . implode("', '", $processor_name) . "'];"; echo "var type_id = ['" . implode("', '", $type_id) . "'];"; echo "var type_name = ['" . implode("', '", $type_name) . "'];"; echo "var group_id = " . $group_id . ";"; echo "var relname = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'relname') . "';"; echo "var choose = '" . $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one') . "';"; echo "var browse = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'browse') . "';"; echo "var local_file = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'local_file') . "';"; echo "var scp_ftp_files = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'scp_ftp_files') . "';"; echo "var upload_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload') . "';"; echo "var add_file_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_file') . "';"; echo "var add_change_log_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_change_log') . "';"; echo "var view_change_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'view_change') . "';"; echo "var refresh_files_list = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'refresh_file_list') . "';"; echo "var release_mode = '" . ($is_update ? 'edition' : 'creation') . "';"; if ($is_update) { $pm = PermissionsManager::instance(); $dar = $pm->getAuthorizedUgroups($release->getReleaseID(), FRSRelease::PERM_READ); $ugroups_name = array(); foreach ($dar as $row) { $ugroups_name[] = util_translate_name_ugroup($row['name']); } echo "var ugroups_name = '" . implode(", ", $ugroups_name) . "';"; echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'release_perm') . "';"; } else { echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'default_permissions') . "';"; } echo '</script>'; //set variables for news template $relname = $GLOBALS['Language']->getText('file_admin_editreleases', 'relname'); if (!$is_update) { echo '<p>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'contain_multiple_files') . '</p>'; } ?> <FORM id="frs_form" NAME="frsRelease" ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php echo $url; ?> " CLASS="form-inline"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $GLOBALS['sys_max_size_upload']; ?>"> <input type="hidden" name="postReceived" value="" /> <?php if ($release->getReleaseId()) { echo '<input type="hidden" id="release_id" name="release[release_id]" value="' . $release->getReleaseId() . '" />'; } ?> <TABLE BORDER="0" width="100%"> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_properties'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editpackages', 'p_name'); ?> :</B> </TD> <TD> <?php $res =& $frspf->getFRSPackagesFromDb($group_id); $rows = count($res); if (!$res || $rows < 1) { echo '<p class="highlight">' . $GLOBALS['Language']->getText('file_admin_qrs', 'no_p_available') . '</p>'; } else { echo '<SELECT NAME="release[package_id]" id="package_id">'; for ($i = 0; $i < $rows; $i++) { echo '<OPTION VALUE="' . $res[$i]->getPackageID() . '"'; if ($res[$i]->getPackageID() == $release->getPackageId()) { echo ' selected'; } echo '>' . $hp->purify(util_unconvert_htmlspecialchars($res[$i]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</OPTION>'; } echo '</SELECT>'; } ?> </TD><td></td> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_name'); ?> : <span class="highlight"><strong>*</strong></span></B> </TD> <TD> <INPUT TYPE="TEXT" id="release_name" name="release[name]" onBlur="update_news()" value="<?php echo $hp->purify($release->getName()); ?> "> </TD> </TR> <TR> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date'); ?> :</B> </TD> <TD> <?php echo $GLOBALS['HTML']->getDatePicker('release_date', 'release[date]', isset($release_date) ? $hp->purify($release_date) : format_date('Y-m-d', $release->getReleaseDate())); ?> </TD> <td></td> <TD> <B><?php echo $GLOBALS['Language']->getText('global', 'status'); ?> :</B> </TD> <TD> <?php print frs_show_status_popup($name = 'release[status_id]', $release->getStatusID()) . "<br>"; ?> </TD> </TR></TABLE></FIELDSET> </TD></TR> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_uploaded_files'); ?> </LEGEND> <?php $titles = array(); $titles[] = $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'delete_col') : ''; $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'filename'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'processor'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'file_type'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'md5sum'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'comment'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'user'); if ($is_update) { $titles[] = $GLOBALS['Language']->getText('file_admin_editreleasepermissions', 'release'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date'); } echo html_build_list_table_top($titles, false, false, false, 'files'); ?> <tbody id="files_body"> <?php $files =& $release->getFiles(); for ($i = 0; $i < count($files); $i++) { $fname = $files[$i]->getFileName(); $list = split('/', $fname); $fname = $list[sizeof($list) - 1]; $user_id = $files[$i]->getUserID(); $userName = isset($user_id) ? UserManager::instance()->getUserById($files[$i]->getUserID())->getRealName() : ""; echo '<TR>'; echo '<TD><INPUT TYPE="CHECKBOX" NAME="release_files_to_delete[]" VALUE="' . $files[$i]->getFileID() . '"</TD>'; echo '<TD>' . $hp->purify($fname, CODENDI_PURIFIER_CONVERT_HTML) . '<INPUT TYPE="HIDDEN" NAME="release_files[]" VALUE="' . $files[$i]->getFileID() . '"></TD>'; echo '<TD>' . frs_show_processor_popup($group_id, $name = 'release_file_processor[]', $files[$i]->getProcessorID()) . '</TD>'; echo '<TD>' . frs_show_filetype_popup($name = 'release_file_type[]', $files[$i]->getTypeID()) . '</TD>'; //In case of difference between the inserted md5 and the computed one //we dispaly an editable text field to let the user insert the right value //to avoid the error message next time $value = 'value = "' . $files[$i]->getReferenceMd5() . '"'; if ($frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) { $value = 'value = "' . $files[$i]->getComputedMd5() . '" readonly="true"'; } echo '<TD><INPUT TYPE="TEXT" NAME="release_reference_md5[]" ' . $value . ' SIZE="36" ></TD>'; $comment = $files[$i]->getComment(); echo '<TD><textarea NAME="release_comment[]" cols="20", rows="1" >' . $comment . '</textarea></TD>'; echo '<TD><INPUT TYPE="TEXT" NAME="user" value = "' . $userName . '" readonly="true"></TD>'; echo '<TD>' . frs_show_release_popup2($group_id, $name = 'new_release_id[]', $files[$i]->getReleaseID()) . '</TD>'; echo '<TD><INPUT TYPE="TEXT" NAME="release_time[]" VALUE="' . format_date('Y-m-d', $files[$i]->getReleaseTime()) . '" SIZE="10" MAXLENGTH="10"></TD></TR>'; } echo '<INPUT TYPE="HIDDEN" id="nb_files" NAME="nb_files" VALUE="' . count($files) . '">'; ?> <tr id="row_0"> <td></td> <td> <input type="hidden" name="js" value="no_js"/> <select name="ftp_file[]" id="ftp_file_0"> <option value="-1"><?php echo $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one'); ?> </option> <?php //iterate and show the files in the upload directory $file_list = $frsff->getUploadedFileNames($release->getProject()); foreach ($file_list as $file) { echo '<option value="' . $file . '">' . $hp->purify($file, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } echo '<script type="text/javascript">'; echo "var available_ftp_files = ['" . implode("', '", $file_list) . "'];"; echo '</script>'; ?> </select> <span id="or">or</span> <input type="file" name="file[]" id="file_0" /> </td> <td> <?php print frs_show_processor_popup($group_id, $name = 'file_processor'); ?> </td> <td> <?php print frs_show_filetype_popup($name = 'file_type'); ?> </td> <td> <input name="reference_md5" value="" size="36" type="TEXT"> </td> </tr> </tbody> </table> <?php echo '<span class="small" style="color:#666"><i>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload_file_msg', formatByteToMb($GLOBALS['sys_max_size_upload'])) . '</i> </span>'; echo '<div id=\'files_help\'><span class="smaller">'; include $GLOBALS['Language']->getContent('file/qrs_attach_file'); echo '</span></div>'; ?> </FIELDSET> </TD></TR> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notes'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR id="notes_title"> <TD VALIGN="TOP" width="10%"> <span id="release_notes"><B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_notes'); ?> : </B></span> </TD> </TR> <TR id="upload_notes"> <TD> <input id="uploaded_notes" type="file" name="uploaded_release_notes" size="30"> </TD> </TR> <TR id="release_notes_area"> <TD width="100%"> <TEXTAREA NAME="release[release_notes]" rows="7" cols="70"><?php echo $hp->purify($release->getNotes(), CODENDI_PURIFIER_CONVERT_HTML); ?> </TEXTAREA> </TD> </TR> <TR id="change_log_title"> <TD VALIGN="TOP" width="10%"> <span id="change_log"><B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'change_log'); ?> : </B></span> </TD> </TR> <TR id="upload_change_log"> <TD> <input type="file" id="uploaded_change_log" name="uploaded_change_log" size="30"> </TD> </TR> <TR id="change_log_area"> <TD width="40%"> <TEXTAREA ID="text_area_change_log" NAME="release[change_log]" ROWS="7" COLS="70"><?php echo $hp->purify($release->getChanges(), CODENDI_PURIFIER_CONVERT_HTML); ?> </TEXTAREA> </TD> </TR> </TABLE></FIELDSET> </TD></TR> <TR> <TD> <FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_permissions'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR id="permissions"> <TD> <DIV id="permissions_list"> <?php if ($is_update) { permission_display_selection_frs("RELEASE_READ", $release->getReleaseID(), $group_id); } else { permission_display_selection_frs("PACKAGE_READ", $release->getPackageID(), $group_id); } ?> </DIV> </TD> </TR> </TABLE> </FIELDSET> </TD> </TR> <?php if (user_ismember($group_id, 'A') || user_ismember($group_id, 'N2') || user_ismember($group_id, 'N1')) { echo ' <TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_news') . '</LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR> <TD VALIGN="TOP"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'submit_news') . ' :</B> </TD> <TD> <INPUT ID="submit_news" TYPE="CHECKBOX" NAME="release_submit_news" VALUE="1"> </TD> </TR> <TR id="tr_subject"> <TD VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'subject') . ' :</B> </TD> <TD> <INPUT TYPE="TEXT" ID="release_news_subject" NAME="release_news_subject" VALUE=" ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_subject', $relname) . '" SIZE="40" MAXLENGTH="60"> </TD> </TR> <TR id="tr_details"> <TD VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'details') . ' :</B> </TD> <TD> <TEXTAREA ID="release_news_details" NAME="release_news_details" ROWS="7" COLS="50">' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_details', array($relname, $url_news)) . ' </TEXTAREA> </TD> </TR> <TR id="tr_public"> <TD ROWSPAN=2 VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('news_submit', 'news_privacy') . ' :</B> </TD> <TD> <INPUT TYPE="RADIO" ID="publicnews" NAME="private_news" VALUE="0" CHECKED>' . $GLOBALS['Language']->getText('news_submit', 'public_news') . ' </TD> </TR > <TR id="tr_private"> <TD> <INPUT TYPE="RADIO" ID="privatenews" NAME="private_news" VALUE="1">' . $GLOBALS['Language']->getText('news_submit', 'private_news') . ' </TD> </TR></DIV> </TABLE></FIELDSET> </TD></TR>'; } $fmmf = new FileModuleMonitorFactory(); $count = count($fmmf->getFilesModuleMonitorFromDb($release->getPackageId())); if ($count > 0) { echo '<TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notification') . '</LEGEND>'; echo '<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">'; echo '<TR><TD>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'users_monitor', $count) . '</TD></TR>'; echo '<TR><TD><B>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'mail_file_rel_notice') . '</B><INPUT TYPE="CHECKBOX" NAME="notification" VALUE="1" CHECKED>'; echo '</TD></TR>'; echo '</TABLE></FIELDSET></TD></TR>'; } ?> <TR> <TD ALIGN="CENTER"> <INPUT TYPE="HIDDEN" NAME="create" VALUE="bla"> <INPUT TYPE="SUBMIT" ID="create_release" VALUE="<?php echo $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'edit_release') : $GLOBALS['Language']->getText('file_admin_qrs', 'release_file'); ?> "> <input type="submit" ID="cancel_release" name="cancel" value="<?php echo $GLOBALS['Language']->getText('global', 'btn_cancel'); ?> " /> </TD> </TR> </TABLE> </FORM> <?php file_utils_footer(array()); }
protected static function fetchSelectUsers($select_name, $field, $value_function) { $hp = Codendi_HTMLPurifier::instance(); $html = ''; $html .= '<input type="hidden" name="' . $select_name . '" value="" />'; $html .= '<select multiple="multiple" name="' . $select_name . '"> <option value="">' . $GLOBALS['Language']->getText('global', 'none') . '</option>'; $selected = ""; if (in_array("artifact_submitters", $value_function)) { $selected = 'selected="selected"'; } $html .= '<option value="artifact_submitters" ' . $selected . '>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'submitters') . '</option>'; $selected = ""; $ugroup_res = ugroup_db_get_ugroup($GLOBALS['UGROUP_PROJECT_MEMBERS']); $name = util_translate_name_ugroup(db_result($ugroup_res, 0, 'name')); if (in_array("group_members", $value_function)) { $selected = 'selected="selected"'; } $html .= '<option value="group_members" ' . $selected . '>' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; $selected = ""; $ugroup_res = ugroup_db_get_ugroup($GLOBALS['UGROUP_PROJECT_ADMIN']); $name = util_translate_name_ugroup(db_result($ugroup_res, 0, 'name')); if (in_array("group_admins", $value_function)) { $selected = 'selected="selected"'; } $html .= '<option value="group_admins" ' . $selected . '>' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; $ugroup_res = ugroup_db_get_existing_ugroups(100); $rows = db_numrows($ugroup_res); for ($i = 0; $i < $rows; $i++) { $ug = db_result($ugroup_res, $i, 'ugroup_id'); $selected = ""; if ($ug == $GLOBALS['UGROUP_NONE'] || $ug == $GLOBALS['UGROUP_ANONYMOUS'] || $ug == $GLOBALS['UGROUP_PROJECT_MEMBERS'] || $ug == $GLOBALS['UGROUP_PROJECT_ADMIN'] || $ug == $GLOBALS['UGROUP_TRACKER_ADMIN']) { continue; } $ugr = "ugroup_" . $ug; if (in_array($ugr, $value_function)) { $selected = 'selected="selected"'; } $html .= '<option value="' . $ugr . '" ' . $selected . '>' . $hp->purify(util_translate_name_ugroup(db_result($ugroup_res, $i, 'name')), CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } $group_id = $field->getTracker()->getGroupId(); if ($group_id != 100) { $ugroup_res = ugroup_db_get_existing_ugroups($group_id); $rows = db_numrows($ugroup_res); for ($i = 0; $i < $rows; $i++) { $selected = ""; $ug = db_result($ugroup_res, $i, 'ugroup_id'); $ugr = "ugroup_" . $ug; if (in_array($ugr, $value_function)) { $selected = 'selected="selected"'; } $html .= '<option value="' . $ugr . '" ' . $selected . '>' . $hp->purify(util_translate_name_ugroup(db_result($ugroup_res, $i, 'name')), CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } } $html .= '</select>'; return $html; }
/** * Fetch the html code to display the field value in tooltip * * @param Tracker_Artifact $artifact * @param Tracker_Artifact_ChangesetValue_PermissionsOnArtifact $value The changeset value for this field * @return string */ protected function fetchTooltipValue(Tracker_Artifact $artifact, Tracker_Artifact_ChangesetValue $value = null) { $html = ''; if ($value && $artifact->useArtifactPermissions()) { $ugroup_dao = $this->getUGroupDao(); $perms = $value->getPerms(); $perms_name = array(); foreach ($perms as $perm) { $row = $ugroup_dao->searchByUGroupId($perm)->getRow(); $perms_name[] = util_translate_name_ugroup($row['name']); } $html .= implode(",", $perms_name); } return $html; }
$btn_update = $Language->getText('plugin_ldap', 'ugroup_edit_btn_update'); $vSubmit = new Valid_WhiteList('submit', array($btn_update)); $vSubmit->required(); if ($request->isPost() && $request->valid($vSubmit)) { if ($request->get('submit') == $btn_update) { $vUserAdd = new Valid_String('user_add'); $vUserAdd->required(); if ($request->valid($vUserAdd)) { $ldapUserGroupManager->addListOfUsersToGroup($request->get('user_add')); } } } // // Display // $ugroupRow = ugroup_db_get_ugroup($ugroupId); $ugroupName = util_translate_name_ugroup($row['name']); $clean_ugroupName = $hp->purify($ugroupName); project_admin_header(array('title' => $Language->getText('project_admin_editugroup', 'edit_ug'), 'group' => $group_id)); echo '<h2>' . $Language->getText('project_admin_editugroup', 'ug_admin', $clean_ugroupName) . '</h2>'; echo '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_add_users_help') . '</p>'; echo '<form name="plugin_ldap_edit_ugroup" method="post" action="">'; echo '<input type="hidden" name="ugroup_id" value="' . $ugroupId . '" />'; echo '<input type="hidden" name="func" value="add_user" />'; echo '<p>' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_group_add_users') . ' <textarea name="user_add" id="user_add" rows="2" cols="60" wrap="soft"/></textarea></p>'; echo '<input type="submit" name="submit" value="' . $btn_update . '" />'; // JS code for autocompletion on "add_user" field defined on top. $js = "new UserAutoCompleter('user_add',\r\n '" . util_get_dir_image_theme() . "',\r\n true);"; $GLOBALS['Response']->includeFooterJavascriptSnippet($js); echo '</form>'; project_admin_footer(array());
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; }
/** * Return the list of ugroup selectable to fill the notification table. * * It contains: all dynamic ugroups plus project members and admins. */ function getUgroupsAllowedForTable($groupId) { $res = ugroup_db_get_existing_ugroups($groupId, array($GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN'])); $ugroups = array(); while ($row = db_fetch_array($res)) { $r = array(); $r['value'] = $row['ugroup_id']; $r['text'] = util_translate_name_ugroup($row['name']); $ugroups[] = $r; } return $ugroups; }
/** * Display the value function form * * @param field_id: the field id to edit * @param value_function: the value function to bind to * @param or_label: display an additionnal label to display "Or ..." * * @return void */ function displayValueFunctionForm($field_id, $value_function, $or_label = "") { $hp = Codendi_HTMLPurifier::instance(); global $Language; if ($or_label) { echo '<h3>' . $hp->purify($or_label, CODENDI_PURIFIER_CONVERT_HTML) . ' ' . $Language->getText('tracker_include_type', 'bind_to_list') . ' '; } else { echo '<h3>' . $Language->getText('tracker_include_type', 'bind_to_list') . ' '; } echo help_button('TrackerAdministration.html#TrackerBindingFieldToValueList') . '</h3>'; echo ' <FORM ACTION="" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="update_binding"> <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() . '"> ' . $Language->getText('tracker_include_type', 'bind_to') . ': <select multiple name="value_function[]"> <option value="">' . $Language->getText('global', 'none') . '</option>'; $selected = ""; if ($value_function && in_array("artifact_submitters", $value_function)) { $selected = " selected"; } echo '<option value="artifact_submitters"' . $selected . '>' . $Language->getText('tracker_include_type', 'submitters') . '</option>'; $selected = ""; $ugroup_res = ugroup_db_get_ugroup($GLOBALS['UGROUP_PROJECT_MEMBERS']); $name = util_translate_name_ugroup(db_result($ugroup_res, 0, 'name')); if ($value_function && in_array("group_members", $value_function)) { $selected = " selected"; } echo '<option value="group_members"' . $selected . '>' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; $selected = ""; $ugroup_res = ugroup_db_get_ugroup($GLOBALS['UGROUP_PROJECT_ADMIN']); $name = util_translate_name_ugroup(db_result($ugroup_res, 0, 'name')); if ($value_function && in_array("group_admins", $value_function)) { $selected = " selected"; } echo '<option value="group_admins"' . $selected . '>' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; $selected = ""; $ugroup_res = ugroup_db_get_ugroup($GLOBALS['UGROUP_TRACKER_ADMIN']); $name = util_translate_name_ugroup(db_result($ugroup_res, 0, 'name')); if ($value_function && in_array("tracker_admins", $value_function)) { $selected = " selected"; } echo '<option value="tracker_admins"' . $selected . '>' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; $ugroup_res = ugroup_db_get_existing_ugroups(100); $rows = db_numrows($ugroup_res); for ($i = 0; $i < $rows; $i++) { $ug = db_result($ugroup_res, $i, 'ugroup_id'); $selected = ""; if ($ug == $GLOBALS['UGROUP_NONE'] || $ug == $GLOBALS['UGROUP_ANONYMOUS'] || $ug == $GLOBALS['UGROUP_PROJECT_MEMBERS'] || $ug == $GLOBALS['UGROUP_PROJECT_ADMIN'] || $ug == $GLOBALS['UGROUP_TRACKER_ADMIN']) { continue; } $ugr = "ugroup_" . $ug; if ($value_function && in_array($ugr, $value_function)) { $selected = " selected"; } echo '<option value="' . $ugr . '"' . $selected . '>' . $hp->purify(util_translate_name_ugroup(db_result($ugroup_res, $i, 'name')), CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } if ($this->Group->getID() != 100) { $ugroup_res = ugroup_db_get_existing_ugroups($this->Group->getID()); $rows = db_numrows($ugroup_res); for ($i = 0; $i < $rows; $i++) { $selected = ""; $ug = db_result($ugroup_res, $i, 'ugroup_id'); $ugr = "ugroup_" . $ug; if ($value_function && in_array($ugr, $value_function)) { $selected = " selected"; } echo '<option value="' . $ugr . '"' . $selected . '>' . $hp->purify(util_translate_name_ugroup(db_result($ugroup_res, $i, 'name')), CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } } echo ' </select> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_type', 'bind') . '"> </FORM>'; }
private function getDocumentPermissions(DataAccessResult $results) { $perms = $this->minimal_permissions; foreach ($results as $row) { if ($row['id'] < ProjectUGroup::PROJECT_ADMIN || $row['id'] > ProjectUGroup::NONE) { $ugroup_name = util_translate_name_ugroup($row['name']); $ugroup_id = $row['id']; $this->ugroups[$ugroup_id] = $ugroup_name; $perms[$ugroup_id][] = self::V2_SOAP_PERM_READ; } } return $perms; }