diff --git a/fleet2.php b/fleet2.php index b060d2e6c..7eab06b5f 100644 --- a/fleet2.php +++ b/fleet2.php @@ -19,6 +19,11 @@ $_Lang['SelectResources'] = 'false'; $_Lang['SelectQuantumGate'] = 'false'; + +$setFormValues = [ + 'holdingtime' => null, +]; + if(!empty($_POST['gobackVars'])) { $_POST['gobackVars'] = json_decode(base64_decode($_POST['gobackVars']), true); @@ -36,7 +41,7 @@ } if(isset($_POST['gobackVars']['holdingtime'])) { - $_Lang['SelectHolding_'.$_POST['gobackVars']['holdingtime']] = 'selected'; + $setFormValues['holdingtime'] = $_POST['gobackVars']['holdingtime']; } if(isset($_POST['gobackVars']['expeditiontime'])) { @@ -668,6 +673,28 @@ $_Lang['Insert_AllyPact_AttackWarn'] = 'false'; } +$availableHoldTimes = FlightControl\Utils\Helpers\getAvailableHoldTimes([]); + +$missionHoldTimeOptions = array_map( + function ($holdTimeValue) use ($setFormValues) { + return buildDOMElementHTML([ + 'tagName' => 'option', + 'contentHTML' => $holdTimeValue, + 'attrs' => [ + 'value' => $holdTimeValue, + 'selected' => ( + $holdTimeValue == $setFormValues['holdingtime'] ? + '' : + null + ), + ], + ]); + }, + $availableHoldTimes +); + +$_Lang['P_HTMLBuilder_MissionHold_AvailableTimes'] = implode('', $missionHoldTimeOptions); + display(parsetemplate(gettemplate('fleet2_body'), $_Lang), $_Lang['fl_title']); ?> diff --git a/templates/default_template/fleet2_body.tpl b/templates/default_template/fleet2_body.tpl index 357bc6c24..fc05c8492 100644 --- a/templates/default_template/fleet2_body.tpl +++ b/templates/default_template/fleet2_body.tpl @@ -151,12 +151,7 @@ var AllyPact_AttackWarn = {Insert_AllyPact_AttackWarn};