xref: /trunk/main/sd/res/webview/poll.pl (revision c667dd47)
1#!/usr/bin/env perl
2# *************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21# *************************************************************
22
23require "common.pl";
24
25print "Content-type: text/html\n\n";
26print "<HTML>";
27
28# get current and last shown picture id
29$sCurrPic = join( "", common::File_read( "currpic.txt" ) );
30
31%aRequestMap = common::HTTP_getRequest();
32$sLastPic = $aRequestMap{ "LastPic" };
33
34print "<HEAD>";
35    print "<META http-equiv=\"refresh\" CONTENT=\"" . $common::REFRESH_TIME . "; URL=poll.pl?LastPic=" . $sCurrPic . "\">";
36print "</HEAD>";
37
38#' a new picture was chosen ?
39if( $sLastPic ne $sCurrPic )
40{
41    # then show the new picture
42    print "<BODY bgcolor=\"red\" onLoad=\"parent.frame1.location.href='./show.pl?" . $sCurrPic . "'\">";
43}
44else
45{
46    # otherwise do nothing
47    print "<BODY bgcolor=\"green\">";
48}
49
50print "</BODY>";
51
52print "</HTML>";
53