From fc92f9cd36dcaeb96da37c699a61331805d9e2fc Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 8 Mar 2019 15:13:42 +0000 Subject: [PATCH] Work in progress on templates plugin. --- WEB-INF/resources/ca.lang.php | 3 ++ WEB-INF/resources/cs.lang.php | 3 ++ WEB-INF/resources/da.lang.php | 3 ++ WEB-INF/resources/de.lang.php | 3 ++ WEB-INF/resources/en.lang.php | 3 ++ WEB-INF/resources/es.lang.php | 3 ++ WEB-INF/resources/et.lang.php | 3 ++ WEB-INF/resources/fa.lang.php | 3 ++ WEB-INF/resources/fi.lang.php | 3 ++ WEB-INF/resources/fr.lang.php | 3 ++ WEB-INF/resources/gr.lang.php | 3 ++ WEB-INF/resources/he.lang.php | 3 ++ WEB-INF/resources/hu.lang.php | 3 ++ WEB-INF/resources/it.lang.php | 3 ++ WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/template_add.tpl | 26 +++++++++++ WEB-INF/templates/templates.tpl | 4 +- template_add.php | 72 ++++++++++++++++++++++++++++++ 18 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 WEB-INF/templates/template_add.tpl create mode 100644 template_add.php diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 04de03b6..07d4e815 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -367,6 +367,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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 a9389a30..27494aec 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -378,6 +378,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/da.lang.php b/WEB-INF/resources/da.lang.php index 981982ce..f4fd9c53 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -345,6 +345,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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 dbace500..dcd666a4 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -328,6 +328,9 @@ $i18n_key_words = array( 'title.work_units' => 'Arbeitseinheiten', // TODO: translate the following. // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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 660e8448..7fb968f9 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -319,6 +319,9 @@ $i18n_key_words = array( 'title.swap_roles' => 'Swapping Roles', 'title.work_units' => 'Work Units', 'title.templates' => 'Templates', +'title.add_template' => 'Adding Template', +'title.edit_template' => 'Editing Template', +'title.delete_template' => 'Deleting Template', // 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 6b331feb..b31ec28e 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -366,6 +366,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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 72284464..c4c4cebd 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -349,6 +349,9 @@ $i18n_key_words = array( 'title.work_units' => 'Töö ühikud', // TODO: translate the following. // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/fa.lang.php b/WEB-INF/resources/fa.lang.php index 27fcf684..6632b7eb 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -353,6 +353,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/fi.lang.php b/WEB-INF/resources/fi.lang.php index f8892dd4..68d167fa 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -345,6 +345,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/fr.lang.php b/WEB-INF/resources/fr.lang.php index 791e7bc2..807006f0 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -339,6 +339,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/gr.lang.php b/WEB-INF/resources/gr.lang.php index 80201449..d5dde290 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -335,6 +335,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/he.lang.php b/WEB-INF/resources/he.lang.php index 568b78b2..bd4f06b6 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -365,6 +365,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/hu.lang.php b/WEB-INF/resources/hu.lang.php index 98e9d5f1..c35fb70a 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -366,6 +366,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/it.lang.php b/WEB-INF/resources/it.lang.php index 1a15690f..bb28e972 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -345,6 +345,9 @@ $i18n_key_words = array( // 'title.swap_roles' => 'Swapping Roles', // 'title.work_units' => 'Work Units', // 'title.templates' => 'Templates', +// 'title.add_template' => 'Adding Template', +// 'title.edit_template' => 'Editing Template', +// 'title.delete_template' => 'Deleting Template', // 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/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 180c7671..72f5079b 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.55.4839 | Copyright © Anuko | +  Anuko Time Tracker 1.18.55.4840 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/template_add.tpl b/WEB-INF/templates/template_add.tpl new file mode 100644 index 00000000..fd2983a7 --- /dev/null +++ b/WEB-INF/templates/template_add.tpl @@ -0,0 +1,26 @@ +{$forms.predefinedExpenseForm.open} + + + + +
+ + + + + + + + + + + + + + + + + +
{$i18n.label.thing_name} (*):{$forms.predefinedExpenseForm.name.control}
{$i18n.label.cost} (*):{$forms.predefinedExpenseForm.cost.control} {$user->getCurrency()|escape}
{$i18n.label.required_fields}
 
{$forms.predefinedExpenseForm.btn_add.control}
+
+{$forms.predefinedExpenseForm.close} diff --git a/WEB-INF/templates/templates.tpl b/WEB-INF/templates/templates.tpl index a1ea3496..177f32cf 100644 --- a/WEB-INF/templates/templates.tpl +++ b/WEB-INF/templates/templates.tpl @@ -5,13 +5,15 @@ + {if $templates} {foreach $templates as $template} - + + diff --git a/template_add.php b/template_add.php new file mode 100644 index 00000000..606ea9f7 --- /dev/null +++ b/template_add.php @@ -0,0 +1,72 @@ +isPluginEnabled('tp')) { + header('Location: feature_disabled.php'); + exit(); +} +// End of access checks. + +if ($request->isPost()) { + $cl_name = trim($request->getParameter('name')); + $cl_cost = trim($request->getParameter('cost')); +} + +$form = new Form('predefinedExpenseForm'); +$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 250px;','value'=>$cl_name)); +$form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost)); +$form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add'))); + +if ($request->isPost()) { + // Validate user input. + if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); + if (!ttValidFloat($cl_cost)) $err->add($i18n->get('error.field'), $i18n->get('label.cost')); + if ($err->no()) { + if (ttPredefinedExpenseHelper::insert(array( + 'name' => $cl_name, + 'cost' => $cl_cost))) { + header('Location: predefined_expenses.php'); + exit(); + } else + $err->add($i18n->get('error.db')); + } +} // isPost + +$smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('title', $i18n->get('title.add_template')); +$smarty->assign('content_page_name', 'predefined_expense_add.tpl'); +$smarty->display('index.tpl'); -- 2.20.1
{$i18n.label.thing_name}{$i18n.label.description} {$i18n.label.edit} {$i18n.label.delete}
{$template_expense['name']|escape}{$template['name']|escape}{$template['description']|escape} {$i18n.label.edit} {$i18n.label.delete}