From d2c6224504e91f7f7ddbc0b97277d87d2cad744f Mon Sep 17 00:00:00 2001 From: anuko Date: Fri, 12 Jan 2018 17:52:59 +0000 Subject: [PATCH] Added toltips to editable comment fields to help view the entire comment. --- WEB-INF/lib/form/TextField.class.php | 5 +++++ WEB-INF/templates/footer.tpl | 2 +- week.php | 11 ++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/WEB-INF/lib/form/TextField.class.php b/WEB-INF/lib/form/TextField.class.php index db29a0c7..6b745a2a 100644 --- a/WEB-INF/lib/form/TextField.class.php +++ b/WEB-INF/lib/form/TextField.class.php @@ -30,18 +30,23 @@ import('form.FormElement'); class TextField extends FormElement { + var $title = null; // Control title (ex: to display a tooltip). + function __construct($name) { $this->class = 'TextField'; $this->name = $name; } + function setTitle($title) { $this->title = $title; } + function getHtml() { if (empty($this->id)) $this->id = $this->name; $html = "\n\tid\" name=\"$this->name\""; if (!empty($this->size)) $html .= " size=\"$this->size\""; if (!empty($this->style)) $html .= " style=\"$this->style\""; + if (!empty($this->title)) $html .= " title=\"$this->title\""; if($this->isEnabled()) { if (!empty($this->max_length)) $html .= " maxlength=\"$this->max_length\""; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 734c1586..7ad20044 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.13.13.3741 | Copyright © Anuko | +  Anuko Time Tracker 1.13.14.3742 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/week.php b/week.php index 1fb904eb..bb75bdf5 100644 --- a/week.php +++ b/week.php @@ -142,9 +142,8 @@ class LabelCellRenderer extends DefaultCellRenderer { } } -// Define rendering class for a single cell for time entry in week view table. -// TODO: Refactor the class name, as we now handle both durations and comments in these cells. -class TimeCellRenderer extends DefaultCellRenderer { +// Define rendering class for a single cell for a time or a comment entry in week view table. +class WeekViewCellRenderer extends DefaultCellRenderer { function render(&$table, $value, $row, $column, $selected = false) { $field_name = $table->getValueAt($row,$column)['control_id']; // Our text field names (and ids) are like x_y (row_column). $field = new TextField($field_name); @@ -156,8 +155,10 @@ class TimeCellRenderer extends DefaultCellRenderer { $field->setStyle('width: 60px;'); // TODO: need to style everything properly, eventually. if (0 == $row % 2) $field->setValue($table->getValueAt($row,$column)['duration']); // Duration for even rows. - else + else { $field->setValue($table->getValueAt($row,$column)['note']); // Comment for odd rows. + $field->setTitle($table->getValueAt($row,$column)['note']); // Tooltip to help view the entire comment. + } // Disable control when time entry mode is TYPE_START_FINISH and there is no value in control // because we can't supply start and finish times in week view - there are no fields for them. global $user; @@ -194,7 +195,7 @@ $table->setData($dataArray); // Add columns to table. $table->addColumn(new TableColumn('label', '', new LabelCellRenderer(), $dayTotals['label'])); for ($i = 0; $i < 7; $i++) { - $table->addColumn(new TableColumn($dayHeaders[$i], $dayHeaders[$i], new TimeCellRenderer(), $dayTotals[$dayHeaders[$i]])); + $table->addColumn(new TableColumn($dayHeaders[$i], $dayHeaders[$i], new WeekViewCellRenderer(), $dayTotals[$dayHeaders[$i]])); } $table->setInteractive(false); $form->addInputElement($table); -- 2.20.1