Skip to content

Commit

Permalink
1.3-5 is here (If I find another crital bug...)
Browse files Browse the repository at this point in the history
  • Loading branch information
GM-Script-Writer-62850 committed Jun 27, 2013
1 parent ad68035 commit 59e953d
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 38 deletions.
4 changes: 2 additions & 2 deletions README
Expand Up @@ -5,8 +5,8 @@ Based on Linux Scanner Server 1.2 Beta

Released under the GPL 2.0

Last Update: 06/25/2013 (Month/Day/Year)
For Version: 1.3-4
Last Update: 06/26/2013 (Month/Day/Year)
For Version: 1.3-5

Change Log:
https://github.com/GM-Script-Writer-62850/PHP-Scanner-Server/wiki/Change-Log
Expand Down
4 changes: 2 additions & 2 deletions inc/config.php
Expand Up @@ -41,9 +41,9 @@
<a href="index.php?page=Config&action=Delete-Setting" onclick="return confirm('Delete all settings?')">Remove All Of These Settings</a></p><ul class="simplelist">
<?php
foreach($file as $id => $opt){
echo '<li class="boxlist"><a class="tool icon del" href="index.php?page=Config&action=Delete-Setting&value='.urlencode($id).'" onclick="return confirm(\'Delete this setting: &#92;n'.html($id).'\')"><span class="tip">Delete</span></a> <a target="_blank" href="index.php?page=Scan&action=restore&';
echo '<li class="boxlist"><a class="tool icon del" href="index.php?page=Config&action=Delete-Setting&value='.urlencode($id).'" onclick="return confirm(\'Delete this setting: &#92;n'.html($id).'\')"><span class="tip">Delete</span></a> <a target="_blank" href="index.php?page=Scan&action=restore';
foreach($opt as $key => $val){
echo html($key).'='.html($val).'&';
echo '&'.html($key).'='.html($val);
}
echo '">'.html($id).'</a></li>';
}
Expand Down
12 changes: 6 additions & 6 deletions inc/edit.php
Expand Up @@ -37,7 +37,7 @@
<span class="tool">Brightness<span class="tip">Lighting</span></span>:
</div>
<div class="control">
<select name="bright">
<select name="bright" onchange="changeBrightContrast()">
<script type="text/JavaScript">
for(var i=-100;i<=100;i+=10){
document.write('<option '+(i==0?'selected="selected" ':'')+'value="'+i+'">'+i+' %</option>');
Expand All @@ -50,7 +50,7 @@
<span class="tool">Contrast<span class="tip">Vividness</span></span>:
</div>
<div class="control">
<select name="contrast">
<select name="contrast" onchange="changeBrightContrast()">
<script type="text/JavaScript">
for(var i=-100;i<=100;i+=10){
document.write('<option '+(i==0?'selected="selected" ':'')+'value="'+i+'">'+i+' %</option>');
Expand Down Expand Up @@ -124,13 +124,13 @@
<div class="control"><input onkeypress="return false" type="text" readonly="readonly" name="loc_width" value="0" size="3"/> pixle(s)</div>
<div class="label">Height: </div>
<div class="control"><input onkeypress="return false" type="text" readonly="readonly" name="loc_height" value="0" size="3"/> pixle(s)</div>
<div class="label">x1 (Left): </div>
<div class="label">X<sub>1</sub> (Left): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_x1" value="0" size="3"/> pixle(s)</div>
<div class="label">y1 (Top): </div>
<div class="label">Y<sub>1</sub> (Top): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_y1" value="0" size="3"/> pixle(s)</div>
<div class="label">x2 (Right): </div>
<div class="label">X<sub>2</sub> (Right): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_x2" value="0" size="3"/> pixle(s)</div>
<div class="label">y2 (Bottom): </div>
<div class="label">Y<sub>2</sub> (Bottom): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_y2" value="0" size="3"/> pixle(s)</div>
<div align="center"><input type="button" value="Update" onclick="setRegion(ias);"/><input type="button" onclick="clearRegion(ias,true)" value="Clear"/></div>
</p>
Expand Down
2 changes: 1 addition & 1 deletion inc/header.php
@@ -1,5 +1,5 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1"/>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<!--[if lt IE 9]><meta http-equiv="X-UA-Compatible" content="chrome=1"><![endif]-->
<title><?php echo $GLOBALS['NAME']; ?> ~ <?php echo $GLOBALS['PAGE']; ?></title>
<link id="style" rel="stylesheet" href="inc/style.php<?php
Expand Down
59 changes: 55 additions & 4 deletions inc/main.js
Expand Up @@ -12,7 +12,8 @@ $(document).ready(function () {
disable: ((previewIMG.src.indexOf('inc/images/blank.gif')>-1)?true:false),
fadeSpeed: 850,
parent: 'div#select',
zIndex: 1
zIndex: 1,
rotating: false
});
if(previewIMG){
if(previewIMG.src.indexOf('inc/images/blank.gif')>-1){
Expand All @@ -24,7 +25,7 @@ $(document).ready(function () {
function getID(id){
return document.getElementById(id);
}
function pre_scan(form,ias,t){
function pre_scan(form,ias){
previewIMG.style.zIndex=-1;
previewIMG.nextSibling.removeAttribute('style');
previewIMG.parentNode.style.height=previewIMG.offsetHeight+3+'px';
Expand All @@ -33,6 +34,12 @@ function pre_scan(form,ias,t){
ele=getID('select');
if(ele)
ele.style.display='none';
if(!document.scanning.scanner)
return;
if(document.scanning.scanner.disabled){
document.scanning.scanner.removeAttribute('disabled');
setTimout(function(){document.scanning.scanner.setAttribute('disabled','disabled');},250);
}
return true;
}
function sendE(ele,e){
Expand All @@ -46,6 +53,14 @@ function sendE(ele,e){
}
}
function config(json){
if(document.scanning.scanner.value!=json['scanner']&&document.scanning.scanner.disabled){
var str='';
for(var i in json){
str+="&"+i+'='+encodeURIComponent(json[i]);
}
document.location.href='index.php?page=Scan&action=restore'+str;
return;
}
for(var i in json){
document.scanning[i].value=json[i];
sendE(document.scanning[i],'change');
Expand Down Expand Up @@ -80,6 +95,8 @@ function storeRegion(img, sel){
}
function setRegion(ias){
//Code to counter user stupidty and innocent mistakes
if(ias.getOptions()["rotating"])
return false;
var ele=previewIMG;
var img_W=ele.offsetWidth;
var img_H=ele.offsetHeight;
Expand Down Expand Up @@ -161,6 +178,7 @@ function lastScan(scan,preview,scanner,ele,imgur){
getID('sel').removeAttribute('style');
document.scanning.scanner.value=scanner;
sendE(document.scanning.scanner,'change');
document.scanning.scanner.disabled='disabled';
sendE(document.scanning.size,'change');
ele.parentNode.parentNode.innerHTML='<h2>'+generic+'</h2><p><a class="tool icon download" href="download.php?file='+scan+'"><span class="tip">Download</span></a> '+
'<a class="tool icon zip" href="download.php?file='+scan+'&compress"><span class="tip">Download Zip</span></a> '+
Expand Down Expand Up @@ -283,6 +301,7 @@ function scannerChange(ele){
else
document.scanning.source.removeAttribute('disabled');
sourceChange(document.scanning.source);

}
function sourceChange(ele){
var info,text,html,html2,html3,dpi;
Expand Down Expand Up @@ -314,7 +333,7 @@ function sourceChange(ele){
html3='';
dpi=info['DPI-'+ele.value].split('|');
for(var i=0,max=dpi.length;i<max;i++)
html3+='<option value="'+dpi[i]+'">'+dpi[i]+' '+(isNaN(dpi[i])?'':'dpi')+'</option>';
html3+='<option value="'+dpi[i]+'">'+dpi[i]+' '+(isNaN(dpi[i])?'':'DPI')+'</option>';
// Apply Changes
if(document.all){// http://support.microsoft.com/kb/276228
document.scanning.size.parentNode.innerHTML='<select onchange="paperChange(this);" name="size">'+html2+'</select>';
Expand All @@ -333,6 +352,7 @@ function sourceChange(ele){
sendE(document.scanning.size,'change');
}
function paperChange(ele){
ele.parentNode.nextSibling.textContent=ele.childNodes[ele.selectedIndex].title;
if(ele.value=='full'){
document.scanning.ornt.selectedIndex=0;
document.scanning.ornt.disabled='disabled';
Expand All @@ -342,8 +362,9 @@ function paperChange(ele){
json=parseJSON(json);
var width=json['WIDTH-'+document.scanning.source.value];
var height=json['HEIGHT-'+document.scanning.source.value];
// Set Orientation
var paper=ele.value.split('-');
if(Number(paper[0])>height||Number(paper[1])>width){
if(Number(paper[0])>height||Number(paper[1])>width||ele.value=='full'){
document.scanning.ornt.selectedIndex=0;
document.scanning.ornt.disabled='disabled';
}
Expand All @@ -353,6 +374,36 @@ function paperChange(ele){
function rotateChange(ele){
var val=ele.value;
ele.nextSibling.textContent=(val==180?'Upside-down':(val<0?'Counterclockwise':'Clockwise'));
var prefixes = 't WebkitT MozT OT msT'.split(' ');
for(var prefix in prefixes){
if(typeof document.body.style[prefixes[prefix]+'ransform']!="undefined"){
prefix=prefixes[prefix]+'ransform';
break;
}
}
if(typeof prefix=="number"|| typeof document.evaluate=="undefined"||val==0)
return;
ele=document.evaluate("//div[@id='preview_img']/p/img[@title='Preview']",document,null,9,null).singleNodeValue;// Who wants to bet it takes MS till 2010 to support this
if(ele.src.indexOf('inc/images/blank.gif')>-1)
return;
ias.setOptions({ "hide": true, "disable": true, "fadeSpeed": false, "rotating": true });
ele.style[prefix]='rotate('+val+'deg)';// To DO add scale(X%)
setTimeout(function(){// We can not leave it rotated, it brutally screws up cropping
ele.style[prefix]=null;
setTimeout(function(){
ias.setOptions({ "hide": false, "disable": false, "fadeSpeed": 850, "rotating": false });
if(document.scanning.loc_width.value>0&&document.scanning.loc_height.value>0)
setRegion(ias);
},800);// 800ms is the animation duration in the css
},2000);// should be long enough to see how it looks, given there is a 800ms animation
}
function changeBrightContrast(){// Webkit based only :(
if(typeof document.body.style.webkitFilter!='string')
return;
ele=document.evaluate("//div[@id='preview_img']/p/img[@title='Preview']",document,null,9,null).singleNodeValue;
if(ele.src.indexOf('inc/images/blank.gif')>-1)
return;
ele.style.webkitFilter='brightness('+document.scanning.bright.value+'%) contrast('+(Number(document.scanning.contrast.value)+100)+'%)';
}
function fileChange(type){
if(type=='txt')
Expand Down
18 changes: 9 additions & 9 deletions inc/scan.php
Expand Up @@ -62,7 +62,7 @@
<div class="ie_276228"><select name="quality" class="upper"><script type="text/JavaScript">
var dpi='<?php echo $CANNERS[$SEL]->{"DPI-$defSource"}; ?>'.split('|');
for(var i=0,max=dpi.length;i<max;i++){
document.write('<option value="'+dpi[i]+'">'+dpi[i]+' '+(isNaN(dpi[i])?'':'dpi')+'</option>');
document.write('<option value="'+dpi[i]+'">'+dpi[i]+' '+(isNaN(dpi[i])?'':'DPI')+'</option>');
}
</script>
</select></div><span class="tip">Dots Per Inch</span>
Expand All @@ -71,7 +71,7 @@
<div class="label">
<span class="tool">Size<span class="tip">How big the paper is</span></span>:
</div>
<div class="control">
<div class="control tool">
<div class="ie_276228"><select <?php //echo ((($WIDTH=="0"||$WIDTH==NULL)&&($HEIGHT=="0"||$HEIGHT==NULL))===false?'disabled="disabled" ':''); ?>name="size" onchange="paperChange(this);">
<option value="full" title="<?php echo $CANNERS[$SEL]->{"WIDTH-$defSource"}.' mm x '.$CANNERS[$SEL]->{"HEIGHT-$defSource"}.'t mm'; ?>">Full Scan: <?php echo round($CANNERS[$SEL]->{"WIDTH-$defSource"}/25.4,2).'" x '.round($CANNERS[$SEL]->{"HEIGHT-$defSource"}/25.4,2); ?>'"</option><?php
if(file_exists("config/paper.json"))
Expand All @@ -83,7 +83,7 @@
echo '<option value="'.$val->{"width"}.'-'.$val->{"height"}.'" title="'.$val->{"width"}.' mm x '.$val->{"height"}.' mm">'.$key.': '.round($val->{"width"}/25.4,2).'" x '.round($val->{"height"}/25.4,2).'"</option>';
}
?>
</select></div>
</select></div><span class="tip"><?php echo $CANNERS[$SEL]->{"WIDTH-$defSource"}.' mm x '.$CANNERS[$SEL]->{"HEIGHT-$defSource"}.' mm'; ?></span>
<script type="text/javascript">paper=<?php echo json_encode($paper);?></script>
</div>

Expand Down Expand Up @@ -152,7 +152,7 @@
<span class="tool">Brightness<span class="tip">Lighting</span></span>:
</div>
<div class="control">
<select name="bright">
<select name="bright" onchange="changeBrightContrast()">
<script type="text/JavaScript">
for(var i=-100;i<=100;i+=10){
document.write('<option '+(i==0?'selected="selected" ':'')+'value="'+i+'">'+i+' %</option>');
Expand All @@ -165,7 +165,7 @@
<span class="tool">Contrast<span class="tip">Vividness</span></span>:
</div>
<div class="control">
<select name="contrast">
<select name="contrast" onchange="changeBrightContrast()">
<script type="text/JavaScript">
for(var i=-100;i<=100;i+=10){
document.write('<option '+(i==0?'selected="selected" ':'')+'value="'+i+'">'+i+' %</option>');
Expand Down Expand Up @@ -252,13 +252,13 @@
<div class="control"><input onkeypress="return false" type="text" readonly="readonly" name="loc_width" value="0<?php //echo (isset($M_WIDTH)?$M_WIDTH:0); ?>" size="3"/> pixle(s)</div>
<div class="label">Height: </div>
<div class="control"><input onkeypress="return false" type="text" readonly="readonly" name="loc_height" value="0<?php //echo (isset($M_HEIGHT)?$M_HEIGHT:0); ?>" size="3"/> pixle(s)</div>
<div class="label">x1 (Left): </div>
<div class="label">X<sub>1</sub> (Left): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_x1" value="0<?php //echo (isset($X_1)?$X_1:0); ?>" size="3"/> pixle(s)</div>
<div class="label">y1 (Top): </div>
<div class="label">Y<sub>1</sub> (Top): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_y1" value="0<?php //echo (isset($Y_1)?$Y_1:0); ?>" size="3"/> pixle(s)</div>
<div class="label">x2 (Right): </div>
<div class="label">X<sub>2</sub> (Right): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_x2" value="0" size="3"/> pixle(s)</div>
<div class="label">y2 (Bottom): </div>
<div class="label">Y<sub>2</sub> (Bottom): </div>
<div class="control"><input onkeypress="return validateKey(this,event,ias);" type="text" name="loc_y2" value="0" size="3"/> pixle(s)</div>
<div align="center"><input type="button" value="Update" onclick="setRegion(ias);"/><input type="button" onclick="clearRegion(ias,true)" value="Clear"/></div>
</p>
Expand Down
23 changes: 21 additions & 2 deletions inc/style.php
Expand Up @@ -180,7 +180,7 @@
float: left;
width: 235px;
margin: 0 8px 0 0;
paddin: 0;
padding: 0;
}

#nojs{
Expand Down Expand Up @@ -448,10 +448,24 @@
height: 471px;
width: 450px;
position: relative;
-moz-transition-property: transform, -moz-transform;
-moz-transition-duration: 0.8s;
-o-transition-property: -o-transform, transform;
-o-transition-duration: 0.8s;
-webkit-transition-property: -webkit-transform, -webkit-filter, transform;
-webkit-transition-duration: 0.8s;
transition-property: transform, -webkit-transform, -o-transform, -moz-transform, -webkit-filter;
transition-duration: 0.8s;
transform: rotate(0);
-moz-transform: rotate(0);
-o-transform: rotate(0);
-webkit-transform: rotate(0);
-webkit-filter:brightness(0%) contrast(100%);
}

#preview_img p{
position: relative;
overflow: hidden;
}

img[src="inc/images/blank.gif"]{
Expand Down Expand Up @@ -491,13 +505,18 @@
#scans.enable{
-moz-column-count: 3;
-moz-column-gap: 0;
/* broken tool-tips in opera, chrome, and safari */
-webkit-column-count: 3;
-webkit-column-gap: 0;
column-count: 3;
column-gap: 0;
padding-right: 6px;
}

#scans.enable.webkit a.tool[style] .tip{ /* workaround for shitty column implementation*/
bottom: 101%;
left: 30%;
}
#scans.enable .box{
display: inline-block;
float: none;
Expand Down Expand Up @@ -568,7 +587,7 @@
#paper-list ul{
-moz-column-count: 3;
-moz-column-gap: 50px;
/* broken tooltips in opera, messed up borders and broken tooltips in chrome and safari
/* broken tool-tips in opera, messed up borders and broken tool-tips in chrome and safari
-webkit-column-count: 3;
-webkit-column-gap: 50px;
column-count: 3;
Expand Down
20 changes: 10 additions & 10 deletions index.php
Expand Up @@ -6,7 +6,7 @@
// Sorry for the lack of explanations in the code feel free to ask what something does

$NAME="PHP Scanner Server";
$VER="1.3-4";
$VER="1.3-5";
$SAE_VER="1.4"; // Scanner access enabler version

# ****************
Expand Down Expand Up @@ -288,8 +288,8 @@ function quit(){
$FILE=substr(exe('cd "scans"; ls "Scan'.$FILE.'"*',true),5,-1);//Should only have one file listed
$IMAGE=$FILES[$i];
include "inc/scans.php";
}// Chrome's css columns fail (also disabled in css)
echo '</div><script type="text/javascript">if(document.body.style.WebkitColumnGap==""||document.body.style.MozColumnGap==""||document.body.style.columnGap=="")getID("scans").className="enable";</script>';
}
echo '</div><script type="text/javascript">if(document.body.style.WebkitColumnGap==""||document.body.style.MozColumnGap==""||document.body.style.columnGap=="")getID("scans").className="enable"+(document.body.style.WebkitColumnGap==""?" webkit":"");</script>';
}
checkFreeSpace($FreeSpaceWarn);
Footer();
Expand Down Expand Up @@ -965,11 +965,6 @@ function quit(){
$LAMP='--lamp-switch=yes --lamp-off-at-exit=yes ';
}*/

$SOURCE=($SOURCE=='Inactive')?'':"--source \"$SOURCE\" ";
if(!is_null($CANNERS[$SCANNER]->{"UUID"})){// Bug #13
$DEVICE=uuid2bus($CANNERS[$SCANNER]);
$CANNERS[$SCANNER]->{"DEVICE"}=$DEVICE;
}
if($CANNERS[$SCANNER]->{"DUPLEX-$SOURCE"}===true){
if($DUPLEX=='true')
$DUPLEX='--duplex=yes ';
Expand All @@ -978,7 +973,12 @@ function quit(){
}
else
$DUPLEX='';
$cmd="scanimage -d \"$DEVICE\" -l $X -t $Y -x $SIZE_X -y $SIZE_Y $DUPLEX--resolution $QUALITY $SOURCE--mode \"$MODE\" $LAMP--format=pnm";
$OURCE=($SOURCE=='Inactive')?'':"--source \"$SOURCE\" ";
if(!is_null($CANNERS[$SCANNER]->{"UUID"})){// Bug #13
$DEVICE=uuid2bus($CANNERS[$SCANNER]);
$CANNERS[$SCANNER]->{"DEVICE"}=$DEVICE;
}
$cmd="scanimage -d \"$DEVICE\" -l $X -t $Y -x $SIZE_X -y $SIZE_Y $DUPLEX--resolution $QUALITY $OURCE--mode \"$MODE\" $LAMP--format=pnm";
if($SOURCE=='ADF'||$SOURCE=='Automatic Document Feeder') # Multi-page scan
exe("cd $CANDIR;$cmd --batch",true);// Be careful with this, doing this without a ADF feeder will result in scanning the flatbed over and over, include --batch-count=3 for testing
else # Single page scan
Expand Down Expand Up @@ -1049,7 +1049,7 @@ function quit(){
}
$ORNT=($ORNT==''?'vert':$ORNT);
echo "var ornt=document.createElement('input');ornt.name='ornt0';ornt.value='$ORNT';ornt.type='hidden';document.scanning.appendChild(ornt);".
"var p=document.createElement('p');p.innerHTML='<small>Changing orientation will void select region.</small>';document.getElementById('opt').appendChild(p);</script>";
"var p=document.createElement('p');p.innerHTML='<small>Changing orientation will void select region.</small>';document.getElementById('opt').appendChild(p);document.scanning.scanner.disabled='disabled'</script>";

# Check if image is empty and post error, otherwise post image to page
if(!file_exists("scans/$P_FILENAME")){
Expand Down
4 changes: 2 additions & 2 deletions jquery.imgareaselect-0.9.10/scripts/jquery.min.js

Large diffs are not rendered by default.

0 comments on commit 59e953d

Please sign in to comment.