From 47f3c2364ceb89f97079ed2efbc89f91b5ee0112 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 31 Aug 2017 02:59:10 -0500 Subject: [PATCH] Cleanup: restructure user dashboard, login, and logout links to be more consistent with the 'user_*' naming Having all the dashboards called just 'dashboard' is convenient in the general sense, but is more inconsistent when I have a notable amount of 'user_*' names. Be consistent with the 'user_*' names and have the login, logout, and (user) dashboard files renamed to user_login, user_logout, and user_dashboard. The other users of 'dashboard' will be updated as needed and as I get to them. --- common/standard/classes/standard_paths.php | 30 +++++++++++----------- common/standard/menus/menu_utility.php | 6 ++--- .../u/ja/{dashboard.php => user_dashboard.php} | 0 .../paths/u/ja/{login.php => user_login.php} | 0 .../paths/u/ja/{logout.php => user_logout.php} | 0 .../paths/u/{dashboard.php => user_dashboard.php} | 5 ++++ .../standard/paths/u/{login.php => user_login.php} | 6 ++--- .../paths/u/{logout.php => user_logout.php} | 0 8 files changed, 26 insertions(+), 21 deletions(-) rename common/standard/paths/u/ja/{dashboard.php => user_dashboard.php} (100%) rename common/standard/paths/u/ja/{login.php => user_login.php} (100%) rename common/standard/paths/u/ja/{logout.php => user_logout.php} (100%) rename common/standard/paths/u/{dashboard.php => user_dashboard.php} (98%) rename common/standard/paths/u/{login.php => user_login.php} (99%) rename common/standard/paths/u/{logout.php => user_logout.php} (100%) diff --git a/common/standard/classes/standard_paths.php b/common/standard/classes/standard_paths.php index 1c489af..eed5aca 100644 --- a/common/standard/classes/standard_paths.php +++ b/common/standard/classes/standard_paths.php @@ -14,15 +14,15 @@ require_once('common/standard/classes/standard_path.php'); */ class c_standard_paths extends c_base_return { const URI_HOME = ''; - const URI_LOGIN = 'u/login'; - const URI_LOGOUT = 'u/logout'; - const URI_DASHBOARD_USER = 'u/dashboard'; const URI_DASHBOARD_MANAGEMENT = 'm/dashboard'; const URI_DASHBOARD_ADMINISTER = 'a/dashboard'; const URI_USER_CREATE = 'u/create'; + const URI_USER_DASHBOARD = 'u/dashboard'; const URI_USER_VIEW = 'u/view'; const URI_USER_EDIT = 'u/edit'; const URI_USER_LOCK = 'u/lock'; + const URI_USER_LOGIN = 'u/login'; + const URI_USER_LOGOUT = 'u/logout'; const URI_USER_UNLOCK = 'u/unlock'; const URI_USER_DELETE = 'u/create'; const URI_USER_CHECK = 'u/check'; @@ -36,42 +36,42 @@ class c_standard_paths extends c_base_return { protected const PATH_MANAGEMENT = 'common/standard/paths/m/'; protected const PATH_ADMINISTER = 'common/standard/paths/a/'; - protected const NAME_LOGIN = 'login'; - protected const NAME_LOGOUT = 'logout'; protected const NAME_ACCESS_DENIED = 'access_denied'; protected const NAME_NOT_FOUND = 'not_found'; protected const NAME_BAD_METHOD = 'bad_method'; protected const NAME_SERVER_ERROR = 'server_error'; protected const NAME_OPTIONS_METHOD = 'options'; - protected const NAME_DASHBOARD_USER = 'dashboard'; protected const NAME_DASHBOARD_MANAGEMENT = 'dashboard'; protected const NAME_DASHBOARD_ADMINISTER = 'dashboard'; protected const NAME_INDEX = 'index'; protected const NAME_USER_CREATE = 'user_create'; + protected const NAME_USER_DASHBOARD = 'user_dashboard'; protected const NAME_USER_VIEW = 'user_view'; protected const NAME_USER_EDIT = 'user_edit'; protected const NAME_USER_LOCK = 'user_lock'; + protected const NAME_USER_LOGIN = 'user_login'; + protected const NAME_USER_LOGOUT = 'user_logout'; protected const NAME_USER_UNLOCK = 'user_unlock'; protected const NAME_USER_DELETE = 'user_delete'; protected const NAME_USER_PRINT = 'user_print'; protected const NAME_USER_PDF = 'user_pdf'; protected const NAME_USER_PS = 'user_ps'; - protected const HANDLER_LOGIN = 'c_standard_path_user_login'; - protected const HANDLER_LOGOUT = 'c_standard_path_user_logout'; protected const HANDLER_NOT_FOUND = 'c_standard_path_not_found'; protected const HANDLER_ACCESS_DENIED = 'c_standard_path_access_denied'; protected const HANDLER_BAD_METHOD = 'c_standard_path_bad_method'; protected const HANDLER_SERVER_ERROR = 'c_standard_path_server_error'; protected const HANDLER_OPTIONS_METHOD = 'c_standard_path_options_method'; - protected const HANDLER_USER_DASHBOARD = 'c_standard_path_user_dashboard'; protected const HANDLER_MANAGEMENT_DASHBOARD = 'c_standard_path_management_dashboard'; protected const HANDLER_ADMINISTER_DASHBOARD = 'c_standard_path_administer_dashboard'; protected const HANDLER_INDEX = 'c_standard_path_index'; protected const HANDLER_USER_CREATE = 'c_standard_path_user_create'; + protected const HANDLER_USER_DASHBOARD = 'c_standard_path_user_dashboard'; protected const HANDLER_USER_VIEW = 'c_standard_path_user_view'; protected const HANDLER_USER_EDIT = 'c_standard_path_user_edit'; protected const HANDLER_USER_LOCK = 'c_standard_path_user_lock'; + protected const HANDLER_USER_LOGIN = 'c_standard_path_user_login'; + protected const HANDLER_USER_LOGOUT = 'c_standard_path_user_logout'; protected const HANDLER_USER_UNLOCK = 'c_standard_path_user_unlock'; protected const HANDLER_USER_DELETE = 'c_standard_path_user_delete'; protected const HANDLER_USER_PRINT = 'c_standard_path_user_print'; @@ -159,7 +159,7 @@ class c_standard_paths extends c_base_return { * A path object. */ public function get_handler_login() { - return $this->pr_include_path(self::PATH_USER, self::NAME_LOGIN, self::HANDLER_LOGIN); + return $this->pr_include_path(self::PATH_USER, self::NAME_USER_LOGIN, self::HANDLER_USER_LOGIN); } /** @@ -169,7 +169,7 @@ class c_standard_paths extends c_base_return { * A path object. */ public function get_handler_logout() { - return $this->pr_include_path(self::PATH_USER, self::NAME_LOGOUT, self::HANDLER_LOGOUT); + return $this->pr_include_path(self::PATH_USER, self::NAME_USER_LOGOUT, self::HANDLER_USER_LOGOUT); } /** @@ -591,8 +591,8 @@ class c_standard_paths extends c_base_return { $this->paths->add_path(self::URI_HOME, self::HANDLER_INDEX, self::PATH_INTERNAL, self::NAME_INDEX); // create login/logout paths - $this->paths->add_path(self::URI_LOGIN, self::HANDLER_LOGIN, self::PATH_USER, self::NAME_LOGIN); - $this->paths->add_path(self::URI_LOGOUT, self::HANDLER_LOGOUT, self::PATH_USER, self::NAME_LOGOUT); + $this->paths->add_path(self::URI_USER_LOGIN, self::HANDLER_USER_LOGIN, self::PATH_USER, self::NAME_USER_LOGIN); + $this->paths->add_path(self::URI_USER_LOGOUT, self::HANDLER_USER_LOGOUT, self::PATH_USER, self::NAME_USER_LOGOUT); } /** @@ -670,7 +670,7 @@ class c_standard_paths extends c_base_return { */ protected function pr_paths_create_user() { // dashboards - $this->paths->add_path(self::URI_DASHBOARD_USER, self::HANDLER_USER_DASHBOARD, self::PATH_USER, self::NAME_DASHBOARD_USER); + $this->paths->add_path(self::URI_USER_DASHBOARD, self::HANDLER_USER_DASHBOARD, self::PATH_USER, self::NAME_USER_DASHBOARD); // user paths $this->paths->add_path(self::URI_USER_CREATE, self::HANDLER_USER_CREATE, self::PATH_USER, self::NAME_USER_CREATE); @@ -745,7 +745,7 @@ class c_standard_paths extends c_base_return { unset($id_group); // PHP's instanceof does not support strings, so is_subclass_of() and is_a() must instead be used. - if (class_exists(self::HANDLER_LOGOUT) && (is_subclass_of($this->handler, self::HANDLER_LOGOUT) || is_a($this->handler, self::HANDLER_LOGOUT, TRUE))) { + if (class_exists(self::HANDLER_USER_LOGOUT) && (is_subclass_of($this->handler, self::HANDLER_USER_LOGOUT) || is_a($this->handler, self::HANDLER_USER_LOGOUT, TRUE))) { // if the user is not logged in. then provide a page not found for logout path. if (!$this->session->is_logged_in()->get_value_exact()) { $path_not_found = $this->get_handler_not_found(); diff --git a/common/standard/menus/menu_utility.php b/common/standard/menus/menu_utility.php index c8d0706..d184acc 100644 --- a/common/standard/menus/menu_utility.php +++ b/common/standard/menus/menu_utility.php @@ -41,7 +41,7 @@ class c_standard_menu_utility extends c_standard_menu { $menu = $this->pr_create_html_create_menu($settings['base_css'] . self::CLASS_NAME, $this->pr_get_text(0)); if ($session->is_logged_in() instanceof c_base_return_true) { - $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(3), $settings['base_path'] . c_standard_paths::URI_DASHBOARD_USER); + $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(3), $settings['base_path'] . c_standard_paths::URI_USER_DASHBOARD); $item->set_attribute(c_base_markup_attributes::ATTRIBUTE_CLASS, self::CLASS_DASHBOARD_USER); $menu->set_tag($item); unset($item); @@ -65,7 +65,7 @@ class c_standard_menu_utility extends c_standard_menu { $menu->set_tag($item); unset($item); - $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(7), $settings['base_path'] . c_standard_paths::URI_LOGOUT); + $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(7), $settings['base_path'] . c_standard_paths::URI_USER_LOGOUT); $item->set_attribute(c_base_markup_attributes::ATTRIBUTE_CLASS, self::CLASS_LOGOUT); $menu->set_tag($item); unset($item); @@ -76,7 +76,7 @@ class c_standard_menu_utility extends c_standard_menu { $menu->set_tag($item); unset($item); - $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(2), $settings['base_path'] . c_standard_paths::URI_LOGIN); + $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(2), $settings['base_path'] . c_standard_paths::URI_USER_LOGIN); $item->set_attribute(c_base_markup_attributes::ATTRIBUTE_CLASS, self::CLASS_LOGIN); $menu->set_tag($item); unset($item); diff --git a/common/standard/paths/u/ja/dashboard.php b/common/standard/paths/u/ja/user_dashboard.php similarity index 100% rename from common/standard/paths/u/ja/dashboard.php rename to common/standard/paths/u/ja/user_dashboard.php diff --git a/common/standard/paths/u/ja/login.php b/common/standard/paths/u/ja/user_login.php similarity index 100% rename from common/standard/paths/u/ja/login.php rename to common/standard/paths/u/ja/user_login.php diff --git a/common/standard/paths/u/ja/logout.php b/common/standard/paths/u/ja/user_logout.php similarity index 100% rename from common/standard/paths/u/ja/logout.php rename to common/standard/paths/u/ja/user_logout.php diff --git a/common/standard/paths/u/dashboard.php b/common/standard/paths/u/user_dashboard.php similarity index 98% rename from common/standard/paths/u/dashboard.php rename to common/standard/paths/u/user_dashboard.php index 193decd..5392637 100644 --- a/common/standard/paths/u/dashboard.php +++ b/common/standard/paths/u/user_dashboard.php @@ -12,6 +12,11 @@ require_once('common/standard/classes/standard_path.php'); require_once('common/theme/classes/theme_html.php'); +/** + * Provides a path handler for user dashboard. + * + * This listens on: /u/dashboard + */ class c_standard_path_user_dashboard extends c_standard_path { protected const PATH_SELF = 'u/dashboard'; diff --git a/common/standard/paths/u/login.php b/common/standard/paths/u/user_login.php similarity index 99% rename from common/standard/paths/u/login.php rename to common/standard/paths/u/user_login.php index 26b4f3a..a7f4815 100644 --- a/common/standard/paths/u/login.php +++ b/common/standard/paths/u/user_login.php @@ -77,7 +77,7 @@ class c_standard_path_user_login extends c_standard_path { $href = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_A); $href->set_text($this->pr_get_text(6)); - $href->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $settings['base_path'] . c_standard_paths::URI_LOGOUT); + $href->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $settings['base_path'] . c_standard_paths::URI_USER_LOGOUT); $block->set_tag($href); unset($href); @@ -646,7 +646,7 @@ class c_standard_path_user_login extends c_standard_path { return array( 'scheme' => NULL, 'authority' => NULL, - 'path' => $this->settings['base_path'] . c_standard_paths::URI_DASHBOARD_USER, + 'path' => $this->settings['base_path'] . c_standard_paths::URI_USER_DASHBOARD, 'query' => NULL, 'fragment' => NULL, 'url' => TRUE, @@ -945,7 +945,7 @@ class c_standard_path_user_login extends c_standard_path { protected function pr_create_html_add_header_link_canonical() { $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); - $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . c_standard_paths::URI_LOGIN); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . c_standard_paths::URI_USER_LOGIN); $this->html->set_header($tag); unset($tag); diff --git a/common/standard/paths/u/logout.php b/common/standard/paths/u/user_logout.php similarity index 100% rename from common/standard/paths/u/logout.php rename to common/standard/paths/u/user_logout.php -- 1.8.3.1