web/website/integrations/osticket/dev-jarvis-form.php
2026-11-27 23:43:05 +00:00

37 lines
5.4 KiB
PHP

<?php
if(!defined('ROOT_DIR')||!isset($identity,$values,$owner))exit;
$jf=dune_jarvis_fields();$jc=dune_jarvis_catalogue();
$je=static fn($v)=>htmlspecialchars((string)$v,ENT_QUOTES,'UTF-8');
$render=function($key)use($jf,$values,$jc,$je){
[$label,$required,$max,$type,$hint]=$jf[$key];$value=$values[$key]??'';
echo '<label class="'.($type==='textarea'?'wide':'').'">'.$je($label).($required?' *':'');
if(in_array($type,['select','route','choice','action'],true)){
echo '<select name="'.$je($key).'"'.($required?' required':'').'>';
if($type!=='select')echo '<option value="">Choose…</option>';
$options=$type==='action'?array_column($jc['actions'],'label','id'):$hint;
foreach($options as$id=>$text){$id=$type==='select'?$text:$id;echo '<option value="'.$je($id).'"'.($value===$id?' selected':'').'>'.$je($text).'</option>';}
echo '</select>';
}elseif($type==='textarea')echo '<textarea name="'.$je($key).'" maxlength="'.$max.'"'.($required?' required':'').' placeholder="'.$je($hint).'">'.$je($value).'</textarea>';
else echo '<input name="'.$je($key).'" type="'.($type==='number'?'number':'text').'" maxlength="'.$max.'"'.($type==='number'?' min="1" max="15"':'').($required?' required':'').' placeholder="'.$je($hint).'" value="'.$je($value).'">';
echo '</label>';
};
?>
<section class="dev-box dev-jarvis-request" id="new-task">
<div class="dev-task-heading"><div><p class="eyebrow">A REQUEST IS NOT AN EXECUTED ACTION</p><h2>J.A.R.V.I.S. request desk</h2></div><img src="/assets/seals/team-dev-150.png" width="64" height="64" alt="Development bureau seal"></div>
<p>Use English. Choose the execution route, identify the exact targets and define the evidence needed to finish. Your request is preserved in a private ticket. Approval does not issue a key or execute a change.</p>
<form method="post" id="jarvis-dev-request">
<input type="hidden" name="action" value="create"><input type="hidden" name="csrf" value="<?=$je($_SESSION['dune_dev_csrf'])?>"><input type="hidden" name="submission" value="<?=$je($_SESSION['dune_dev_submission'])?>">
<fieldset><legend>1 · Route &amp; destination</legend><div class="dev-fields"><?php foreach(['title','workflow','type','system','environment']as$k)$render($k);?></div><p id="jarvis-route-help" role="status">A supported data operation uses an existing Jarvis action. A browser or access problem does not turn it into a developer operation.</p></fieldset>
<fieldset data-jarvis-routes="existing"><legend>2 · Existing action &amp; typed parameters</legend><div class="dev-fields"><?php $render('action_id');?></div><p id="jarvis-action-effect"></p><div class="dev-fields" id="jarvis-action-fields"></div><p>Catalogue membership is not execution authority. The current domain adapter and required normal key must still be verified at execution.</p></fieldset>
<fieldset data-jarvis-routes="idea capability code devkey"><legend>2 · Catalogue review</legend><div class="dev-fields"><?php $render('catalogue_review');?></div><p>For a future idea or new key proposal, leave this blank if you need a reviewer to check the catalogue. You do not need technical implementation knowledge. An unavailable interface never permits bypassing an access denial.</p></fieldset>
<fieldset data-jarvis-routes="capability"><legend>Missing capability</legend><div class="dev-fields"><?php $render('missing_capability');?></div></fieldset>
<fieldset data-jarvis-routes="devkey" class="jarvis-devkey-request"><legend>Dev key request · separately controlled</legend><p>Developer keys can authorise destructive operations. This form only requests review: no developer key is issued, displayed or executed here, including for Owners.</p><div class="dev-fields"><?php foreach(['dev_actor','dev_actions','dev_expiry','destructive_actions']as$k)$render($k);?></div><label class="dev-check"><input type="checkbox" name="dev_acknowledgement" value="1"> I understand that issuance and execution require the separately authorised server/CLI developer flow, bound to the exact actor, environment and manifest.</label></fieldset>
<fieldset><legend>3 · Outcome, context &amp; protected scope</legend><div class="dev-fields"><?php foreach(['targets','objective','current','expected','scope','preserve','acceptance']as$k)$render($k);?></div></fieldset>
<fieldset><legend>4 · Checks, recovery &amp; supporting material</legend><div class="dev-fields"><?php foreach(['risk','reproduction','testplan','references','dependencies','priority','timing']as$k)$render($k);?></div><p>Add relevant files to the resulting private ticket. Never attach credentials, a real key, an environment file or unnecessary personal information.</p></fieldset>
<label class="dev-check"><input type="checkbox" name="privacy" value="1" required> I have not included passwords, tokens, private keys or unnecessary personal data.</label>
<p class="jarvis-request-receipt">Completion must identify the real outcome and audit/receipt reference. Planned, tested, deployed and executed are different states.</p>
<button type="submit"><?=$owner?'Create reviewed request':'Submit request for review'?></button>
</form>
<noscript><p>JavaScript is required to choose typed action parameters. Other request fields still undergo server validation.</p></noscript>
<script type="application/json" id="jarvis-request-catalogue"><?=json_encode(['catalogue'=>$jc,'values'=>$values],JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_THROW_ON_ERROR)?></script>
</section>