Navigation Menu

Skip to content

Commit

Permalink
Fix html validation and css for manage project pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryn Warriner committed Feb 9, 2011
1 parent da7be28 commit 413abf7
Show file tree
Hide file tree
Showing 6 changed files with 612 additions and 911 deletions.
48 changes: 3 additions & 45 deletions core/print_api.php
Expand Up @@ -897,51 +897,9 @@ function print_all_bug_action_option_list( $p_project_ids = null ) {
# if no project is specified use the current project
# also exclude any administrators
function print_project_user_list_option_list( $p_project_id = null ) {
$t_mantis_project_user_list_table = db_get_table( 'project_user_list' );
$t_mantis_user_table = db_get_table( 'user' );

if( null === $p_project_id ) {
$p_project_id = helper_get_current_project();
}
$c_project_id = (int) $p_project_id;

$t_adm = config_get_global( 'admin_site_threshold' );
$query = "SELECT DISTINCT u.id, u.username, u.realname
FROM $t_mantis_user_table u
LEFT JOIN $t_mantis_project_user_list_table p
ON p.user_id=u.id AND p.project_id=" . db_param() . "
WHERE u.access_level<" . db_param() . " AND
u.enabled = " . db_param() . " AND
p.user_id IS NULL
ORDER BY u.realname, u.username";
$result = db_query_bound( $query, Array( $c_project_id, $t_adm, true ) );
$t_display = array();
$t_sort = array();
$t_users = array();
$t_show_realname = ( ON == config_get( 'show_realname' ) );
$t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) );
$category_count = db_num_rows( $result );
for( $i = 0;$i < $category_count;$i++ ) {
$row = db_fetch_array( $result );
$t_users[] = $row['id'];
$t_user_name = string_attribute( $row['username'] );
$t_sort_name = $t_user_name;
if(( isset( $row['realname'] ) ) && ( $row['realname'] <> '' ) && $t_show_realname ) {
$t_user_name = string_attribute( $row['realname'] );
if( $t_sort_by_last_name ) {
$t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 );
$t_sort_name = ( isset( $t_sort_name_bits[1] ) ? $t_sort_name_bits[1] . ', ' : '' ) . $t_sort_name_bits[0];
} else {
$t_sort_name = utf8_strtolower( $t_user_name );
}
}
$t_display[] = $t_user_name;
$t_sort[] = $t_sort_name;
}
array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display );
$t_count = count( $t_sort );
for( $i = 0;$i < $t_count; $i++ ) {
echo '<option value="' . $t_users[$i] . '">' . $t_display[$i] . '</option>';
$t_users = user_get_unassigned_by_project_id( $p_project_id );
foreach( $t_users AS $t_id=>$t_name ) {
echo '<option value="' . $t_id . '">' . $t_name . '</option>';
}
}

Expand Down
56 changes: 56 additions & 0 deletions core/user_api.php
Expand Up @@ -1064,6 +1064,62 @@ function user_get_assigned_projects( $p_user_id ) {
return $t_projects;
}

