From a0ec26126e6c1872239d5c1621272b5b6a3ba0df Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Thu, 27 Dec 2012 21:24:44 +0100 Subject: fix duplicating user angel types --- includes/pages/user_shifts.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index fadcc905..7eaf8140 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -235,7 +235,7 @@ function user_shifts() { $comment = strip_request_item_nl('comment'); sql_query("INSERT INTO `ShiftEntry` SET `Comment`='" . sql_escape($comment) . "', `UID`=" . sql_escape($user_id) . ", `TID`=" . sql_escape($selected_type_id) . ", `SID`=" . sql_escape($shift_id)); - if (sql_num_query("SELECT * FROM `UserAngelTypes` INNER JOIN `AngelTypes` ON `AngelTypes`.`id` = `UserAngelTypes`.`angeltype_id` WHERE `AngelTypes`.`restricted` = 0 AND `user_id` = '" . sql_escape($user_id) . "' AND `angeltype_id` = '" . sql_escape($selected_type_id) . "'") == 0) + if ($type['restricted'] == 0 && sql_num_query("SELECT * FROM `UserAngelTypes` INNER JOIN `AngelTypes` ON `AngelTypes`.`id` = `UserAngelTypes`.`angeltype_id` WHERE `angeltype_id` = '" . sql_escape($selected_type_id) . "' AND `user_id` = '" . sql_escape($user_id) . "' ") == 0) sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ('" . sql_escape($user_id) . "', '" . sql_escape($selected_type_id) . "')"); $user_source = User($user_id); @@ -458,7 +458,7 @@ function view_user_shifts() { $user_may_join_shift &= isset($angeltype['confirm_user_id']); // you can only join if the shift is in future or running - $user_may_join_shift &= time() < $shift['end']; + $user_may_join_shift &= time() < $shift['start']; // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); @@ -574,7 +574,7 @@ function view_user_shifts() { $user_may_join_shift &= isset($angeltype['confirm_user_id']); // you can only join if the shift is in future or running - $user_may_join_shift &= time() < $shift['end']; + $user_may_join_shift &= time() < $shift['start']; // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); -- cgit v1.2.3-54-g00ecf From 13747c62fd9575ac1ed764c3dc33d34459321840 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 27 Dec 2012 22:46:41 +0100 Subject: more CSS an JS voodoo for bugblues table view --- includes/pages/user_shifts.php | 31 ++++++++++++++++++------------- public/css/base.css | 29 +++++++++++++++++++++++++---- public/css/scrolltable.js | 26 ++++++++++++++++++++++++++ templates/layout.html | 1 + templates/user_shifts.html | 3 ++- 5 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 public/css/scrolltable.js (limited to 'includes/pages') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 7eaf8140..9ed566f8 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -324,6 +324,11 @@ function view_user_shifts() { $_SESSION['user_shifts'][$key] = array_map('get_ids_from_array', $$key); } + if (!isset($_REQUEST['new_style'])) + $_SESSION['user_shifts']['new_style'] = false; + else + $_SESSION['user_shifts']['new_style'] = true; + if (isset ($_REQUEST['days'])) { $filtered = array_filter($_REQUEST['days'], create_function('$a', 'return preg_match("/^\d\d\d\d-\d\d-\d\d\\$/", $a);')); if (!empty ($filtered)) @@ -343,7 +348,6 @@ function view_user_shifts() { ORDER BY `start`"); $shifts_table = ""; - $row_count = 0; //qqqq /* [0] => Array @@ -358,7 +362,7 @@ function view_user_shifts() { [room_name] => test1 ) */ - if(count($_SESSION['user_shifts']['days'])==1) { + if(count($_SESSION['user_shifts']['days'])==1 && $_SESSION['user_shifts']['new_style']) { $myrooms=$rooms; foreach($myrooms as $k => $v) { if(array_search($v["id"],$_SESSION['user_shifts']['rooms'])===FALSE) @@ -380,7 +384,7 @@ function view_user_shifts() { } } } - $shifts_table=""; + $shifts_table="
-
"; foreach($myrooms as $room) { $rid=$room["id"]; $colspan=1; @@ -390,7 +394,7 @@ function view_user_shifts() { $todo[$rid][$i]=$colspan; $shifts_table.="\n"; } - $shifts_table.=""; + $shifts_table.=""; for($i=0;$i<24*4;$i++) { $thistime=$first+($i*15*60); if($thistime%(60*60)==0) { @@ -486,13 +490,13 @@ function view_user_shifts() { $shifts_row .= 'Weitere Helfer eintragen »'; } } - $color=""; - if($is_free) { - $color="style=\"background: #F6CECE\";"; - } else { - $color="style=\"background: #BCF5A9\";"; - } - $shifts_table.="'; + $shifts_table.=''; $todo[$rid][$i]--; } } $shifts_table.="\n"; } - $shifts_table.="
-".$room['name']."
"; + if ($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) + $style='background-color: #F6CECE'; + elseif (!$is_free && in_array(1, $_SESSION['user_shifts']['filled'])) + $style='background-color: #BCF5A9'; + else + $style='border: 0'; + $shifts_table.=""; if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (!$is_free && in_array(1, $_SESSION['user_shifts']['filled']))) { $shifts_table.=$shifts_row; } @@ -504,13 +508,13 @@ function view_user_shifts() { } } while($todo[$rid][$i]) { - $shifts_table.='
"; + $shifts_table.=''; // qqq } else { $shifts_table = array(); @@ -623,6 +627,7 @@ function view_user_shifts() { 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", ucfirst(Get_Text("tasks")) . '1'), 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", ucfirst(Get_Text("occupancy"))), 'task_notice' => '1' . Get_Text("pub_schichtplan_tasks_notice"), + 'new_style_checkbox' => '', 'shifts_table' => $shifts_table, 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), make_user_shifts_ical_link($user['ical_key']), page_link_to('user_myshifts') . '&reset'), 'filter' => ucfirst(Get_Text("to_filter")), diff --git a/public/css/base.css b/public/css/base.css index 3e2d8520..b6e75ac1 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -4,10 +4,8 @@ } body { - font-family: Arial; - sans-serif; - font-size: - 14px; + font-family: Arial, sans-serif; + font-size: 14px; } header { @@ -107,6 +105,29 @@ a.sprache img { table { border-collapse: collapse; margin-top: 5px; + display: block; +} + +table.scrollable { + max-width: 100%; + overflow-x: scroll; + overflow-y: hidden; +} + +table.scrollable thead tr { + display: block; + position: relative; +} + +table.scrollable tbody { + display: block; + position: relative; + overflow-x: hidden; + overflow-y: auto; +} + +table.scrollable tbody * { + width: auto; } fieldset hr { diff --git a/public/css/scrolltable.js b/public/css/scrolltable.js new file mode 100644 index 00000000..1184207f --- /dev/null +++ b/public/css/scrolltable.js @@ -0,0 +1,26 @@ +function scrolltable(elem) { + var widths = new Array(); + var thead = elem.getElementsByTagName('thead')[0]; + var tbody = elem.getElementsByTagName('tbody')[0]; + var ths = Array.prototype.slice.call(thead.getElementsByTagName('th'),0); + ths = ths.concat(Array.prototype.slice.call(tbody.getElementsByTagName('tr')[0].getElementsByTagName('td'), 0)); + ths.push(tbody.getElementsByTagName('th')[0]); + console.debug(ths); + for(var i = 0; i < ths.length; i++) + widths.push(ths[i].offsetWidth); + widths.push(tbody.offsetWidth); + elem.className = elem.className + ' scrollable'; + var tbodywidth = widths.pop(); + tbody.style.width = (tbodywidth + 16) + 'px'; + tbody.style.height = (window.innerHeight - 50) + 'px'; + for(var i = 0; i < ths.length; i++) { + var paddingLeft = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-left')); + var paddingRight = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-right')); + var borderLeft = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('border-left-width')); + var borderRight = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('border-right-width')); + var targetwidth = widths.shift(); + ths[i].style.maxWidth = ths[i].style.minWidth = (targetwidth - paddingLeft - paddingRight - borderRight) + 'px'; + if (ths[i].offsetWidth > targetwidth) + ths[i].style.maxWidth = ths[i].style.minWidth = (parseInt(ths[i].style.minWidth) - 1) + 'px'; + } +} diff --git a/templates/layout.html b/templates/layout.html index f6d19c6f..f47d3693 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -12,6 +12,7 @@ + %atom_link% diff --git a/templates/user_shifts.html b/templates/user_shifts.html index e25c5862..927f3cca 100644 --- a/templates/user_shifts.html +++ b/templates/user_shifts.html @@ -1,4 +1,4 @@ -
+
Filter %room_select% @@ -6,6 +6,7 @@ %day_select% %filled_select%
%task_notice%
+
%new_style_checkbox%
-- cgit v1.2.3-54-g00ecf From dd5ca95975d368d3fb1bbf9cca422222049242aa Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 27 Dec 2012 22:49:10 +0100 Subject: fixes for last commit --- includes/pages/user_shifts.php | 6 +++--- public/css/base.css | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 9ed566f8..bc2e392d 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -60,9 +60,9 @@ function user_shifts() { // Benötigte Engeltypen vom Raum $needed_angel_types_source = sql_select("SELECT `AngelTypes`.*, `NeededAngelTypes`.`count` FROM `AngelTypes` LEFT JOIN `NeededAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id` AND `NeededAngelTypes`.`room_id`=" . sql_escape($shift['RID']) . ") ORDER BY `AngelTypes`.`name`"); foreach ($needed_angel_types_source as $type) { - if($type['count'] != "") + if($type['count'] != "") $needed_angel_types[$type['id']] =$type['count']; - } + } // Benötigte Engeltypen von der Schicht $needed_angel_types_source = sql_select("SELECT `AngelTypes`.*, `NeededAngelTypes`.`count` FROM `AngelTypes` LEFT JOIN `NeededAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id` AND `NeededAngelTypes`.`shift_id`=" . sql_escape($shift_id) . ") ORDER BY `AngelTypes`.`name`"); @@ -384,7 +384,7 @@ function view_user_shifts() { } } } - $shifts_table=""; + $shifts_table="
-
"; foreach($myrooms as $room) { $rid=$room["id"]; $colspan=1; diff --git a/public/css/base.css b/public/css/base.css index b6e75ac1..6bcb95d1 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -108,6 +108,10 @@ table { display: block; } +#shifts { + background-color: #fff; +} + table.scrollable { max-width: 100%; overflow-x: scroll; -- cgit v1.2.3-54-g00ecf From 378d524fbd7687e577f5e9c4be5e0726435b2bad Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Fri, 28 Dec 2012 03:27:08 +0100 Subject: polished the table view by offloading "is this shift free" to SQL. Might put too much load on db server, need to evaluate. Also, replaced loads of & with & and simplified some expressions --- db/update.d/22_shifts.php | 5 +++ includes/pages/user_shifts.php | 90 ++++++++++++++++++++++++------------------ public/css/base.css | 14 +++++++ public/css/scrolltable.js | 2 +- 4 files changed, 71 insertions(+), 40 deletions(-) create mode 100644 db/update.d/22_shifts.php (limited to 'includes/pages') diff --git a/db/update.d/22_shifts.php b/db/update.d/22_shifts.php new file mode 100644 index 00000000..3055c778 --- /dev/null +++ b/db/update.d/22_shifts.php @@ -0,0 +1,5 @@ + 0 AS 'has_special_needs' + FROM `Shifts` + INNER JOIN `Room` USING (`RID`) + LEFT JOIN (SELECT COUNT(*) AS special_needs , nat3.`shift_id` FROM `NeededAngelTypes` AS nat3 WHERE `shift_id` IS NOT NULL GROUP BY nat3.`shift_id`) AS nat2 ON nat2.`shift_id` = `Shifts`.`SID` + INNER JOIN `NeededAngelTypes` AS nat ON nat.`count` != 0 AND ((nat2.`special_needs` > 0 AND nat.`shift_id` = `Shifts`.`SID`) OR ((nat2.`special_needs` = 0 OR nat2.`special_needs` IS NULL) AND nat.`room_id` = `RID`)) + LEFT JOIN (SELECT se.`SID`, se.`TID`, COUNT(*) as count FROM `ShiftEntry` AS se GROUP BY se.`SID`, se.`TID`) AS entries ON entries.`SID` = `Shifts`.`SID` AND entries.`TID` = nat.`angel_type_id` WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ") - AND DATE(FROM_UNIXTIME(`start`)) IN ('" . implode("','", $_SESSION['user_shifts']['days']) . "') - ORDER BY `start`"); + AND DATE(FROM_UNIXTIME(`start`)) IN ('" . implode("','", $_SESSION['user_shifts']['days']) . "') "; + if (count($_SESSION['user_shifts']['filled']) == 1) { + if ($_SESSION['user_shifts']['filled'][0] == 0) + $SQL .= " + AND NOT (nat.`count` <= entries.`count`) "; + elseif ($_SESSION['user_shifts']['filled'][0] == 1) + $SQL .= " + AND (nat.`count` <= entries.`count`) "; + } + $SQL .= " + ORDER BY `start`"; + $shifts = sql_select($SQL); $shifts_table = ""; //qqqq @@ -360,6 +375,8 @@ function view_user_shifts() { [URL] => [PSID] => [room_name] => test1 + [has_special_needs] => 1 + [is_full] => 0 ) */ if(count($_SESSION['user_shifts']['days'])==1 && $_SESSION['user_shifts']['new_style']) { @@ -372,10 +389,13 @@ function view_user_shifts() { $last=date("U",strtotime($_SESSION['user_shifts']['days'][0]." 23:59:59")); $maxshow=24*4; $block=array(); + $todo=array(); foreach($myrooms as $room) { $rid=$room["id"]; + $block[$rid] = array_fill(0, $maxshow, 0); foreach($shifts as $shift) { if($shift["RID"]==$rid) { + // calculate number of parallel shifts in each timeslot for one room $blocks=($shift["end"]-$shift["start"])/(15*60); $firstblock=floor(($shift["start"]-$first)/(15*60)); for($i=$firstblock;$i<$blocks+$firstblock && $i < $maxshow;$i++) { @@ -387,15 +407,14 @@ function view_user_shifts() { $shifts_table="
-
"; foreach($myrooms as $room) { $rid=$room["id"]; - $colspan=1; - if(is_array($block[$rid])) - foreach($block[$rid] as $max) if($max>$colspan) $colspan=$max; - for($i=0;$i<$maxshow;$i++) - $todo[$rid][$i]=$colspan; - $shifts_table.="\n"; + $colspan = call_user_func_array('max', $block[$rid]); + if($colspan == 0) + $colspan = 1; + $todo[$rid] = array_fill(0, $maxshow, $colspan); + $shifts_table.=" 1)? ' colspan="' . $colspan . '"' : '') . ">${room['name']}\n"; } $shifts_table.=""; - for($i=0;$i<24*4;$i++) { + for($i=0;$i<$maxshow;$i++) { $thistime=$first+($i*15*60); if($thistime%(60*60)==0) { $shifts_table.=""; @@ -413,22 +432,22 @@ function view_user_shifts() { $is_free = false; $shifts_row = $shift['name']; if (in_array('admin_shifts', $privileges)) - $shifts_row .= ' [edit][x]'; + $shifts_row .= ' [edit][x]'; $shifts_row.= '
'; - $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); $query = "SELECT `NeededAngelTypes`.`count`, `AngelTypes`.`id`, `AngelTypes`.`restricted`, `UserAngelTypes`.`confirm_user_id`, `AngelTypes`.`name`, `UserAngelTypes`.`user_id` FROM `NeededAngelTypes` JOIN `AngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`) LEFT JOIN `UserAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `UserAngelTypes`.`angeltype_id`AND `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . ") - WHERE "; - if ($shift_has_special_needs) + WHERE + `count` > 0 + AND "; + if ($shift['has_special_needs']) $query .= "`shift_id` = " . sql_escape($shift['SID']); else $query .= "`room_id` = " . sql_escape($shift['RID']); - $query .= " AND `count` > 0 "; if (!empty($_SESSION['user_shifts']['types'])) - $query .= "AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") "; - $query .= "ORDER BY `AngelTypes`.`name`"; + $query .= " AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") "; + $query .= " ORDER BY `AngelTypes`.`name`"; $angeltypes = sql_select($query); if (count($angeltypes) > 0) { @@ -442,7 +461,7 @@ function view_user_shifts() { else $style="font-weight:normal;"; if (in_array('user_shifts_admin', $privileges)) - $entry_list[] = "" . '' . $entry['Nick'] . ' [x]'; + $entry_list[] = "" . '' . $entry['Nick'] . ' [x]'; else $entry_list[] = "" . $entry['Nick'].""; } @@ -451,7 +470,7 @@ function view_user_shifts() { // is the shift still running or alternatively is the user shift admin? $user_may_join_shift = true; - /* you cannot join if user already joined this shift */ + // you cannot join if user already joined this shift $user_may_join_shift &= !$my_shift; // you cannot join if user is not of this angel type @@ -467,7 +486,7 @@ function view_user_shifts() { // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); if ($user_may_join_shift) - $entry_list[] = '' . $inner_text . ' »'; + $entry_list[] = '' . $inner_text . ' »'; else { if(time() > $shift['end']) { $entry_list[] = $inner_text . ' (vorbei)'; @@ -487,30 +506,23 @@ function view_user_shifts() { $shifts_row .= '
'; } if (in_array('user_shifts_admin', $privileges)) { - $shifts_row .= 'Weitere Helfer eintragen »'; + $shifts_row .= 'Weitere Helfer eintragen »'; } } - if ($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) - $style='background-color: #F6CECE'; - elseif (!$is_free && in_array(1, $_SESSION['user_shifts']['filled'])) - $style='background-color: #BCF5A9'; - else - $style='border: 0'; - $shifts_table.=""; - for($j=0;$j<$blocks;$j++) { + for($j=0;$j<$blocks&& $i+$j < $maxshow;$j++) { $todo[$rid][$i+$j]--; } } } } - while($todo[$rid][$i]) { - $shifts_table.=''; - $todo[$rid][$i]--; - } + // fill up row with empty '; } $shifts_table.="\n"; } @@ -532,7 +544,7 @@ function view_user_shifts() { ); if (in_array('admin_shifts', $privileges)) - $shift_row['entries'] .= ' [edit][x]'; + $shift_row['entries'] .= ' [edit][x]'; $shift_row['entries'] .= '
'; $is_free = false; $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); @@ -545,7 +557,7 @@ function view_user_shifts() { $query .= "`shift_id` = " . sql_escape($shift['SID']); else $query .= "`room_id` = " . sql_escape($shift['RID']); - $query .= " AND `count` > 0 "; + $query .= " AND `count` > 0 "; if (!empty($_SESSION['user_shifts']['types'])) $query .= "AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") "; $query .= "ORDER BY `AngelTypes`.`name`"; @@ -557,7 +569,7 @@ function view_user_shifts() { $entry_list = array (); foreach ($entries as $entry) { if (in_array('user_shifts_admin', $privileges)) - $entry_list[] = '' . $entry['Nick'] . '[x]'; + $entry_list[] = '' . $entry['Nick'] . '[x]'; else $entry_list[] = $entry['Nick']; } @@ -583,7 +595,7 @@ function view_user_shifts() { // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); if ($user_may_join_shift) - $entry_list[] = '' . $inner_text . ' »'; + $entry_list[] = '' . $inner_text . ' »'; else { if(time() > $shift['end']) { $entry_list[] = $inner_text . ' (vorbei)'; @@ -603,7 +615,7 @@ function view_user_shifts() { $shift_row['entries'] .= '
'; } if (in_array('user_shifts_admin', $privileges)) { - $shift_row['entries'] .= 'Weitere Helfer eintragen »'; + $shift_row['entries'] .= 'Weitere Helfer eintragen »'; } if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (!$is_free && in_array(1, $_SESSION['user_shifts']['filled']))) { $shifts_table[] = $shift_row; @@ -629,7 +641,7 @@ function view_user_shifts() { 'task_notice' => '1' . Get_Text("pub_schichtplan_tasks_notice"), 'new_style_checkbox' => '', 'shifts_table' => $shifts_table, - 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), make_user_shifts_ical_link($user['ical_key']), page_link_to('user_myshifts') . '&reset'), + 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_ical_link($user['ical_key'])), page_link_to('user_myshifts') . '&reset'), 'filter' => ucfirst(Get_Text("to_filter")), )); } diff --git a/public/css/base.css b/public/css/base.css index 6bcb95d1..0f37c8f0 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -112,6 +112,18 @@ table { background-color: #fff; } +#shifts td.free { + background-color: #F6CECE; +} + +#shifts td.occupied { + background-color: #BCF5A9; +} + +#shifts td:not(.free):not(.occupied) { + border: 0; +} + table.scrollable { max-width: 100%; overflow-x: scroll; @@ -170,6 +182,8 @@ fieldset p label input { th { background: #f0f0f0; +} +thead th { vertical-align: bottom; } diff --git a/public/css/scrolltable.js b/public/css/scrolltable.js index 1184207f..1319495c 100644 --- a/public/css/scrolltable.js +++ b/public/css/scrolltable.js @@ -12,7 +12,7 @@ function scrolltable(elem) { elem.className = elem.className + ' scrollable'; var tbodywidth = widths.pop(); tbody.style.width = (tbodywidth + 16) + 'px'; - tbody.style.height = (window.innerHeight - 50) + 'px'; + tbody.style.height = (window.innerHeight - 100) + 'px'; for(var i = 0; i < ths.length; i++) { var paddingLeft = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-left')); var paddingRight = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-right')); -- cgit v1.2.3-54-g00ecf From cc8f117ed128cf9b046f9835640b84362d151883 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Fri, 28 Dec 2012 03:53:08 +0100 Subject: fix remembering of new-style-setting and fix a bug with signing up for shifts after they startet --- includes/pages/user_shifts.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 8ed0662a..a074ab77 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -324,9 +324,13 @@ function view_user_shifts() { $_SESSION['user_shifts'][$key] = array_map('get_ids_from_array', $$key); } - if (!isset($_REQUEST['new_style'])) - $_SESSION['user_shifts']['new_style'] = false; - else + if (isset($_REQUEST['rooms'])) { + if (isset($_REQUEST['new_style'])) + $_SESSION['user_shifts']['new_style'] = true; + else + $_SESSION['user_shifts']['new_style'] = false; + } + if (!isset ($_SESSION['user_shifts']['new_style'])) $_SESSION['user_shifts']['new_style'] = true; if (isset ($_REQUEST['days'])) { @@ -488,7 +492,7 @@ function view_user_shifts() { if ($user_may_join_shift) $entry_list[] = '' . $inner_text . ' »'; else { - if(time() > $shift['end']) { + if(time() > $shift['start']) { $entry_list[] = $inner_text . ' (vorbei)'; } elseif($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && !isset($angeltype['confirm_user_id'])) { $entry_list[] = $inner_text . ' unconfirmed'; -- cgit v1.2.3-54-g00ecf
-".$room['name']."
".date("H:i",$thistime)." "; + $shifts_table.=''; if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (!$is_free && in_array(1, $_SESSION['user_shifts']['filled']))) { $shifts_table.=$shifts_row; } $shifts_table.=" + while($todo[$rid][$i]--) + $shifts_table.='