8 use CXGN
::DB
::Connection
;
11 my $page=CXGN
::Page
->new("Create organization","john");
12 my $dbh=CXGN
::DB
::Connection
->new("sgn_people");
14 my $logged_in_person_id=CXGN
::Login
->new($dbh)->verify_session();
15 my $logged_in_user=CXGN
::People
::Person
->new($dbh, $logged_in_person_id);
16 my $logged_in_username=$logged_in_user->get_first_name()." ".$logged_in_user->get_last_name();
17 my $logged_in_user_type=$logged_in_user->get_user_type();
18 if($logged_in_user_type eq 'curator')
20 my($name,$short_name)=$page->get_encoded_arguments("organization_name", "short_name");
23 $short_name ||= $name;
24 my $org_query=$dbh->prepare("select sp_organization_id from sgn_people.sp_organization where name=?");
25 $org_query->execute($name);
26 my($existing_org_id)=$org_query->fetchrow_array();
27 if($existing_org_id){$page->message_page("Organization \"$name\" exists, id $existing_org_id.");}
30 my $org_insert=$dbh->prepare("insert into sgn_people.sp_organization (name, shortname) values (?,?)");
31 $org_insert->execute($name, $short_name);
32 $page->header("Create organization","Organization created: $name");
38 $page->header("Create organization");
40 <form method="post" action="">
41 <table cellpadding="2" cellspacing="2" width="100%" align="center">
42 <tr><td colspan="2"><b>Curators may use this form to create organizations.<br /> </b></td></tr>
43 <tr><td>Organization name</td><td><input type="text" name="organization_name" size="30" value=""></td></tr>
44 <tr><td>Short name</td><td><input type="text" name="short_name" size="30" value=""></td></tr>
45 <tr><td> </td></tr>
46 <tr><td colspan="2" align="center"><input type="submit" name="create_organization" value="Create organization"></td></tr>
47 <tr><td colspan="2" align="center"><input type="reset" name="Clear" value="Clear form"></td></tr>
55 $page->client_redirect('/solpeople/login.pl');