Usabitily fixes
This commit is contained in:
@@ -15,16 +15,10 @@ $timings=new TimingStatistics();
|
|||||||
function RenderDocument($filePath){
|
function RenderDocument($filePath){
|
||||||
$render="";
|
$render="";
|
||||||
if($filePath!=null){
|
if($filePath!=null){
|
||||||
$filename=pathinfo($filePath)["basename"];
|
|
||||||
$filePathFixed=htmlentities($filePath,ENT_HTML5, "UTF-8");
|
$filePathFixed=htmlentities($filePath,ENT_HTML5, "UTF-8");
|
||||||
$filenameFixed=htmlentities($filename,ENT_HTML5, "UTF-8");
|
|
||||||
$render.='<div><a href="'.$filePathFixed.'" class="button" download="'.$filenameFixed.'">'.
|
|
||||||
MultiLang::GetString("Download").'</a></div>'."\n";
|
|
||||||
$render.='<iframe src="'.$filePathFixed.'" '.
|
$render.='<iframe src="'.$filePathFixed.'" '.
|
||||||
'class="previewDoc" ></iframe>';
|
'class="previewDoc" ></iframe>';
|
||||||
}else{
|
}else{
|
||||||
$render.='<div><button class="button" disabled="disabled">'.
|
|
||||||
MultiLang::GetString("Download").'</button></div>'."\n";
|
|
||||||
$render.='<iframe src="about:blank" '.
|
$render.='<iframe src="about:blank" '.
|
||||||
'class="previewDoc" ></iframe>';
|
'class="previewDoc" ></iframe>';
|
||||||
}
|
}
|
||||||
@@ -46,6 +40,7 @@ $Format=RequestParm("ddlFormat",$Format);
|
|||||||
$Size=RequestParm("ddlSize",$Size);
|
$Size=RequestParm("ddlSize",$Size);
|
||||||
$Crop=RequestParm("chkCrop",$Crop)!=false;
|
$Crop=RequestParm("chkCrop",$Crop)!=false;
|
||||||
$CropFuzz=RequestParm("txtCropFuzz",$CropFuzz);
|
$CropFuzz=RequestParm("txtCropFuzz",$CropFuzz);
|
||||||
|
$Prefix=RequestParm("txtPrefix",$Prefix);
|
||||||
|
|
||||||
$CurrentKey=$Scanner["ScanDevice"]."_".$Resolution."_".$Format."_".$Size;
|
$CurrentKey=$Scanner["ScanDevice"]."_".$Resolution."_".$Format."_".$Size;
|
||||||
|
|
||||||
@@ -54,7 +49,7 @@ $DestFile=null;
|
|||||||
if(RequestParm("btnScan",false)){
|
if(RequestParm("btnScan",false)){
|
||||||
$timeThen=time()+microtime();
|
$timeThen=time()+microtime();
|
||||||
CleanUp();
|
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);
|
$DestFile=Scan($Scanner["ScanDevice"],$Resolution,$Format,$Size,$baseName);
|
||||||
if($Crop){
|
if($Crop){
|
||||||
CropImage($DestFile);
|
CropImage($DestFile);
|
||||||
@@ -71,6 +66,7 @@ echo json_encode($timings->GetTimingsAverage(),JSON_PRETTY_PRINT);
|
|||||||
echo ";\n";
|
echo ";\n";
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
|
|
||||||
// Render Form
|
// Render Form
|
||||||
$formFields="";
|
$formFields="";
|
||||||
$formFields.=RenderFieldInfo(MultiLang::GetString("Scanner"),$Scanner["ScanModel"]);
|
$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("Format"),"ddlFormat",$Formats,$Format);
|
||||||
$formFields.=RenderFieldCombo(MultiLang::GetString("Size"),"ddlSize",MultiLang::ApplyArrayKeys($Sizes),$Size);
|
$formFields.=RenderFieldCombo(MultiLang::GetString("Size"),"ddlSize",MultiLang::ApplyArrayKeys($Sizes),$Size);
|
||||||
//$formFields.=RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz);
|
//$formFields.=RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz);
|
||||||
|
$formFields.=RenderFieldText(MultiLang::GetString("Prefix"),"txtPrefix",$Prefix);
|
||||||
$formFields.=RenderFieldButton("","btnScan",MultiLang::GetString("Scan"),"ShowProgressDialog();");
|
$formFields.=RenderFieldButton("","btnScan",MultiLang::GetString("Scan"),"ShowProgressDialog();");
|
||||||
|
$formFields.=RenderFieldLinkButton("","btnDownload",MultiLang::GetString("Download"),$DestFile,pathinfo($DestFile)["basename"],"");
|
||||||
$formFields.=RenderHidden("hidScanDevice",$Scanner["ScanDevice"]);
|
$formFields.=RenderHidden("hidScanDevice",$Scanner["ScanDevice"]);
|
||||||
$formFields.=RenderHidden("hidScanModel",$Scanner["ScanModel"]);
|
$formFields.=RenderHidden("hidScanModel",$Scanner["ScanModel"]);
|
||||||
$columns="";
|
$columns="";
|
||||||
|
|||||||
31
code/ui.php
31
code/ui.php
@@ -91,6 +91,27 @@ function RenderButton($id,$value,$onClick=""){
|
|||||||
return $render;
|
return $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function RenderLinkButton($id,$text,$href="",$download="",$onClick=""){
|
||||||
|
$idFixed=htmlentities($id,ENT_HTML5, "UTF-8");
|
||||||
|
|
||||||
|
$render='<a class="button" ';
|
||||||
|
if($href!=""){
|
||||||
|
$hrefFixed=htmlentities($href,ENT_HTML5, "UTF-8");
|
||||||
|
$render.=' href="'.$hrefFixed.'"';
|
||||||
|
}
|
||||||
|
if($download!=""){
|
||||||
|
$downloadFixed=htmlentities($download,ENT_HTML5, "UTF-8");
|
||||||
|
$render.=' download="'.$downloadFixed.'"';
|
||||||
|
}
|
||||||
|
if($onClick!=""){
|
||||||
|
$onClickFixed=htmlentities($onClick,ENT_HTML5, "UTF-8");
|
||||||
|
$render.=' onclick="'.$onClickFixed.'"';
|
||||||
|
}
|
||||||
|
$render.='>'.$text.'</a>'."\n";
|
||||||
|
|
||||||
|
return $render;
|
||||||
|
}
|
||||||
|
|
||||||
function RenderFieldInfo($text,$info){
|
function RenderFieldInfo($text,$info){
|
||||||
$render='<div class="field">'."\n";
|
$render='<div class="field">'."\n";
|
||||||
$render.=RenderLabel($text);
|
$render.=RenderLabel($text);
|
||||||
@@ -139,6 +160,16 @@ function RenderFieldButton($text,$idButton,$value,$onClick=""){
|
|||||||
return $render;
|
return $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function RenderFieldLinkButton($text,$linkText,$href="",$download="",$onClick=""){
|
||||||
|
$render='<div class="field">'."\n";
|
||||||
|
$render.=RenderLabel($text);
|
||||||
|
$render.=RenderLinkButton($idButton,$href,$download,$onClick);
|
||||||
|
|
||||||
|
$render.='</div>'."\n";
|
||||||
|
return $render;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function RenderParagraph($text,$class=null){
|
function RenderParagraph($text,$class=null){
|
||||||
if($text==null || $text==""){ return ""; }
|
if($text==null || $text==""){ return ""; }
|
||||||
|
|||||||
@@ -48,3 +48,5 @@ $Size="A4";
|
|||||||
$Crop=false;
|
$Crop=false;
|
||||||
$CropFuzz=50;
|
$CropFuzz=50;
|
||||||
|
|
||||||
|
// Prefix
|
||||||
|
$Prefix="Scan";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link href="style.css" rel="stylesheet" type="text/css">
|
<link href="style.css" rel="stylesheet" type="text/css">
|
||||||
<script type="text/javascript" src="script.js"></script>
|
<script type="text/javascript" src="script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body oncontextmenu="return false;">
|
||||||
<h1>Scans</h1>
|
<h1>Scans</h1>
|
||||||
<?php
|
<?php
|
||||||
include_once "code/main.php";
|
include_once "code/main.php";
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"Resolution": "Resolution",
|
"Resolution": "Resolution",
|
||||||
"Format": "Format",
|
"Format": "Format",
|
||||||
"Size": "Size",
|
"Size": "Size",
|
||||||
|
"Prefix": "Prefix",
|
||||||
"Scan": "Scan",
|
"Scan": "Scan",
|
||||||
"Loading": "Loading",
|
"Loading": "Loading",
|
||||||
"Full": "Full",
|
"Full": "Full",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"Resolution": "Resolucion",
|
"Resolution": "Resolucion",
|
||||||
"Format": "Formato",
|
"Format": "Formato",
|
||||||
"Size": "Tamaño",
|
"Size": "Tamaño",
|
||||||
|
"Prefix": "Prefijo",
|
||||||
"Scan": "Escanear",
|
"Scan": "Escanear",
|
||||||
"Loading": "Cargando",
|
"Loading": "Cargando",
|
||||||
"Full": "Completo",
|
"Full": "Completo",
|
||||||
|
|||||||
Reference in New Issue
Block a user