|
@@ -35,30 +35,42 @@ function ManageCalendar()
|
|
$context['explain_text'] = $txt['calendar_desc'];
|
|
$context['explain_text'] = $txt['calendar_desc'];
|
|
|
|
|
|
// Little short on the ground of functions here... but things can and maybe will change...
|
|
// 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));
|
|
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...
|
|
// Set up the two tabs here...
|
|
$context[$context['admin_menu_name']]['tab_data'] = array(
|
|
$context[$context['admin_menu_name']]['tab_data'] = array(
|
|
'title' => $txt['manage_calendar'],
|
|
'title' => $txt['manage_calendar'],
|
|
'help' => 'calendar',
|
|
'help' => 'calendar',
|
|
'description' => $txt['calendar_settings_desc'],
|
|
'description' => $txt['calendar_settings_desc'],
|
|
- 'tabs' => array(
|
|
|
|
|
|
+ );
|
|
|
|
+ if (!empty($modSettings['cal_enabled']))
|
|
|
|
+ $context[$context['admin_menu_name']]['tab_data']['tabs'] = array(
|
|
'holidays' => array(
|
|
'holidays' => array(
|
|
'description' => $txt['manage_holidays_desc'],
|
|
'description' => $txt['manage_holidays_desc'],
|
|
),
|
|
),
|
|
'settings' => array(
|
|
'settings' => array(
|
|
'description' => $txt['calendar_settings_desc'],
|
|
'description' => $txt['calendar_settings_desc'],
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- );
|
|
|
|
|
|
+ );
|
|
|
|
|
|
$subActions[$_REQUEST['sa']]();
|
|
$subActions[$_REQUEST['sa']]();
|
|
}
|
|
}
|
|
@@ -290,7 +302,7 @@ function EditHoliday()
|
|
*/
|
|
*/
|
|
function ModifyCalendarSettings($return_config = false)
|
|
function ModifyCalendarSettings($return_config = false)
|
|
{
|
|
{
|
|
- global $context, $txt, $sourcedir, $scripturl, $smcFunc;
|
|
|
|
|
|
+ global $context, $txt, $sourcedir, $scripturl, $smcFunc, $modSettings;
|
|
|
|
|
|
// Load the boards list.
|
|
// Load the boards list.
|
|
$boards = array('');
|
|
$boards = array('');
|
|
@@ -306,48 +318,55 @@ function ModifyCalendarSettings($return_config = false)
|
|
$smcFunc['db_free_result']($request);
|
|
$smcFunc['db_free_result']($request);
|
|
|
|
|
|
// Look, all the calendar settings - of which there are many!
|
|
// 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));
|
|
call_integration_hook('integrate_modify_calendar_settings', array(&$config_vars));
|
|
if ($return_config)
|
|
if ($return_config)
|