xref: /trunk/main/sd/res/webview/savepic.pl (revision cdf0e10c)
1*cdf0e10cSrcweir#!/usr/bin/perl
2*cdf0e10cSrcweir
3*cdf0e10cSrcweirrequire "common.pl";
4*cdf0e10cSrcweir
5*cdf0e10cSrcweir%aRequestMap = common::HTTP_getRequest();
6*cdf0e10cSrcweir
7*cdf0e10cSrcweir# get new picture
8*cdf0e10cSrcweir$sCurrPic = $aRequestMap{ "CurrPic" };
9*cdf0e10cSrcweir
10*cdf0e10cSrcweir@aPictureArray = common::File_read( "picture.txt" );
11*cdf0e10cSrcweir$nPictureArrayLen = @aPictureArray;
12*cdf0e10cSrcweir
13*cdf0e10cSrcweir# check if + or - was pressed
14*cdf0e10cSrcweirif( $aRequestMap{ "Auswahl" } eq "+" )
15*cdf0e10cSrcweir{
16*cdf0e10cSrcweir	$sCurrPic = abs( $sCurrPic ) + 1;
17*cdf0e10cSrcweir}
18*cdf0e10cSrcweir
19*cdf0e10cSrcweirif( $aRequestMap{ "Auswahl" } eq "-" )
20*cdf0e10cSrcweir{
21*cdf0e10cSrcweir	$sCurrPic = abs( $sCurrPic ) - 1;
22*cdf0e10cSrcweir}
23*cdf0e10cSrcweir
24*cdf0e10cSrcweir# save picture name
25*cdf0e10cSrcweirif( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
26*cdf0e10cSrcweir{
27*cdf0e10cSrcweir	open( F_CURRPIC, ">currpic.txt");
28*cdf0e10cSrcweir	print F_CURRPIC abs( $sCurrPic );
29*cdf0e10cSrcweir	close( F_CURRPIC );
30*cdf0e10cSrcweir}
31*cdf0e10cSrcweir
32*cdf0e10cSrcweir# return to edit page
33*cdf0e10cSrcweirprint "Content-type: text/html\n\n";
34*cdf0e10cSrcweirprint "<HTML>\n<HEAD>\n";
35*cdf0e10cSrcweirprint "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
36*cdf0e10cSrcweirprint "<title>savepic.pl</title>";
37*cdf0e10cSrcweirprint "</HEAD>\n";
38*cdf0e10cSrcweirprint "<BODY>\n";
39*cdf0e10cSrcweirprint "</BODY>\n";
40*cdf0e10cSrcweirprint "</HTML>\n";
41*cdf0e10cSrcweir%>
42