Пример #1
0
function print_subproject_option_list($p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_parents = array())
{
    array_push($p_parents, $p_parent_id);
    $t_project_ids = current_user_get_accessible_subprojects($p_parent_id);
    $t_project_count = count($t_project_ids);
    for ($i = 0; $i < $t_project_count; $i++) {
        $t_full_id = $t_id = $t_project_ids[$i];
        if ($t_id != $p_filter_project_id) {
            echo "<option value=\"";
            if ($p_trace) {
                $t_full_id = join($p_parents, ";") . ';' . $t_id;
            }
            echo $t_full_id . '"';
            if ($p_project_id !== null) {
                check_selected($p_project_id, $t_full_id);
            }
            echo '>' . str_repeat('&#160;', count($p_parents)) . str_repeat('&#187;', count($p_parents)) . ' ' . string_attribute(project_get_field($t_id, 'name')) . '</option>' . "\n";
            print_subproject_option_list($t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents);
        }
    }
}
Пример #2
0
function print_extended_project_browser_subproject_javascript($p_trace)
{
    $t_trace_projects = explode(';', $p_trace);
    $t_top_id = $t_trace_projects[0];
    $t_level = count($t_trace_projects);
    $t_parent_id = $t_trace_projects[$t_level - 1];
    $t_project_ids = current_user_get_accessible_subprojects($t_parent_id);
    $t_project_count = count($t_project_ids);
    for ($i = 0; $i < $t_project_count; $i++) {
        $t_id = $t_project_ids[$i];
        $t_name = addslashes(str_repeat('&#160;', $t_level) . str_repeat('&raquo;', $t_level) . ' ' . project_get_field($t_id, 'name'));
        echo 'subprojects[\'' . $t_top_id . '\'][\'' . $p_trace . ';' . $t_id . '\'] = \'' . $t_name . '\';' . "\n";
        print_extended_project_browser_subproject_javascript($p_trace . ';' . $t_id);
    }
}
Пример #3
0
 */
require_once 'core.php';
require_api('authentication_api.php');
require_api('constant_inc.php');
require_api('current_user_api.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('string_api.php');
auth_ensure_user_authenticated();
$f_ref = string_sanitize_url(gpc_get_string('ref', ''));
if (count(current_user_get_accessible_projects()) == 1) {
    $t_project_ids = current_user_get_accessible_projects();
    $t_project_id = (int) $t_project_ids[0];
    if (count(current_user_get_accessible_subprojects($t_project_id)) == 0) {
        $t_ref_urlencoded = string_url($f_ref);
        print_header_redirect("set_project.php?project_id={$t_project_id}&ref={$t_ref_urlencoded}", true);
        /* print_header_redirect terminates script execution */
    }
}
html_page_top(lang_get('select_project_button'));
?>

<!-- Project Select Form BEGIN -->
<div id="select-project-div" class="form-container">
	<form id="select-project-form" method="post" action="set_project.php">
		<?php 
# CSRF protection not required here - form does not result in modifications
?>
		<fieldset>
Пример #4
0
}
?>
	</td>
</tr>

