xref: /trunk/main/sd/res/webview/poll.pl (revision cdf0e10c)
1*cdf0e10cSrcweir#!/usr/bin/perl
2*cdf0e10cSrcweir
3*cdf0e10cSrcweirrequire "common.pl";
4*cdf0e10cSrcweir
5*cdf0e10cSrcweirprint "Content-type: text/html\n\n";
6*cdf0e10cSrcweirprint "<HTML>";
7*cdf0e10cSrcweir
8*cdf0e10cSrcweir# get current and last shown picture id
9*cdf0e10cSrcweir$sCurrPic = join( "", common::File_read( "currpic.txt" ) );
10*cdf0e10cSrcweir
11*cdf0e10cSrcweir%aRequestMap = common::HTTP_getRequest();
12*cdf0e10cSrcweir$sLastPic = $aRequestMap{ "LastPic" };
13*cdf0e10cSrcweir
14*cdf0e10cSrcweirprint "<HEAD>";
15*cdf0e10cSrcweir    print "<META http-equiv=\"refresh\" CONTENT=\"" . $common::REFRESH_TIME . "; URL=poll.pl?LastPic=" . $sCurrPic . "\">";
16*cdf0e10cSrcweirprint "</HEAD>";
17*cdf0e10cSrcweir
18*cdf0e10cSrcweir#' a new picture was chosen ?
19*cdf0e10cSrcweirif( $sLastPic ne $sCurrPic )
20*cdf0e10cSrcweir{
21*cdf0e10cSrcweir    # then show the new picture
22*cdf0e10cSrcweir    print "<BODY bgcolor=\"red\" onLoad=\"parent.frame1.location.href='./show.pl?" . $sCurrPic . "'\">";
23*cdf0e10cSrcweir}
24*cdf0e10cSrcweirelse
25*cdf0e10cSrcweir{
26*cdf0e10cSrcweir    # otherwise do nothing
27*cdf0e10cSrcweir    print "<BODY bgcolor=\"green\">";
28*cdf0e10cSrcweir}
29*cdf0e10cSrcweir
30*cdf0e10cSrcweirprint "</BODY>";
31*cdf0e10cSrcweir
32*cdf0e10cSrcweirprint "</HTML>";