xref: /trunk/main/sd/res/webview/savepic.pl (revision bb113e63)
1cdf0e10cSrcweir#!/usr/bin/perl
2*bb113e63SAndrew Rist# *************************************************************
3*bb113e63SAndrew Rist#
4*bb113e63SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5*bb113e63SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6*bb113e63SAndrew Rist#  distributed with this work for additional information
7*bb113e63SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8*bb113e63SAndrew Rist#  to you under the Apache License, Version 2.0 (the
9*bb113e63SAndrew Rist#  "License"); you may not use this file except in compliance
10*bb113e63SAndrew Rist#  with the License.  You may obtain a copy of the License at
11*bb113e63SAndrew Rist#
12*bb113e63SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13*bb113e63SAndrew Rist#
14*bb113e63SAndrew Rist#  Unless required by applicable law or agreed to in writing,
15*bb113e63SAndrew Rist#  software distributed under the License is distributed on an
16*bb113e63SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*bb113e63SAndrew Rist#  KIND, either express or implied.  See the License for the
18*bb113e63SAndrew Rist#  specific language governing permissions and limitations
19*bb113e63SAndrew Rist#  under the License.
20*bb113e63SAndrew Rist#
21*bb113e63SAndrew Rist# *************************************************************
22cdf0e10cSrcweir
23cdf0e10cSrcweirrequire "common.pl";
24cdf0e10cSrcweir
25cdf0e10cSrcweir%aRequestMap = common::HTTP_getRequest();
26cdf0e10cSrcweir
27cdf0e10cSrcweir# get new picture
28cdf0e10cSrcweir$sCurrPic = $aRequestMap{ "CurrPic" };
29cdf0e10cSrcweir
30cdf0e10cSrcweir@aPictureArray = common::File_read( "picture.txt" );
31cdf0e10cSrcweir$nPictureArrayLen = @aPictureArray;
32cdf0e10cSrcweir
33cdf0e10cSrcweir# check if + or - was pressed
34cdf0e10cSrcweirif( $aRequestMap{ "Auswahl" } eq "+" )
35cdf0e10cSrcweir{
36cdf0e10cSrcweir	$sCurrPic = abs( $sCurrPic ) + 1;
37cdf0e10cSrcweir}
38cdf0e10cSrcweir
39cdf0e10cSrcweirif( $aRequestMap{ "Auswahl" } eq "-" )
40cdf0e10cSrcweir{
41cdf0e10cSrcweir	$sCurrPic = abs( $sCurrPic ) - 1;
42cdf0e10cSrcweir}
43cdf0e10cSrcweir
44cdf0e10cSrcweir# save picture name
45cdf0e10cSrcweirif( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
46cdf0e10cSrcweir{
47cdf0e10cSrcweir	open( F_CURRPIC, ">currpic.txt");
48cdf0e10cSrcweir	print F_CURRPIC abs( $sCurrPic );
49cdf0e10cSrcweir	close( F_CURRPIC );
50cdf0e10cSrcweir}
51cdf0e10cSrcweir
52cdf0e10cSrcweir# return to edit page
53cdf0e10cSrcweirprint "Content-type: text/html\n\n";
54cdf0e10cSrcweirprint "<HTML>\n<HEAD>\n";
55cdf0e10cSrcweirprint "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
56cdf0e10cSrcweirprint "<title>savepic.pl</title>";
57cdf0e10cSrcweirprint "</HEAD>\n";
58cdf0e10cSrcweirprint "<BODY>\n";
59cdf0e10cSrcweirprint "</BODY>\n";
60cdf0e10cSrcweirprint "</HTML>\n";
61cdf0e10cSrcweir%>
62