From e85347d56f89d7fcc5e68763038551687f291b5c Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Thu, 27 Jun 2019 20:10:14 +0000 Subject: [PATCH] More work in progress on custom fields extension. --- WEB-INF/resources/ca.lang.php | 1 + WEB-INF/resources/cs.lang.php | 1 + WEB-INF/resources/da.lang.php | 1 + WEB-INF/resources/de.lang.php | 1 + WEB-INF/resources/en.lang.php | 1 + WEB-INF/resources/es.lang.php | 1 + WEB-INF/resources/et.lang.php | 1 + WEB-INF/resources/fa.lang.php | 1 + WEB-INF/resources/fi.lang.php | 1 + WEB-INF/resources/fr.lang.php | 1 + WEB-INF/resources/gr.lang.php | 1 + WEB-INF/resources/he.lang.php | 1 + WEB-INF/resources/hu.lang.php | 1 + WEB-INF/resources/it.lang.php | 1 + WEB-INF/resources/ja.lang.php | 1 + WEB-INF/resources/ko.lang.php | 1 + WEB-INF/resources/nl.lang.php | 1 + WEB-INF/resources/no.lang.php | 1 + WEB-INF/resources/pl.lang.php | 1 + WEB-INF/resources/pt-br.lang.php | 1 + WEB-INF/resources/pt.lang.php | 1 + WEB-INF/resources/ro.lang.php | 1 + WEB-INF/resources/ru.lang.php | 1 + WEB-INF/resources/sk.lang.php | 1 + WEB-INF/resources/sl.lang.php | 1 + WEB-INF/resources/sr.lang.php | 1 + WEB-INF/resources/sv.lang.php | 1 + WEB-INF/resources/tr.lang.php | 1 + WEB-INF/resources/zh-cn.lang.php | 1 + WEB-INF/resources/zh-tw.lang.php | 1 + WEB-INF/templates/cf_custom_field_add.tpl | 6 ++++++ WEB-INF/templates/footer.tpl | 2 +- cf_custom_field_add.php | 8 ++++---- plugins/CustomFields.class.php | 4 ++-- 34 files changed, 43 insertions(+), 7 deletions(-) diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 960ed0b2..0f0b4c7f 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -415,6 +415,7 @@ $i18n_key_words = array( // 'dropdown.selected_year' => 'year', // 'dropdown.all_time' => 'all time', // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projectes', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index 1d1da524..9000b3b1 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -425,6 +425,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'od počátku', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projekty', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index b1afacb7..c1767631 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -398,6 +398,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'Alt', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'Projekter', 'dropdown.tasks' => 'Opgaver', 'dropdown.clients' => 'Klienter', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index 9524dad6..9fe12dfc 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -380,6 +380,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'Gesamtzeitraum', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'Projekte', 'dropdown.tasks' => 'Aufgaben', 'dropdown.clients' => 'Kunden', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index ef89c364..7d25fd69 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -364,6 +364,7 @@ $i18n_key_words = array( 'dropdown.selected_year' => 'year', 'dropdown.all_time' => 'all time', 'dropdown.time' => 'time', +'dropdown.user' => 'user', 'dropdown.projects' => 'projects', 'dropdown.tasks' => 'tasks', 'dropdown.clients' => 'clients', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index 5fd0ac43..44ed2567 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -415,6 +415,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'dropdown.all_time' => 'all time', // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'proyectos', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 3eea2d0e..34a7239b 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -403,6 +403,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'kõik ajavahemikud', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projektid', 'dropdown.tasks' => 'tööülesanded', 'dropdown.clients' => 'kliendid', diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index 3b6e9d81..3095a87e 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -409,6 +409,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'همه زمان ها', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'پروژه ها', 'dropdown.tasks' => 'وظایف', 'dropdown.clients' => 'مشتریان', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index 1aa06d56..752c6ffd 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -398,6 +398,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'kaikki tunnit', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projektit', 'dropdown.tasks' => 'tehtävät', 'dropdown.clients' => 'asiakkaat', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index cb488372..ff7e4e6f 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -390,6 +390,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'depuis toujours', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'Projets', 'dropdown.tasks' => 'Tâches', 'dropdown.clients' => 'Clients', diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php index c8a8ab08..1e3c8be9 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -388,6 +388,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'όλη την περίοδο', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'έργα', 'dropdown.tasks' => 'εργασίες', 'dropdown.clients' => 'πελάτες', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index 10a40edc..2905e274 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -415,6 +415,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'הכל', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'פרוייקטים', 'dropdown.tasks' => 'משימות', 'dropdown.clients' => 'לקוחות', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index 95d99046..d44c8d8a 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -417,6 +417,7 @@ $i18n_key_words = array( // 'dropdown.selected_year' => 'year', // 'dropdown.all_time' => 'all time', // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projektek', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 845b1d10..a1efcd52 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -398,6 +398,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'tutto il tempo', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'progetti', 'dropdown.tasks' => 'compiti', 'dropdown.clients' => 'clienti', diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index 3b9c091e..1fadd683 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -421,6 +421,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'すべての時間', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'プロジェクト', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index 43d3f8ad..115a96a5 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -424,6 +424,7 @@ $i18n_key_words = array( 'dropdown.all_time' => '전시간', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => '프로젝트', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index 49125a64..58d3aaaa 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -365,6 +365,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'alles', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projecten', 'dropdown.tasks' => 'taken', 'dropdown.clients' => 'klanten', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index 04ccf3c6..27d6a91b 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -419,6 +419,7 @@ $i18n_key_words = array( // 'dropdown.all_time' => 'all time', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'prosjekter', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 3f0d93bf..aa6a2cef 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -401,6 +401,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'od początku', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projekty', 'dropdown.tasks' => 'zadania', 'dropdown.clients' => 'klienci', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index ef6eacee..3d1d0abe 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -396,6 +396,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'todas as datas', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projetos', 'dropdown.tasks' => 'tarefas', 'dropdown.clients' => 'clientes', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index 79bbae1c..2720464a 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -404,6 +404,7 @@ $i18n_key_words = array( // 'dropdown.all_time' => 'all time', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projetos', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index fc9f67e5..64b4551c 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -421,6 +421,7 @@ $i18n_key_words = array( // 'dropdown.selected_year' => 'year', // 'dropdown.all_time' => 'all time', // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'proiecte', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 22c666fe..980aa466 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -361,6 +361,7 @@ $i18n_key_words = array( 'dropdown.selected_year' => 'год', 'dropdown.all_time' => 'всё время', 'dropdown.time' => 'время', +'dropdown.user' => 'пользователь', 'dropdown.projects' => 'проекты', 'dropdown.tasks' => 'задачи', 'dropdown.clients' => 'клиенты', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 133f80f0..56d14f66 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -405,6 +405,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'celý čas', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projekty', 'dropdown.tasks' => 'úlohy', // TODO: translate the following. diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index f0220996..db54f19e 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -395,6 +395,7 @@ $i18n_key_words = array( // 'dropdown.selected_year' => 'year', // 'dropdown.all_time' => 'all time', // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projekti', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index d8f8986e..eb8f3ebf 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -399,6 +399,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'svi datumi', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projekti', 'dropdown.tasks' => 'zadaci', 'dropdown.clients' => 'klijenti', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index 97392f9e..c17662ba 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -398,6 +398,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'Livstid', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'Projekt', 'dropdown.tasks' => 'Arbetsuppgifter', 'dropdown.clients' => 'Kunder', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index 39c39e8f..5701f562 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -430,6 +430,7 @@ $i18n_key_words = array( 'dropdown.all_time' => 'tüm zamanlar', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => 'projeler', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 7493be7a..dce6df85 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -411,6 +411,7 @@ $i18n_key_words = array( 'dropdown.all_time' => '全部时间', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => '项目', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index b8d923b8..a18cb213 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -416,6 +416,7 @@ $i18n_key_words = array( 'dropdown.all_time' => '全部時間', // TODO: translate the following. // 'dropdown.time' => 'time', +// 'dropdown.user' => 'user', 'dropdown.projects' => '項目', // TODO: translate the following. // 'dropdown.tasks' => 'tasks', diff --git a/WEB-INF/templates/cf_custom_field_add.tpl b/WEB-INF/templates/cf_custom_field_add.tpl index 442f41bb..4c343eec 100644 --- a/WEB-INF/templates/cf_custom_field_add.tpl +++ b/WEB-INF/templates/cf_custom_field_add.tpl @@ -8,6 +8,12 @@ {$i18n.label.thing_name} (*): {$forms.fieldForm.name.control} +{if isTrue('CF_DEBUG')} + + {$i18n.label.entity}: + {$forms.fieldForm.entity.control} {$i18n.label.what_is_it} + +{/if} {$i18n.label.type}: {$forms.fieldForm.type.control} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 59b49cfe..265b35fe 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.19.5.5017 | Copyright © Anuko | +  Anuko Time Tracker 1.19.5.5018 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/cf_custom_field_add.php b/cf_custom_field_add.php index c22c10e5..e4a919eb 100644 --- a/cf_custom_field_add.php +++ b/cf_custom_field_add.php @@ -49,7 +49,7 @@ if (count($fields) >= 1) { if ($request->isPost()) { $cl_field_name = trim($request->getParameter('name')); - $cl_field_entity = $request->getParameter('entity'); + $cl_entity_type = $request->getParameter('entity'); $cl_field_type = $request->getParameter('type'); $cl_required = $request->getParameter('required'); if (!$cl_required) @@ -59,8 +59,8 @@ if ($request->isPost()) { $form = new Form('fieldForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>'')); $form->addInput(array('type'=>'combobox','name'=>'entity', - 'data'=>array(CustomFields::ENTITY_TIME=>$i18n->get('label.type_text'), - CustomFields::ENTITY_USER=>$i18n->get('label.user')) + 'data'=>array(CustomFields::ENTITY_TIME=>$i18n->get('dropdown.time'), + CustomFields::ENTITY_USER=>$i18n->get('dropdown.user')) )); $form->addInput(array('type'=>'combobox','name'=>'type', 'data'=>array(CustomFields::TYPE_TEXT=>$i18n->get('label.type_text'), @@ -74,7 +74,7 @@ if ($request->isPost()) { if (!ttValidString($cl_field_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); if ($err->no()) { - $res = CustomFields::insertField($cl_field_name, $cl_field_type, $cl_required); + $res = CustomFields::insertField($cl_field_name, $cl_entity_type, $cl_field_type, $cl_required); if ($res) { header('Location: cf_custom_fields.php'); exit(); diff --git a/plugins/CustomFields.class.php b/plugins/CustomFields.class.php index ce870a94..a0c49ec5 100644 --- a/plugins/CustomFields.class.php +++ b/plugins/CustomFields.class.php @@ -32,7 +32,7 @@ class CustomFields { const ENTITY_TIME = 1; // Field is associated with time entries. const ENTITY_USER = 2; // Field is associated with users. const ENTITY_PROJECT = 3; // Field is associated with projects. - + const TYPE_TEXT = 1; // A text field. const TYPE_DROPDOWN = 2; // A dropdown field with pre-defined values. @@ -301,7 +301,7 @@ class CustomFields { } // The insertField inserts a custom field for group. - static function insertField($field_name, $field_type, $required) { + static function insertField($field_name, $entity_type, $field_type, $required) { global $user; $mdb2 = getConnection(); -- 2.20.1