From 9c1dcfc365c9563566469d2c2ea9390c8de35166 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Mon, 6 Apr 2020 11:15:29 +0100 Subject: [PATCH 1/2] Linting and Bootstrap tidying of form. --- .../views/milestone/milestone_edit.php | 112 +++++++++--------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/modules/milestones/views/milestone/milestone_edit.php b/modules/milestones/views/milestone/milestone_edit.php index 1f8c197887..daf0b70a22 100644 --- a/modules/milestones/views/milestone/milestone_edit.php +++ b/modules/milestones/views/milestone/milestone_edit.php @@ -39,7 +39,6 @@
Milestone details @@ -48,121 +47,128 @@ echo data_entry_helper::hidden_text(array( 'fieldname' => 'milestone:id', - 'default' => html::initial_value($values, 'milestone:id') + 'default' => html::initial_value($values, 'milestone:id'), )); echo data_entry_helper::hidden_text(array( 'fieldname' => 'website_id', - 'default' => html::initial_value($values, 'milestone:website_id') + 'default' => html::initial_value($values, 'milestone:website_id'), )); echo data_entry_helper::text_input(array( 'label' => 'Title', 'fieldname' => 'milestone:title', - 'class' => 'control-width-4', - 'default' => html::initial_value($values, 'milestone:title') + 'default' => html::initial_value($values, 'milestone:title'), )); echo data_entry_helper::select(array( 'label' => 'Count what?', 'fieldname' => 'milestone:entity', - 'lookupValues' => array('T' => 'Species or taxa', 'O' => 'Records', 'M' => 'Media/photos'), + 'lookupValues' => [ + 'T' => 'Species or taxa', + 'O' => 'Records', + 'M' => 'Media/photos', + ], 'default' => html::initial_value($values, 'milestone:entity'), - 'helpText' => 'Are you targetting a total count of species, records or media/photos for this milestone?' + 'helpText' => 'Are you targetting a total count of species, records or media/photos for this milestone?', )); echo data_entry_helper::text_input(array( 'label' => 'Count', 'fieldname' => 'milestone:count', - 'class' => 'control-width-2', 'default' => html::initial_value($values, 'milestone:count'), - 'helpText' => 'What is the target number that must be reached to hit the milestone?' + 'helpText' => 'What is the target number that must be reached to hit the milestone?', )); echo data_entry_helper::text_input(array( 'label' => 'Group ID', 'fieldname' => 'milestone:group_id', - 'class' => 'control-width-2', 'default' => html::initial_value($values, 'milestone:group_id'), - 'helpText' => 'Optional ID of the recording group associated with the milestone, only users that are members of this group will receive the milestone award.' + 'helpText' => 'Optional ID of the recording group associated with the milestone, only users that are members of this group will receive the milestone award.', )); echo data_entry_helper::textarea(array( 'label' => 'Success message', 'fieldname' => 'milestone:success_message', - 'class' => 'control-width-6', - 'default' =>html::initial_value($values, 'milestone:success_message'), - 'helpText' => 'This message will be sent to the user on reaching the milestone as a notification.' + 'default' => html::initial_value($values, 'milestone:success_message'), + 'helpText' => 'This message will be sent to the user on reaching the milestone as a notification.', )); echo data_entry_helper::text_input(array( 'label' => 'Awarded by', 'fieldname' => 'milestone:awarded_by', - 'class' => 'control-width-6', - 'default'=> html::initial_value($values, 'milestone:awarded_by'), - 'helpText' => 'Which organisation is awarding the milestone? This will appear in the from field for the notification sent to the recorder.' + 'default' => html::initial_value($values, 'milestone:awarded_by'), + 'helpText' => 'Which organisation is awarding the milestone? This will appear in the from field for the notification sent to the recorder.', )); - //The filter title is actually generated using the milestone title we enter. There are issues with using the built-in validator to detect duplicate titles because the filter supermodel is validated - //first. The filter requires a unique title/sharing/created_by_id option that isn't included in the model, the issue is only - //detected once the system tries to add the filter to the database, this will fail with a general error without even getting as far as doing the milestone model's - //title duplciate detection. - //So to fix this, collect the existing filters from the database so we can compare the titles with the one we create and then - //do the validation manually. - $readAuth = data_entry_helper::get_read_auth(0-$_SESSION['auth_user']->id, kohana::config('indicia.private_key')); - $existingFilterData = data_entry_helper::get_population_data(array( + // The filter title is actually generated using the milestone title we + // enter. There are issues with using the built-in validator to detect + // duplicate titles because the filter supermodel is validated first. The + // filter requires a unique title/sharing/created_by_id option that isn't + // included in the model, the issue is only detected once the system tries + // to add the filter to the database, this will fail with a general error + // without even getting as far as doing the milestone model's title + // duplciate detection. + // So to fix this, collect the existing filters from the database so we can + // compare the titles with the one we create and then do the validation + // manually. + $readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key')); + $existingFilterData = data_entry_helper::get_population_data([ 'table' => 'filter', 'extraParams' => $readAuth, - 'nocache' => true - )); - - //When we save a milestone when we need to automatically set the filter title as there isn't a separate field - //to fill this in. - //Also hide the "who" filter as we don't need this for milestones as they can apply to all users - //Also manually do the unique milestone/filter title validation (see note above) - data_entry_helper::$javascript .= " -var existingFilterData=".json_encode($existingFilterData)."; + 'nocache' => TRUE, + ]); + + // When we save a milestone when we need to automatically set the filter + // title as there isn't a separate field to fill this in. + // Also hide the "who" filter as we don't need this for milestones as they + // can apply to all users. + // Also manually do the unique milestone/filter title validation (see note + // above). + $jsFilterData = json_encode($existingFilterData); + data_entry_helper::$javascript .= <<id, kohana::config('indicia.private_key')); $filterPanelHTML = '

