From 166465b8c2c12bf582e9f396f79323ee0f562938 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 25 Apr 2011 17:54:21 +0200 Subject: [PATCH] Added feature to open external event links in a new window Fixed latest bots block Fixed missing whois_online legend --- .../adm/style/portal/acp_portal_calendar.html | 2 +- root/includes/acp/acp_portal.php | 2 +- .../de/mods/portal/portal_calendar_module.php | 2 +- .../mods/portal/portal_latest_bots_module.php | 1 + .../en/mods/portal/portal_calendar_module.php | 1 + .../mods/portal/portal_latest_bots_module.php | 1 + root/portal/modules/portal_calendar.php | 14 +++++++++ root/portal/modules/portal_latest_bots.php | 29 +++++++++++++++---- .../portal/modules/calendar_side.html | 4 +-- .../portal/modules/whois_online_center.html | 2 +- .../portal/modules/calendar_side.html | 4 +-- .../portal/modules/whois_online_center.html | 2 +- 12 files changed, 50 insertions(+), 14 deletions(-) diff --git a/root/adm/style/portal/acp_portal_calendar.html b/root/adm/style/portal/acp_portal_calendar.html index 7bf27986..12f7b3fd 100644 --- a/root/adm/style/portal/acp_portal_calendar.html +++ b/root/adm/style/portal/acp_portal_calendar.html @@ -24,7 +24,7 @@
-
+
diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index a10f1014..d1536913 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -807,7 +807,7 @@ class acp_portal if (preg_match('/^portal_.+\.' . $phpEx . '$/', $file)) { $class = str_replace(".$phpEx", '', $file) . '_module'; - if(in_array(str_replace(array('portal_', '_module'), '', $class), $installed_modules)) + if(in_array(str_replace(array('portal_', '_module'), '', $class), $installed_modules) && $class != 'portal_custom_module') { continue; } diff --git a/root/language/de/mods/portal/portal_calendar_module.php b/root/language/de/mods/portal/portal_calendar_module.php index db743c2d..59bd79c4 100644 --- a/root/language/de/mods/portal/portal_calendar_module.php +++ b/root/language/de/mods/portal/portal_calendar_module.php @@ -126,7 +126,7 @@ $lang = array_merge($lang, array( 'ACP_PORTAL_CALENDAR_EVENT_START_FIRST' => 'Das Ende der Veranstaltung muss nach dem Beginn der Veranstaltung liegen.', 'ACP_PORTAL_CALENDAR_PERMISSION' => 'Berechtigungen für die Veranstaltung', 'ACP_PORTAL_CALENDAR_PERMISSION_EXP' => 'Wähle die Gruppen aus, denen es erlaubt sein soll die Veranstaltung zu sehen. Falls alle Benutzer die Veranstaltung sehen sollen, dann wähle nichts aus.
Wähle mehrere Gruppen aus/ab, indem du beim Klicken die Strg-Taste drückst.', - + 'PORTAL_EVENTS_URL_NEW_WINDOW' => 'Öffne externe Veranstaltungsverknüpfungen in einem neuen Fenster', // Logs 'LOG_PORTAL_EVENT_UPDATED' => 'Veranstaltung aktualisiert
» %s', diff --git a/root/language/de/mods/portal/portal_latest_bots_module.php b/root/language/de/mods/portal/portal_latest_bots_module.php index ca89d4bb..10655404 100644 --- a/root/language/de/mods/portal/portal_latest_bots_module.php +++ b/root/language/de/mods/portal/portal_latest_bots_module.php @@ -35,6 +35,7 @@ $lang = array_merge($lang, array( 'LATEST_BOTS' => 'Letzte Bots', 'LAST_VISITED_BOTS' => 'Die letzten Bots', 'LAST_VISITED_BOTS_CNT' => 'Die letzten %s Bots', + 'LAST_VISITED_BOT' => 'Der letzte Bot', // ACP 'ACP_PORTAL_BOTS_SETTINGS' => 'Einstellungen für Bot-Besuche', diff --git a/root/language/en/mods/portal/portal_calendar_module.php b/root/language/en/mods/portal/portal_calendar_module.php index d2845a98..02183afe 100644 --- a/root/language/en/mods/portal/portal_calendar_module.php +++ b/root/language/en/mods/portal/portal_calendar_module.php @@ -126,6 +126,7 @@ $lang = array_merge($lang, array( 'ACP_PORTAL_CALENDAR_EVENT_START_FIRST' => 'The end of the event has to be after the start of the event.', 'ACP_PORTAL_CALENDAR_PERMISSION' => 'Event permissions', 'ACP_PORTAL_CALENDAR_PERMISSION_EXP' => 'Select the groups that should be authorized to view the event. If you want all users to be able to view the event, don’t select anything.
Select/Deselect multiple groups by holding CTRL and clicking.', + 'PORTAL_EVENTS_URL_NEW_WINDOW' => 'Open external event links in a new window', // Logs diff --git a/root/language/en/mods/portal/portal_latest_bots_module.php b/root/language/en/mods/portal/portal_latest_bots_module.php index 22642d40..ec3c1712 100644 --- a/root/language/en/mods/portal/portal_latest_bots_module.php +++ b/root/language/en/mods/portal/portal_latest_bots_module.php @@ -35,6 +35,7 @@ $lang = array_merge($lang, array( 'LATEST_BOTS' => 'Latest Bots', 'LAST_VISITED_BOTS' => 'Last visited bots', 'LAST_VISITED_BOTS_CNT' => 'Last %s visited bots', + 'LAST_VISITED_BOT' => 'Last visited bot', // ACP 'ACP_PORTAL_BOTS_SETTINGS' => 'Visiting bots settings', diff --git a/root/portal/modules/portal_calendar.php b/root/portal/modules/portal_calendar.php index bb40bbdb..40942106 100644 --- a/root/portal/modules/portal_calendar.php +++ b/root/portal/modules/portal_calendar.php @@ -178,6 +178,15 @@ class portal_calendar_module { if($cur_event['start_time'] >= $today_timestamp || $cur_event['end_time'] >= $today_timestamp || (($cur_event['start_time'] + 86400) >= $today_timestamp && $cur_event['all_day'])) { + // check if this is an external link + if (isset($cur_event['url']) && strpos($cur_event['url'], generate_board_url()) === false) + { + $is_external = true; + } + else + { + $is_external = false; + } // current events if((($cur_event['start_time'] + 86400) >= $today_timestamp && $cur_event['all_day']) || ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp)) { @@ -189,6 +198,7 @@ class portal_calendar_module 'EVENT_DESC' => (isset($cur_event['desc']) && $cur_event['desc'] != '') ? $cur_event['desc'] : '', 'ALL_DAY' => ($cur_event['all_day']) ? true : false, 'MODULE_ID' => $module_id, + 'EVENT_URL_NEW_WINDOW' => ($is_external && $config['board3_events_url_new_window_' . $module_id]) ? true : false, )); } else @@ -201,6 +211,7 @@ class portal_calendar_module 'EVENT_DESC' => (isset($cur_event['desc']) && $cur_event['desc'] != '') ? $cur_event['desc'] : '', 'ALL_DAY' => (($cur_event['start_time'] - $cur_event['end_time']) == 1) ? true : false, 'MODULE_ID' => $module_id, + 'EVENT_URL_NEW_WINDOW' => ($is_external && $config['board3_events_url_new_window_' . $module_id]) ? true : false, )); } } @@ -221,6 +232,7 @@ class portal_calendar_module 'board3_long_month_' . $module_id => array('lang' => 'PORTAL_LONG_MONTH' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_sunday_first_' . $module_id => array('lang' => 'PORTAL_SUNDAY_FIRST' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_display_events_' . $module_id => array('lang' => 'PORTAL_DISPLAY_EVENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'board3_events_url_new_window_' . $module_id => array('lang' => 'PORTAL_EVENTS_URL_NEW_WINDOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'board3_events_' . $module_id => array('lang' => 'PORTAL_EVENTS_MANAGE', 'validate' => 'string', 'type' => 'custom', 'explain' => false, 'method' => 'manage_events', 'submit' => 'update_events'), ), ); @@ -237,6 +249,7 @@ class portal_calendar_module set_config('board3_long_month_' . $module_id, 0); set_config('board3_display_events_' . $module_id, 0); set_config('board3_events_' . $module_id, ''); + set_config('board3_events_url_new_window_' . $module_id, 0); set_portal_config('board3_calendar_events_' . $module_id, ''); return true; @@ -261,6 +274,7 @@ class portal_calendar_module 'board3_long_month_' . $module_id, 'board3_display_events_' . $module_id, 'board3_events_' . $module_id, + 'board3_events_url_new_window_' . $module_id, ); $sql = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE ' . $db->sql_in_set('config_name', $del_config); diff --git a/root/portal/modules/portal_latest_bots.php b/root/portal/modules/portal_latest_bots.php index cc9ae657..c473d231 100755 --- a/root/portal/modules/portal_latest_bots.php +++ b/root/portal/modules/portal_latest_bots.php @@ -64,22 +64,41 @@ class portal_latest_bots_module AND user_lastvisit > 0 ORDER BY user_lastvisit DESC'; $result = $db->sql_query_limit($sql, $config['board3_last_visited_bots_number_' . $module_id]); + + $show_module = false; while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('last_visited_bots', array( - 'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']), - 'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']), - )); + 'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']), + 'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']), + )); + $show_module = true; } $db->sql_freeresult($result); + + if($config['board3_last_visited_bots_number_' . $module_id] != 0) + { + if($config['board3_last_visited_bots_number_' . $module_id] == 1) + { + $last_visited_bots = $user->lang['LAST_VISITED_BOT']; + } + else + { + $last_visited_bots = sprintf($user->lang['LAST_VISITED_BOTS_CNT'], $config['board3_last_visited_bots_number_' . $module_id]); + } + } + else + { + $last_visited_bots = $user->lang['LAST_VISITED_BOTS']; + } // Assign specific vars $template->assign_vars(array( - 'LAST_VISITED_BOTS' => ($config['board3_last_visited_bots_number_' . $module_id] != 0) ? sprintf($user->lang['LAST_VISITED_BOTS_CNT'], $config['board3_last_visited_bots_number_' . $module_id]) : $user->lang['LAST_VISITED_BOTS'], + 'LAST_VISITED_BOTS' => $last_visited_bots, )); - if(!empty($row)) + if($show_module) { return 'latest_bots_side.html'; } diff --git a/root/styles/prosilver/template/portal/modules/calendar_side.html b/root/styles/prosilver/template/portal/modules/calendar_side.html index 7ceb41be..e30ac99b 100644 --- a/root/styles/prosilver/template/portal/modules/calendar_side.html +++ b/root/styles/prosilver/template/portal/modules/calendar_side.html @@ -41,7 +41,7 @@
  • - + onclick="window.open('{minical.cur_events.EVENT_URL}'); return false;"> {minical.cur_events.EVENT_TITLE}:
    {L_EVENT_START}: {minical.cur_events.START_TIME}
    {L_EVENT_ALL_DAY}
    {L_EVENT_START}: {minical.cur_events.START_TIME}
    {L_EVENT_END}: {minical.cur_events.END_TIME}
    @@ -65,7 +65,7 @@
  • - + onclick="window.open('{minical.upcoming_events.EVENT_URL}'); return false;"> {minical.upcoming_events.EVENT_TITLE}:
    {minical.upcoming_events.EVENT_DESC}
    {L_EVENT_TIME}: {minical.upcoming_events.START_TIME}
    diff --git a/root/styles/prosilver/template/portal/modules/whois_online_center.html b/root/styles/prosilver/template/portal/modules/whois_online_center.html index 1d16a9cc..fd3d3853 100644 --- a/root/styles/prosilver/template/portal/modules/whois_online_center.html +++ b/root/styles/prosilver/template/portal/modules/whois_online_center.html @@ -3,7 +3,7 @@
  • {TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})
    {RECORD_USERS}

    {LOGGED_IN_USER_LIST} -
    {L_LEGEND}: {PORTAL_LEGEND}

    +
    {L_LEGEND}: {PORTAL_LEGEND}

  • diff --git a/root/styles/subsilver2/template/portal/modules/calendar_side.html b/root/styles/subsilver2/template/portal/modules/calendar_side.html index aae43101..95df325b 100644 --- a/root/styles/subsilver2/template/portal/modules/calendar_side.html +++ b/root/styles/subsilver2/template/portal/modules/calendar_side.html @@ -46,7 +46,7 @@ -
    + onclick="window.open('{minical.cur_events.EVENT_URL}'); return false;"> {minical.cur_events.EVENT_TITLE}:
    {L_EVENT_TIME}: {minical.cur_events.START_TIME}
    {L_EVENT_START}: {minical.cur_events.START_TIME}
    {L_EVENT_END}: {minical.cur_events.END_TIME}
    @@ -70,7 +70,7 @@ -
    + onclick="window.open('{minical.upcoming_events.EVENT_URL}'); return false;"> {minical.upcoming_events.EVENT_TITLE}:
    {L_EVENT_TIME}: {minical.upcoming_events.START_TIME}
    {L_EVENT_START}: {minical.upcoming_events.START_TIME}
    {L_EVENT_END}: {minical.upcoming_events.END_TIME}
    diff --git a/root/styles/subsilver2/template/portal/modules/whois_online_center.html b/root/styles/subsilver2/template/portal/modules/whois_online_center.html index 725b9173..2f73ba70 100644 --- a/root/styles/subsilver2/template/portal/modules/whois_online_center.html +++ b/root/styles/subsilver2/template/portal/modules/whois_online_center.html @@ -10,7 +10,7 @@ {TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})
    {RECORD_USERS}

    {LOGGED_IN_USER_LIST}
    - + {L_LEGEND}: {PORTAL_LEGEND}