From: Jan Michel Date: Mon, 20 Apr 2015 11:28:55 +0000 (+0200) Subject: adding presenter files X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=992c9ca86efec8bbadfbdc52399d913c6ad6d6da;p=labtools.git adding presenter files --- diff --git a/presenter/convert.sh b/presenter/convert.sh new file mode 100644 index 0000000..6b27965 --- /dev/null +++ b/presenter/convert.sh @@ -0,0 +1,12 @@ +#!/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;\ diff --git a/presenter/getPic.pl b/presenter/getPic.pl new file mode 100644 index 0000000..53f1c28 --- /dev/null +++ b/presenter/getPic.pl @@ -0,0 +1,11 @@ +#!/usr/bin/perl +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +print "Content-type: text/html\n\n"; + +open FILE, "<", "presenter"; +my @data = ; +close FILE; + +my $f = $data[0]; + +print $f; \ No newline at end of file diff --git a/presenter/getfiles.pl b/presenter/getfiles.pl new file mode 100644 index 0000000..c917f1f --- /dev/null +++ b/presenter/getfiles.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +print "Content-type: text/html\n\n"; + +my @files = qx(cd store; ls -1 * | sort); +print ""; + + diff --git a/presenter/index.pl b/presenter/index.pl new file mode 100644 index 0000000..4994e3d --- /dev/null +++ b/presenter/index.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); + +print "Content-type: text/html\n\n"; + +use Data::Dumper; +use warnings; +use strict; +use utf8; +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); + +use URI::Escape qw(uri_unescape uri_escape); + +print < + + + Remote Presenter + + + + +HDOC +print ''; +print <Remote Presenter
<-- Click to show or just watch! +
+
+ +
+ + +
Files +
 
+ +
+ +HDOC + +print ""; + + + + + + diff --git a/presenter/presenter b/presenter/presenter new file mode 120000 index 0000000..2be2ab5 --- /dev/null +++ b/presenter/presenter @@ -0,0 +1 @@ +/dev/shm/presenter \ No newline at end of file diff --git a/presenter/scripts.js b/presenter/scripts.js new file mode 100644 index 0000000..e6eb137 --- /dev/null +++ b/presenter/scripts.js @@ -0,0 +1,48 @@ + +var currentPic = ''; + +function getData(command,dId,callback) { + + var xmlhttp = null; + var cb = null; + xmlhttp=new XMLHttpRequest(); + cb = callback; + var destId = dId; + var cmd = command; + + xmlhttp.onreadystatechange = function() { + if(xmlhttp.readyState == 4) { + if(document.getElementById(destId)){ + document.getElementById(destId).innerHTML = xmlhttp.responseText; + } + if(cb) { + cb(xmlhttp.responseText); + } + } + } + + xmlhttp.open("GET",command,1); + xmlhttp.send(null); + } + + +function updatefiles() { + getData("getfiles.pl","files"); +} + +function present(f) { + getData("showPic.pl?"+f); +} + +function updatepresentation(t) { + if(currentPic != t) { + currentPic = t; + document.getElementById("content").innerHTML = ''; + } + setTimeout('getData("getPic.pl",null,updatepresentation)',1000); + } + + +setTimeout('updatefiles();',500); + +setTimeout('getData("getPic.pl",null,updatepresentation)',1000); \ No newline at end of file diff --git a/presenter/showPic.pl b/presenter/showPic.pl new file mode 100644 index 0000000..fcfd74d --- /dev/null +++ b/presenter/showPic.pl @@ -0,0 +1,11 @@ +#!/usr/bin/perl +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +print "Content-type: text/html\n\n"; + + +my $t = $ENV{'QUERY_STRING'}; +$t =~ s-/--; + +system("echo $t>presenter"); + +1; \ No newline at end of file diff --git a/presenter/style.css b/presenter/style.css new file mode 100644 index 0000000..9fafb57 --- /dev/null +++ b/presenter/style.css @@ -0,0 +1,68 @@ +html { + height:100%; + margin:0; + padding:0; +} + + +* { + box-sizing:border-box; +} + + +body { + background: #000; + color:#888; + font-family: sans-serif; + height: 100%; + overflow:hidden; + margin:0; + padding-left:20px; + } + + +#control { + height:100%; + width:220px; + left:-200px; + position:absolute; + top:0; + border-right:40px solid #000; + background:#ccb; + transition:left 0.3s; + overflow:hidden; + } + +#control:hover { + left:0; + border:0; + } + +#content { + height:100%; + width:100%; + position:absolute; + padding-right:100px; + } + +#content img { + height:100%; + width:100%; + object-fit:contain; + margin:0; + padding:0; + } + + +div.but { + border:1px solid #aaa; + background:#fff; + width:100px; + margin:5px; + text-align:center; + display:inline-block; + cursor:hand; + color:#889; + } + + \ No newline at end of file diff --git a/presenter/uploadFiles.pl b/presenter/uploadFiles.pl new file mode 100644 index 0000000..8134d10 --- /dev/null +++ b/presenter/uploadFiles.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +use CGI; +use warnings; + +my $cgi = new CGI(); +print "Content-type: text/html\n\n"; + + +my $upfile = $cgi->param('upfile'); + +my $basename = GetBasename($upfile); +$basename =~ s-/--; + +my $fh = $cgi->upload('upfile'); + + +if (! open(OUTFILE, ">store/$basename") ) { + print "Can't open outfile for writing - $!"; + exit(-1); +} + +my $nBytes = 0; +my $totBytes = 0; +my $buffer = ""; +while ( $nBytes = read($upfile, $buffer, 1024) ) { + print OUTFILE $buffer; + $totBytes += $nBytes; +} +close(OUTFILE); + + +sub GetBasename { + my $fullname = shift; + + my(@parts); + # check which way our slashes go. + if ( $fullname =~ /(\\)/ ) { + @parts = split(/\\/, $fullname); + } else { + @parts = split(/\//, $fullname); + } + + return(pop(@parts)); +} \ No newline at end of file