From 4cb8c9dbb1cb73ab0275426aa61cac095fbdc012 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 1 Apr 2011 01:19:01 +0200 Subject: [PATCH] Reworked parts of calendar block Fixed missing CSS for li-tags of calendar --- install.xml | 12 +++- .../de/mods/portal/portal_calendar_module.php | 4 +- .../en/mods/portal/portal_calendar_module.php | 4 +- root/portal/modules/portal_calendar.php | 58 +++++++++++-------- .../portal/modules/calendar_side.html | 6 +- root/styles/prosilver/theme/portal.css | 38 ++++++------ 6 files changed, 72 insertions(+), 50 deletions(-) diff --git a/install.xml b/install.xml index c2a98b70..6064c148 100644 --- a/install.xml +++ b/install.xml @@ -86,7 +86,7 @@ Weitere Sprachen kannst in unserem Internationalen Forum finden: http://www.boar - 2.0.0a1 + 2.0.0a2 easy @@ -111,10 +111,20 @@ Weitere Sprachen kannst in unserem Internationalen Forum finden: http://www.boar Added missing IF $S_BLOCK_ICON Fixed select for displaying events + Add feature to disable modules without having to remove them + Fixed typo in title of Latest Bots block + Applied patch for folders with special characters (upload module) + Reworked parts of calendar block + Fixed missing CSS for li-tags of calendar Fehlendes IF $S_BLOCK_ICON hinzugefügt Auswahl für das Anzeigen von Events repariert + Fähigkeit hinzugefügt um Module zu deaktivieren ohne sie zu entfernen + Schreibfehler in "Letzte Bots" Block beseitigt + Patch für Ordner mit Spezialcharaktern hinzugefügt (Upload Modul) + Teile des Kalender Blocks überarbeitet + Fehlendes CSS für li-tags des Kalenders hinzugefügt diff --git a/root/language/de/mods/portal/portal_calendar_module.php b/root/language/de/mods/portal/portal_calendar_module.php index bacf0c4b..e444e6ce 100644 --- a/root/language/de/mods/portal/portal_calendar_module.php +++ b/root/language/de/mods/portal/portal_calendar_module.php @@ -116,11 +116,11 @@ $lang = array_merge($lang, array( 'ACP_PORTAL_CALENDAR_END_INCORRECT' => 'Die eingegebene End-Zeit ist nicht korrekt. Bitte folge genau den Anweisungen.', 'ACP_PORTAL_CALENDAR_EVENT_PAST' => 'Die Start-zeit der Veranstaltung muss in der Zukunft liegen.', 'ACP_PORTAL_EVENT_START_DAY' => 'Start-Datum der Veranstaltung', - 'ACP_PORTAL_EVENT_START_DAY_EXP' => 'Gebe das Datum ein, an dem die Veranstaltung beginnt. Das Datum muss in folgendem Format sein: JJJJ-MM-TT', + 'ACP_PORTAL_EVENT_START_DAY_EXP' => 'Gebe das Datum ein, an dem die Veranstaltung beginnt. Das Datum muss in folgendem Format sein: TT-MM-JJJJ', 'ACP_PORTAL_EVENT_START_TIME' => 'Start-Zeit der Veranstaltung', 'ACP_PORTAL_EVENT_START_TIME_EXP' => 'Gebe die Zeit ein, zu der die Veranstaltung beginnt. Die Zeit muss im 24 Stunden Format sein, z.B. 23:12', 'ACP_PORTAL_EVENT_END_DAY' => 'End-Datum der Veranstaltung', - 'ACP_PORTAL_EVENT_END_DAY_EXP' => 'Gebe das Datum ein, an dem die Veranstaltung endet. Das Datum muss in folgendem Format sein: JJJJ-MM-TT', + 'ACP_PORTAL_EVENT_END_DAY_EXP' => 'Gebe das Datum ein, an dem die Veranstaltung endet. Das Datum muss in folgendem Format sein: TT-MM-JJJJ', 'ACP_PORTAL_EVENT_END_TIME' => 'End-Zeit der Veranstaltung', 'ACP_PORTAL_EVENT_END_TIME_EXP' => 'Gebe die Zeit ein, zu der die Veranstaltung endet. Die Zeit muss im 24 Stunden Forrmat sein, z.B. 23:12', 'ACP_PORTAL_CALENDAR_EVENT_START_FIRST' => 'Das Ende der Veranstaltung muss nach dem Beginn der Veranstaltung liegen.', diff --git a/root/language/en/mods/portal/portal_calendar_module.php b/root/language/en/mods/portal/portal_calendar_module.php index 5cd31385..8171a725 100644 --- a/root/language/en/mods/portal/portal_calendar_module.php +++ b/root/language/en/mods/portal/portal_calendar_module.php @@ -116,11 +116,11 @@ $lang = array_merge($lang, array( 'ACP_PORTAL_CALENDAR_END_INCORRECT' => 'The end time you entered was incorrect. Please follow the instructions carefully.', 'ACP_PORTAL_CALENDAR_EVENT_PAST' => 'The event start time needs to be in the future.', 'ACP_PORTAL_EVENT_START_DAY' => 'Event start date', - 'ACP_PORTAL_EVENT_START_DAY_EXP' => 'Enter the date when the event starts. The date has to be in this format: YYYY-MM-DD', + 'ACP_PORTAL_EVENT_START_DAY_EXP' => 'Enter the date when the event starts. The date has to be in this format: DD-MM-YYYY', 'ACP_PORTAL_EVENT_START_TIME' => 'Event start time', 'ACP_PORTAL_EVENT_START_TIME_EXP' => 'Enter the time when the event starts. The time has to be in a 24 hour format, i.e. 23:12', 'ACP_PORTAL_EVENT_END_DAY' => 'Event end date', - 'ACP_PORTAL_EVENT_END_DAY_EXP' => 'Enter the date when the event starts. The date has to be in this format: YYYY-MM-DD', + 'ACP_PORTAL_EVENT_END_DAY_EXP' => 'Enter the date when the event starts. The date has to be in this format: DD-MM-YYYY', 'ACP_PORTAL_EVENT_END_TIME' => 'Event end time', 'ACP_PORTAL_EVENT_END_TIME_EXP' => 'Enter the time when the event starts. The time has to be in a 24 hour format, i.e. 23:12', 'ACP_PORTAL_CALENDAR_EVENT_START_FIRST' => 'The end of the event has to be after the start of the event.', diff --git a/root/portal/modules/portal_calendar.php b/root/portal/modules/portal_calendar.php index 1a98ec26..80279e0f 100644 --- a/root/portal/modules/portal_calendar.php +++ b/root/portal/modules/portal_calendar.php @@ -157,7 +157,7 @@ class portal_calendar_module */ $events = $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]); - if(!empty($events)) + if(!empty($events) && $config['board3_display_events_' . $module_id]) { // we sort the $events array by the start time foreach($events as $key => $cur_event) @@ -168,18 +168,18 @@ class portal_calendar_module foreach($events as $key => $cur_event) { - if($cur_event['start_time'] >= $today_timestamp || $cur_event['end_time'] >= $today_timestamp) + if($cur_event['start_time'] >= time() || ($cur_event['end_time'] + $user->timezone + $user->dst) >= time() || (($cur_event['start_time'] + 86400) >= $today_timestamp && $cur_event['all_day'])) { // current events - if(($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] <= $cur_event['start_time']) || ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp)) + if((($cur_event['start_time'] + 86400) >= time() && $cur_event['all_day']) || ($cur_event['start_time'] <= time() && ($cur_event['end_time'] + $user->timezone + $user->dst) >= time())) { $template->assign_block_vars('cur_events', array( 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url(str_replace('&', '&', $cur_event['url'])) : '', 'EVENT_TITLE' => $cur_event['title'], 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), - 'END_TIME' => $user->format_date($cur_event['end_time'], 'j. M Y, H:i'), + 'END_TIME' => (!empty($cur_event['end_time'])) ? $user->format_date($cur_event['end_time'], 'j. M Y, H:i') : false, '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, + 'ALL_DAY' => ($cur_event['all_day']) ? true : false, )); } else @@ -187,7 +187,6 @@ class portal_calendar_module $template->assign_block_vars('upcoming_events', array( 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url(str_replace('&', '&', $cur_event['url'])) : '', 'EVENT_TITLE' => $cur_event['title'], - 'CUR_EVENT' => ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp) ? true : false, 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), 'END_TIME' => $user->format_date($cur_event['end_time'], 'j. M Y, H:i'), 'EVENT_DESC' => (isset($cur_event['desc']) && $cur_event['desc'] != '') ? $cur_event['desc'] : '', @@ -296,7 +295,7 @@ class portal_calendar_module * parse the event time * first check for obvious errors, we don't want to waste server resources */ - if(strlen($event_start_day) < 9 || strlen($event_start_day) > 10 || strlen($event_start_time) < 4 || strlen($event_start_time) > 5) + if(strlen($event_start_day) < 9 || strlen($event_start_day) > 10 || (strlen($event_start_time) < 4 && !$event_all_day) || strlen($event_start_time) > 5) { trigger_error($user->lang['ACP_PORTAL_CALENDAR_START_INCORRECT']. adm_back_link($u_action), E_USER_WARNING); } @@ -310,9 +309,9 @@ class portal_calendar_module $start_colon_pos = strpos($event_start_time, ':', 0); $start_day_length = strlen($event_start_day); $start_time_length = strlen($event_start_time); - $start_year = (int) substr($event_start_day, 0, $first_start_hyphen); + $start_day = (int) substr($event_start_day, 0, $first_start_hyphen); $start_month = (int) substr($event_start_day, $first_start_hyphen + 1, ($second_start_hyphen - $first_start_hyphen - 1)); - $start_day = (int) substr($event_start_day, $second_start_hyphen + 1, $start_day_length - $second_start_hyphen); + $start_year = (int) substr($event_start_day, $second_start_hyphen + 1, $start_day_length - $second_start_hyphen); $start_hour = (int) substr($event_start_time, 0, $start_colon_pos); $start_minute = (int) substr($event_start_time, $start_colon_pos + 1, ($start_time_length - $start_colon_pos) - 1); @@ -323,17 +322,18 @@ class portal_calendar_module $end_colon_pos = strpos($event_end_time, ':', 0); $end_day_length = strlen($event_end_day); $end_time_length = strlen($event_end_time); - $end_year = (int) substr($event_end_day, 0, 4); - $end_month = (int) substr($event_end_day, 5, 2); - $end_day = (int) substr($event_end_day, 8, 2); - $end_hour = (int) substr($event_end_time, 0, 2); - $end_minute = (int) substr($event_end_time, 3, 2); + $end_day = (int) substr($event_end_day, 0, $first_end_hyphen); + $end_month = (int) substr($event_end_day, $first_end_hyphen + 1, ($second_end_hyphen - $first_end_hyphen - 1)); + $end_year = (int) substr($event_end_day, $second_end_hyphen + 1, $end_day_length - $second_end_hyphen); + $end_hour = (int) substr($event_end_time, 0, $end_colon_pos); + $end_minute = (int) substr($event_end_time, $end_colon_pos + 1, ($end_time_length - $end_colon_pos) - 1); } // UNIX timestamps - $start_time = mktime($start_hour, $start_minute, 0, $start_month, $start_day, $start_year); - $end_time = (!$event_all_day) ? mktime($end_hour, $end_minute, 0, $end_month, $end_day, $end_year) : ($start_time - 1); - if($start_time <= time()) + $start_time = mktime($start_hour, $start_minute, 0, $start_month, $start_day, $start_year) - $user->timezone - $user->dst; + $end_time = (!$event_all_day) ? mktime($end_hour, $end_minute, 0, $end_month, $end_day, $end_year) - $user->timezone - $user->dst : ''; + + if(($end_time + $user->timezone + $user->dst) <= time() && !(($start_time + 86400) >= time() && $event_all_day)) { trigger_error($user->lang['ACP_PORTAL_CALENDAR_EVENT_PAST']. adm_back_link($u_action), E_USER_WARNING); } @@ -377,6 +377,7 @@ class portal_calendar_module 'desc' => $event_desc, 'start_time' => $start_time, 'end_time' => $end_time, + 'all_day' => $event_all_day, 'permission' => $event_permission, 'url' => htmlspecialchars_decode($event_url), ); @@ -392,6 +393,7 @@ class portal_calendar_module 'desc' => $event_desc, 'start_time' => $start_time, 'end_time' => $end_time, + 'all_day' => $event_all_day, 'permission' => $event_permission, 'url' => $event_url, // optional ); @@ -444,14 +446,16 @@ class portal_calendar_module // Edit or add menu item case 'edit': case 'add': + $event_all_day = (isset($events[$link_id]['all_day']) && $events[$link_id]['all_day'] == true) ? true : false; + $template->assign_vars(array( 'EVENT_TITLE' => (isset($events[$link_id]['title']) && $action != 'add') ? $events[$link_id]['title'] : '', 'EVENT_DESC' => (isset($events[$link_id]['desc']) && $action != 'add') ? $events[$link_id]['desc'] : '', - 'EVENT_START_DAY' => ($action != 'add') ? $user->format_date($events[$link_id]['start_time'], 'Y-m-d') : '', - 'EVENT_START_TIME' => ($action != 'add') ? $user->format_date($events[$link_id]['start_time'], 'G:i') : '', - 'EVENT_END_DAY' => ($action != 'add' && ($events[$link_id]['start_time'] - $events[$link_id]['end_time']) != true) ? $user->format_date($events[$link_id]['end_time'], 'Y-m-d') : '', - 'EVENT_END_TIME' => ($action != 'add' && ($events[$link_id]['start_time'] - $events[$link_id]['end_time']) != true) ? $user->format_date($events[$link_id]['end_time'], 'G:i') : '', - 'EVENT_ALL_DAY' => (isset($events[$link_id]['start_time']) && ($events[$link_id]['start_time'] - $events[$link_id]['end_time'])) ? true : false, + 'EVENT_START_DAY' => ($action != 'add') ? $user->format_date($events[$link_id]['start_time'] + $user->timezone + $user->dst, 'd-m-Y') : '', + 'EVENT_START_TIME' => ($action != 'add') ? $user->format_date($events[$link_id]['start_time'] + $user->timezone + $user->dst, 'G:i') : '', + 'EVENT_END_DAY' => ($action != 'add' && !$event_all_day) ? $user->format_date($events[$link_id]['end_time'] + $user->timezone + $user->dst, 'd-m-Y') : '', + 'EVENT_END_TIME' => ($action != 'add' && !$event_all_day) ? $user->format_date($events[$link_id]['end_time'] + $user->timezone + $user->dst, 'G:i') : '', + 'EVENT_ALL_DAY' => (isset($events[$link_id]['all_day']) && $events[$link_id]['all_day'] == true) ? true : false, 'EVENT_URL' => (isset($events[$link_id]['url']) && $action != 'add') ? $events[$link_id]['url'] : '', //'U_BACK' => $u_action, @@ -484,15 +488,19 @@ class portal_calendar_module for ($i = 0; $i < sizeof($events); $i++) { + $event_all_day = ($events[$i]['all_day'] == true) ? true : false; + $start_time_format = (!intval($user->format_date($events[$i]['start_time'] + $user->timezone + $user->dst, 'H')) && !intval($user->format_date($events[$i]['start_time'] + $user->timezone + $user->dst, 'i'))) ? 'j. M Y' : 'j. M Y, H:i'; + $end_time_format = (!intval($user->format_date($events[$i]['end_time'] + $user->timezone + $user->dst, 'H')) && !intval($user->format_date($events[$i]['end_time'] + $user->timezone + $user->dst, 'i'))) ? 'j. M Y' : 'j. M Y, H:i'; + $template->assign_block_vars('events', array( 'EVENT_TITLE' => ($action != 'add') ? ((isset($user->lang[$events[$i]['title']])) ? $user->lang[$events[$i]['title']] : $events[$i]['title']) : '', 'EVENT_DESC' => ($action != 'add') ? $events[$i]['desc'] : '', - 'EVENT_START' => ($action != 'add') ? $user->format_date($events[$i]['start_time'], 'j. M Y, H:i') : '', - 'EVENT_END' => ($action != 'add' && ($events[$i]['start_time'] - $events[$i]['end_time']) != 1) ? $user->format_date($events[$i]['end_time'], 'j. M Y, H:i') : '', + 'EVENT_START' => ($action != 'add') ? $user->format_date($events[$i]['start_time'] + $user->timezone + $user->dst, $start_time_format) : '', + 'EVENT_END' => ($action != 'add' && !$event_all_day) ? $user->format_date($events[$i]['end_time'] + $user->timezone + $user->dst, $end_time_format) : '', 'EVENT_URL' => ($action != 'add' && isset($events[$i]['url']) && !empty($events[$i]['url'])) ? str_replace('&', '&', $events[$i]['url']) : '', 'U_EDIT' => $u_action . '&action=edit&id=' . $i, 'U_DELETE' => $u_action . '&action=delete&id=' . $i, - 'EVENT_ALL_DAY' => ($events[$i]['end_time'] - $events[$i]['start_time']) ? true : false, + 'EVENT_ALL_DAY' => $event_all_day, )); } diff --git a/root/styles/prosilver/template/portal/modules/calendar_side.html b/root/styles/prosilver/template/portal/modules/calendar_side.html index 71991742..6d507da4 100644 --- a/root/styles/prosilver/template/portal/modules/calendar_side.html +++ b/root/styles/prosilver/template/portal/modules/calendar_side.html @@ -38,7 +38,7 @@
{cur_events.EVENT_TITLE}:
- {L_EVENT_TIME}: {cur_events.START_TIME}
+ {L_EVENT_START}: {cur_events.START_TIME}
{L_EVENT_ALL_DAY}
{L_EVENT_START}: {cur_events.START_TIME}
{L_EVENT_END}: {cur_events.END_TIME}
{L_EVENT_ALL_DAY}
@@ -48,7 +48,7 @@ -
  • {L_NO_CUR_EVENTS}
  • +
  • {L_NO_CUR_EVENTS}

  • @@ -70,7 +70,7 @@ -
  • {L_NO_UPCOMING_EVENTS}
  • +
  • {L_NO_UPCOMING_EVENTS}
  • diff --git a/root/styles/prosilver/theme/portal.css b/root/styles/prosilver/theme/portal.css index d6c59910..e8fce8ed 100644 --- a/root/styles/prosilver/theme/portal.css +++ b/root/styles/prosilver/theme/portal.css @@ -20,33 +20,37 @@ span.portal-corners-top-inner, span.portal-corners-bottom-inner{ /* main menu, user menu and the links */ .portal-navigation{ -width: auto; + width: auto; } .portal-navigation ul{ -list-style-type: none; -margin: 0; -padding: 0; -margin-bottom: 8px; /*bottom spacing between each UL and rest of content*/ + list-style-type: none; + margin: 0; + padding: 0; + margin-bottom: 8px; /*bottom spacing between each UL and rest of content*/ } .portal-navigation ul li{ -padding-bottom: 2px; /*bottom spacing between menu items*/ + padding-bottom: 2px; /*bottom spacing between menu items*/ } .portal-navigation ul li a{ -background-image: url("{T_THEME_PATH}/images/portal/arrowbullet.gif"); -background-repeat: no-repeat; -background-position: center left; /*custom bullet list image*/ -display: block; -padding: 2px 0; -padding-left: 19px; /*link text is indented 19px*/ -font-weight: bold; -font-size: 90%; + background-image: url("{T_THEME_PATH}/images/portal/arrowbullet.gif"); + background-repeat: no-repeat; + background-position: center left; /*custom bullet list image*/ + display: block; + padding: 2px 0; + padding-left: 19px; /*link text is indented 19px*/ + font-weight: bold; + font-size: 90%; } .portal-navigation div.menutitle{ -padding: 1px 0; -font: bold 90% 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif; -font-size: 12px; + padding: 1px 0; + font: bold 90% 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif; + font-size: 12px; +} + +.calendar-info { + list-style-type: none; } \ No newline at end of file