View Issue Details

IDProjectCategoryView StatusLast Update
0027258mantisbtcode cleanuppublic2020-09-18 19:28
Reporterdregad Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityN/A
Status resolvedResolutionfixed 
Target Version2.25.0Fixed in Version2.25.0 
Summary0027258: Code cleanup around User/Global Profiles
Description

As part of refactoring of Profiles management pages (0027256), taking the opportunity to cleanup the code, language strings and related API.

In no particular order

  • Indentation
  • HTML warnings and improvements (HTML5, WCAG)
  • PHPDoc blocks
  • Removed unused language strings
  • Optimization
  • Remove usless code
  • Use DbQuery instead of legacy DB API calls
TagsNo tags attached.

Relationships

child of 0027256 resolveddregad Refactor Profiles management pages to display a list of records 

Activities

Related Changesets

MantisBT: master e9a0ca0c

2020-09-01 13:09:05

dregad

Details Diff
Coding guidelines

Fixes 0027258
Affected Issues
0027258
mod - account_prof_menu_page.php Diff File

MantisBT: master 93c4eac4

2020-09-01 14:00:42

dregad

Details Diff
Fix HTML indentation and warnings

Fixes 0027258
Affected Issues
0027258
mod - account_prof_menu_page.php Diff File

MantisBT: master d27ea37d

2020-09-02 03:02:51

dregad

Details Diff
Add <label> to form inputs

To comply with WCAG standard, inputs should be associated with a label.

This requires a CSS tweak CSS to ensure consistent display of labels in
bold font.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_menu_page.php Diff File
mod - css/ace-mantis.css Diff File

MantisBT: master a39ee9a9

2020-09-04 12:14:32

dregad

Details Diff
Fix undefined variable inspection warning

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master 39142cdf

2020-09-04 12:16:16

dregad

Details Diff
Avoid calling profile_is_global() twice

Profile API has no cache, so this causes unnecessary execution of
another DB query.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master 4c8c3f80

2020-09-04 12:17:23

dregad

Details Diff
Add space between * and label for required fields

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master 3f660aa6

2020-09-04 12:22:42

dregad

Details Diff
Only highlight sidebar manage menu when needed

We are only in the context of Manage menu when editing Global Profiles.
When working with a User Profile, the sidebar should not show the
Manage Overview Page as active.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File
mod - account_prof_menu_page.php Diff File

MantisBT: master 047057de

2020-09-04 12:24:32

dregad

Details Diff
Remove case statement for unused 'edit' action

Profile edit is always managed in account_prof_edit_page.php, so the
redirection account_prof_update.php's switch statement is never called.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_update.php Diff File

MantisBT: master 1078148d

2020-09-04 12:32:10

dregad

Details Diff
Refactor add/update/delete actions

Storing the user ID in a variable early in the case block to simplify
the code.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_update.php Diff File

MantisBT: master fc5ad9a1

2020-09-04 12:39:57

dregad

Details Diff
profile_get_row_direct() now throws exception

If the given Profile does not exist, throw an exception to trigger an
error, instead of silently returning false.

Adapt MC API to catch the exception instead of the return value.

Fixes 0027258
Affected Issues
0027258
mod - api/soap/mc_api.php Diff File
mod - core/profile_api.php Diff File

MantisBT: master 2fc662ff

2020-09-04 12:45:07

dregad

Details Diff
profile_is_global() now calls profile_get_row_direct()

This allows triggering an error when checking on an invalid Profile ID
instead of returning false (which could be interpreted as if it were a
valid User profile)

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File
mod - core/profile_api.php Diff File

MantisBT: master ef8640c8

2020-09-04 12:47:11

dregad

Details Diff
New profile_get_name() function

Returns the "profile name" i.e. concatenation of Platform, OS and Build.

Fixes 0027258
Affected Issues
0027258
mod - core/filter_form_api.php Diff File
mod - core/profile_api.php Diff File

MantisBT: master acbabd18

2020-09-04 13:02:49

dregad

Details Diff
Fix HTML indentation and warnings

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master d98fe425

2020-09-04 13:09:30

dregad

Details Diff
Add <label> to form inputs

To comply with WCAG standard, inputs should be associated with a label.

This requires a CSS tweak CSS to ensure consistent display of labels in
bold font.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master 6677d03e

2020-09-04 13:49:26

dregad

Details Diff
Remove unnecessary check on form parameter

The calling form no longer relies on a select, so checking that the
profile_id parameter is 0 does not make sense anymore.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_update.php Diff File

MantisBT: master 7bf00a0c

2020-09-04 13:50:11

dregad

Details Diff
Remove and consolidate language strings

- Deleted unused Profile-related strings
- Regrouped duplicated strings, e.g. edit_profile_title -> edit_profile,
add_profile_title and add_profile_button -> add_profile
- Renamed additional_description -> profile_description
- Moved generic strings out of the "User/Global Profiles" block

