From 4f6db20ae479576b221bc5269ef6734e9c869c6a Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 13:03:25 +0100 Subject: [PATCH 1/6] fix shift view bars --- includes/view/Shifts_view.php | 6 ++++-- public/css/theme4.css | 4 +++- themes/theme4.less | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 885d1ad9..fbd71d54 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -81,7 +81,7 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt ]), div('col-sm-3 col-xs-6', [ '

' . _('Location') . '

', - '

' . glyph('map-marker') . $room['Name'] . '

' + '

' . Room_name_render($room) . '

' ]) ]), div('row', [ @@ -113,7 +113,9 @@ function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shi $needed_angels .= '
' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '
'; $needed_angels .= '

' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '

'; - $needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']); + $bar_max = max($needed_angeltype['count']*10, $needed_angeltype['taken']*10, 10); + $bar_value = max(1, $needed_angeltype['taken'] * 10); + $needed_angels .= progress_bar(0, $bar_max, $bar_value, $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']); $angels = []; foreach ($shift['ShiftEntry'] as $shift_entry) { diff --git a/public/css/theme4.css b/public/css/theme4.css index f4ff0d7b..4e641efb 100644 --- a/public/css/theme4.css +++ b/public/css/theme4.css @@ -7027,6 +7027,8 @@ a.thumbnail.active { color: #fff; } .label-warning, -.label-success { +.label-success, +.progress-bar-warning, +.progress-bar-success { color: #222222; } diff --git a/themes/theme4.less b/themes/theme4.less index 6e221bc1..750a35cc 100644 --- a/themes/theme4.less +++ b/themes/theme4.less @@ -1046,6 +1046,6 @@ a.thumbnail.active { } } -.label-warning, .label-success { +.label-warning, .label-success, .progress-bar-warning, .progress-bar-success { color: @gray-darker; } From a8bcb19eaad798a6441a29e58f9c03ae84de4fc5 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 13:06:05 +0100 Subject: [PATCH 2/6] fix shift view bars --- includes/sys_template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/sys_template.php b/includes/sys_template.php index d2247062..3679328b 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -33,7 +33,7 @@ function label($content, $class = 'default') { } function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = '') { - return '
' . $content . '
'; + return '
' . $content . '
'; } /** From bae3ede662426d362a3b9d33d9124253af7e847b Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 13:38:16 +0100 Subject: [PATCH 3/6] fixes #279 fix exporting freeload comment in json export --- includes/controller/shifts_controller.php | 23 ++++++----------------- includes/model/Shifts_model.php | 4 +++- includes/model/User_model.php | 2 +- includes/pages/user_atom.php | 3 --- includes/pages/user_ical.php | 3 --- includes/view/ShiftTypes_view.php | 1 + 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 1500b449..1e04c5a8 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -1,6 +1,6 @@ parse($shifttype['description']) ]); } From 476d1daeb76306faf3ecd70f2afc8e29e98b9553 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 13:58:43 +0100 Subject: [PATCH 4/6] fixes #280 shift entries finished by user returns no freeloaded shifts --- includes/model/ShiftEntry_model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 99f67028..dca7e1c1 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -115,6 +115,7 @@ function ShiftEntries_finished_by_user($user) { JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id` WHERE `ShiftEntry`.`UID`=" . sql_escape($user['UID']) . " AND `Shifts`.`end` < " . sql_escape(time()) . " + AND `ShiftEntry`.`freeloaded` = 0 ORDER BY `Shifts`.`end` "); } From 34248bb20cb3102fbcff76fcd7e059c12d87a6c3 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 14:27:47 +0100 Subject: [PATCH 5/6] show freeload comments to supporters (user shift admin) --- includes/controller/users_controller.php | 2 +- includes/model/Shifts_model.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index 33abe764..26ca8d00 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -151,7 +151,7 @@ function user_controller() { } } - $shifts = Shifts_by_user($user_source); + $shifts = Shifts_by_user($user_source, in_array("user_shifts_admin", $privileges)); foreach ($shifts as &$shift) { // TODO: Move queries to model $shift['needed_angeltypes'] = sql_select("SELECT DISTINCT `AngelTypes`.* FROM `ShiftEntry` JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id` WHERE `ShiftEntry`.`SID`='" . sql_escape($shift['SID']) . "' ORDER BY `AngelTypes`.`name`"); diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 67580eee..b1d4ca5e 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -261,10 +261,11 @@ function Shift_create($shift) { /** * Return users shifts. */ -function Shifts_by_user($user) { +function Shifts_by_user($user, $include_freeload_comments = false) { $result = sql_select(" SELECT `ShiftTypes`.`id` as `shifttype_id`, `ShiftTypes`.`name`, `ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`, + " . ($include_freeload_comments ? "`ShiftEntry`.`freeload_comment`, " : "") . " `Shifts`.*, `Room`.* FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) From 561e8ec36c50b2ace9fe7352dfb4e11f57d0e82e Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 25 Nov 2016 14:55:19 +0100 Subject: [PATCH 6/6] better msg placement on angeltype view --- includes/view/AngelTypes_view.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index a48f8d4c..04c0e286 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -49,7 +49,7 @@ function AngelType_delete_view($angeltype) { /** * Render angeltype edit form. - * + * * @param Angeltype $angeltype * The angeltype to edit * @param boolean $supporter_mode @@ -193,8 +193,8 @@ function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes) */ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $supporter, $user_driver_license, $user) { $page = [ - msg(), - AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user) + AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user), + msg() ]; $page[] = '

' . _("Description") . '

';