xref: /trunk/main/sd/res/webview/savepic.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
25%aRequestMap = common::HTTP_getRequest();
26
27# get new picture
28$sCurrPic = $aRequestMap{ "CurrPic" };
29
30@aPictureArray = common::File_read( "picture.txt" );
31$nPictureArrayLen = @aPictureArray;
32
33# check if + or - was pressed
34if( $aRequestMap{ "Auswahl" } eq "+" )
35{
36	$sCurrPic = abs( $sCurrPic ) + 1;
37}
38
39if( $aRequestMap{ "Auswahl" } eq "-" )
40{
41	$sCurrPic = abs( $sCurrPic ) - 1;
42}
43
44# save picture name
45if( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
46{
47	open( F_CURRPIC, ">currpic.txt");
48	print F_CURRPIC abs( $sCurrPic );
49	close( F_CURRPIC );
50}
51
52# return to edit page
53print "Content-type: text/html\n\n";
54print "<HTML>\n<HEAD>\n";
55print "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
56print "<title>savepic.pl</title>";
57print "</HEAD>\n";
58print "<BODY>\n";
59print "</BODY>\n";
60print "</HTML>\n";
61%>
62