Skip to content

Commit

Permalink
! A little reorg and retrofitting everything to support big icons in …
Browse files Browse the repository at this point in the history
…the ACP. This is still a WIP and has some debug code in it yet.

Signed-off-by: Peter Spicer <sleeping@myperch.org>
  • Loading branch information
Arantor committed Oct 8, 2013
1 parent a455dda commit 57cde67
Show file tree
Hide file tree
Showing 35 changed files with 81 additions and 26 deletions.
32 changes: 16 additions & 16 deletions Sources/Admin.php
Expand Up @@ -141,20 +141,6 @@ function AdminMain()
'settings' => array($txt['language_settings']),
),
),
'serversettings' => array(
'label' => $txt['admin_server_settings'],
'file' => 'ManageServer.php',
'function' => 'ModifySettings',
'icon' => 'server.png',
'subsections' => array(
'general' => array($txt['general_settings']),
'database' => array($txt['database_paths_settings']),
'cookie' => array($txt['cookies_sessions_settings']),
'cache' => array($txt['caching_settings']),
'loads' => array($txt['load_balancing_settings']),
'phpinfo' => array($txt['phpinfo_settings']),
),
),
'current_theme' => array(
'label' => $txt['theme_current_settings'],
'file' => 'Themes.php',
Expand Down Expand Up @@ -223,7 +209,7 @@ function AdminMain()
'label' => $txt['manage_drafts'],
'file' => 'Drafts.php',
'function' => 'ModifyDraftSettings',
'icon' => 'logs.png',
'icon' => 'drafts.png',
'permission' => array('admin_forum'),
'enabled' => in_array('dr', $context['admin_features']),
),
Expand Down Expand Up @@ -381,6 +367,20 @@ function AdminMain()
'title' => $txt['admin_maintenance'],
'permission' => array('admin_forum'),
'areas' => array(
'serversettings' => array(
'label' => $txt['admin_server_settings'],
'file' => 'ManageServer.php',
'function' => 'ModifySettings',
'icon' => 'server.png',
'subsections' => array(
'general' => array($txt['general_settings']),
'database' => array($txt['database_paths_settings']),
'cookie' => array($txt['cookies_sessions_settings']),
'cache' => array($txt['caching_settings']),
'loads' => array($txt['load_balancing_settings']),
'phpinfo' => array($txt['phpinfo_settings']),
),
),
'maintain' => array(
'label' => $txt['maintain_title'],
'file' => 'ManageMaintenance.php',
Expand Down Expand Up @@ -461,7 +461,7 @@ function AdminMain()
validateSession();

// Actually create the menu!
$admin_include_data = createMenu($admin_areas);
$admin_include_data = createMenu($admin_areas, array('do_big_icons' => true));
unset($admin_areas);

// Nothing valid?
Expand Down
24 changes: 20 additions & 4 deletions Sources/Subs-Menu.php
Expand Up @@ -26,9 +26,6 @@ function createMenu($menuData, $menuOptions = array())
{
global $context, $settings, $options, $txt, $modSettings, $scripturl, $smcFunc, $user_info, $sourcedir, $options;

// Work out where we should get our images from.
$context['menu_image_path'] = file_exists($settings['theme_dir'] . '/images/admin/change_menu.png') ? $settings['images_url'] . '/admin' : $settings['default_images_url'] . '/admin';

/* Note menuData is array of form:
Possible fields:
Expand Down Expand Up @@ -127,10 +124,29 @@ function createMenu($menuData, $menuOptions = array())
if (!isset($area['force_menu_into_arms_of_another_menu']) && $user_info['name'] == 'iamanoompaloompa')
$menu_context['sections'][$section_id]['areas'][$area_id] = unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9'));
elseif (isset($area['icon']))
$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $context['menu_image_path'] . '/' . $area['icon'] . '" alt="" />&nbsp;&nbsp;';
$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = file_exists($settings['theme_dir'] . '/images/admin/' . $area['icon']) ? '<img src="' . $settings['images_url'] . '/admin/' . $area['icon'] . '" alt="" />&nbsp;&nbsp;' : '<img src="' . $settings['default_images_url'] . '/admin/' . $area['icon'] . '" alt="" />&nbsp;&nbsp;';
else
$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '';

// Mod authors may wish to just set such an icon. Easy here, just drop in a URL.
if (!empty($menuOptions['do_big_icons']))
{
if (isset($area['bigicon']))
$menu_context['sections'][$section_id]['areas'][$area_id]['bigicon'] = $area['bigicon'];
// Otherwise we try to use the big icon, which has the same filename as the small one but in another folder.
elseif (isset($area['icon']))
{
if (file_exists($settings['theme_dir'] . '/images/admin/big/' . $area['icon']))
$menu_context['sections'][$section_id]['areas'][$area_id]['bigicon'] = $settings['images_url'] . '/admin/big/' . $area['icon'];
elseif (file_exists($settings['default_theme_dir'] . '/images/admin/big/' . $area['icon']))
$menu_context['sections'][$section_id]['areas'][$area_id]['bigicon'] = $settings['default_images_url'] . '/admin/big/' . $area['icon'];
}

// They do need an icon. Have they got one?
if (empty($menu_context['sections'][$section_id]['areas'][$area_id]['bigicon']))
$menu_context['sections'][$section_id]['areas'][$area_id]['bigicon'] = $settings['default_images_url'] . '/admin/big/default.png';
}

// Did it have subsections?
if (!empty($area['subsections']))
{
Expand Down
30 changes: 28 additions & 2 deletions Themes/default/Admin.template.php
Expand Up @@ -78,7 +78,31 @@ function template_admin()
</div>
</div>';

echo '
//print_r($context[$context['admin_menu_name']]);
$use_bg2 = true;
foreach ($context[$context['admin_menu_name']]['sections'] as $area_id => $area)
{
echo '
<fieldset id="group_', $area_id, '" class="', $use_bg2 ? 'windowbg2' : 'windowbg', ' admin_group">
<legend>', $area['title'], '</legend>';

foreach ($area['areas'] as $item_id => $item)
{
// No point showing the 'home' page here, we're already on it!
if ($area_id == 'forum' && $item_id == 'index')
continue;

$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
echo '
<a href="', $url, '"><img src="', $item['bigicon'], '" alt="" /><br />', $item['label'], '</a>';
}

echo '
</fieldset>';
$use_bg2 = !$use_bg2;
}

/*echo '
<div class="windowbg2 quick_tasks">
<div class="content">
<ul id="quick_tasks" class="flow_hidden">';
Expand All @@ -94,7 +118,9 @@ function template_admin()
echo '
</ul>
</div>
</div>
</div>';*/

echo '
</div>';

// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
Expand Down
21 changes: 17 additions & 4 deletions Themes/default/css/admin.css
Expand Up @@ -409,10 +409,9 @@ body#chrome #quick_search .button_submit {
/* Admin and moderation could generally do with a clean up everywhere.
/* Live news from smf.org and support information. */
#admin_main_section {
margin: 12px 0 0 0;
padding: 8px 12px 4px 12px;
border-radius: 7px 7px 0 0;
border-bottom: none;
margin: 12px 0;
padding: 8px 12px;
border-radius: 7px;
}
#admin_main_section .cat_bar {
background: none;
Expand Down Expand Up @@ -472,6 +471,20 @@ body#chrome #quick_search .button_submit {
border-top: double #ddd;
}

fieldset.admin_group legend {
background: #eaf1f4;
border: 1px solid #cacdd3;
padding: 1px 5px;
border-radius: 3px;
}
fieldset.admin_group a {
display: inline-block;
width: 100px;
font-size: 85%;
text-align: center;
vertical-align: top;
}

/* The update warning. */
#update_section {
margin: 6px 0;
Expand Down
Binary file added Themes/default/images/admin/big/attachment.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/ban.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/boards.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/calendar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/current_theme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/drafts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/engines.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/features.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/languages.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/logs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/mail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/maintain.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/membergroups.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/members.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/modifications.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/news.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/packages.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/paid.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/permissions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/posts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/regcenter.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/reports.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/scheduled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Themes/default/images/admin/big/security.png
Binary file added Themes/default/images/admin/big/server.png
Binary file added Themes/default/images/admin/big/smiley.png
Binary file added Themes/default/images/admin/big/support.png
Binary file added Themes/default/images/admin/big/themes.png
Binary file added Themes/default/images/admin/drafts.png

0 comments on commit 57cde67

Please sign in to comment.