Skip to content

Commit

Permalink
Unique titles for view dashboard (joomla#147)
Browse files Browse the repository at this point in the history
* Unique titles for view dashboard

* Remove tabs

* Rename $dashboard to $extenssion. Enable sections

* Add comments. Fix positions

* Fix positions. Language Keys as in com_categories

* Redo changes in language files

* Improve Search for language keys

* Code improvement

* Use ApplicationHelper::stringURLSafe()

* oops

* Fix again

* CodeSniffer: Add blank line, remove double space

* CodeSniffer: remove double space
  • Loading branch information
chmst authored and bembelimen committed Apr 28, 2019
1 parent 5aa2d07 commit 841ef85
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
45 changes: 41 additions & 4 deletions administrator/components/com_cpanel/View/Cpanel/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Language\Text;
Expand Down Expand Up @@ -55,17 +56,53 @@ class HtmlView extends BaseHtmlView
public function display($tpl = null)
{
$app = Factory::getApplication();
$extension = ApplicationHelper::stringURLSafe($app->input->getCmd('dashboard'));

$title = Text::_('COM_CPANEL_DASHBOARD_BASE_TITLE');

$position = ApplicationHelper::stringURLSafe($extension);

// Generate a title for the view cPanel
if (!empty($extension))
{
$parts = explode('.', $extension);

$prefix = 'COM_CPANEL_DASHBOARD_';
$lang = Factory::getLanguage();

if (strpos($parts[0], 'com_') === false)
{
$prefix .= strtoupper($parts[0]);
}
else
{
$prefix = strtoupper($parts[0]) . '_DASHBOARD';

// Need to load the language file
$lang->load($parts[0], JPATH_BASE, null, false, true)
|| $lang->load($parts[0], JPATH_ADMINISTRATOR . '/components/' . $parts[0], null, false, true);
$lang->load($parts[0]);
}

$sectionkey = !empty($parts[1]) ? '_' . strtoupper($parts[1]) : '';
$key = $prefix . $sectionkey . '_TITLE';

// Search for a component title
if ($lang->hasKey($key))
{
$title = Text::_($key);
}
}

// Set toolbar items for the page
ToolbarHelper::title(Text::_('COM_CPANEL'), 'home-2 cpanel');
ToolbarHelper::title(Text::_($title, 'home-2 cpanel'));
ToolbarHelper::help('screen.cpanel');

// Display the cpanel modules
$dashboard = $app->input->getCmd('dashboard');
$this->position = $dashboard ? 'cpanel-' . $dashboard : 'cpanel';
$this->position = $position ? 'cpanel-' . $position : 'cpanel';
$this->modules = ModuleHelper::getModules($this->position);

$quickicons = $dashboard ? 'icon-' . $dashboard : 'icon';
$quickicons = $position ? 'icon-' . $position : 'icon';
$this->quickicons = ModuleHelper::getModules($quickicons);

parent::display($tpl);
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/en-GB.com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8


COM_CONTENT="Articles"
COM_CONTENT_ADD_NEW_MENU_ITEM="New Menu Item"
COM_CONTENT_ARTICLE_CONTENT="Content"
Expand Down
7 changes: 7 additions & 0 deletions administrator/language/en-GB/en-GB.com_cpanel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
COM_CPANEL="Control Panel"
COM_CPANEL_ADD_DASHBOARD_MODULE="Add dashboard module"
COM_CPANEL_ADD_MODULE_MODAL_TITLE="Add Module"
COM_CPANEL_DASHBOARD_BASE_TITLE="Control Panel"
COM_CPANEL_DASHBOARD_COMPONENTS_TITLE="Control Panel Components"
COM_CPANEL_DASHBOARD_CONTENT_TITLE="Control Panel Content"
COM_CPANEL_DASHBOARD_CONTENT_WORKFLOW_TITLE="Control Panel Content Workflow"
COM_CPANEL_DASHBOARD_MENUS_TITLE="Control Panel Menu"
COM_CPANEL_DASHBOARD_SYSTEM_TITLE="Control Panel System"
COM_CPANEL_DASHBOARD_USERS_TITLE="Control Panel Users"
COM_CPANEL_ERROR_DASHBOARD_TYPE_NOT_SUPPORTED="This dashboard type is not supported."
COM_CPANEL_MESSAGES_BODYMORE_NOCLOSE="This information area won't appear when you have hidden all the messages."
COM_CPANEL_MESSAGES_BODY_NOCLOSE="There are important post-installation messages that require your attention."
Expand Down

0 comments on commit 841ef85

Please sign in to comment.