#!/bin/bash
-#convert \
-#-density 480 $1 -resize 25% \
-#-set filename:f '%t.%e' \
-#-flatten \
-#-colorspace rgb \
-#-background white \
-#-depth 8 \
-#-quality 84 \
-#PNG:'%[filename:1].png'
-
-#convert -density 300x300 -resize 1440x900 -quality 80 $1 `echo $1|cut -f1 -d'.'`.png;\
-
pdftoppm -png -r 300 -scale-to 1400 $1 $2
my $cmd = "cd store;cd $room; ls -1 -v";
my @files = qx($cmd);
-print "<select onChange=\"previewSelected()\" id=\"filelist\" size=\"20\">\n";
+my $i = 0;
+
+print "<div id=\"filecontainer\">";
foreach my $f (@files) {
chomp($f);
next if $f eq "currentstate";
next if $f eq "thumb";
- print "<option onMouseover=\"preview('$f')\" value='$f'>$f</option>\n";
+ print '<div>'.$f.'<br><img src="store/'.$room.'/thumb/'.$f.'" onClick="present(this)" data-file="'.$f.'" data-id="'.$i.'">
+ <button type="button" onClick="window.open(\'store/'.$room.'/'.$f.'\')">View</button>
+</div>';
+ $i++;
+ }
+print "</div>";
+print "<hr><select multiple=\"multiple\" id=\"filelist\" >\n";
+foreach my $f (@files) {
+ chomp($f);
+ next if $f eq "currentstate";
+ next if $f eq "thumb";
+ print "<option value='$f'>$f</option>\n";
}
print "</select>";
-
-
</head>
<body class="title">
<h1>Remote Presenter</h1>
-<select id="roomlist" size="20">
+<p>Please select a room to enter:
+<p><select id="roomlist" size="20">
HDOC
my @files = qx(cd store; ls -1 -v );
print <<HDOC;
</select><br>
<button type="button" onClick="window.location='showroom.pl?'+document.getElementById('roomlist').value">Enter Room</button>
+
+<h2>Usage summary</h2>
+<ul>
+<li>The menu hides on the left side of the screen - move your pointer there or click close to the boarder of the window
+<li>File upload: First select a file (jpg, png, gif or pdf only), then click upload. Converting PDFs might take a moment
+<li>Click on an image to show to all connected viewers
+<li>"View" - the selected image is shown in a new browser window, the public view is not changed
+<li>"Delete" - delete the selected files from the list above
+<li>Click anywhere in the image to set a red pointer for everybody to see
+<li>Images can be changed by using the arrow keys
</body>
</html>
-HDOC
\ No newline at end of file
+HDOC
}
function present(f) {
- if(f != "") {
- getData("showPic.pl?img="+f+"&room="+currentRoom+'&posx=-1&posy=-1');
+ if(f) {
+ getData("showPic.pl?img="+f.getAttribute('data-file')+"&room="+currentRoom+'&posx=-1&posy=-1');
}
else {
alert("Select a file to show!");
else if(d==38 || d==33) d=-1;
else return true;
current = currentPic.split(',',1);
- for(i=0;i<document.getElementById('filelist').children.length;i++){
- if (document.getElementById('filelist').children[i].getAttribute('value') == current[0]) {
+ for(i=0;i<document.getElementById('filecontainer').children.length;i++){
+ if (document.getElementById('filecontainer').children[i].children[1].getAttribute('data-file') == current[0]) {
break;
}
}
f = '';
- if(document.getElementById('filelist').children[i+d]) {
- f = document.getElementById('filelist').children[i+d].getAttribute('value');
+ if(document.getElementById('filecontainer').children[i+d]) {
+ f = document.getElementById('filecontainer').children[i+d].children[1].getAttribute('data-file');
}
if(f != "") {
getData("showPic.pl?img="+f+"&room="+currentRoom+'&posx=-1&posy=-1');
function pointer(e) {
var t = document.getElementById("screen");
// alert(t.offsetLeft);
- var x = Math.round((e.pageX - t.offsetLeft)/t.offsetWidth*100);
- var y = Math.round((e.pageY - t.offsetTop)/t.offsetHeight*100);
+ var x = Math.round((e.pageX - t.offsetLeft)/t.clientWidth*100);
+ var y = Math.round((e.pageY - t.offsetTop)/t.clientHeight*100);
var i = currentPic.split(",");
getData("showPic.pl?img="+i[0]+"&room="+currentRoom+'&posx='+x+'&posy='+y);
}
currentPic = t;
var i = t.split(",");
if(s) {
- x = i[1]*s.offsetWidth/100-30 + s.offsetLeft;
- y = i[2]*s.offsetHeight/100-10 + s.offsetTop;
+ x = i[1]*s.clientWidth/100-30 + s.offsetLeft;
+ y = i[2]*s.clientHeight/100-10 + s.offsetTop;
}
else { x=0;y=0; }
document.getElementById("content").innerHTML = '<img id="screen" onClick="pointer(event);" src="store/'+currentRoom+'/'+i[0]+'"><div id="pointer" style="left:'+x+'px;top:'+y+'px;"> </div>';
-
- c = currentPic.split(',',1);
- document.getElementById('current').innerHTML = "Current: "+c[0];
}
setTimeout('getData("getPic.pl?old='+t+'&room='+currentRoom+'",null,updatepresentation)',1000);
}
-function preview(f) {
- document.getElementById("preview").innerHTML = '<img src="store/'+currentRoom+'/thumb/'+f+'">';
- }
-
-function previewSelected() {
- f = document.getElementById("filelist").value;
- document.getElementById("preview").innerHTML = '<img src="store/'+currentRoom+'/thumb/'+f+'">';
- }
-
-
-function togglemulti() {
- document.getElementById("filelist").setAttribute('multiple','multiple');
- }
-
-
setTimeout('updatefiles();',500);
setTimeout('updatepresentation(" ");',200);
my $room = $cgi->param("room");
if (!($room =~ /^[a-zA-Z0-9]+$/) || !(-d "store/$room")) {
print "Invalid room";
- return 1;
+ exit 1;
}
my $t = $cgi->param("img");
-if($t =~ /[\"\$\(\)\/]/ || !(-e "store/$room/$t")) {
+if(!($t =~ /^[a-zA-Z0-9\.\-_]+$/) || $t =~ /[\"\$\(\)\/]/ || !(-e "store/$room/$t")) {
print "Invalid selection";
- return 1;
+ exit 1;
}
my $tmp = $cgi->param("posx").','.$cgi->param("posy");
if(!($tmp =~ /^-?[0-9]+,-?[0-9]+$/)) {
print "Invalid Position";
- return 1;
+ exit 1;
}
$t .= ','.$tmp;
system("echo $t>store/$room/currentstate");
-1;
\ No newline at end of file
+1;
Select a file and press upload.
<form method="post" action="uploadFiles.pl" enctype="multipart/form-data" >
<input type="hidden" name="room" value="$room">
-<input type="file" name="upfile" ><input type="submit" name="button" value="Upload">
+<input type="file" name="upfile">
+<input type="submit" name="button" value="Upload">
</form>
<hr>
<button type="button" onClick="updatefiles();">Update file list</button>
<div id="files"> </div>
-<button type="button" onClick="window.open('store/$room/'+document.getElementById('filelist').value)">Show 2 Me</button>
-<button type="button" onClick="present(document.getElementById('filelist').value)">Show 2 All</button>
<br><button type="button" onClick="deletePic(document.getElementById('filelist').value)">Delete</button>
-<button type="button" onClick="togglemulti()" title='Enable selecting several files for deletion'>MS</button>
-<div id="current"></div><div id="preview"></div>You can use arrow keys to change slides!</div>
+
+<!--<button type="button" onClick="window.open('store/$room/'+document.getElementById('filelist').value)">Show 2 Me</button>
+<button type="button" onClick="present(document.getElementById('filelist').value)">Show 2 All</button>
+<button type="button" onClick="togglemulti()" title='Enable selecting several files for deletion'>MS</button>-->
+
</body></html>
HDOC
color:#888;
font-family: sans-serif;
height: 100%;
- overflow:hidden;
+ overflow:hidden !important;
margin:0;
padding-left:20px;
}
body.title {
background:#f0f0ea;
padding:0;
+ margin-left: 20px;
}
h1 {
left:-200px;
position:absolute;
top:0;
+ padding-left:10px;
border-right:70px solid #000;
background:#ccb;
transition:left 0.6s 3s ease-out, border 0.6s 3s ease-out;
- overflow:hidden;
+ overflow-y:scroll !important;
+ overflow-x:hidden;
}
#control:hover {
#content img {
height:100%;
-/* width:100%; */
+ width:100%;
max-height:100%;
max-width:100%;
object-fit:contain;
- margin:0 auto;
+ margin:auto;
padding:0;
}
width:180px;
}
-/*
-@keyframes pointerani {
- 0% {width:25px;height:25px;margin:0;}
- 100% {width:20px;height:20px;margin:2.5px 0 0 2.5px;}
-}
-*/
-
@keyframes pointerani {
0% {opacity:.2;}
100% {opacity:.7;}
opacity:0.7;
border-radius:15px;
position:absolute;
- //animation: pointerani 1s infinite alternate;
}
-#preview {
- width:205px;
- border:1px solid #aaa;
- margin:1px;
+
+#files div {
+ padding-top:2px;
+ border-bottom:1px solid #aaa;
+ clear:both;
+
+}
+
+#files img {
+ margin:auto;
+ max-height:100px;
+ max-width:150px;
+ object-fit:contain;
position:relative;
- left:5px;
- padding:1px;
- text-align:center;
- background:white;
- }
+}
+#files button {
+ font-size:80%;
+ width:35px;
+ display:block;
+ float:right;
+ margin-right:5px;
+ padding:0px;
+ }
+
+
$basename =~ s-/--;
$basename =~ s-\s--;
+unless($basename =~ /^[a-zA-Z0-9\.\-_]+$/) {
+ print("Filename contains invalid characters. Only a-z A-Z 0-9 . _ - are allowed.");
+ exit(-1);
+ }
+
my $fh = $cgi->upload('upfile');