From 2a2bb2cc8f9551d1e93de2d34e27b21201f9e44a Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 22 Apr 2019 21:32:16 +0000 Subject: [PATCH] More work in progress on remote work plugin. --- WEB-INF/lib/ttWorkHelper.class.php | 46 ++++++++++++++++++++++++++++++ WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/work_add.tpl | 4 +++ mysql.sql | 19 ++++++++++++ work_add.php | 20 +++++++------ 5 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 WEB-INF/lib/ttWorkHelper.class.php diff --git a/WEB-INF/lib/ttWorkHelper.class.php b/WEB-INF/lib/ttWorkHelper.class.php new file mode 100644 index 00000000..b8d2fde8 --- /dev/null +++ b/WEB-INF/lib/ttWorkHelper.class.php @@ -0,0 +1,46 @@ +query($sql); + if (is_a($res, 'PEAR_Error')) return false; + + while ($val = $res->fetchRow()) { + $result[] = $val; + } + return $result; + } +} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index b54e2baa..675f20d6 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} + + + + diff --git a/mysql.sql b/mysql.sql index 56c217a3..40065f06 100644 --- a/mysql.sql +++ b/mysql.sql @@ -576,6 +576,25 @@ create unique index currency_idx on tt_work_currencies(`name`); INSERT INTO `tt_work_currencies` (`id`, `name`) VALUES ('1', 'USD'), ('2', 'CAD'), ('3', 'AUD'), ('4', 'EUR'), ('5', 'NZD'); +# +# Structure for table tt_work_categories. WORK IN PROGRESS! +# This table keeps work categories supported by remote work plugin. +# +# CREATE TABLE `tt_work_categories` ( +# `id` int(10) unsigned NOT NULL, # category id +# `parent_id` int(10) unsigned default NULL, # parent category id +# `level` tinyint(4) default 0, # sub-category level +# +# Localized name fields below for all supported languages? +# `name_en` varhar(64) NOT NULL, # English. +# `name_de` varhar(64) default NULL, # German. +# `name_fr` varhar(64) default NULL, # French. +# `name_ru` varhar(64) default NULL, # Russian. +# +# PRIMARY KEY (`id`) +# ); + + # # Structure for table tt_site_config. This table stores configuration data # for Time Tracker site as a whole. diff --git a/work_add.php b/work_add.php index 20d0ac01..452e515b 100644 --- a/work_add.php +++ b/work_add.php @@ -31,6 +31,7 @@ import('form.Form'); import('ttProjectHelper'); import('ttGroupHelper'); import('ttFileHelper'); +import('ttWorkHelper'); // Access checks. if (!ttAccessAllowed('manage_work')) { @@ -48,24 +49,27 @@ $showFiles = $user->isPluginEnabled('at'); if ($request->isPost()) { $cl_name = trim($request->getParameter('work_name')); $cl_description = trim($request->getParameter('description')); + $cl_currency = $request->getParameter('currency'); } $form = new Form('workForm'); - - - - $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'work_name','style'=>'width: 250px;','value'=>$cl_name)); $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description)); if ($showFiles) $form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit'))); +// Add a dropdown for currency. +$currencies = ttWorkHelper::getCurrencies(); +$form->addInput(array('type'=>'combobox','name'=>'currency','data'=>$currencies,'datakeys'=>array('id','name'),'value'=>$cl_currency)); -// Should not we get it from server? -// $CURRENCY_OPTIONS = array(array('id'=>'.','name'=>'.'),array('id'=>',','name'=>',')); -// $form->addInput(array('type'=>'combobox','name'=>'decimal_mark','style'=>'width: 150px','data'=>$DECIMAL_MARK_OPTIONS,'datakeys'=>array('id','name'),'value'=>$cl_decimal_mark, -// 'onchange'=>'adjustDecimalPreview()')); +// TODO: design how to handle one-time vs ongoing work. Apparently, with a conditional display of relevant controls. +// Ongoing work - rate per hour control. +// One-time work - budget dropdown control. +// When selection changes, we hide and show required controls. +// TODO: design how to handle categories and sub-categories. +// One major complication is localization of names. +// Coding and design are currently ongoing. if ($request->isPost()) { -- 2.20.1
 Anuko Time Tracker 1.19.2.4973 | Copyright © Anuko | +  Anuko Time Tracker 1.19.2.4974 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/work_add.tpl b/WEB-INF/templates/work_add.tpl index 3992fa15..757a4e22 100644 --- a/WEB-INF/templates/work_add.tpl +++ b/WEB-INF/templates/work_add.tpl @@ -17,6 +17,10 @@ {$forms.workForm.newfile.control}
{$i18n.label.currency}:{$forms.workForm.currency.control}
{$i18n.label.required_fields}