<!-- Subprojects -->
<form name="update_children_form" action="manage_proj_update_children.php" method="post">
<?php 
echo form_security_field('manage_proj_update_children');
?>
<input type="hidden" name="project_id" value="<?php 
echo $f_project_id;
?>
" />
<?php 
$t_subproject_ids = current_user_get_accessible_subprojects($f_project_id, true);
if (array() != $t_subproject_ids) {
    ?>
<tr class="row-category">
	<td width="20%">
		<?php 
    echo lang_get('name');
    ?>
	</td>
	<td width="10%">
		<?php 
    echo lang_get('status');
    ?>
	</td>
	<td width="10%">
		<?php 
Пример #5
0
/**
 * Display html form to edit account preferences
 *
 * @param integer $p_user_id            A valid user identifier.
 * @param boolean $p_error_if_protected Whether to error if the account is protected.
 * @param boolean $p_accounts_menu      Display account preferences menu.
 * @param string  $p_redirect_url       Redirect URI.
 * @return void
 */
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $t_redirect_url = $p_redirect_url;
    if (is_blank($t_redirect_url)) {
        $t_redirect_url = 'account_prefs_page.php';
    }
    # protected account check
    if (user_is_protected($p_user_id)) {
        if ($p_error_if_protected) {
            trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
        } else {
            return;
        }
    }
    $t_pref = user_pref_get($p_user_id);
    # Account Preferences Form BEGIN
    ?>

<div id="account-prefs-update-div" class="form-container">
	<form id="account-prefs-update-form" method="post" action="account_prefs_update.php">
		<fieldset>
			<legend><span><?php 
    echo lang_get('default_account_preferences_title');
    ?>
</span></legend>
			<?php 
    echo form_security_field('account_prefs_update');
    ?>
			<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
			<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
		<?php 
    if ($p_accounts_menu) {
        print_account_menu('account_prefs_page.php');
    }
    ?>
			<div class="field-container">
				<label for="default-project-id"><span><?php 
    echo lang_get('default_project');
    ?>
</span></label>
				<span class="select">
					<select id="default-project-id" name="default_project">
<?php 
    # Count number of available projects
    $t_projects = current_user_get_accessible_projects();
    $t_num_proj = count($t_projects);
    if ($t_num_proj == 1) {
        $t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
    }
    # Don't display "All projects" in selection list if there is only 1
    print_project_option_list((int) $t_pref->default_project, $t_num_proj != 1);
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="refresh-delay"><span><?php 
    echo lang_get('refresh_delay');
    ?>
</span></label>
				<span class="input"><input id="refresh-delay" type="text" name="refresh_delay" size="4" maxlength="4" value="<?php 
    echo $t_pref->refresh_delay;
    ?>
" /> <?php 
    echo lang_get('minutes');
    ?>
</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="redirect-delay"><span><?php 
    echo lang_get('redirect_delay');
    ?>
</span></label>
				<span class="input"><input id="redirect-delay" type="text" name="redirect_delay" size="4" maxlength="3" value="<?php 
    echo $t_pref->redirect_delay;
    ?>
" /> <?php 
    echo lang_get('seconds');
    ?>
</span>
				<span class="label-style"></span>
			</div>
			<fieldset class="field-container">
				<legend><span><?php 
    echo lang_get('bugnote_order');
    ?>
</span></legend>
				<span class="radio"><input id="bugnote-order-desc" type="radio" name="bugnote_order" value="DESC" <?php 
    check_checked($t_pref->bugnote_order, 'DESC');
    ?>
 /></span>
				<label for="bugnote-order-desc"><span><?php 
    echo lang_get('bugnote_order_desc');
    ?>
</span></label>
				<span class="radio"><input id="bugnote-order-asc" type="radio" name="bugnote_order" value="ASC" <?php 
    check_checked($t_pref->bugnote_order, 'ASC');
    ?>
 /></span>
				<label for="bugnote-order-asc"><span><?php 
    echo lang_get('bugnote_order_asc');
    ?>
</span></label>
				<span class="label-style"></span>
			</fieldset>
			<?php 
    if (ON == config_get('enable_email_notification')) {
        ?>
			<fieldset class="field-container">
				<legend><label for="email-on-new"><?php 
        echo lang_get('email_on_new');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-new" type="checkbox" name="email_on_new" <?php 
        check_checked((int) $t_pref->email_on_new, ON);
        ?>
 /></span>
				<label for="email-on-new-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-new-min-severity" name="email_on_new_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_new_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-assigned"><?php 
        echo lang_get('email_on_assigned');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-assigned" type="checkbox" name="email_on_assigned" <?php 
        check_checked((int) $t_pref->email_on_assigned, ON);
        ?>
 /></span>
				<label for="email-on-assigned-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-assigned-min-severity" name="email_on_assigned_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_assigned_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-feedback"><?php 
        echo lang_get('email_on_feedback');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-feedback" type="checkbox" name="email_on_feedback" <?php 
        check_checked((int) $t_pref->email_on_feedback, ON);
        ?>
 /></span>
				<label for="email-on-feedback-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-feedback-min-severity" name="email_on_feedback_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_feedback_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-resolved"><?php 
        echo lang_get('email_on_resolved');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-resolved" type="checkbox" name="email_on_resolved" <?php 
        check_checked((int) $t_pref->email_on_resolved, ON);
        ?>
 /></span>
				<label for="email-on-resolved-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-resolved-min-severity" name="email_on_resolved_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_resolved_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-closed"><?php 
        echo lang_get('email_on_closed');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-closed" type="checkbox" name="email_on_closed" <?php 
        check_checked((int) $t_pref->email_on_closed, ON);
        ?>
 /></span>
				<label for="email-on-closed-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-closed-min-severity" name="email_on_closed_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_closed_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-reopened"><?php 
        echo lang_get('email_on_reopened');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-reopened" type="checkbox" name="email_on_reopened" <?php 
        check_checked((int) $t_pref->email_on_reopened, ON);
        ?>
 /></span>
				<label for="email-on-reopened-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-reopened-min-severity" name="email_on_reopened_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_reopened_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-bugnote-added"><?php 
        echo lang_get('email_on_bugnote_added');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-bugnote-added" type="checkbox" name="email_on_bugnote" <?php 
        check_checked((int) $t_pref->email_on_bugnote, ON);
        ?>
 /></span>
				<label for="email-on-bugnote-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-bugnote-min-severity" name="email_on_bugnote_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_bugnote_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-status"><?php 
        echo lang_get('email_on_status_change');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-status" type="checkbox" name="email_on_status" <?php 
        check_checked((int) $t_pref->email_on_status, ON);
        ?>
 /></span>
				<label for="email-on-status-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-status-min-severity" name="email_on_status_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_status_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-priority-change"><?php 
        echo lang_get('email_on_priority_change');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-priority-change" type="checkbox" name="email_on_priority" <?php 
        check_checked((int) $t_pref->email_on_priority, ON);
        ?>
 /></span>
				<label for="email-on-priority-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-priority-min-severity" name="email_on_priority_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_priority_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<div class="field-container">
				<label for="email-bugnote-limit"><span><?php 
        echo lang_get('email_bugnote_limit');
        ?>
</span></label>
				<span class="input"><input id="email-bugnote-limit" type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" /></span>
				<span class="label-style"></span>
			</div>
<?php 
    } else {
        ?>
			<input type="hidden" name="email_on_new"      value="<?php 
        echo $t_pref->email_on_new;
        ?>
" />
			<input type="hidden" name="email_on_assigned" value="<?php 
        echo $t_pref->email_on_assigned;
        ?>
" />
			<input type="hidden" name="email_on_feedback" value="<?php 
        echo $t_pref->email_on_feedback;
        ?>
" />
			<input type="hidden" name="email_on_resolved" value="<?php 
        echo $t_pref->email_on_resolved;
        ?>
" />
			<input type="hidden" name="email_on_closed"   value="<?php 
        echo $t_pref->email_on_closed;
        ?>
" />
			<input type="hidden" name="email_on_reopened" value="<?php 
        echo $t_pref->email_on_reopened;
        ?>
" />
			<input type="hidden" name="email_on_bugnote"  value="<?php 
        echo $t_pref->email_on_bugnote;
        ?>
" />
			<input type="hidden" name="email_on_status"   value="<?php 
        echo $t_pref->email_on_status;
        ?>
" />
			<input type="hidden" name="email_on_priority" value="<?php 
        echo $t_pref->email_on_priority;
        ?>
" />
			<input type="hidden" name="email_on_new_min_severity"      value="<?php 
        echo $t_pref->email_on_new_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_assigned_min_severity" value="<?php 
        echo $t_pref->email_on_assigned_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_feedback_min_severity" value="<?php 
        echo $t_pref->email_on_feedback_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_resolved_min_severity" value="<?php 
        echo $t_pref->email_on_resolved_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_closed_min_severity"   value="<?php 
        echo $t_pref->email_on_closed_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_reopened_min_severity" value="<?php 
        echo $t_pref->email_on_reopened_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_bugnote_min_severity"  value="<?php 
        echo $t_pref->email_on_bugnote_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_status_min_severity"   value="<?php 
        echo $t_pref->email_on_status_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_priority_min_severity" value="<?php 
        echo $t_pref->email_on_priority_min_severity;
        ?>
" />
			<input type="hidden" name="email_bugnote_limit" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
<?php 
    }
    ?>
			<div class="field-container">
				<label for="timezone"><span><?php 
    echo lang_get('timezone');
    ?>
</span></label>
				<span class="select">
					<select id="timezone" name="timezone">
						<?php 
    print_timezone_option_list($t_pref->timezone ? $t_pref->timezone : config_get_global('default_timezone'));
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="language"><span><?php 
    echo lang_get('language');
    ?>
</span></label>
				<span class="select">
					<select id="language" name="language">
						<?php 
    print_language_option_list($t_pref->language);
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>

			<?php 
    event_signal('EVENT_ACCOUNT_PREF_UPDATE_FORM', array($p_user_id));
    ?>
			<span class="submit-button"><input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" /></span>
		</fieldset>
	</form>
</div>

<div id="account-prefs-reset-div" class="form-container">
	<form id="account-prefs-reset-form" method="post" action="account_prefs_reset.php">
		<fieldset>
			<?php 
    echo form_security_field('account_prefs_reset');
    ?>
			<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
			<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
			<span class="submit-button"><input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" /></span>
		</fieldset>
	</form>
</div>

<?php 
}
Пример #6
0
/**
 * print bug counts by project
 * @todo check p_cache - static?
 *
 * @param array   $p_projects Array of project id's.
 * @param integer $p_level    Indicates the depth of the project within the sub-project hierarchy.
 * @param array   $p_cache    Summary cache.
 * @return void
 */