/**
* List of users that are NOT in the specified project and that are enabled
* if no project is specified use the current project
* also exclude any administrators
* @param int $p_project_id
* @return array List of users not assigned to the specified project
*/
function user_get_unassigned_by_project_id( $p_project_id = null ) {
$t_mantis_project_user_list_table = db_get_table( 'project_user_list' );
$t_mantis_user_table = db_get_table( 'user' );

if( null === $p_project_id ) {
$p_project_id = helper_get_current_project();
}

$t_adm = config_get_global( 'admin_site_threshold' );
$t_query = "SELECT DISTINCT u.id, u.username, u.realname
FROM $t_mantis_user_table u
LEFT JOIN $t_mantis_project_user_list_table p
ON p.user_id=u.id AND p.project_id=" . db_param() . "
WHERE u.access_level<" . db_param() . " AND
u.enabled = " . db_param() . " AND
p.user_id IS NULL
ORDER BY u.realname, u.username";
$t_result = db_query_bound( $t_query, Array( $p_project_id, $t_adm, true ) );
$t_display = array();
$t_sort = array();
$t_users = array();
$t_show_realname = ( ON == config_get( 'show_realname' ) );
$t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) );
$t_user_count = db_num_rows( $t_result );
while( $t_row = db_fetch_array( $t_result ) ) {
$t_users[] = $t_row['id'];
$t_user_name = string_attribute( $t_row['username'] );
$t_sort_name = $t_user_name;
if(( isset( $t_row['realname'] ) ) && ( $t_row['realname'] <> '' ) && $t_show_realname ) {
$t_user_name = string_attribute( $t_row['realname'] );
if( $t_sort_by_last_name ) {
$t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 );
$t_sort_name = ( isset( $t_sort_name_bits[1] ) ? $t_sort_name_bits[1] . ', ' : '' ) . $t_sort_name_bits[0];
} else {
$t_sort_name = utf8_strtolower( $t_user_name );
}
}
$t_display[] = $t_user_name;
$t_sort[] = $t_sort_name;
}
array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display );
$t_count = count( $t_sort );
$t_user_list = array();
for( $i = 0;$i < $t_count; $i++ ) {
$t_user_list[$t_users[$i]] = $t_display[$i];
}
return $t_user_list;
}

# --------------------
# return the number of open assigned bugs to a user in a project
function user_get_assigned_open_bug_count( $p_user_id, $p_project_id = ALL_PROJECTS ) {
Expand Down
11 changes: 11 additions & 0 deletions css/default.css
Expand Up @@ -375,6 +375,9 @@ div#account-profile-div,
div#account-profile-update-div {
width: 65%;
}
div#project-delete-div {
text-align: center;
}
fieldset {
border: none;
margin: 0em;
Expand Down Expand Up @@ -448,6 +451,14 @@ div#account-prefs-update-div fieldset fieldset>label {
div#manage-user-actions-div {
text-align: center;
}
#manage-user-filter,
#manage-project-subproject-add-form,
#manage-project-category-copy-form,
#manage-project-version-copy-form,
#manage-project-custom-field-copy-form,
#manage-project-users-copy-form {
float: right;
}
fieldset fieldset legend label {
z-index: 9999;
}
Expand Down
165 changes: 67 additions & 98 deletions manage_proj_create_page.php
Expand Up @@ -59,112 +59,81 @@
$f_parent_id = gpc_get( 'parent_id', null );
?>

<br />
<div>
<form method="post" action="manage_proj_create.php">
<?php
echo form_security_field( 'manage_proj_create' );
if ( null !== $f_parent_id ) {
$f_parent_id = (int) $f_parent_id;
?>
<input type="hidden" name="parent_id" value="<?php echo $f_parent_id ?>">
<?php } ?>
<table class="width75" cellspacing="1">
<tr>
<td class="form-title" colspan="2">
<?php
<div id="manage-project-create-div" class="form-container">
<form method="post" id="manage-project-create-form" action="manage_proj_create.php">
<fieldset class="has-required"><?php
echo form_security_field( 'manage_proj_create' );
if ( null !== $f_parent_id ) {
$f_parent_id = (int) $f_parent_id; ?>
<input type="hidden" name="parent_id" value="<?php echo $f_parent_id ?>" /><?php
} ?>
<legend><span><?php
if ( null !== $f_parent_id ) {
echo lang_get( 'add_subproject_title' );
} else {
echo lang_get( 'add_project_title' );
} ?></span></legend>

