View Issue Details

IDProjectCategoryView StatusLast Update
0027258mantisbtcode cleanuppublic2021-03-18 03:46
Reporterdregad Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
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

related to 0027958 closeddregad Inconsistent form input labels' font size when HTML label element is used 
related to 0028084 closeddregad Labels for email notifications in User Prefs page appear in bold 
child of 0027256 closeddregad Refactor Profiles management pages to display a list of records 

Activities

Related Changesets

MantisBT: master e9a0ca0c

2020-09-01 09:09

dregad


Details Diff
Coding guidelines

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

MantisBT: master 93c4eac4

2020-09-01 10:00

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-01 23:02

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, 0028084
mod - account_prof_menu_page.php Diff File
mod - css/ace-mantis.css Diff File

MantisBT: master a39ee9a9

2020-09-04 08:14

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 08: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 08:17

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 08:22

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 08:24

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 08:32

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 08:39

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 08:45

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 08:47

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 09:02

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 09:09

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 09:49

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 09:50

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 06:27

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 06:39

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 06:41

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 06:44

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 06:45

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 06:50

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