Specify the filter used to define which records count

'; - $hiddenPopupDivs=''; + $hiddenPopupDivs = ''; $filterPanelHTML .= report_filter_panel($readAuth, array( - 'allowLoad'=>false, - 'allowSave' => false, - 'embedInExistingForm' => true, - 'runningOnWarehouse' => true, + 'allowLoad' => FALSE, + 'allowSave' => FALSE, + 'embedInExistingForm' => TRUE, + 'runningOnWarehouse' => TRUE, 'taxon_list_id' => warehouse::getMasterTaxonListId(), - 'website_id' => html::initial_value($values, 'milestone:website_id') ? html::initial_value($values, 'milestone:website_id') : $values['website_id'] + 'website_id' => html::initial_value($values, 'milestone:website_id') ? html::initial_value($values, 'milestone:website_id') : $values['website_id'], ), $this->uri->argument(1), $hiddenStuff); - // fields to auto-create a filter record for this group's defined set of records - $filterPanelHTML .= data_entry_helper::hidden_text(array('fieldname' => 'filter:id' ,'default'=>html::initial_value($values, 'filter:id'))); + // Fields to auto-create a filter record for this group's defined set of records. + $filterPanelHTML .= data_entry_helper::hidden_text([ + 'fieldname' => 'filter:id', + 'default' => html::initial_value($values, 'filter:id'), + ]); $filterPanelHTML .= ''; $filterPanelHTML .= ''; $filterPanelHTML .= ''; echo $filterPanelHTML; - echo html::form_buttons(html::initial_value($values, 'milestone:id')!=null, false, false); - data_entry_helper::$dumped_resources[] = 'jquery'; - data_entry_helper::$dumped_resources[] = 'jquery_ui'; - data_entry_helper::$dumped_resources[] = 'fancybox'; + echo html::form_buttons(html::initial_value($values, 'milestone:id') != NULL, FALSE, FALSE); data_entry_helper::enable_validation('milestones-form'); - data_entry_helper::link_default_stylesheet(); echo data_entry_helper::dump_javascript(); ?>
\ No newline at end of file From 5f366f3d249192ad87b149301b64b5d0e0bee55c Mon Sep 17 00:00:00 2001 From: John van Breda Date: Mon, 6 Apr 2020 12:25:18 +0100 Subject: [PATCH 2/2] Version bump --- application/config/version.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/version.php b/application/config/version.php index 9ac972286b..29960f2908 100644 --- a/application/config/version.php +++ b/application/config/version.php @@ -29,14 +29,14 @@ * * @var string */ -$config['version'] = '3.2.2'; +$config['version'] = '3.2.3'; /** * Version release date. * * @var string */ -$config['release_date'] = '2020-04-03'; +$config['release_date'] = '2020-04-06'; /** * Link to the code repository downloads page.