diff options
author | joanofarctangent@gmail.com <iduffe@dev.piny.svcs.cs.pdx.edu> | 2011-01-18 18:51:35 -0800 |
---|---|---|
committer | joanofarctangent@gmail.com <iduffe@dev.piny.svcs.cs.pdx.edu> | 2011-01-18 18:51:35 -0800 |
commit | 8203bf9c98833de59ba0c939566ce25ce53e2eb0 (patch) | |
tree | b8edde28d20b366780db3ff09388145a684d082a /pinyweb | |
parent | 666f8065cd416870d236ae2063dd836fb35d18a0 (diff) | |
parent | 5e5c8b90363ff5460ee6eb9378a31f099d38aefe (diff) | |
download | piny-code-8203bf9c98833de59ba0c939566ce25ce53e2eb0.tar.gz piny-code-8203bf9c98833de59ba0c939566ce25ce53e2eb0.zip |
Merge branch 'master' of piny.be:/srv/git/piny-code
Diffstat (limited to 'pinyweb')
-rwxr-xr-x | pinyweb/cgi-bin/checkconstraint.cgi | 41 | ||||
-rwxr-xr-x[-rw-r--r--] | pinyweb/cgi-bin/newuser.cgi | 0 | ||||
-rw-r--r-- | pinyweb/debian/changelog | 7 | ||||
-rw-r--r-- | pinyweb/debian/control | 2 |
4 files changed, 49 insertions, 1 deletions
diff --git a/pinyweb/cgi-bin/checkconstraint.cgi b/pinyweb/cgi-bin/checkconstraint.cgi new file mode 100755 index 0000000..8db0903 --- /dev/null +++ b/pinyweb/cgi-bin/checkconstraint.cgi @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use CGI; +use JSON qw( encode_json ); +use Moose::Util::TypeConstraints qw( find_type_constraint ); + +use Piny; + +my $q = CGI->new( ); + +my $type = $q->param( 't' ); +my $value = $q->param( 'v' ); + +if ( not defined $type or not defined $value ) { + print "Status: 400 Bad Request\nContent-type: application/json\n\n"; + print encode_json( { "ok" => JSON::false, "msg" => "Unable to validate due to client-side error, please reload this page. Required parameter missing." } ); +} else { + + my $constraint = find_type_constraint( $type ); + + if ( not defined $constraint ) { + print "Status: 400 Bad Request\nContent-type: application/json\n\n"; + print encode_json( { "ok" => JSON::false, "msg" => "Unable to validate due to client-side error, please reload this page. Invalid constraint name." } ); + } else { + + print "Status: 200 OK\nContent-type: application/json\n\n"; + + my $error = $constraint->validate( $value ); + + if ( defined $error ) { + print encode_json( { "ok" => JSON::false, "msg" => $error } ); + } else { + print encode_json( { "ok" => JSON::true } ); + }; + + }; + +}; diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi index 7001321..7001321 100644..100755 --- a/pinyweb/cgi-bin/newuser.cgi +++ b/pinyweb/cgi-bin/newuser.cgi diff --git a/pinyweb/debian/changelog b/pinyweb/debian/changelog index 33e7f7d..18dfcf4 100644 --- a/pinyweb/debian/changelog +++ b/pinyweb/debian/changelog @@ -1,3 +1,10 @@ +pinyweb (0.8) unstable; urgency=low + + * Depend on pinyadmin. + * Adding an AJAX CGI for live validation. + + -- Julian Blake Kongslie <jblake@omgwallhack.org> Tue, 18 Jan 2011 17:52:23 -0800 + pinyweb (0.7) unstable; urgency=low * it turns out i'm an idiot diff --git a/pinyweb/debian/control b/pinyweb/debian/control index 1a1d795..97e5537 100644 --- a/pinyweb/debian/control +++ b/pinyweb/debian/control @@ -8,7 +8,7 @@ Standards-version: 3.9.1 Package: pinyweb Architecture: any -Depends: ${perl:Depends}, ${misc:Depends}, ${shlibs:Depends}, libpiny-perl (>= 0.14) +Depends: ${perl:Depends}, ${misc:Depends}, ${shlibs:Depends}, libjson-perl, libpiny-perl (>= 0.14), pinyadmin (>= 0.10) Description: CGIs for managing piny repositories The CGI programs for day-to-day administrative tasks in the Piny infrastructure. |