From ccad5f6b0a1739455bf3b53dfcbcffd6692ffd5e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 6 Apr 2019 13:21:29 +0000 Subject: [PATCH] More work in progress on time record attachments. --- WEB-INF/lib/ttFileHelper.class.php | 7 +++-- WEB-INF/resources/ca.lang.php | 1 + WEB-INF/resources/cs.lang.php | 1 + WEB-INF/resources/da.lang.php | 2 ++ WEB-INF/resources/de.lang.php | 2 ++ WEB-INF/resources/en.lang.php | 1 + WEB-INF/resources/es.lang.php | 3 +- WEB-INF/resources/et.lang.php | 2 ++ WEB-INF/resources/fa.lang.php | 2 ++ WEB-INF/resources/fi.lang.php | 2 ++ WEB-INF/resources/fr.lang.php | 2 ++ WEB-INF/resources/gr.lang.php | 2 ++ WEB-INF/resources/he.lang.php | 3 +- WEB-INF/resources/hu.lang.php | 1 + WEB-INF/resources/it.lang.php | 2 ++ WEB-INF/resources/ja.lang.php | 3 +- WEB-INF/resources/ko.lang.php | 3 +- WEB-INF/resources/nl.lang.php | 2 ++ WEB-INF/resources/no.lang.php | 3 +- WEB-INF/resources/pl.lang.php | 2 ++ WEB-INF/resources/pt-br.lang.php | 2 ++ WEB-INF/resources/pt.lang.php | 1 + WEB-INF/resources/ro.lang.php | 3 +- WEB-INF/resources/ru.lang.php | 1 + WEB-INF/resources/sk.lang.php | 3 +- WEB-INF/resources/sl.lang.php | 1 + WEB-INF/resources/sr.lang.php | 2 ++ WEB-INF/resources/sv.lang.php | 2 ++ WEB-INF/resources/tr.lang.php | 3 +- WEB-INF/resources/zh-cn.lang.php | 3 +- WEB-INF/resources/zh-tw.lang.php | 3 +- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/time_files.tpl | 47 ++++++++++++++++++++++++++++++ project_files.php | 2 +- time_files.php | 22 +++++--------- 35 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 WEB-INF/templates/time_files.tpl diff --git a/WEB-INF/lib/ttFileHelper.class.php b/WEB-INF/lib/ttFileHelper.class.php index f3c36e56..9d18022b 100644 --- a/WEB-INF/lib/ttFileHelper.class.php +++ b/WEB-INF/lib/ttFileHelper.class.php @@ -297,8 +297,8 @@ class ttFileHelper { return $val['group_key']; } - // getProjectFiles obtains a list of files for a project. - static function getProjectFiles($project_id) { + // getEntityFiles obtains a list of files for an entity. + static function getEntityFiles($id, $type) { global $user; $mdb2 = getConnection(); @@ -306,8 +306,9 @@ class ttFileHelper { $org_id = $user->org_id; $result = array(); + $entity_type = $mdb2->quote($type); $sql = "select id, remote_id, file_name as name, description from tt_files". - " where entity_type = 'project' and entity_id = $project_id". + " where entity_type = $entity_type and entity_id = $id". " and group_id = $group_id and org_id = $org_id and status = 1 order by id"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index f6a53574..4454d348 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -300,6 +300,7 @@ $i18n_key_words = array( 'title.edit_time_record' => 'Modificant l\\\'historial de temps', 'title.delete_time_record' => 'Eliminant l\\\'historial de temps', // TODO: translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index fc976878..aa590549 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -310,6 +310,7 @@ $i18n_key_words = array( 'title.edit_time_record' => 'Upravit časový záznam', 'title.delete_time_record' => 'Smazat časový záznam', // TODO: translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 6c748c8f..0248b8d7 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -282,6 +282,8 @@ $i18n_key_words = array( 'title.time' => 'Tid', 'title.edit_time_record' => 'Redigér Tidsregistrering', 'title.delete_time_record' => 'Slet Tidsregistrering', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Udgifter', 'title.edit_expense' => 'Redigér Udgift', 'title.delete_expense' => 'Slet Udgift', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index e162f398..18bfc2e9 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -270,6 +270,8 @@ $i18n_key_words = array( 'title.time' => 'Zeiten', 'title.edit_time_record' => 'Bearbeiten des Stundeneintrags', 'title.delete_time_record' => 'Eintrag löschen', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Kosten', 'title.edit_expense' => 'Kostenposition ändern', 'title.delete_expense' => 'Kostenposition löschen', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 54da108c..98c6f915 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -258,6 +258,7 @@ $i18n_key_words = array( 'title.time' => 'Time', 'title.edit_time_record' => 'Editing Time Record', 'title.delete_time_record' => 'Deleting Time Record', +'title.time_files' => 'Time Record Files', 'title.expenses' => 'Expenses', 'title.edit_expense' => 'Editing Expense Item', 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index aee71b4c..8e7ce8c9 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -298,7 +298,8 @@ $i18n_key_words = array( 'title.time' => 'Tiempo', 'title.edit_time_record' => 'Modificando el historial de tiempo', 'title.delete_time_record' => 'Eliminando el historial de tiempo', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 4963cc59..65beb3ee 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -288,6 +288,8 @@ $i18n_key_words = array( 'title.time' => 'Ajaarvestus', 'title.edit_time_record' => 'Ajakande muutmine', 'title.delete_time_record' => 'Ajakande kustutamine', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Kulud', 'title.edit_expense' => 'Kulukirje muutmine', 'title.delete_expense' => 'Kulukirje kustutamine', diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index d6ed945c..6a74f0ed 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -293,6 +293,8 @@ $i18n_key_words = array( 'title.time' => 'زمان', 'title.edit_time_record' => 'ویرایش رکورد زمان', 'title.delete_time_record' => 'حذف رکورد زمان', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'هزینه ها', 'title.edit_expense' => 'ویرایش آیتم هزینه ها', 'title.delete_expense' => 'حذف آیتم هزینه ها', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index 5aaf7f97..d02a010c 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -286,6 +286,8 @@ $i18n_key_words = array( 'title.time' => 'Tuntien kirjaus', 'title.edit_time_record' => 'Tuntikirjausten muokkaus', 'title.delete_time_record' => 'Tuntikirjausten poisto', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Kulut', 'title.edit_expense' => 'Kulutietojen muokkaus', 'title.delete_expense' => 'Kulutiedon poisto', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index f95bf742..45447d7d 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -280,6 +280,8 @@ $i18n_key_words = array( 'title.time' => 'Temps', 'title.edit_time_record' => 'Modification de l\\\'entrée de temps', 'title.delete_time_record' => 'Suppression de l\\\'entrée de temps', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Dépenses', 'title.edit_expense' => 'Modification d\\\'une dépense', 'title.delete_expense' => 'Suppression d\\\'une dépense', diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php index ee10172a..68208ee6 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -273,6 +273,8 @@ $i18n_key_words = array( 'title.time' => 'Χρόνος', 'title.edit_time_record' => 'Επεξεργασία χρόνου', 'title.delete_time_record' => 'Διαγραφή χρόνου', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Δαπάνες', 'title.edit_expense' => 'Επεξεργασία δαπάνης', 'title.delete_expense' => 'Διαγραφή δαπάνης', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index 90056902..5c199ec6 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -303,7 +303,8 @@ $i18n_key_words = array( 'title.time' => 'זמן', 'title.edit_time_record' => 'עריכת רשומה', 'title.delete_time_record' => 'מחיקת רשומה', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index 58fcf50a..5f7b40cf 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -300,6 +300,7 @@ $i18n_key_words = array( // 'title.time' => 'Time', // 'title.edit_time_record' => 'Editing Time Record', // 'title.delete_time_record' => 'Deleting Time Record', +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 4b6cf98d..678b1b08 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -281,6 +281,8 @@ $i18n_key_words = array( 'title.time' => 'Tempo', 'title.edit_time_record' => 'Modifica record temporale', 'title.delete_time_record' => 'Eliminazione record temporale', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Spese', 'title.edit_expense' => 'Modifica voce di spesa', 'title.delete_expense' => 'Eliminezione voce di spesa', diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index b4fd746f..8b68a1b0 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -305,7 +305,8 @@ $i18n_key_words = array( 'title.time' => '時間', 'title.edit_time_record' => '時間レコードの編集', 'title.delete_time_record' => '時間レコードの削除', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index b7c4a695..181e0707 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -305,7 +305,8 @@ $i18n_key_words = array( 'title.time' => '시간', 'title.edit_time_record' => '시간기록을 편집하기', 'title.delete_time_record' => '시간기록을 삭제하기', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index f0604715..e444f214 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -258,6 +258,8 @@ $i18n_key_words = array( 'title.time' => 'Tijdsregistraties', 'title.edit_time_record' => 'Wijzigen tijdrecord', 'title.delete_time_record' => 'Verwijder tijdrecord', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Kosten', 'title.edit_expense' => 'Bewerk kosten artikel', 'title.delete_expense' => 'Verwijder kosten artikel', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index d8848cd0..0f91855e 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -302,7 +302,8 @@ $i18n_key_words = array( 'title.time' => 'Tid', 'title.edit_time_record' => 'Endre tids oppføringen', 'title.delete_time_record' => 'Slett tids oppføringen', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index b62c3b61..4d457d61 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -287,6 +287,8 @@ $i18n_key_words = array( 'title.time' => 'Wybrana data', 'title.edit_time_record' => 'Edytowanie wpisu', 'title.delete_time_record' => 'Usuwanie wpisu', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Wydatki', 'title.edit_expense' => 'Edytowanie wpisu', 'title.delete_expense' => 'Usuwanie wpisu', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index 7662b98d..88344d82 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -284,6 +284,8 @@ $i18n_key_words = array( 'title.time' => 'Tempo', 'title.edit_time_record' => 'Editando entrada de hora', 'title.delete_time_record' => 'Apagando entrada de hora', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Gastos', 'title.edit_expense' => 'Editando item de gasto', 'title.delete_expense' => 'Apagando item de gasto', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index b76b0dcd..c388f095 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -289,6 +289,7 @@ $i18n_key_words = array( // 'title.time' => 'Time', // 'title.edit_time_record' => 'Editing Time Record', // 'title.delete_time_record' => 'Deleting Time Record', +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index 908c7d38..7800b2b9 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -305,7 +305,8 @@ $i18n_key_words = array( 'title.time' => 'Timpul', 'title.edit_time_record' => 'Editarea inregistrarii timpului', 'title.delete_time_record' => 'Ștergerea inregistrarii timpului', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index cb7c0925..d1b74e0d 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -257,6 +257,7 @@ $i18n_key_words = array( 'title.time' => 'Время', 'title.edit_time_record' => 'Редактирование записи о времени', 'title.delete_time_record' => 'Удаление записи о времени', +'title.time_files' => 'Файлы записи о времени', 'title.expenses' => 'Расходы', 'title.edit_expense' => 'Редактирование предмета расхода', 'title.delete_expense' => 'Удаление предмета расхода', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 2024b49f..7073ac5f 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -292,7 +292,8 @@ $i18n_key_words = array( 'title.time' => 'Časový záznam', 'title.edit_time_record' => 'Upravovanie časového záznamu', 'title.delete_time_record' => 'Vymazávanie časového záznamu', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index bd7615dc..2b609003 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -285,6 +285,7 @@ $i18n_key_words = array( // 'title.time' => 'Time', // 'title.edit_time_record' => 'Editing Time Record', // 'title.delete_time_record' => 'Deleting Time Record', +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index 89875af5..a6b4b74b 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -285,6 +285,8 @@ $i18n_key_words = array( 'title.time' => 'Vreme', 'title.edit_time_record' => 'Izmeni unos vremena', 'title.delete_time_record' => 'Obriši unos vremena', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Troškovi', 'title.edit_expense' => 'Izmeni stavke troškova', 'title.delete_expense' => 'Obriši stavke troškova', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index ff2dda34..b2837ccd 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -281,6 +281,8 @@ $i18n_key_words = array( 'title.time' => 'Tider', 'title.edit_time_record' => 'Redigera tidsregistrering', 'title.delete_time_record' => 'Ta bort tidsregistrering', +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', 'title.expenses' => 'Kostnader', 'title.edit_expense' => 'Redigera kostnad', 'title.delete_expense' => 'Ta bort kostnad', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index c0411a64..cef0d9eb 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -314,7 +314,8 @@ $i18n_key_words = array( 'title.time' => 'Zaman', 'title.edit_time_record' => 'Zaman kaydını düzenliyor', 'title.delete_time_record' => 'Zaman kaydını siliyor', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 208bd684..551ef564 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -293,7 +293,8 @@ $i18n_key_words = array( // 'title.time' => 'Time', 'title.edit_time_record' => '编辑时间记录', 'title.delete_time_record' => '删除时间记录', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index 0dcd0e8c..eef91794 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -300,7 +300,8 @@ $i18n_key_words = array( // 'title.time' => 'Time', 'title.edit_time_record' => '編輯時間記錄', 'title.delete_time_record' => '刪除時間記錄', -// TODO: translate the following. +// TODO: Translate the following. +// 'title.time_files' => 'Time Record Files', // 'title.expenses' => 'Expenses', // 'title.edit_expense' => 'Editing Expense Item', // 'title.delete_expense' => 'Deleting Expense Item', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index dee093f7..17d7a68c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.63.4909 | Copyright © Anuko | +  Anuko Time Tracker 1.18.63.4910 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/time_files.tpl b/WEB-INF/templates/time_files.tpl new file mode 100644 index 00000000..f373815f --- /dev/null +++ b/WEB-INF/templates/time_files.tpl @@ -0,0 +1,47 @@ + + + + +
+ + + + +{if $can_edit} + + +{/if} + +{if $files} + {foreach $files as $file} + + + + {if $can_edit} + + + {/if} + + {/foreach} +{/if} +
{$i18n.label.thing_name}{$i18n.label.description}{$i18n.label.edit}{$i18n.label.delete}
{$file.name|escape}{$file.description|escape}{$i18n.label.edit}{$i18n.label.delete}
+
+ +{if $can_edit} +{$forms.fileUploadForm.open} + + + + +
+ + + + + + + +
{$i18n.label.description}:{$forms.fileUploadForm.description.control}{$forms.fileUploadForm.newfile.control}
{$forms.fileUploadForm.btn_submit.control}
+
+{$forms.fileUploadForm.close} +{/if} diff --git a/project_files.php b/project_files.php index 3af70d5e..f797cc6b 100644 --- a/project_files.php +++ b/project_files.php @@ -53,7 +53,7 @@ if ($request->isPost()) { } $fileHelper = new ttFileHelper($err); -$files = $fileHelper::getProjectFiles($cl_project_id); +$files = $fileHelper::getEntityFiles($cl_project_id, 'project'); $form = new Form('fileUploadForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id)); diff --git a/time_files.php b/time_files.php index fc809925..6b76b23d 100644 --- a/time_files.php +++ b/time_files.php @@ -54,17 +54,10 @@ if ($request->isPost()) { } $fileHelper = new ttFileHelper($err); - - - - -die("coding ongoing sown from here..."); $files = $fileHelper::getEntityFiles($cl_id, 'time'); - - $form = new Form('fileUploadForm'); -$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id)); +$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); $form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit'),'maxsize'=>67108864)); // 64 MB file upload limit. // Note: for the above limit to work make sure to set upload_max_filesize and post_max_size in php.ini to at least 64M. $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description)); @@ -79,20 +72,21 @@ if ($request->isPost()) { // Finished validating user input. if ($err->no()) { - $fields = array('entity_type'=>'project', - 'entity_id' => $cl_project_id, + $fields = array('entity_type'=>'time', + 'entity_id' => $cl_id, 'file_name' => $_FILES['newfile']['name'], 'description'=>$cl_description); if ($fileHelper->putFile($fields)) { - header('Location: project_files.php?id='.$cl_project_id); + header('Location: time_files.php?id='.$cl_id); exit(); } } } // isPost -$smarty->assign('can_manage', $user->can('manage_projects')); +$canEdit = !($time_rec['approved'] || $time_rec['timesheet_id'] || $time_rec['invoice_id']); +$smarty->assign('can_edit', $canEdit); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('files', $files); -$smarty->assign('title', $i18n->get('title.project_files').': '.$project['name']); -$smarty->assign('content_page_name', 'project_files.tpl'); +$smarty->assign('title', $i18n->get('title.time_files')); +$smarty->assign('content_page_name', 'time_files.tpl'); $smarty->display('index.tpl'); -- 2.20.1