<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-name" class="required"><span><?php echo lang_get( 'project_name' )?></span></label>
<span class="input"><input type="text" id="project-name" name="name" size="64" maxlength="128" /></span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-status"><span><?php echo lang_get( 'status' ) ?></span></label>
<span class="select">
<select id="project-status" name="status">
<?php print_enum_string_option_list( 'project_status' ) ?>
</select>
</span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-view-state"><span><?php echo lang_get( 'view_status' ) ?></span></label>
<span class="select">
<select id="project-view-state" name="view_state">
<?php print_enum_string_option_list( 'view_state' ) ?>
</select>
</span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-inherit-global"><span><?php echo lang_get( 'inherit_global' ) ?></span></label>
<span class="checkbox"><input type="checkbox" id="project-inherit-global" name="inherit_global" checked="checked" /></span>
<span class="label-style"></span>
</div>
<?php if ( !is_null( $f_parent_id ) ) { ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-inherit-parent"><span><?php echo lang_get( 'inherit_parent' ) ?></span></label>
<span class="checkbox"><input type="checkbox" id="project-inherit-parent" name="inherit_parent" checked="checked" /></span>
<span class="label-style"></span>
</div><?php
}
?>
</td>
</tr>
<tr class="row-1">
<th class="category" width="25%">
<span class="required">*</span><?php echo lang_get( 'project_name' )?>
</th>
<td width="75%">
<input type="text" name="name" size="64" maxlength="128" />
</td>
</tr>
<tr class="row-2">
<th class="category">
<?php echo lang_get( 'status' ) ?>
</th>
<td>
<select name="status">
<?php print_enum_string_option_list( 'project_status' ) ?>
</select>
</td>
</tr>
<tr class="row-1">
<th class="category">
<?php echo lang_get( 'view_status' ) ?>
</th>
<td>
<select name="view_state">
<?php print_enum_string_option_list( 'view_state' ) ?>
</select>
</td>
</tr>
<tr class="row-2">
<th class="category">
<?php echo lang_get( 'inherit_global' ) ?>
</th>
<td>
<input type="checkbox" name="inherit_global" checked="checked" />
</td>
</tr>
<?php if ( !is_null( $f_parent_id ) ) { ?>
<tr class="row-1">
<th class="category">
<?php echo lang_get( 'inherit_parent' ) ?>
</th>
<td>
<input type="checkbox" name="inherit_parent" checked="checked" />
</td>
</tr>
<?php
}

if ( config_get( 'allow_file_upload' ) ) {
$t_default_upload_path = '';
# Don't reveal the absolute path to non-administrators for security reasons
if ( current_user_is_administrator() ) {
$t_default_upload_path = config_get( 'absolute_path_default_upload_folder' );
}
?>
<tr class="row-2">
<th class="category">
<?php echo lang_get( 'upload_file_path' ) ?>
</th>
<td>
<input type="text" name="file_path" size="70" maxlength="250" value="<?php echo $t_default_upload_path ?>" />
</td>
</tr>
<?php
}
?>
<tr class="row-1">
<th class="category">
<?php echo lang_get( 'description' ) ?>
</th>
<td>
<textarea name="description" cols="60" rows="5"></textarea>
</td>
</tr>
if ( config_get( 'allow_file_upload' ) ) {
$t_default_upload_path = '';
# Don't reveal the absolute path to non-administrators for security reasons
if ( current_user_is_administrator() ) {
$t_default_upload_path = config_get( 'absolute_path_default_upload_folder' );
}
?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label>
<span class="input"><input type="text" id="project-file-path" name="file_path" size="70" maxlength="250" value="<?php echo $t_default_upload_path ?>" /></span>
<span class="label-style"></span>
</div><?php
} ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-description"><span><?php echo lang_get( 'description' ) ?></span></label>
<span class="textarea"><textarea id="project-description" name="description" cols="60" rows="5"></textarea></span>
<span class="label-style"></span>
</div>

<?php event_signal( 'EVENT_MANAGE_PROJECT_CREATE_FORM' ) ?>
<?php event_signal( 'EVENT_MANAGE_PROJECT_CREATE_FORM' ) ?>

<tr>
<td class="center" colspan="2">
<input type="submit" class="button" value="<?php echo lang_get( 'add_project_button' ) ?>" />
</td>
</tr>
</table>
</form>
<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'add_project_button' ) ?>" /></span>
</fieldset>
</form>
</div>

<?php
Expand Down

0 comments on commit 413abf7

Please sign in to comment.