diff --git a/cgi-bin/coposys b/cgi-bin/coposys new file mode 100644 index 0000000000..f18262369d --- /dev/null +++ b/cgi-bin/coposys @@ -0,0 +1,446 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2001 Cyril Bouthors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# $Id: coposys,v 1.3 2003-02-01 15:23:34 jonas Exp $ +# + +use integer; +use diagnostics; +use sigtrap qw(SEGV BUS); +use strict qw(subs vars refs); +use subs qw(afunc blurfl); + +use CGI qw/:standard/; + +# people in the database +my %people; + +# directory containing the marker files for xplanet +# named thecommunity.mark +my $markerdir='/var/www/coposys'; + +# markerfile +# format : +# latitude longitude "name" #password, date, email +my $filename; + +# +# Syntax of CGI calls : +# +# coposys?community='thecommunity' : displays main form +# coposys?add&name=&password=&password2=&latitude=&longitude=&email=&community= +# coposys?update&name=&password=&latitude=&longitude=&email=&community= +# coposys?delete&name=&del_password=&community= +# + +print header; + +if (param('community')) { + + $filename = $markerdir . '/' . param('community') . '.mark'; + + print 'Coposys $Revision: 1.3 $ ' , "\n\n", + "Manage members of a community \n\n"; + + # form for adding a new member of the community + display_add_update_forms(); + + # display a refresh button + display_list_form(); + + treat_args(); + + # displays a list of members of the community, with a password field next to each to allow modifications + display_community(); + +} +else { + print start_html('error'), 'You need the community argument'; +} + +print end_html; + +################################################################ + +sub display_add_update_forms { + my $date = localtime(); + + print start_html('Coposys.'); + + # Add part of the form + print "
", + + "Use this form to register in the community ". + param('community'). " \n", + + start_form, + + " Full Name ", textfield('name'), "\n ", p, + + "Password ", + password_field({name=>'password',size=>'8',maxlength=>8}), "\n ", p, + + "Password (again) ", + password_field({name=>'password2',size=>8,maxlength=>8}), "\n ", p, + + "Latitude ", textfield('latitude'), "\n ", p, + + "Longitude ", textfield('longitude'), "\n ", p, + + hidden({name=>'community'}), "\n ", + + hidden({name=>'date',default=>$date}), "\n", + + " Email ", textfield('email'), "\n ", p, + + submit({name=>'add'}), "\n", + end_form, "\n\n"; + + print " | "; + + + # Update part of the form + print "", + + "Use this form to update your registration in the community ". + param('community'), " \n", + + start_form, + + " Full Name ", textfield('name'), "\n ", p, + + "Password ", + password_field({name=>'password',size=>'8',maxlength=>8}), "\n ", p, + + "Latitude ", textfield('latitude'), "\n ", p, + + "Longitude ", textfield('longitude'), "\n ", p, + + hidden({name=>'community'}), "\n ", + + hidden({name=>'date',default=>$date}), "\n", + + " Email ", textfield('email'), "\n ", p, + + submit({name=>'update'}), "\n", + + " |
Name | Latitude | Longitude | " ; + print "Last update | ||
$key | \n"; + print "$latitude | \n"; + print "$longitude | \n"; + print "$date | \n"; + print "\n " . start_form, " ", + "password: ", + password_field({name=>'del_password',size=>8,maxlength=>8}), "\n ", + hidden({name=>'community'}), "\n ", + hidden({name=>'name', default=>$key}), "\n ", + submit({name=>'delete'}), "\n ", + end_form, "\n | \n"; + + print "
' . $message . "\n"; +}