Skip to content

Commit

Permalink
Merge pull request #4808 from PedroErnst/feature/sort-modules-by-name
Browse files Browse the repository at this point in the history
Feature/sort modules by name
  • Loading branch information
samus-aran committed Mar 21, 2018
2 parents aed9e4c + a3d2f8c commit e297dfb
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 32 deletions.
35 changes: 15 additions & 20 deletions include/MVC/View/SugarView.php
Expand Up @@ -656,6 +656,21 @@ public function displayHeader($retModTabs = false)
// Now time to go through each of the tab sets and fix them up.
foreach ($groupTabs as $tabIdx => $tabData) {
$topTabs = $tabData['modules'];

// Sort the list of modules alphabetically
if ($current_user->getPreference('sort_modules_by_name')) {
asort($topTabs);
}

// put the current module at the top of the list
if (!empty($moduleTab)) {
unset($topTabs[$moduleTab]);
$topTabs = array_merge(
array($moduleTab => $tabData['modules'][$moduleTab]),
$topTabs
);
}

if (!is_array($topTabs)) {
$topTabs = array();
}
Expand All @@ -665,26 +680,6 @@ public function displayHeader($retModTabs = false)
if (count($topTabs) > $max_tabs) {
$extraTabs = array_splice($topTabs, $max_tabs);
}
// Make sure the current module is accessable through one of the top tabs
if (!isset($topTabs[$moduleTab])) {
// Nope, we need to add it.
// First, take it out of the extra menu, if it's there
if (isset($extraTabs[$moduleTab])) {
unset($extraTabs[$moduleTab]);
}
if (count($topTabs) >= $max_tabs - 1) {
// We already have the maximum number of tabs, so we need to shuffle the last one
// from the top to the first one of the extras
$lastElem = array_splice($topTabs, $max_tabs - 1);
$extraTabs = $lastElem + $extraTabs;
}
if (!empty($moduleTab)) {
$topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
if (count($topTabs) >= $max_tabs - 1) {
$extraTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
}
}
}

// Get a unique list of the top tabs so we can build the popup menus for them
foreach ($topTabs as $moduleKey => $module) {
Expand Down
22 changes: 11 additions & 11 deletions include/language/en_us.lang.php
Expand Up @@ -88,8 +88,8 @@
'Prospects' => 'Targets',
'Queues' => 'Queues',
'EmailMarketing' => 'Email Marketing',
'EmailTemplates' => 'Email Templates',
'ProspectLists' => 'Target Lists',
'EmailTemplates' => 'Email - Templates',
'ProspectLists' => 'Targets - Lists',
'SavedSearch' => 'Saved Searches',
'UpgradeWizard' => 'Upgrade Wizard',
'Trackers' => 'Trackers',
Expand Down Expand Up @@ -144,7 +144,7 @@
'2' => 'No',
),

//e.g. en fran�ais 'Analyst'=>'Analyste',
//e.g. en français 'Analyst'=>'Analyste',
'account_type_dom' => array(
'' => '',
'Analyst' => 'Analyst',
Expand All @@ -158,7 +158,7 @@
'Reseller' => 'Reseller',
'Other' => 'Other',
),
//e.g. en espa�ol 'Apparel'=>'Ropa',
//e.g. en español 'Apparel'=>'Ropa',
'industry_dom' => array(
'' => '',
'Apparel' => 'Apparel',
Expand Down Expand Up @@ -2813,7 +2813,7 @@

// knowledge base
$app_list_strings['moduleList']['AOK_KnowledgeBase'] = 'Knowledge Base';
$app_list_strings['moduleList']['AOK_Knowledge_Base_Categories'] = 'KB Categories';
$app_list_strings['moduleList']['AOK_Knowledge_Base_Categories'] = 'KB - Categories';
$app_list_strings['aok_status_list']['Draft'] = 'Draft';
$app_list_strings['aok_status_list']['Expired'] = 'Expired';
$app_list_strings['aok_status_list']['In_Review'] = 'In Review';
Expand Down Expand Up @@ -2975,8 +2975,8 @@
//aos
$app_list_strings['moduleList']['AOS_Contracts'] = 'Contracts';
$app_list_strings['moduleList']['AOS_Invoices'] = 'Invoices';
$app_list_strings['moduleList']['AOS_PDF_Templates'] = 'PDF Templates';
$app_list_strings['moduleList']['AOS_Product_Categories'] = 'Product Categories';
$app_list_strings['moduleList']['AOS_PDF_Templates'] = 'PDF - Templates';
$app_list_strings['moduleList']['AOS_Product_Categories'] = 'Products - Categories';
$app_list_strings['moduleList']['AOS_Products'] = 'Products';
$app_list_strings['moduleList']['AOS_Products_Quotes'] = 'Line Items';
$app_list_strings['moduleList']['AOS_Line_Item_Groups'] = 'Line Item Groups';
Expand Down Expand Up @@ -3125,7 +3125,7 @@
$app_list_strings['aow_run_when_list']['In_Scheduler'] = 'Only In The Scheduler';

//gant
$app_list_strings['moduleList']['AM_ProjectTemplates'] = 'Project Templates';
$app_list_strings['moduleList']['AM_ProjectTemplates'] = 'Projects - Templates';
$app_list_strings['moduleList']['AM_TaskTemplates'] = 'Project Task Templates';
$app_list_strings['relationship_type_list']['FS'] = 'Finish to Start';
$app_list_strings['relationship_type_list']['SS'] = 'Start to Start';
Expand All @@ -3144,9 +3144,9 @@
$app_strings['LBL_JJWG_MAPS_ADDRESS'] = 'Address';

$app_list_strings['moduleList']['jjwg_Maps'] = 'Maps';
$app_list_strings['moduleList']['jjwg_Markers'] = 'Map Markers';
$app_list_strings['moduleList']['jjwg_Areas'] = 'Map Areas';
$app_list_strings['moduleList']['jjwg_Address_Cache'] = 'Map Address Cache';
$app_list_strings['moduleList']['jjwg_Markers'] = 'Maps - Markers';
$app_list_strings['moduleList']['jjwg_Areas'] = 'Maps - Areas';
$app_list_strings['moduleList']['jjwg_Address_Cache'] = 'Maps - Address Cache';

$app_list_strings['moduleList']['jjwp_Partners'] = 'JJWP Partners';

Expand Down
8 changes: 7 additions & 1 deletion modules/Users/Save.php
Expand Up @@ -199,6 +199,12 @@
$focus->setPreference('navigation_paradigm', 'gm', 0, 'global');
}

if (isset($_POST['sort_modules_by_name'])) {
$focus->setPreference('sort_modules_by_name', $_POST['sort_modules_by_name'], 0, 'global');
} else {
$focus->setPreference('sort_modules_by_name', '', 0, 'global');
}

if (isset($_POST['user_subpanel_tabs'])) {
$focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global');
} else {
Expand Down Expand Up @@ -380,7 +386,7 @@
if ((isset($_POST['old_password']) || $focus->portal_only) &&
(isset($_POST['new_password']) && !empty($_POST['new_password'])) &&
(isset($_POST['password_change']) && $_POST['password_change'] == 'true')) {
if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {
if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {

if ($focus->error_string) {
SugarApplication::appendErrorMessage($focus->error_string);
Expand Down
4 changes: 4 additions & 0 deletions modules/Users/UserViewHelper.php
Expand Up @@ -513,6 +513,10 @@ protected function setupAdvancedTabNavSettings() {
}
$this->ss->assign("USE_GROUP_TABS",($useGroupTabs=='gm')?'checked':'');

if ($this->bean->getPreference('sort_modules_by_name')) {
$this->ss->assign('SORT_MODULES_BY_NAME', ' checked');
}

$user_subpanel_tabs = $this->bean->getPreference('subpanel_tabs');
if(isset($user_subpanel_tabs)) {
$this->ss->assign("SUBPANEL_TABS", $user_subpanel_tabs?'checked':'');
Expand Down
2 changes: 2 additions & 0 deletions modules/Users/language/en_us.lang.php
Expand Up @@ -289,6 +289,8 @@
'LBL_STATUS' => 'Status',
'LBL_SUBPANEL_TABS' => 'Subpanel Tabs',
'LBL_SUBPANEL_TABS_DESCRIPTION' => 'In Detail Views, group Subpanels into tabs and display one tab at a time.',
'LBL_SORT_MODULES' => 'Sort modules alphabetically',
'LBL_SORT_MODULES_DESCRIPTION' => 'Order modules by name in the navigation drop down.',
'LBL_SUGAR_LOGIN' => 'Is SuiteCRM User',
'LBL_THEME' => 'Themes',
'LBL_TIME_FORMAT_TEXT' => 'Set the display format for time stamps',
Expand Down
7 changes: 7 additions & 0 deletions modules/Users/tpls/EditViewFooter.tpl
Expand Up @@ -505,6 +505,13 @@
</table>
</td>
</tr>
<tr>
<td width="17%" scope="row"><span>{$MOD.LBL_SORT_MODULES}
:</span>&nbsp;{sugar_help text=$MOD.LBL_SORT_MODULES_DESCRIPTION }</td>
<td width="83%" colspan="3">
<input type="checkbox" name="sort_modules_by_name" {$SORT_MODULES_BY_NAME} tabindex='13'>
</td>
</tr>
<tr>
<td width="17%" scope="row"><span>{$MOD.LBL_SUBPANEL_TABS}
:</span>&nbsp;{sugar_help text=$MOD.LBL_SUBPANEL_TABS_DESCRIPTION }</td>
Expand Down

0 comments on commit e297dfb

Please sign in to comment.