UB-Mannheim /
PalMA
| 1 | <?php |
||
| 2 | |||
| 3 | // Copyright (C) 2014 Universitätsbibliothek Mannheim |
||
| 4 | // See file LICENSE for license details. |
||
| 5 | |||
| 6 | // Author: Stefan Weil |
||
| 7 | |||
| 8 | // References: |
||
| 9 | // http://responsiveslides.com/ |
||
| 10 | // http://unslider.com/ |
||
| 11 | // http://www.java2s.com/Code/JavaScript/GUI-Components/AnimationRandomMovement.htm |
||
| 12 | // http://www.tutorialspoint.com/javascript/javascript_animation.htm |
||
| 13 | |||
| 14 | // TODO: |
||
| 15 | |||
| 16 | $servername = $_SERVER["SERVER_NAME"]; |
||
| 17 | $serveraddress = $_SERVER["SERVER_ADDR"]; |
||
| 18 | $serveruri = dirname($_SERVER["REQUEST_URI"]); |
||
| 19 | $pin = sprintf("%04u", rand(0, 9999)); |
||
| 20 | $url = "http://${servername}${serveruri}/index.php"; |
||
| 21 | |||
| 22 | // Store PIN in database. |
||
| 23 | require_once '../../DBConnector.class.php'; |
||
| 24 | $dbcon = palma\DBConnector::getInstance(); |
||
| 25 | $dbcon->exec("UPDATE setting SET value='$pin' WHERE key='pin'"); |
||
| 26 | |||
| 27 | ?> |
||
| 28 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
||
| 29 | "http://www.w3.org/TR/html4/strict.dtd"> |
||
| 30 | |||
| 31 | <html lang="de"> |
||
| 32 | |||
| 33 | <head> |
||
| 34 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||
| 35 | <title>PalMA – <?=__("Picture Show")?></title> |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 36 | <script type="text/javascript" src="/jquery.min.js"></script> |
||
| 37 | <script type="text/javascript" src="/unslider.min.js"></script> |
||
| 38 | <style type="text/css"> |
||
| 39 | * { |
||
| 40 | margin: 0; |
||
| 41 | padding: 0; |
||
| 42 | } |
||
| 43 | |||
| 44 | html { |
||
| 45 | font-family: sans-serif; |
||
| 46 | font-size: 120%; |
||
| 47 | height: 100%; |
||
| 48 | } |
||
| 49 | li { |
||
| 50 | height: 600px; |
||
| 51 | } |
||
| 52 | .banner { |
||
| 53 | position: relative; |
||
| 54 | overflow: auto; |
||
| 55 | } |
||
| 56 | .banner ul { |
||
| 57 | list-style: none; |
||
| 58 | } |
||
| 59 | .banner ul li { |
||
| 60 | float: left; |
||
| 61 | } |
||
| 62 | body { |
||
| 63 | background-color: black; |
||
| 64 | } |
||
| 65 | h1, p { |
||
| 66 | color: white; |
||
| 67 | } |
||
| 68 | #pin { |
||
| 69 | position: absolute; |
||
| 70 | left: 500px; |
||
| 71 | top: 40px; |
||
| 72 | z-index: 2; |
||
| 73 | } |
||
| 74 | img { |
||
| 75 | position: absolute; |
||
| 76 | right: 40px; |
||
| 77 | top: 40px; |
||
| 78 | z-index: 2; |
||
| 79 | } |
||
| 80 | </style> |
||
| 81 | </head> |
||
| 82 | |||
| 83 | <body> |
||
| 84 | <div><img src="../../qrcode/php/qr_img.php?d=<?=$url?>&e=H" alt="QR Code"></div> |
||
| 85 | <div id="pin"><h1>PIN: <?=$pin?></h1></div> |
||
| 86 | |||
| 87 | <div class="banner"> |
||
| 88 | <ul> |
||
| 89 | <?php |
||
| 90 | //~ <ul id="bannerlist"> |
||
| 91 | $pictures = '../../pictures'; |
||
| 92 | if (is_dir($pictures)) { |
||
| 93 | $filelist = scandir($pictures); |
||
| 94 | sort($filelist, SORT_NATURAL); |
||
| 95 | foreach ($filelist as $file) { |
||
| 96 | $picture = "$pictures/$file"; |
||
| 97 | if (is_file($picture)) { |
||
| 98 | echo("<li style=\"background-image: url('$picture'); background-repeat: no-repeat\"></li>\n"); |
||
| 99 | //~ echo("<li><img src=\"$picture\"></li>\n"); |
||
| 100 | } |
||
| 101 | } |
||
| 102 | } else { |
||
| 103 | echo <<<EOD |
||
| 104 | <li style="background-image: url('http://www.bib.uni-mannheim.de/typo3temp/pics/b1ad582e53.jpg');"></li> |
||
| 105 | <li style="background-image: url('http://www.bib.uni-mannheim.de/typo3temp/pics/640e1eafcd.jpg');"></li> |
||
| 106 | <li style="background-image: url('http://www.bib.uni-mannheim.de/typo3temp/pics/998e4505ca.jpg');"></li> |
||
| 107 | <li style="background-image: url('http://www.bib.uni-mannheim.de/typo3temp/pics/e4843ceada.jpg');"></li> |
||
| 108 | <li style="background-image: url('http://www.bib.uni-mannheim.de/typo3temp/pics/565d17487b.jpg');"></li> |
||
| 109 | <li style="background-image: url('http://edz.bib.uni-mannheim.de/www-edz/images/edz2.jpg');"></li> |
||
| 110 | EOD; |
||
| 111 | } |
||
| 112 | ?> |
||
| 113 | </ul> |
||
| 114 | </div> |
||
| 115 | |||
| 116 | <h1>maTeam – Mannheim Team Monitor / Share your desktop.</h1> |
||
| 117 | <p>Just go to <?=$url?> and enter the PIN.</p> |
||
| 118 | |||
| 119 | <script type="text/javascript"> |
||
| 120 | |||
| 121 | $(function() { |
||
| 122 | $('.banner').unslider({ |
||
| 123 | speed: 500, // The speed to animate each slide (in milliseconds) |
||
| 124 | delay: 10000, // The delay between slide animations (in milliseconds) |
||
| 125 | complete: function() {}, // A function that gets called after every slide animation |
||
| 126 | keys: true, // Enable keyboard (left, right) arrow shortcuts |
||
| 127 | dots: true, // Display dot navigation |
||
| 128 | fluid: false // Support responsive design. May break non-responsive designs |
||
| 129 | }); |
||
| 130 | }); |
||
| 131 | |||
| 132 | //Random Movement - http://www.btinternet.com/~kurt.grigg/javascript |
||
| 133 | |||
| 134 | if ((document.getElementById) && |
||
| 135 | window.addEventListener || window.attachEvent){ |
||
| 136 | |||
| 137 | (function(){ |
||
| 138 | |||
| 139 | var imgh = 163; |
||
| 140 | var imgw = 156; |
||
| 141 | var timer = 40; //setTimeout speed. |
||
| 142 | var min = 1; //slowest speed. |
||
| 143 | var max = 5; //fastest speed. |
||
| 144 | |||
| 145 | var h,w,r,temp; |
||
| 146 | var d = document; |
||
| 147 | var y = 2; |
||
| 148 | var x = 2; |
||
| 149 | var dir = 45; //direction. |
||
| 150 | var acc = 1; //acceleration. |
||
| 151 | var newacc = [1, 0, 1]; |
||
| 152 | var vel = 1; //initial speed. |
||
| 153 | var sev = 0; |
||
| 154 | var newsev = [1, -1, 2, -2, 0, 0, 1, -1, 2, -2]; |
||
| 155 | |||
| 156 | //counters. |
||
| 157 | var c1 = 0; //time between changes. |
||
| 158 | var c2 = 0; //new time between changes. |
||
| 159 | |||
| 160 | var pix = "px"; |
||
| 161 | var domWw = (typeof window.innerWidth == "number"); |
||
| 162 | var domSy = (typeof window.pageYOffset == "number"); |
||
| 163 | |||
| 164 | if (domWw) r = window; |
||
| 165 | else{ |
||
| 166 | if (d.documentElement && |
||
| 167 | typeof d.documentElement.clientWidth == "number" && |
||
| 168 | d.documentElement.clientWidth != 0) |
||
| 169 | r = d.documentElement; |
||
| 170 | else{ |
||
| 171 | if (d.body && |
||
| 172 | typeof d.body.clientWidth == "number") |
||
| 173 | r = d.body; |
||
| 174 | } |
||
| 175 | } |
||
| 176 | |||
| 177 | |||
| 178 | |||
| 179 | function winsize(){ |
||
| 180 | var oh,sy,ow,sx,rh,rw; |
||
| 181 | if (domWw){ |
||
| 182 | if (d.documentElement && d.defaultView && |
||
| 183 | typeof d.defaultView.scrollMaxY == "number"){ |
||
| 184 | oh = d.documentElement.offsetHeight; |
||
| 185 | sy = d.defaultView.scrollMaxY; |
||
| 186 | ow = d.documentElement.offsetWidth; |
||
| 187 | sx = d.defaultView.scrollMaxX; |
||
| 188 | rh = oh-sy; |
||
| 189 | rw = ow-sx; |
||
| 190 | } |
||
| 191 | else{ |
||
| 192 | rh = r.innerHeight; |
||
| 193 | rw = r.innerWidth; |
||
| 194 | } |
||
| 195 | h = rh - imgh; |
||
| 196 | w = rw - imgw; |
||
| 197 | } |
||
| 198 | else{ |
||
| 199 | h = r.clientHeight - imgh; |
||
| 200 | w = r.clientWidth - imgw; |
||
| 201 | } |
||
| 202 | } |
||
| 203 | |||
| 204 | |||
| 205 | function scrl(yx){ |
||
| 206 | var y,x; |
||
| 207 | if (domSy){ |
||
| 208 | y = r.pageYOffset; |
||
| 209 | x = r.pageXOffset; |
||
| 210 | } |
||
| 211 | else{ |
||
| 212 | y = r.scrollTop; |
||
| 213 | x = r.scrollLeft; |
||
| 214 | } |
||
| 215 | return (yx == 0)?y:x; |
||
| 216 | } |
||
| 217 | |||
| 218 | |||
| 219 | function newpath(){ |
||
| 220 | sev = newsev[Math.floor(Math.random()*newsev.length)]; |
||
| 221 | acc = newacc[Math.floor(Math.random()*newacc.length)]; |
||
| 222 | c2 = Math.floor(20+Math.random()*50); |
||
| 223 | } |
||
| 224 | |||
| 225 | |||
| 226 | function moveit(){ |
||
| 227 | var vb,hb,dy,dx,curr; |
||
| 228 | if (acc == 1) vel +=0.05; |
||
| 229 | if (acc == 0) vel -=0.05; |
||
| 230 | if (vel >= max) vel = max; |
||
| 231 | if (vel <= min) vel = min; |
||
| 232 | c1++; |
||
| 233 | if (c1 >= c2){ |
||
| 234 | newpath(); |
||
| 235 | c1=0; |
||
| 236 | } |
||
| 237 | curr = dir+=sev; |
||
| 238 | dy = vel * Math.sin(curr*Math.PI/180); |
||
| 239 | dx = vel * Math.cos(curr*Math.PI/180); |
||
| 240 | y+=dy; |
||
| 241 | x+=dx; |
||
| 242 | //horizontal-vertical bounce. |
||
| 243 | vb = 180-dir; |
||
| 244 | hb = 0-dir; |
||
| 245 | //Corner rebounds? |
||
| 246 | if ((y < 1) && (x < 1)){y = 1; x = 1; dir = 45;} |
||
| 247 | if ((y < 1) && (x > w)){y = 1; x = w; dir = 135;} |
||
| 248 | if ((y > h) && (x < 1)){y = h; x = 1; dir = 315;} |
||
| 249 | if ((y > h) && (x > w)){y = h; x = w; dir = 225;} |
||
| 250 | //edge rebounds. |
||
| 251 | if (y < 1) {y = 1; dir = hb;} |
||
| 252 | if (y > h) {y = h; dir = hb;} |
||
| 253 | if (x < 1) {x = 1; dir = vb;} |
||
| 254 | if (x > w) {x = w; dir = vb;} |
||
| 255 | |||
| 256 | //Assign it all to image. |
||
| 257 | temp.style.top = y + scrl(0) + pix; |
||
| 258 | temp.style.left = x + scrl(1) + pix; |
||
| 259 | setTimeout(moveit,timer); |
||
| 260 | } |
||
| 261 | |||
| 262 | function init(){ |
||
| 263 | temp = document.getElementById("pin"); |
||
| 264 | winsize(); |
||
| 265 | moveit(); |
||
| 266 | } |
||
| 267 | |||
| 268 | |||
| 269 | if (window.addEventListener){ |
||
| 270 | window.addEventListener("resize",winsize,false); |
||
| 271 | window.addEventListener("load",init,false); |
||
| 272 | } |
||
| 273 | else if (window.attachEvent){ |
||
| 274 | window.attachEvent("onresize",winsize); |
||
| 275 | window.attachEvent("onload",init); |
||
| 276 | } |
||
| 277 | |||
| 278 | })(); |
||
| 279 | }//End. |
||
| 280 | |||
| 281 | </script> |
||
| 282 | </body> |
||
| 283 | </html> |
||
| 284 |