Change the layout to two columns; Parameters and document view.

This commit is contained in:
2015-06-27 03:45:06 +02:00
parent 8690ff5638
commit 9792f23158
2 changed files with 63 additions and 39 deletions

View File

@@ -4,6 +4,7 @@ include_once "config.php";
include_once "utils.php";
include_once "ui.php";
$Commands=array();
function ExecCommand($command){
@@ -136,16 +137,27 @@ function CropImage($file){
}
function RenderDocument($filePath){
$filename=pathinfo($filePath)["basename"];
$filePathFixed=htmlentities($filePath,ENT_HTML5, "UTF-8");
$filenameFixed=htmlentities($filename,ENT_HTML5, "UTF-8");
$render="";
$render.='<div><a href="'.$filePathFixed.'" class="button" download="'.$filenameFixed.'">'.
'Download</a></div>'."\n";
$render.='<iframe src="'.$filePathFixed.'" '.
'class="previewDoc" ></iframe>';
return $render;
}
// Detect scanner
$Scanner=array();
$Scanner["ScanDevice"]=RequestParm("hidScanDevice","");
$Scanner["ScanModel"]=RequestParm("hidScanDevice","");
$Scanner["ScanModel"]=RequestParm("hidScanModel","");
if($Scanner["ScanDevice"]=="" || $Scanner["ScanModel"]==""){
$Scanner=ScannerDetect();
}
// Configure with formdata
$Resolution=RequestParm("ddlResolution",$Resolution);
$Format=RequestParm("ddlFormat",$Format);
@@ -165,31 +177,24 @@ if(RequestParm("btnScan",false)){
MoveToDest($DestFile);
}
echo '<form id="frmMain" method="POST" action="'.$_SERVER['PHP_SELF'].'">'."\n";
// Render header info
echo RenderFieldInfo("Scanner",$Scanner["ScanModel"]);
echo RenderFieldCombo("Resolution","ddlResolution",$Resolutions,$Resolution);
echo RenderFieldCombo("Format","ddlFormat",$Formats,$Format);
echo RenderFieldCombo("Size","ddlSize",$Sizes,$Size);
echo RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz);
echo RenderFieldButton("","btnScan","Scan");
echo RenderHidden("hidScanDevice",$Scanner["ScanDevice"]);
echo RenderHidden("hidScanModel",$Scanner["ScanModel"]);
// Render Form
$formFields="";
$formFields.=RenderFieldInfo("Scanner",$Scanner["ScanModel"]);
$formFields.=RenderFieldCombo("Resolution","ddlResolution",$Resolutions,$Resolution);
$formFields.=RenderFieldCombo("Format","ddlFormat",$Formats,$Format);
$formFields.=RenderFieldCombo("Size","ddlSize",$Sizes,$Size);
$formFields.=RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz);
$formFields.=RenderFieldButton("","btnScan","Scan");
$formFields.=RenderHidden("hidScanDevice",$Scanner["ScanDevice"]);
$formFields.=RenderHidden("hidScanModel",$Scanner["ScanModel"]);
$columns="";
$columns.=renderDiv("divColLeft",$formFields);
$result="";
if($DestFile!=null){
$DestFilenane=pathinfo($DestFile)["basename"];
$DestFileFixed=htmlentities($DestFilenane,ENT_HTML5, "UTF-8");
$DestPathFixed=htmlentities($DestFile,ENT_HTML5, "UTF-8");
echo '<div><a href="'.$DestPathFixed.'" class="button" download="'.$DestFileFixed.'">'.
'Download</a></div>'."\n";
echo '<iframe src="'.$DestPathFixed.'" '.
'class="previewDoc" ></iframe>';
$result.=RenderDocument($DestFile);
}
echo RenderCommandLog();
echo "</form>\n";
$columns.=renderDiv("divColRight",$result);
$columns.=RenderCommandLog();
echo RenderForm("frmMain",$columns);

View File

@@ -1,9 +1,12 @@
* {margin:0;padding:0;border:none;font-family:Arial,sans-serif; color:rgb(32,32,32);background-color: #E9F0F0; box-sizing:border-box; -moz-box-sizing:border-box;}
html{height: 100%;}
body{height:100%;}
h1{
font-size: 40px;
color: rgb(128,128,128);
margin:15px;
padding:15px;
}
.field{
display:block;
@@ -14,7 +17,7 @@ h1{
}
.fieldLabel{
display:inline-block;
width:20%;
width:40%;
font-weight: bold;
vertical-align:top;
white-space: normal;
@@ -23,7 +26,7 @@ h1{
}
.fieldContent{
display:inline-block;
width:80%;
width:60%;
white-space: normal;
vertical-align:top;
word-break: break-word;
@@ -57,13 +60,6 @@ h1{
background-color: white;
}
.previewImage{
margin:5px;
border: solid 1px rgb(32,32,32);
max-width:200px;
max-height:200px;
}
#divConsoleContainer{
margin:5px;
}
@@ -90,6 +86,29 @@ h1{
color: red;
}
.divHidden{
display: none;
}
form{
white-space: nowrap;
height: calc(100% - 120px);
}
#divColLeft{
box-sizing: border-box;
display: inline-block;
width:40%;
vertical-align:top;
}
#divColRight{
box-sizing: border-box;
display: inline-block;
width:59%;
height: 100%;
padding: 15px;
vertical-align:top;
}
#divColRight .previewDoc{
box-sizing: border-box;
width:100%;
height: calc(100% - 35px);
border: solid 1px rgb(32,32,32);
}