diff --git a/code/main.php b/code/main.php index 539de82..e411d46 100644 --- a/code/main.php +++ b/code/main.php @@ -15,16 +15,10 @@ $timings=new TimingStatistics(); function RenderDocument($filePath){ $render=""; if($filePath!=null){ - $filename=pathinfo($filePath)["basename"]; $filePathFixed=htmlentities($filePath,ENT_HTML5, "UTF-8"); - $filenameFixed=htmlentities($filename,ENT_HTML5, "UTF-8"); - $render.='
'."\n"; $render.=''; }else{ - $render.=''."\n"; $render.=''; } @@ -46,6 +40,7 @@ $Format=RequestParm("ddlFormat",$Format); $Size=RequestParm("ddlSize",$Size); $Crop=RequestParm("chkCrop",$Crop)!=false; $CropFuzz=RequestParm("txtCropFuzz",$CropFuzz); +$Prefix=RequestParm("txtPrefix",$Prefix); $CurrentKey=$Scanner["ScanDevice"]."_".$Resolution."_".$Format."_".$Size; @@ -54,7 +49,7 @@ $DestFile=null; if(RequestParm("btnScan",false)){ $timeThen=time()+microtime(); CleanUp(); - $baseName="Scan-".date("Y-m-d_H_i_s"); + $baseName=$Prefix."-".date("Y-m-d_H_i_s"); $DestFile=Scan($Scanner["ScanDevice"],$Resolution,$Format,$Size,$baseName); if($Crop){ CropImage($DestFile); @@ -71,6 +66,7 @@ echo json_encode($timings->GetTimingsAverage(),JSON_PRETTY_PRINT); echo ";\n"; echo "\n"; + // Render Form $formFields=""; $formFields.=RenderFieldInfo(MultiLang::GetString("Scanner"),$Scanner["ScanModel"]); @@ -78,7 +74,9 @@ $formFields.=RenderFieldCombo(MultiLang::GetString("Resolution"),"ddlResolution" $formFields.=RenderFieldCombo(MultiLang::GetString("Format"),"ddlFormat",$Formats,$Format); $formFields.=RenderFieldCombo(MultiLang::GetString("Size"),"ddlSize",MultiLang::ApplyArrayKeys($Sizes),$Size); //$formFields.=RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz); +$formFields.=RenderFieldText(MultiLang::GetString("Prefix"),"txtPrefix",$Prefix); $formFields.=RenderFieldButton("","btnScan",MultiLang::GetString("Scan"),"ShowProgressDialog();"); +$formFields.=RenderFieldLinkButton("","btnDownload",MultiLang::GetString("Download"),$DestFile,pathinfo($DestFile)["basename"],""); $formFields.=RenderHidden("hidScanDevice",$Scanner["ScanDevice"]); $formFields.=RenderHidden("hidScanModel",$Scanner["ScanModel"]); $columns=""; diff --git a/code/ui.php b/code/ui.php index 6b13676..df69944 100644 --- a/code/ui.php +++ b/code/ui.php @@ -91,6 +91,27 @@ function RenderButton($id,$value,$onClick=""){ return $render; } +function RenderLinkButton($id,$text,$href="",$download="",$onClick=""){ + $idFixed=htmlentities($id,ENT_HTML5, "UTF-8"); + + $render=''.$text.''."\n"; + + return $render; +} + function RenderFieldInfo($text,$info){ $render='