Style changes
This commit is contained in:
@@ -22,17 +22,32 @@ function RenderCommandLog(){
|
||||
global $Commands;
|
||||
$renderLog="";
|
||||
foreach($Commands as $loggedCommand){
|
||||
$renderLog.=RenderParagraph($loggedCommand["Command"],"font-weight: bold;");
|
||||
$renderLog.=RenderParagraph($loggedCommand["Command"],"command");
|
||||
$renderLog.=RenderParagraph($loggedCommand["Result"]);
|
||||
$renderLog.=RenderParagraph($loggedCommand["Error"],"color: red;");
|
||||
$renderLog.=RenderParagraph($loggedCommand["Error"],"error");
|
||||
}
|
||||
|
||||
return RenderDiv("divConsoleContainer",
|
||||
RenderButton("btnToggle","Log","var elem=document.getElementById('divConsole');if(elem.style.display==''){elem.style.display='none';}else{elem.style.display='';}return false;").
|
||||
RenderDiv("divConsole",$renderLog,"display:none;")
|
||||
RenderDiv("divConsole",$renderLog,null,"display:none;")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function ScannerDetect(){
|
||||
global $ScanImage;
|
||||
$Command=$ScanImage." -f\"%d|%v %m%n\"";
|
||||
$scansResults=ExecCommand($Command);
|
||||
$devicesResults=explode("\n",$scansResults);
|
||||
list($ScannerDevice,$ScannerModel)=explode("|",$devicesResults[0]);
|
||||
|
||||
$Scanner=array();
|
||||
$Scanner["ScanDevice"]=$ScannerDevice;
|
||||
$Scanner["ScanModel"]=$ScannerModel;
|
||||
|
||||
return $Scanner;
|
||||
}
|
||||
|
||||
function Scan($device,$resolution,$format,$size,$destFileBase){
|
||||
global $PreviewDir;
|
||||
global $ScanImage;
|
||||
@@ -121,15 +136,14 @@ function CropImage($file){
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Detect scanner
|
||||
$CMD=$ScanImage." --list-devices | grep device";
|
||||
$SaneScanner = ExecCommand($CMD);
|
||||
unset($cmd);
|
||||
$start=strpos($SaneScanner,"`")+1;
|
||||
$laenge=strpos($SaneScanner,"'")-$start;
|
||||
$Scanner = "\"".substr($SaneScanner,$start,$laenge)."\"";
|
||||
unset($start);
|
||||
unset($laenge);
|
||||
$Scanner=array();
|
||||
$Scanner["ScanDevice"]=RequestParm("hidScanDevice","");
|
||||
$Scanner["ScanModel"]=RequestParm("hidScanDevice","");
|
||||
if($Scanner["ScanDevice"]=="" || $Scanner["ScanModel"]==""){
|
||||
$Scanner=ScannerDetect();
|
||||
}
|
||||
|
||||
|
||||
// Configure with formdata
|
||||
@@ -144,7 +158,7 @@ $DestFile=null;
|
||||
if(RequestParm("btnScan",false)){
|
||||
CleanUp();
|
||||
$baseName="Scan-".date("Y-m-d_H_i_s");
|
||||
$DestFile=Scan($Scanner,$Resolution,$Format,$Size,$baseName);
|
||||
$DestFile=Scan($Scanner["ScanDevice"],$Resolution,$Format,$Size,$baseName);
|
||||
if($Crop){
|
||||
CropImage($DestFile);
|
||||
}
|
||||
@@ -152,24 +166,30 @@ if(RequestParm("btnScan",false)){
|
||||
}
|
||||
|
||||
|
||||
echo '<form id="frmMain" method="GET" action="index.php">'."\n";
|
||||
echo '<form id="frmMain" method="POST" action="'.$_SERVER['PHP_SELF'].'">'."\n";
|
||||
|
||||
// Render header info
|
||||
echo RenderFieldInfo("Scanner",$SaneScanner);
|
||||
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 RenderFieldCheckText("Cropping","chkCrop",$Crop,"txtCropFuzz",$CropFuzz);
|
||||
echo RenderFieldButton("","btnScan","Scan");
|
||||
if($DestFile!=null){
|
||||
$DestFileFixed=htmlentities($DestFile,ENT_HTML5, "UTF-8");
|
||||
echo '<div><a href="'.$DestFileFixed.'">'.
|
||||
'Download '.$DestFileFixed.'</a></div>'."\n";
|
||||
echo '<div><img alt="preview" src="'.$DestFileFixed.'" '.
|
||||
'class="previewImage" /></div>';
|
||||
}
|
||||
echo RenderHidden("hidScanDevice",$Scanner["ScanDevice"]);
|
||||
echo RenderHidden("hidScanModel",$Scanner["ScanModel"]);
|
||||
|
||||
echo "</form>\n";
|
||||
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>';
|
||||
}
|
||||
|
||||
echo RenderCommandLog();
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
|
||||
|
||||
36
code/ui.php
36
code/ui.php
@@ -140,29 +140,47 @@ function RenderFieldButton($text,$idButton,$value,$onClick=""){
|
||||
}
|
||||
|
||||
|
||||
function RenderParagraph($text,$style=null){
|
||||
function RenderParagraph($text,$class=null){
|
||||
if($text==null || $text==""){ return ""; }
|
||||
$textLines=explode("\n",$text);
|
||||
$render="";
|
||||
foreach ($textLines as $line) {
|
||||
$textFixed=htmlentities($line,ENT_HTML5, "UTF-8");
|
||||
if($style==null){
|
||||
if($class==null){
|
||||
$render.="<p>".$textFixed."</p>\n";
|
||||
}else{
|
||||
$render.="<p style=\"".$style."\">".$textFixed."</p>\n";
|
||||
$render.="<p class=\"".$class."\">".$textFixed."</p>\n";
|
||||
}
|
||||
}
|
||||
return $render;
|
||||
}
|
||||
|
||||
function RenderDiv($idDiv,$innerHTML,$style=null){
|
||||
function RenderDiv($idDiv,$innerHTML,$class=null,$style=null){
|
||||
$idFixed=htmlentities($idDiv,ENT_HTML5, "UTF-8");
|
||||
if($style==null){
|
||||
$render='<div id="'.$idFixed.'" >';
|
||||
}else{
|
||||
$render='<div id="'.$idFixed.'" style="'.$style.'">';
|
||||
$render='<div id="'.$idFixed.'"';
|
||||
if($class!=null){
|
||||
$render.=' class="'.$class.'"';
|
||||
}
|
||||
if($style!=null){
|
||||
$render.=' style="'.$style.'"';
|
||||
}
|
||||
$render.=' >'."\n";
|
||||
$render.=$innerHTML;
|
||||
$render.='<div/>'."\n";
|
||||
$render.='</div>'."\n";
|
||||
return $render;
|
||||
}
|
||||
|
||||
function RenderHidden($id,$value){
|
||||
$idFixed=htmlentities($id,ENT_HTML5, "UTF-8");
|
||||
$valueFixed=htmlentities($value,ENT_HTML5, "UTF-8");
|
||||
return '<input type="hidden" value="'.$valueFixed.'" '.
|
||||
'id="'.$idFixed.'" name="'.$idFixed.'" />'."\n";
|
||||
}
|
||||
|
||||
function RenderForm($id,$innerHTML){
|
||||
$idFixed=htmlentities($id,ENT_HTML5, "UTF-8");
|
||||
$render='<form id="'.$idFixed.'" method="POST" action="'.$_SERVER['PHP_SELF'].'">'."\n";
|
||||
$render.=$innerHTML;
|
||||
$render.='</form>'."\n";
|
||||
return $render;
|
||||
}
|
||||
|
||||
42
style.css
42
style.css
@@ -1,24 +1,16 @@
|
||||
* {margin:0;padding:0;border:none;font-family:Arial,sans-serif; color:rgb(32,32,32);background-color:white; box-sizing:border-box; -moz-box-sizing:border-box;}
|
||||
h1{
|
||||
font-size: 30px;
|
||||
color: rgb(128,128,128);
|
||||
margin:5px;
|
||||
margin-top:10px;
|
||||
}
|
||||
h1:first-child{
|
||||
margin-top:5px;
|
||||
}
|
||||
* {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;}
|
||||
|
||||
h1{
|
||||
font-size: 40px;
|
||||
color: rgb(128,128,128);
|
||||
margin:15px;
|
||||
}
|
||||
.field{
|
||||
display:block;
|
||||
white-space:nowrap;
|
||||
vertical-align:top;
|
||||
font-size:0;
|
||||
margin:5px;
|
||||
margin-top:10px;
|
||||
}
|
||||
.field:first-child{
|
||||
margin-top:5px;
|
||||
margin:15px;
|
||||
}
|
||||
.fieldLabel{
|
||||
display:inline-block;
|
||||
@@ -27,7 +19,7 @@ h1:first-child{
|
||||
vertical-align:top;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
font-size:14px;
|
||||
font-size:16px;
|
||||
}
|
||||
.fieldContent{
|
||||
display:inline-block;
|
||||
@@ -35,21 +27,25 @@ h1:first-child{
|
||||
white-space: normal;
|
||||
vertical-align:top;
|
||||
word-break: break-word;
|
||||
font-size:14px;
|
||||
font-size:16px;
|
||||
}
|
||||
|
||||
.combo{
|
||||
min-width:100px;
|
||||
border: solid 1px rgb(32,32,32);
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.button{
|
||||
display:inline-block;
|
||||
padding:5px;
|
||||
margin:0;
|
||||
margin-top: 5px;
|
||||
background-color: rgb(192,192,192);
|
||||
border: solid 1px rgb(32,32,32);
|
||||
cursor:pointer;
|
||||
font-size:14px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.button:hover{
|
||||
background-color: rgb(240,240,240);
|
||||
@@ -57,6 +53,8 @@ h1:first-child{
|
||||
|
||||
.textBox{
|
||||
border: solid 1px rgb(32,32,32);
|
||||
font-size:14px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.previewImage{
|
||||
@@ -85,3 +83,13 @@ h1:first-child{
|
||||
background-color: black;
|
||||
font-family: Monospace;
|
||||
}
|
||||
#divConsole p.command{
|
||||
font-weight: bold;
|
||||
}
|
||||
#divConsole p.error{
|
||||
color: red;
|
||||
}
|
||||
|
||||
.divHidden{
|
||||
display: none;
|
||||
}
|
||||
Reference in New Issue
Block a user