Changeset 91 for branches/stable/cgi-bin


Ignore:
Timestamp:
11/30/04 14:22:50 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Overhaul of city listings - first stage. Cities are now listed in
ONE place for stuffing into HTML and so on. City list also updated
with most of the cities currently listed, and a few that have
probably been removed.
SQL schema updated with new table

Location:
branches/stable/cgi-bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/ipdb.psql

    r75 r91  
    55
    66--
    7 -- TOC Entry ID 18 (OID 16556)
     7-- TOC Entry ID 22 (OID 16556)
    88--
    99-- Name: "plpgsql_call_handler" () Type: FUNCTION Owner: postgres
     
    1313
    1414--
    15 -- TOC Entry ID 19 (OID 16557)
     15-- TOC Entry ID 23 (OID 16557)
    1616--
    1717-- Name: plpgsql Type: PROCEDURAL LANGUAGE Owner:
     
    217217GRANT ALL on "allocations" to "ipdb";
    218218
     219--
     220-- TOC Entry ID 18 (OID 92809)
     221--
     222-- Name: alloctypes Type: TABLE Owner: ipdb
     223--
     224
     225CREATE TABLE "alloctypes" (
     226        "type" character(2) DEFAULT '' NOT NULL,
     227        "listname" character varying(40) DEFAULT '',
     228        "dispname" character varying(40) DEFAULT '',
     229        "listorder" integer DEFAULT 0,
     230        Constraint "alloctypes_pkey" Primary Key ("type")
     231);
     232
     233--
     234-- TOC Entry ID 19 (OID 92809)
     235--
     236-- Name: alloctypes Type: ACL Owner:
     237--
     238
     239REVOKE ALL on "alloctypes" from PUBLIC;
     240GRANT ALL on "alloctypes" to "kdeugau";
     241GRANT ALL on "alloctypes" to "ipdb";
     242
     243--
     244-- TOC Entry ID 20 (OID 93964)
     245--
     246-- Name: cities Type: TABLE Owner: ipdb
     247--
     248
     249CREATE TABLE "cities" (
     250        "city" character varying(30) DEFAULT '' NOT NULL,
     251        "routing" character(1) DEFAULT 'n' NOT NULL,
     252        Constraint "cities_pkey" Primary Key ("city")
     253);
     254
     255--
     256-- TOC Entry ID 21 (OID 93964)
     257--
     258-- Name: cities Type: ACL Owner:
     259--
     260
     261REVOKE ALL on "cities" from PUBLIC;
     262GRANT ALL on "cities" to "kdeugau";
     263GRANT ALL on "cities" to "ipdb";
     264
  • branches/stable/cgi-bin/main.cgi

    r89 r91  
    6969# Other global variables
    7070my @masterblocks;
     71my @citylist;
     72my @poplist;
    7173my %allocated;  # Count for allocated blocks in a master block
    7274my %free;       # Count for free blocks (routed and unrouted) in a master block
     
    7880# Use the connectDB function, otherwise we end up confusing ourselves
    7981my $ip_dbh = connectDB;
     82my $sth;
    8083
    8184# Slurp up the master block list - we need this several places
    8285# While we're at it, initialize the related hashes.
    83 my $sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
     86$sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
    8487$sth->execute;
    8588for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
     
    9295}
    9396
     97# Initialize the city and poplist arrays
     98$sth = $ip_dbh->prepare("select * from cities order by city");
     99$sth->execute;
     100my $i = 0;
     101my $j = 0;
     102while (my @data = $sth->fetchrow_array) {
     103  $citylist[$i++] = $data[0];
     104  if ($data[1] eq 'y') {
     105    $poplist[$j++] = $data[0];
     106  }
     107}
    94108
    95109
     
    779793        or croak "Could not open assign.html: $!";
    780794    $html = join('',<HTML>);
     795    close HTML;
    781796    my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
    782797    foreach my $master (@masterblocks) {
     
    785800    $masterlist .= "</select>\n";
    786801    $html =~ s|\$\$MASTERLIST\$\$|$masterlist|g;
    787     close HTML;
    788   }
     802    my $pops = '';
     803    foreach my $pop (@poplist) {
     804      $pops .= "<option>$pop</option>\n";
     805    }
     806    $html =~ s|\$\$POPLIST\$\$|$pops|g;
     807  }
     808  my $cities = '';
     809  foreach my $city (@citylist) {
     810    $cities .= "<option>$city</option>\n";
     811  }
     812  $html =~ s|\$\$ALLCITIES\$\$|$cities|g;
    789813
    790814  print $html;
Note: See TracChangeset for help on using the changeset viewer.