Fixes 0011463, 0027258
Affected Issues
0011463, 0027258
mod - account_prof_edit_page.php Diff File
mod - account_prof_menu_page.php Diff File
mod - lang/strings_english.txt Diff File
mod - lost_pwd_page.php Diff File
mod - news_menu_page.php Diff File
mod - print_all_bug_page_word.php Diff File

MantisBT: master 9d59178f

2020-09-06 10:27:25

dregad

Details Diff
Profile API: use DbQuery

Replace legacy db_query() calls.

Fixes 0027258
Affected Issues
0027258
mod - core/profile_api.php Diff File

MantisBT: master 73caf1bf

2020-09-06 10:39:19

dregad

Details Diff
Fix PHPDoc and static analysis warnings

Fixes 0027258
Affected Issues
0027258
mod - core/profile_api.php Diff File

MantisBT: master 59d78ad4

2020-09-06 10:41:17

dregad

Details Diff
Remove last remaining call to profile_get_row()

Replacing it with profile_get_row_direct().

Since profiles identified with a globally unique ID, it does not make
sense for the API to require a user ID to retrieve a profile, as it
needlessly complexifies the caller's code.

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File

MantisBT: master e4a9f3eb

2020-09-06 10:44:13

dregad

Details Diff
Removed unused API function profile_get_row()

Fixes 0027258
Affected Issues
0027258
mod - core/profile_api.php Diff File

MantisBT: master 0baeffcf

2020-09-06 10:45:46

dregad

Details Diff
Rename profile_get_row_direct() to profile_get_row()

Fixes 0027258
Affected Issues
0027258
mod - account_prof_edit_page.php Diff File
mod - api/soap/mc_api.php Diff File
mod - core/profile_api.php Diff File
mod - print_all_bug_page_word.php Diff File

MantisBT: master 79b70c9b

2020-09-06 10:50:51

dregad

Details Diff
New internal function to avoid code duplication

Added profile_validate_before_update() as the same code snippet was
used in profile_create() and profile_update().

Fixes 0027258
Affected Issues
0027258
mod - core/profile_api.php Diff File

Issue History

Date Modified Username Field Change
2020-09-06 11:44 dregad New Issue
2020-09-06 11:44 dregad Status new => assigned
2020-09-06 11:44 dregad Assigned To => dregad
2020-09-06 11:44 dregad Relationship added related to 0027256
2020-09-06 11:44 dregad Relationship replaced child of 0027256
2020-09-06 11:55 dregad Description Updated View Revisions
2020-09-06 12:12 dregad Note Added: 0064380
2020-09-18 19:28 dregad Changeset attached => MantisBT master e9a0ca0c
2020-09-18 19:28 dregad Changeset attached => MantisBT master 93c4eac4
2020-09-18 19:28 dregad Changeset attached => MantisBT master d27ea37d
2020-09-18 19:28 dregad Changeset attached => MantisBT master a39ee9a9
2020-09-18 19:28 dregad Changeset attached => MantisBT master 39142cdf
2020-09-18 19:28 dregad Changeset attached => MantisBT master 4c8c3f80
2020-09-18 19:28 dregad Changeset attached => MantisBT master 3f660aa6
2020-09-18 19:28 dregad Changeset attached => MantisBT master 047057de
2020-09-18 19:28 dregad Changeset attached => MantisBT master 1078148d
2020-09-18 19:28 dregad Changeset attached => MantisBT master fc5ad9a1
2020-09-18 19:28 dregad Changeset attached => MantisBT master 2fc662ff
2020-09-18 19:28 dregad Changeset attached => MantisBT master ef8640c8
2020-09-18 19:28 dregad Changeset attached => MantisBT master acbabd18
2020-09-18 19:28 dregad Changeset attached => MantisBT master d98fe425
2020-09-18 19:28 dregad Changeset attached => MantisBT master 6677d03e
2020-09-18 19:28 dregad Changeset attached => MantisBT master 7bf00a0c
2020-09-18 19:28 dregad Changeset attached => MantisBT master 9d59178f
2020-09-18 19:28 dregad Changeset attached => MantisBT master 73caf1bf
2020-09-18 19:28 dregad Changeset attached => MantisBT master 59d78ad4
2020-09-18 19:28 dregad Changeset attached => MantisBT master e4a9f3eb
2020-09-18 19:28 dregad Changeset attached => MantisBT master 0baeffcf
2020-09-18 19:28 dregad Changeset attached => MantisBT master 79b70c9b
2020-09-18 19:28 dregad Status assigned => resolved
2020-09-18 19:28 dregad Resolution open => fixed
2020-09-18 19:28 dregad Fixed in Version => 2.25.0