function summary_print_by_project(array $p_projects = array(), $p_level = 0, array $p_cache = null)
{
    $t_project_id = helper_get_current_project();
    if (empty($p_projects)) {
        if (ALL_PROJECTS == $t_project_id) {
            $p_projects = current_user_get_accessible_projects();
        } else {
            $p_projects = array($t_project_id);
        }
    }
    # Retrieve statistics one time to improve performance.
    if (null === $p_cache) {
        $t_query = 'SELECT project_id, status, COUNT( status ) AS bugcount
					FROM {bug}
					GROUP BY project_id, status';
        $t_result = db_query($t_query);
        $p_cache = array();
        $t_resolved_val = config_get('bug_resolved_status_threshold');
        $t_closed_val = config_get('bug_closed_status_threshold');
        while ($t_row = db_fetch_array($t_result)) {
            $t_project_id = $t_row['project_id'];
            $t_status = $t_row['status'];
            $t_bugcount = $t_row['bugcount'];
            if ($t_closed_val <= $t_status) {
                if (isset($p_cache[$t_project_id]['closed'])) {
                    $p_cache[$t_project_id]['closed'] += $t_bugcount;
                } else {
                    $p_cache[$t_project_id]['closed'] = $t_bugcount;
                }
            } else {
                if ($t_resolved_val <= $t_status) {
                    if (isset($p_cache[$t_project_id]['resolved'])) {
                        $p_cache[$t_project_id]['resolved'] += $t_bugcount;
                    } else {
                        $p_cache[$t_project_id]['resolved'] = $t_bugcount;
                    }
                } else {
                    if (isset($p_cache[$t_project_id]['open'])) {
                        $p_cache[$t_project_id]['open'] += $t_bugcount;
                    } else {
                        $p_cache[$t_project_id]['open'] = $t_bugcount;
                    }
                }
            }
        }
    }
    foreach ($p_projects as $t_project) {
        $t_name = str_repeat('&raquo; ', $p_level) . project_get_name($t_project);
        $t_pdata = isset($p_cache[$t_project]) ? $p_cache[$t_project] : array('open' => 0, 'resolved' => 0, 'closed' => 0);
        $t_bugs_open = isset($t_pdata['open']) ? $t_pdata['open'] : 0;
        $t_bugs_resolved = isset($t_pdata['resolved']) ? $t_pdata['resolved'] : 0;
        $t_bugs_closed = isset($t_pdata['closed']) ? $t_pdata['closed'] : 0;
        $t_bugs_total = $t_bugs_open + $t_bugs_resolved + $t_bugs_closed;
        summary_helper_print_row(string_display_line($t_name), $t_bugs_open, $t_bugs_resolved, $t_bugs_closed, $t_bugs_total);
        if (count(project_hierarchy_get_subprojects($t_project)) > 0) {
            $t_subprojects = current_user_get_accessible_subprojects($t_project);
            if (count($t_subprojects) > 0) {
                summary_print_by_project($t_subprojects, $p_level + 1, $p_cache);
            }
        }
    }
}
Пример #7
0
function print_subproject_menu_bar($p_project_id, $p_parents = '')
{
    $t_subprojects = current_user_get_accessible_subprojects($p_project_id);
    $t_char = ':';
    foreach ($t_subprojects as $t_subproject) {
        print "{$t_char} <a href=\"set_project.php?project_id={$p_parents}{$t_subproject}\">" . string_display(project_get_field($t_subproject, 'name')) . '</a>';
        print_subproject_menu_bar($t_subproject, $p_parents . $t_subproject . ';');
        $t_char = ',';
    }
}
Пример #8
0
/**
 * Print the menu bar with a list of projects to which the user has access
 * @return null
 */
