Browse Source

! Core features is getting slimmer all the time, and the other areas have better navigation and handling now.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 years ago
parent
commit
cc0c35f557

+ 7 - 7
Sources/Admin.php

@@ -219,9 +219,9 @@ function AdminMain()
 					'function' => 'ManageCalendar',
 					'icon' => 'calendar.png',
 					'permission' => array('admin_forum'),
-					'enabled' => in_array('cd', $context['admin_features']),
-					'subsections' => array(
-						'holidays' => array($txt['manage_holidays'], 'admin_forum', 'enabled' => !empty($modSettings['cal_enabled'])),
+					'inactive' => empty($modSettings['cal_enabled']),
+					'subsections' => empty($modSettings['cal_enabled']) ? array() : array(
+						'holidays' => array($txt['manage_holidays'], 'admin_forum'),
 						'settings' => array($txt['calendar_settings'], 'admin_forum'),
 					),
 				),
@@ -268,12 +268,12 @@ function AdminMain()
 				),
 				'sengines' => array(
 					'label' => $txt['search_engines'],
-					'enabled' => in_array('sp', $context['admin_features']),
+					'inactive' => empty($modSettings['spider_mode']),
 					'file' => 'ManageSearchEngines.php',
 					'icon' => 'engines.png',
 					'function' => 'SearchEngines',
 					'permission' => 'admin_forum',
-					'subsections' => array(
+					'subsections' => empty($modSettings['spider_mode']) ? array() : array(
 						'stats' => array($txt['spider_stats']),
 						'logs' => array($txt['spider_logs']),
 						'spiders' => array($txt['spiders']),
@@ -351,7 +351,7 @@ function AdminMain()
 				),
 				'paidsubscribe' => array(
 					'label' => $txt['paid_subscriptions'],
-					'enabled' => in_array('ps', $context['admin_features']),
+					'inactive' => !in_array('ps', $context['admin_features']),
 					'file' => 'ManagePaid.php',
 					'icon' => 'paid.png',
 					'function' => 'ManagePaidSubscriptions',
@@ -430,7 +430,7 @@ function AdminMain()
 						'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])),
 						'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])),
 						'banlog' => array($txt['ban_log'], 'manage_bans'),
-						'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => in_array('sp', $context['admin_features'])),
+						'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => !empty($modSettings['spider_mode'])),
 						'tasklog' => array($txt['scheduled_log'], 'admin_forum'),
 						'settings' => array($txt['log_settings'], 'admin_forum'),
 					),

+ 1 - 1
Sources/Load.php

@@ -1797,7 +1797,7 @@ function loadTheme($id_theme = 0, $initialize = true)
 		$modSettings['memberCount'] = $modSettings['totalMembers'];
 
 	// This allows us to change the way things look for the admin.
-	$context['admin_features'] = isset($modSettings['admin_features']) ? explode(',', $modSettings['admin_features']) : array('cd,k,w,ml,pm');
+	$context['admin_features'] = isset($modSettings['admin_features']) ? explode(',', $modSettings['admin_features']) : array('k,w,pm');
 
 	// Default JS variables for use in every theme
 	$context['javascript_vars'] = array(

+ 71 - 52
Sources/ManageCalendar.php

@@ -35,30 +35,42 @@ function ManageCalendar()
 	$context['explain_text'] = $txt['calendar_desc'];
 
 	// Little short on the ground of functions here... but things can and maybe will change...
-	$subActions = array(
-		'editholiday' => 'EditHoliday',
-		'holidays' => 'ModifyHolidays',
-		'settings' => 'ModifyCalendarSettings'
-	);
+	if (!empty($modSettings['cal_enabled']))
+	{
+		$subActions = array(
+			'editholiday' => 'EditHoliday',
+			'holidays' => 'ModifyHolidays',
+			'settings' => 'ModifyCalendarSettings'
+		);
+		$default = 'editholiday';
+	}
+	else
+	{
+		$subActions = array(
+			'settings' => 'ModifyCalendarSettings'
+		);
+		$default = 'settings';
+	}
 
 	call_integration_hook('integrate_manage_calendar', array(&$subActions));
 
-	$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'holidays';
+	$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $default;
 
 	// Set up the two tabs here...
 	$context[$context['admin_menu_name']]['tab_data'] = array(
 		'title' => $txt['manage_calendar'],
 		'help' => 'calendar',
 		'description' => $txt['calendar_settings_desc'],
-		'tabs' => array(
+	);
+	if (!empty($modSettings['cal_enabled']))
+		$context[$context['admin_menu_name']]['tab_data']['tabs'] = array(
 			'holidays' => array(
 				'description' => $txt['manage_holidays_desc'],
 			),
 			'settings' => array(
 				'description' => $txt['calendar_settings_desc'],
 			),
-		),
-	);
+		);
 
 	$subActions[$_REQUEST['sa']]();
 }
@@ -290,7 +302,7 @@ function EditHoliday()
  */
 function ModifyCalendarSettings($return_config = false)
 {
-	global $context, $txt, $sourcedir, $scripturl, $smcFunc;
+	global $context, $txt, $sourcedir, $scripturl, $smcFunc, $modSettings;
 
 	// Load the boards list.
 	$boards = array('');
@@ -306,48 +318,55 @@ function ModifyCalendarSettings($return_config = false)
 	$smcFunc['db_free_result']($request);
 
 	// Look, all the calendar settings - of which there are many!
-	$config_vars = array(
-			// All the permissions:
-			array('permissions', 'calendar_view', 'help' => 'cal_enabled'),
-			array('permissions', 'calendar_post'),
-			array('permissions', 'calendar_edit_own'),
-			array('permissions', 'calendar_edit_any'),
-		'',
-			// How many days to show on board index, and where to display events etc?
-			array('int', 'cal_days_for_index', 6, 'postinput' => $txt['days_word']),
-			array('select', 'cal_showholidays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
-			array('select', 'cal_showbdays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
-			array('select', 'cal_showevents', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
-			array('check', 'cal_export'),
-		'',
-			// Linking events etc...
-			array('select', 'cal_defaultboard', $boards),
-			array('check', 'cal_daysaslink'),
-			array('check', 'cal_allow_unlinked'),
-			array('check', 'cal_showInTopic'),
-		'',
-			// Dates of calendar...
-			array('int', 'cal_minyear'),
-			array('int', 'cal_maxyear'),
-		'',
-			// Calendar spanning...
-			array('check', 'cal_allowspan'),
-			array('int', 'cal_maxspan', 6, 'postinput' => $txt['days_word']),
-		'',
-			// A comment is like a dog marking its territory. ;)
-			array('select', 'cal_highlight_events', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
-			array('select', 'cal_highlight_holidays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
-			array('select', 'cal_highlight_birthdays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
-		'',
-			// Miscellaneous layout settings...
-			array('check', 'cal_disable_prev_next'),
-			array('select', 'cal_display_type', array(0 => $txt['setting_cal_display_comfortable'], 1 => $txt['setting_cal_display_compact'])),
-			array('select', 'cal_week_links', array(0 => $txt['setting_cal_week_links_none'], 1 => $txt['setting_cal_week_links_mini'], 2 => $txt['setting_cal_week_links_main'], 3 => $txt['setting_cal_week_links_both'])),
-			array('check', 'cal_prev_next_links'),
-			array('check', 'cal_short_days'),
-			array('check', 'cal_short_months'),
-			array('check', 'cal_week_numbers'),
-	);
+	if (!empty($modSettings['cal_enabled']))
+		$config_vars = array(
+				array('check', 'cal_enabled'),
+			'',
+				// All the permissions:
+				array('permissions', 'calendar_view', 'help' => 'cal_enabled'),
+				array('permissions', 'calendar_post'),
+				array('permissions', 'calendar_edit_own'),
+				array('permissions', 'calendar_edit_any'),
+			'',
+				// How many days to show on board index, and where to display events etc?
+				array('int', 'cal_days_for_index', 6, 'postinput' => $txt['days_word']),
+				array('select', 'cal_showholidays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
+				array('select', 'cal_showbdays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
+				array('select', 'cal_showevents', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])),
+				array('check', 'cal_export'),
+			'',
+				// Linking events etc...
+				array('select', 'cal_defaultboard', $boards),
+				array('check', 'cal_daysaslink'),
+				array('check', 'cal_allow_unlinked'),
+				array('check', 'cal_showInTopic'),
+			'',
+				// Dates of calendar...
+				array('int', 'cal_minyear'),
+				array('int', 'cal_maxyear'),
+			'',
+				// Calendar spanning...
+				array('check', 'cal_allowspan'),
+				array('int', 'cal_maxspan', 6, 'postinput' => $txt['days_word']),
+			'',
+				// A comment is like a dog marking its territory. ;)
+				array('select', 'cal_highlight_events', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+				array('select', 'cal_highlight_holidays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+				array('select', 'cal_highlight_birthdays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+			'',
+				// Miscellaneous layout settings...
+				array('check', 'cal_disable_prev_next'),
+				array('select', 'cal_display_type', array(0 => $txt['setting_cal_display_comfortable'], 1 => $txt['setting_cal_display_compact'])),
+				array('select', 'cal_week_links', array(0 => $txt['setting_cal_week_links_none'], 1 => $txt['setting_cal_week_links_mini'], 2 => $txt['setting_cal_week_links_main'], 3 => $txt['setting_cal_week_links_both'])),
+				array('check', 'cal_prev_next_links'),
+				array('check', 'cal_short_days'),
+				array('check', 'cal_short_months'),
+				array('check', 'cal_week_numbers'),
+		);
+	else
+		$config_vars = array(
+			array('check', 'cal_enabled'),
+		);
 
 	call_integration_hook('integrate_modify_calendar_settings', array(&$config_vars));
 	if ($return_config)

+ 1 - 1
Sources/ManagePermissions.php

@@ -1545,7 +1545,7 @@ function loadAllPermissions($loadType = 'classic')
 	$hiddenPermissions = array();
 	$relabelPermissions = array(); // Permissions to apply a different label to.
 	$relabelGroups = array(); // As above but for groups.
-	if (!in_array('cd', $context['admin_features']))
+	if (empty($modSettings['cal_enabled']))
 	{
 		$hiddenPermissions[] = 'calendar_view';
 		$hiddenPermissions[] = 'calendar_post';

+ 20 - 9
Sources/ManageSearchEngines.php

@@ -21,25 +21,36 @@ if (!defined('SMF'))
  */
 function SearchEngines()
 {
-	global $context, $txt, $scripturl;
+	global $context, $txt, $scripturl, $modSettings;
 
 	isAllowedTo('admin_forum');
 
 	loadLanguage('Search');
 	loadTemplate('ManageSearch');
 
-	$subActions = array(
-		'editspiders' => 'EditSpider',
-		'logs' => 'SpiderLogs',
-		'settings' => 'ManageSearchEngineSettings',
-		'spiders' => 'ViewSpiders',
-		'stats' => 'SpiderStats',
-	);
+	if (!empty($modSettings['spider_mode']))
+	{
+		$subActions = array(
+			'editspiders' => 'EditSpider',
+			'logs' => 'SpiderLogs',
+			'settings' => 'ManageSearchEngineSettings',
+			'spiders' => 'ViewSpiders',
+			'stats' => 'SpiderStats',
+		);
+		$default = 'stats';
+	}
+	else
+	{
+		$subActions = array(
+			'settings' => 'ManageSearchEngineSettings',
+		);
+		$default = 'settings';
+	}
 
 	call_integration_hook('integrate_manage_search_engines', array(&$subActions));
 
 	// Ensure we have a valid subaction.
-	$context['sub_action'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'stats';
+	$context['sub_action'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $default;
 
 	$context['page_title'] = $txt['search_engines'];
 

+ 0 - 24
Sources/ManageSettings.php

@@ -185,13 +185,6 @@ function ModifyCoreFeatures($return_config = false)
 		save_callback	- Function called on save, takes state as parameter.
 	*/
 	$core_features = array(
-		// cd = calendar.
-		'cd' => array(
-			'url' => 'action=admin;area=managecalendar',
-			'settings' => array(
-				'cal_enabled' => 1,
-			),
-		),
 		// k = karma.
 		'k' => array(
 			'url' => 'action=admin;area=featuresettings;sa=karma',
@@ -275,23 +268,6 @@ function ModifyCoreFeatures($return_config = false)
 				return $returnSettings;
 			'),
 		),
-		// Search engines
-		'sp' => array(
-			'url' => 'action=admin;area=sengines',
-			'settings' => array(
-				'spider_mode' => 1,
-			),
-			'setting_callback' => create_function('$value', '
-				// Turn off the spider group if disabling.
-				if (!$value)
-					return array(\'spider_group\' => 0, \'show_spider_online\' => 0);
-			'),
-			'on_save' => create_function('', '
-				global $sourcedir, $modSettings;
-				require_once($sourcedir . \'/ManageSearchEngines.php\');
-				recacheSpiderNames();
-			'),
-		),
 	);
 
 	// Anyone who would like to add a core feature?

BIN
Themes/default/images/admin/feature_cd.png


BIN
Themes/default/images/admin/feature_sp.png


+ 0 - 4
Themes/default/languages/ManageSettings.english.php

@@ -296,8 +296,6 @@ $txt['standard_profile_field'] = 'Field';
 
 $txt['core_settings_welcome_msg'] = 'Welcome to Your New Forum';
 $txt['core_settings_welcome_msg_desc'] = 'To get you started we suggest you select which of SMF\'s core features you want to enable. We\'d recommend only enabling with those features you need!';
-$txt['core_settings_item_cd'] = 'Calendar';
-$txt['core_settings_item_cd_desc'] = 'Enabling this feature will open up a selection of options to enable your users to view the calendar, add and review events, see users birthdates on a calendar and much, much more.';
 $txt['core_settings_item_k'] = 'Karma';
 $txt['core_settings_item_k_desc'] = 'Karma is a feature that shows the popularity of a member. Members, if allowed, can \'applaud\' or \'smite\' other members, which is how their popularity is calculated.';
 $txt['core_settings_item_ml'] = 'Moderation, Administration and User Logs';
@@ -306,8 +304,6 @@ $txt['core_settings_item_pm'] = 'Post Moderation';
 $txt['core_settings_item_pm_desc'] = 'Post moderation enables you to select groups and boards within which posts must be approved before they become public. Upon enabling this feature be sure to visit the permission section to set up the relevant permissions.';
 $txt['core_settings_item_ps'] = 'Paid Subscriptions';
 $txt['core_settings_item_ps_desc'] = 'Paid subscriptions allow users to pay for subscriptions to change membergroups within the forum and thus change their access rights.';
-$txt['core_settings_item_sp'] = 'Search Engine Tracking';
-$txt['core_settings_item_sp_desc'] = 'Enabling this feature will allow administrators to track search engines as they index your forum.';
 $txt['core_settings_item_w'] = 'Warning System';
 $txt['core_settings_item_w_desc'] = 'This system allows administrators and moderators to issue warnings to users, and can automatically remove user rights as their warning level increases. To take full advantage of this system, &quot;Post Moderation&quot; should be enabled.';
 $txt['core_settings_switch_on'] = 'Click to Enable';

+ 0 - 5
other/upgrade_2-0_mysql.sql

@@ -1910,13 +1910,8 @@ ADD INDEX id_poll (id_poll, id_member, id_choice);
 if (!isset($modSettings['admin_features']))
 {
 	// Work out what they used to have enabled.
-	$enabled_features = array('rg');
-	if (!empty($modSettings['cal_enabled']))
-		$enabled_features[] = 'cd';
 	if (!empty($modSettings['karmaMode']))
 		$enabled_features[] = 'k';
-	if (!empty($modSettings['modlog_enabled']))
-		$enabled_features[] = 'ml';
 	if (!empty($modSettings['paid_enabled']))
 		$enabled_features[] = 'ps';