From: Nik Okuntseff Date: Fri, 2 Feb 2018 18:47:33 +0000 (+0000) Subject: Started to work on week view config. X-Git-Tag: timetracker_1.19-1~1253 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f2787a0b448c84ee7b28de80f6c2f04dfc7985ad;p=timetracker.git Started to work on week view config. --- diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 041db203..bba76303 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -260,11 +260,7 @@ $i18n_key_words = array( // 'title.delete_predefined_expense' => 'Deleting Predefined Expense', 'title.reports' => 'Informes', 'title.report' => 'Informe', - - - -// TODO: refactoring ongoing down from here. - +// TODO: translate the following. // 'title.send_report' => 'Sending Report', // 'title.invoice' => 'Invoice', // 'title.send_invoice' => 'Sending Invoice', @@ -309,6 +305,11 @@ $i18n_key_words = array( // NOTE TO TRANSLATORS: Locking is a feature to lock records from modifications (ex: weekly on Mondays we lock all previous weeks). // It is also a name for the Locking plugin on the Team profile page. // 'title.locking' => 'Locking', +// 'title.week_view' => 'Week View', + + + +// TODO: refactoring ongoing down from here. // Section for common strings inside combo boxes on forms. Strings shared between forms shall be placed here. // Strings that are used in a single form must go to the specific form section. diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index 94f19b77..71c9cf72 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -267,6 +267,51 @@ $i18n_key_words = array( 'title.reports' => 'Sestavy', // TODO: translate the following. // 'title.report' => 'Report', +// 'title.send_report' => 'Sending Report', +// 'title.invoice' => 'Invoice', +// 'title.send_invoice' => 'Sending Invoice', +// 'title.charts' => 'Charts', +// 'title.projects' => 'Projects', +// 'title.add_project' => 'Adding Project', +// 'title.edit_project' => 'Editing Project', +// 'title.delete_project' => 'Deleting Project', +// 'title.tasks' => 'Tasks', +// 'title.add_task' => 'Adding Task', +// 'title.edit_task' => 'Editing Task', +// 'title.delete_task' => 'Deleting Task', +// 'title.users' => 'Users', +// 'title.add_user' => 'Adding User', +// 'title.edit_user' => 'Editing User', +// 'title.delete_user' => 'Deleting User', +// 'title.clients' => 'Clients', +// 'title.add_client' => 'Adding Client', +// 'title.edit_client' => 'Editing Client', +// 'title.delete_client' => 'Deleting Client', +// 'title.invoices' => 'Invoices', +// 'title.add_invoice' => 'Adding Invoice', +// 'title.view_invoice' => 'Viewing Invoice', +// 'title.delete_invoice' => 'Deleting Invoice', +// 'title.notifications' => 'Notifications', +// 'title.add_notification' => 'Adding Notification', +// 'title.edit_notification' => 'Editing Notification', +// 'title.delete_notification' => 'Deleting Notification', +// 'title.monthly_quotas' => 'Monthly Quotas', +// 'title.export' => 'Exporting Team Data', +// 'title.import' => 'Importing Team Data', +// 'title.options' => 'Options', +// 'title.profile' => 'Profile', +// 'title.cf_custom_fields' => 'Custom Fields', +// 'title.cf_add_custom_field' => 'Adding Custom Field', +// 'title.cf_edit_custom_field' => 'Editing Custom Field', +// 'title.cf_delete_custom_field' => 'Deleting Custom Field', +// 'title.cf_dropdown_options' => 'Dropdown Options', +// 'title.cf_add_dropdown_option' => 'Adding Option', +// 'title.cf_edit_dropdown_option' => 'Editing Option', +// 'title.cf_delete_dropdown_option' => 'Deleting Option', +// NOTE TO TRANSLATORS: Locking is a feature to lock records from modifications (ex: weekly on Mondays we lock all previous weeks). +// It is also a name for the Locking plugin on the Team profile page. +// 'title.locking' => 'Locking', +// 'title.week_view' => 'Week View', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 040e5d35..65f27e76 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -278,6 +278,8 @@ $i18n_key_words = array( 'title.cf_edit_dropdown_option' => 'Redigér Mulighed', 'title.cf_delete_dropdown_option' => 'Slet Mulighed', 'title.locking' => 'Lås Registring', +// TODO: translate the following. +// 'title.week_view' => 'Week View', // Section for common strings inside combo boxes on forms. Strings shared between forms shall be placed here. // Strings that are used in a single form must go to the specific form section. diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index b7d3fbca..042bae90 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -269,6 +269,8 @@ $i18n_key_words = array( 'title.cf_edit_dropdown_option' => 'Auswahlmöglichkeit bearbeiten', 'title.cf_delete_dropdown_option' => 'Auswahlmöglichkeit löschen', 'title.locking' => 'Sperren', +// TODO: translate the following. +// 'title.week_view' => 'Week View', // Section for common strings inside combo boxes on forms. Strings shared between forms shall be placed here. // Strings that are used in a single form must go to the specific form section. diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index e895ceb2..f8bf112d 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -275,6 +275,7 @@ $i18n_key_words = array( // NOTE TO TRANSLATORS: Locking is a feature to lock records from modifications (ex: weekly on Mondays we lock all previous weeks). // It is also a name for the Locking plugin on the Team profile page. 'title.locking' => 'Locking', +'title.week_view' => 'Week View', // Section for common strings inside combo boxes on forms. Strings shared between forms shall be placed here. // Strings that are used in a single form must go to the specific form section. diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index 350b67d5..97b4386f 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -317,6 +317,7 @@ $i18n_key_words = array( // NOTE TO TRANSLATORS: Locking is a feature to lock records from modifications (ex: weekly on Mondays we lock all previous weeks). // It is also a name for the Locking plugin on the Team profile page. // 'title.locking' => 'Locking', +// 'title.week_view' => 'Week View', // Section for common strings inside combo boxes on forms. Strings shared between forms shall be placed here. // Strings that are used in a single form must go to the specific form section. diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index e109bf8e..3c5284fe 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -265,15 +265,57 @@ $i18n_key_words = array( 'title.reports' => 'Raportid', // TODO: translate the following. // 'title.report' => 'Report', +// 'title.send_report' => 'Sending Report', +// 'title.invoice' => 'Invoice', +// 'title.send_invoice' => 'Sending Invoice', +// 'title.charts' => 'Charts', +// 'title.projects' => 'Projects', +// 'title.add_project' => 'Adding Project', +// 'title.edit_project' => 'Editing Project', +// 'title.delete_project' => 'Deleting Project', +// 'title.tasks' => 'Tasks', +// 'title.add_task' => 'Adding Task', +// 'title.edit_task' => 'Editing Task', +// 'title.delete_task' => 'Deleting Task', +// 'title.users' => 'Users', +// 'title.add_user' => 'Adding User', +// 'title.edit_user' => 'Editing User', +// 'title.delete_user' => 'Deleting User', +// 'title.clients' => 'Clients', +// 'title.add_client' => 'Adding Client', +// 'title.edit_client' => 'Editing Client', +// 'title.delete_client' => 'Deleting Client', +// 'title.invoices' => 'Invoices', +// 'title.add_invoice' => 'Adding Invoice', +// 'title.view_invoice' => 'Viewing Invoice', +// 'title.delete_invoice' => 'Deleting Invoice', +// 'title.notifications' => 'Notifications', +// 'title.add_notification' => 'Adding Notification', +// 'title.edit_notification' => 'Editing Notification', +// 'title.delete_notification' => 'Deleting Notification', +// 'title.monthly_quotas' => 'Monthly Quotas', +// 'title.export' => 'Exporting Team Data', +// 'title.import' => 'Importing Team Data', +'title.options' => 'Suvandid', +// TODO: translate the following. +// 'title.profile' => 'Profile', +// 'title.cf_custom_fields' => 'Custom Fields', +// 'title.cf_add_custom_field' => 'Adding Custom Field', +// 'title.cf_edit_custom_field' => 'Editing Custom Field', +// 'title.cf_delete_custom_field' => 'Deleting Custom Field', +// 'title.cf_dropdown_options' => 'Dropdown Options', +// 'title.cf_add_dropdown_option' => 'Adding Option', +// 'title.cf_edit_dropdown_option' => 'Editing Option', +// 'title.cf_delete_dropdown_option' => 'Deleting Option', +// NOTE TO TRANSLATORS: Locking is a feature to lock records from modifications (ex: weekly on Mondays we lock all previous weeks). +// It is also a name for the Locking plugin on the Team profile page. +// 'title.locking' => 'Locking', +// 'title.week_view' => 'Week View', // TODO: refactoring ongoing down from here. -// Form titles. -'title.options' => 'Suvandid', - -// TODO: file refactoring is ongoing down from here. "form.filter.project" => 'projekt', "form.filter.filter" => 'lemmikraport', "form.filter.filter_new" => 'salvesta lemmikuna', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index e1462dc8..0c76fa21 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- + {if $smarty.const.WEEK_VIEW_DEBUG == 1} + + + + + {/if} {/if} diff --git a/WEB-INF/templates/week_view.tpl b/WEB-INF/templates/week_view.tpl new file mode 100644 index 00000000..5375a323 --- /dev/null +++ b/WEB-INF/templates/week_view.tpl @@ -0,0 +1,45 @@ +
 Anuko Time Tracker 1.17.10.3862 | Copyright © Anuko | +  Anuko Time Tracker 1.17.10.3863 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/profile_edit.tpl b/WEB-INF/templates/profile_edit.tpl index dc4f5a64..6e3b81eb 100644 --- a/WEB-INF/templates/profile_edit.tpl +++ b/WEB-INF/templates/profile_edit.tpl @@ -229,6 +229,12 @@ function handlePluginCheckboxes() { {$forms.profileForm.quotas.control} {$i18n.label.configure}
{$forms.profileForm.week_view.control} {$i18n.label.configure}
+ +
{$i18n.form.quota.hint}
+ +{$forms.monthlyQuotasForm.open} +
+ + + + +
+ + + + + +
{$i18n.form.quota.workday_hours}:{$forms.monthlyQuotasForm.workdayHours.control}
+
+
+ + + + + + + + + +
{$i18n.form.quota.year}:{$forms.monthlyQuotasForm.year.control}
 
+ + + + + +{foreach $months as $month} + + + + +{/foreach} + + +
{$i18n.form.quota.month}{$i18n.form.quota.quota}
{$month}:{$forms.monthlyQuotasForm.$month.control}
 
+
+{$forms.monthlyQuotasForm.close} diff --git a/profile_edit.php b/profile_edit.php index a9e9a42c..6d82bf78 100644 --- a/profile_edit.php +++ b/profile_edit.php @@ -76,6 +76,7 @@ if ($request->isPost()) { $cl_notifications = $request->getParameter('notifications'); $cl_locking = $request->getParameter('locking'); $cl_quotas = $request->getParameter('quotas'); + $cl_week_view = $request->getParameter('week_view'); } } else { $cl_name = $user->name; @@ -109,6 +110,7 @@ if ($request->isPost()) { $cl_notifications = in_array('no', $plugins); $cl_locking = in_array('lk', $plugins); $cl_quotas = in_array('mq', $plugins); + $cl_week_view = in_array('wv', $plugins); } } @@ -205,6 +207,9 @@ if ($user->canManageTeam()) { $form->addInput(array('type'=>'checkbox','name'=>'notifications','value'=>$cl_notifications,'onchange'=>'handlePluginCheckboxes()')); $form->addInput(array('type'=>'checkbox','name'=>'locking','value'=>$cl_locking,'onchange'=>'handlePluginCheckboxes()')); $form->addInput(array('type'=>'checkbox','name'=>'quotas','value'=>$cl_quotas,'onchange'=>'handlePluginCheckboxes()')); + if (defined('WEEK_VIEW_DEBUG') && isTrue(WEEK_VIEW_DEBUG)) { + $form->addInput(array('type'=>'checkbox','name'=>'week_view','value'=>$cl_week_view)); + } } $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); @@ -261,6 +266,8 @@ if ($request->isPost()) { $plugins .= ',lk'; if ($cl_quotas) $plugins .= ',mq'; + if ($cl_week_view) + $plugins .= ',wv'; $plugins = trim($plugins, ','); $update_result = ttTeamHelper::update($user->team_id, array( diff --git a/week_view.php b/week_view.php new file mode 100644 index 00000000..319235b4 --- /dev/null +++ b/week_view.php @@ -0,0 +1,102 @@ +isPluginEnabled('wv')) { + header('Location: access_denied.php'); + exit(); +} + + +// Get selected year from url parameter. +$selectedYear = $request->getParameter('year'); +if (!$selectedYear or !ttValidInteger($selectedYear)){ + $selectedYear = date('Y'); +} else { + $selectedYear = (int) $selectedYear; +} + +// Months are zero indexed. +$months = $i18n->monthNames; + +$quota = new MonthlyQuota(); + +if ($request->isPost()){ + // Validate user input. + if (!ttTimeHelper::isValidDuration($request->getParameter('workdayHours'))) + $err->add($i18n->getKey('error.field'), $i18n->getKey('form.quota.workday_hours')); + + for ($i = 0; $i < count($months); $i++){ + $val = $request->getParameter($months[$i]); + if (!$quota->isValidQuota($val)) + $err->add($i18n->getKey('error.field'), $months[$i]); + } + // Finished validating user input. + + if ($err->no()) { + + // Handle workday hours. + $hours = $quota->quotaToFloat($request->getParameter('workdayHours')); + if ($hours != $user->workday_hours) { + if (!ttTeamHelper::update($user->team_id, array('name'=>$user->team,'workday_hours'=>$hours))) + $err->add($i18n->getKey('error.db')); + } + + // Handle monthly quotas for a selected year. + $selectedYear = (int) $request->getParameter('year'); + for ($i = 0; $i < count($months); $i++){ + if (!$quota->update($selectedYear, $i+1, $request->getParameter($months[$i]))) + $err->add($i18n->getKey('error.db')); + } + + if ($err->no()) { + // Redisplay the form. + header('Location: quotas.php?year='.$selectedYear); + exit(); + } + } +} + +// Get monthly quotas for the entire year. +$monthsData = $quota->get($selectedYear); +$workdayHours = ttTimeHelper::toAbsDuration($user->workday_hours * 60, true); + +$form = new Form('weekViewForm'); +$form->addInput(array('type'=>'checkbox','name'=>'week_note','value'=>$cl_week_note)); +$form->addInput(array('type'=>'checkbox','name'=>'week_list','value'=>$cl_week_list)); + +$smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('title', $i18n->getKey('label.week_view')); +$smarty->assign('content_page_name', 'week_view.tpl'); +$smarty->display('index.tpl');