-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchkconstr.txt
74 lines (54 loc) · 2.03 KB
/
chkconstr.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##############################
## chkconstr.txt
##
## Ajax reponder: check a constraint
##
###########################################################################
# This code is part of wITIP (a web based Information Theoretic Prover)
#
# Copyright 2017-2024 Laszlo Csirmaz, UTIA, Prague
# This program is free, open-source software. You may redistribute it
# and/or modify under the terms of the GNU General Public License (GPL).
# There is ABSOLUTELY NO WARRANTY, use at your own risk.
###########################################################################
use wSession;
use wUtils;
use strict;
my $session = new wSession;
exit(0) unless ( defined $session );
my $SSID = $session->{SSID};
exit 0 if(!$SSID || wUtils::check_SSID($SSID) );
# return value:
# if OK: "0\n"; constrain added, reload the page
# if error: "1,errpos,errmsg+++aux\n"
use wConstr;
my $err = wConstr::add_constraint($session,$session->getpar("text"));
if($err->{err}){ # there was an error {pos},{aux}
print "1,$err->{pos},$err->{err}";
print "+++",$err->{aux} if($err->{aux});
print "\n";
} else { # OK
print "0\n";
}
exit 0;
__END__
#######################################################
=pod
=head1 wITIP Ajax responder
=head2 chkconstr.txt
Ajax responder to check a new constraint
Arguments are:
SSID: session ID
text: the constraint text
Session ID must have correct format, otherwise the responder aborts. If
there was no parsing error and the constraint has been added, the response
is a single line containing "0" (zero). The web page should reload the page
as both the constraint list and the constraint history have changed.
In case of an error the response is a single line as follows:
1,I<errpos>,I<errmsg>+++I<auxmessage>
I<errpos> is a non-negative number showing the character number where the
error was found. I<Errmsg> is the error message text. The +++i<auxmessage>
part might be missing. The web page should show the appropriate error
message and continue.
=cut
#######################################################