function print_subproject_menu_bar($p_project_id, $p_parents = '')
{
    $t_subprojects = current_user_get_accessible_subprojects($p_project_id);
    $t_char = ':';
    foreach ($t_subprojects as $t_subproject) {
        echo $t_char . ' <a href="' . helper_mantis_url('set_project.php?project_id=' . $p_parents . $t_subproject) . '">' . string_html_specialchars(project_get_field($t_subproject, 'name')) . '</a>';
        print_subproject_menu_bar($t_subproject, $p_parents . $t_subproject . ';');
        $t_char = ',';
    }
}
Пример #9
0
function summary_print_by_project($p_projects = null, $p_level = 0, $p_cache = null)
{
    $t_mantis_bug_table = config_get('mantis_bug_table');
    $t_mantis_project_table = config_get('mantis_project_table');
    $t_project_id = helper_get_current_project();
    if (null == $p_projects) {
        if (ALL_PROJECTS == $t_project_id) {
            $p_projects = current_user_get_accessible_projects();
        } else {
            $p_projects = array($t_project_id);
        }
    }
    # Retrieve statistics one time to improve performance.
    if (null === $p_cache) {
        $query = "SELECT project_id, status, COUNT( status ) AS count\n\t\t\t\t\tFROM {$t_mantis_bug_table}\n\t\t\t\t\tGROUP BY project_id, status";
        $result = db_query($query);
        $p_cache = array();
        $t_resolved_val = RESOLVED;
        $t_closed_val = CLOSED;
        while ($row = db_fetch_array($result)) {
            extract($row, EXTR_PREFIX_ALL, 'v');
            if ($t_closed_val <= $v_status) {
                if (isset($p_cache[$v_project_id]['closed'])) {
                    $p_cache[$v_project_id]['closed'] += $v_count;
                } else {
                    $p_cache[$v_project_id]['closed'] = $v_count;
                }
            } else {
                if ($t_resolved_val <= $v_status) {
                    if (isset($p_cache[$v_project_id]['resolved'])) {
                        $p_cache[$v_project_id]['resolved'] += $v_count;
                    } else {
                        $p_cache[$v_project_id]['resolved'] = $v_count;
                    }
                } else {
                    if (isset($p_cache[$v_project_id]['open'])) {
                        $p_cache[$v_project_id]['open'] += $v_count;
                    } else {
                        $p_cache[$v_project_id]['open'] = $v_count;
                    }
                }
            }
        }
    }
    foreach ($p_projects as $t_project) {
        $t_name = str_repeat("» ", $p_level) . project_get_name($t_project);
        $t_pdata = isset($p_cache[$t_project]) ? $p_cache[$t_project] : array('open' => 0, 'resolved' => 0, 'closed' => 0);
        $t_bugs_open = isset($t_pdata['open']) ? $t_pdata['open'] : 0;
        $t_bugs_resolved = isset($t_pdata['resolved']) ? $t_pdata['resolved'] : 0;
        $t_bugs_closed = isset($t_pdata['closed']) ? $t_pdata['closed'] : 0;
        $t_bugs_total = $t_bugs_open + $t_bugs_resolved + $t_bugs_closed;
        summary_helper_print_row($t_name, $t_bugs_open, $t_bugs_resolved, $t_bugs_closed, $t_bugs_total);
        $t_subprojects = current_user_get_accessible_subprojects($t_project);
        if (count($t_subprojects) > 0) {
            summary_print_by_project($t_subprojects, $p_level + 1, $p_cache);
        }
    }
}
Пример #10
0
				$t_projects = multi_sort( $t_projects, 'name', ASCENDING );
				foreach ( $t_projects as $t_project ) {
					if ( in_array( $t_project['id'], $t_all_subprojects ) ||
						in_array( $f_project_id, project_hierarchy_get_all_subprojects( $t_project['id'] ) ) ||
						!access_has_project_level( $t_manage_access, $t_project['id'] ) ) {
						continue;
					} ?>
					<option value="<?php echo $t_project['id'] ?>"><?php echo string_attribute( $t_project['name'] ) ?></option><?php
				} # End looping over projects ?>
				</select>
				<input type="submit" value="<?php echo lang_get('add_subproject'); ?>" />
			</fieldset>
		</form>
	<?php

	$t_subproject_ids = current_user_get_accessible_subprojects( $f_project_id, /* show_disabled */ true );
	if ( Array() != $t_subproject_ids ) { ?>
	<form id="manage-project-update-subprojects-form" action="manage_proj_update_children.php" method="post">
		<fieldset>
			<?php echo form_security_field( 'manage_proj_update_children' ) ?>
			<input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
			<table cellspacing="1" cellpadding="5" border="1">
				<tr class="row-category">
					<th><?php echo lang_get( 'name' ) ?></th>
					<th><?php echo lang_get( 'status' ) ?></th>
					<th><?php echo lang_get( 'enabled' ) ?></th>
					<th><?php echo lang_get( 'inherit' ) ?></th>
					<th><?php echo lang_get( 'view_status' ) ?></th>
					<th><?php echo lang_get( 'description' ) ?></th>
					<th colspan="2"><?php echo lang_get( 'actions' ) ?></th>
				</tr><?php
Пример #11
0
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $t_redirect_url = $p_redirect_url;
    if (is_blank($t_redirect_url)) {
        $t_redirect_url = 'account_prefs_page.php';
    }
    # protected account check
    if (user_is_protected($p_user_id)) {
        if ($p_error_if_protected) {
            trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
        } else {
            return;
        }
    }
    # prefix data with u_
    $t_pref = user_pref_get($p_user_id);
    # Account Preferences Form BEGIN
    ?>
<br />
<div align="center">
<form method="post" action="account_prefs_update.php">
<?php 
    echo form_security_field('account_prefs_update');
    ?>
<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<?php 
    echo lang_get('default_account_preferences_title');
    ?>
	</td>
	<td class="right">
		<?php 
    if ($p_accounts_menu) {
        print_account_menu('account_prefs_page.php');
    }
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category" width="50%">
		<?php 
    echo lang_get('default_project');
    ?>
	</td>
	<td width="50%">
		<select name="default_project">
<?php 
    # Count number of available projects
    $t_projects = current_user_get_accessible_projects();
    $t_num_proj = count($t_projects);
    if ($t_num_proj == 1) {
        $t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
    }
    # Don't display "All projects" in selection list if there is only 1
    print_project_option_list($t_pref->default_project, $t_num_proj != 1);
    ?>
		</select>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('refresh_delay');
    ?>
	</td>
	<td>
		<input type="text" name="refresh_delay" size="4" maxlength="4" value="<?php 
    echo $t_pref->refresh_delay;
    ?>
" /> <?php 
    echo lang_get('minutes');
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('redirect_delay');
    ?>
	</td>
	<td>
		<input type="text" name="redirect_delay" size="4" maxlength="3" value="<?php 
    echo $t_pref->redirect_delay;
    ?>
" /> <?php 
    echo lang_get('seconds');
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('bugnote_order');
    ?>
	</td>
	<td>
		<label><input type="radio" name="bugnote_order" value="ASC" <?php 
    check_checked($t_pref->bugnote_order, 'ASC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_asc');
    ?>
</label>
		<label><input type="radio" name="bugnote_order" value="DESC" <?php 
    check_checked($t_pref->bugnote_order, 'DESC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_desc');
    ?>
</label>
	</td>
</tr>
<?php 
    if (ON == config_get('enable_email_notification')) {
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_new');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_new" <?php 
        check_checked($t_pref->email_on_new, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_new_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_new_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_assigned');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_assigned" <?php 
        check_checked($t_pref->email_on_assigned, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_assigned_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_assigned_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_feedback');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_feedback" <?php 
        check_checked($t_pref->email_on_feedback, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_feedback_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_feedback_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_resolved');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_resolved" <?php 
        check_checked($t_pref->email_on_resolved, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_resolved_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_resolved_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_closed');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_closed" <?php 
        check_checked($t_pref->email_on_closed, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_closed_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_closed_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_reopened');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_reopened" <?php 
        check_checked($t_pref->email_on_reopened, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_reopened_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_reopened_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_bugnote_added');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_bugnote" <?php 
        check_checked($t_pref->email_on_bugnote, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_bugnote_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_bugnote_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_status_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_status" <?php 
        check_checked($t_pref->email_on_status, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_status_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_status_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_priority_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_priority" <?php 
        check_checked($t_pref->email_on_priority, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_priority_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_priority_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_bugnote_limit');
        ?>
	</td>
	<td>
		<input type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
	</td>
</tr>
<?php 
    } else {
        ?>
		<input type="hidden" name="email_on_new"      value="<?php 
        echo $t_pref->email_on_new;
        ?>
" />
		<input type="hidden" name="email_on_assigned" value="<?php 
        echo $t_pref->email_on_assigned;
        ?>
" />
		<input type="hidden" name="email_on_feedback" value="<?php 
        echo $t_pref->email_on_feedback;
        ?>
" />
		<input type="hidden" name="email_on_resolved" value="<?php 
        echo $t_pref->email_on_resolved;
        ?>
" />
		<input type="hidden" name="email_on_closed"   value="<?php 
        echo $t_pref->email_on_closed;
        ?>
" />
		<input type="hidden" name="email_on_reopened" value="<?php 
        echo $t_pref->email_on_reopened;
        ?>
" />
		<input type="hidden" name="email_on_bugnote"  value="<?php 
        echo $t_pref->email_on_bugnote;
        ?>
" />
		<input type="hidden" name="email_on_status"   value="<?php 
        echo $t_pref->email_on_status;
        ?>
" />
		<input type="hidden" name="email_on_priority" value="<?php 
        echo $t_pref->email_on_priority;
        ?>
" />
		<input type="hidden" name="email_on_new_min_severity"      value="<?php 
        echo $t_pref->email_on_new_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_assigned_min_severity" value="<?php 
        echo $t_pref->email_on_assigned_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_feedback_min_severity" value="<?php 
        echo $t_pref->email_on_feedback_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_resolved_min_severity" value="<?php 
        echo $t_pref->email_on_resolved_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_closed_min_severity"   value="<?php 
        echo $t_pref->email_on_closed_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_reopened_min_severity" value="<?php 
        echo $t_pref->email_on_reopened_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_bugnote_min_severity"  value="<?php 
        echo $t_pref->email_on_bugnote_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_status_min_severity"   value="<?php 
        echo $t_pref->email_on_status_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_priority_min_severity" value="<?php 
        echo $t_pref->email_on_priority_min_severity;
        ?>
" />
		<input type="hidden" name="email_bugnote_limit" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
<?php 
    }
    ?>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('timezone');
    ?>
	</td>
	<td>
		<select name="timezone">
			<?php 
    print_timezone_option_list($t_pref->timezone ? $t_pref->timezone : config_get_global('default_timezone'));
    ?>
		</select>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('language');
    ?>
	</td>
	<td>
		<select name="language">
			<?php 
    print_language_option_list($t_pref->language);
    ?>
		</select>
	</td>
</tr>
<?php 
    event_signal('EVENT_ACCOUNT_PREF_UPDATE_FORM', array($p_user_id));
    ?>
<tr>
	<td colspan="2" class="center">
		<input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" />
	</td>
</tr>
</table>
</form>
</div>

<br />

<div class="border center">
	<form method="post" action="account_prefs_reset.php">
	<?php 
    echo form_security_field('account_prefs_reset');
    ?>
	<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
	<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
	<input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" />
	</form>
</div>

<?php 
}
Пример #12
0
function print_subproject_option_list($p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_parents = array())
{
    array_push($p_parents, $p_parent_id);
    $t_project_ids = current_user_get_accessible_subprojects($p_parent_id);
    $t_project_count = count($t_project_ids);
    for ($i = 0; $i < $t_project_count; $i++) {
        $t_full_id = $t_id = $t_project_ids[$i];
        if ($t_id != $p_filter_project_id) {
            print "<option value=\"";
            if ($p_trace) {
                $t_full_id = join($p_parents, ";") . ';' . $t_id;
            }
            print "{$t_full_id}\"";
            check_selected($p_project_id, $t_full_id);
            print '>' . str_repeat("&raquo; ", count($p_parents)) . string_display(project_get_field($t_id, 'name')) . '</option>' . "\n";
            print_subproject_option_list($t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents);
        }
    }
}