Changeset 92 for trunk/cgi-bin


Ignore:
Timestamp:
11/30/04 15:42:30 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Port updates and bugfixes from /branches/stable r87:91 back
into devel tree

Location:
trunk/cgi-bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/ipdb.psql

    r74 r92  
    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
  • trunk/cgi-bin/main.cgi

    r87 r92  
    6868# Other global variables
    6969my @masterblocks;
     70my @citylist;
     71my @poplist;
    7072my %allocated;  # Count for allocated blocks in a master block
    7173my %free;       # Count for free blocks (routed and unrouted) in a master block
     
    7779# Use the connectDB function, otherwise we end up confusing ourselves
    7880my $ip_dbh = connectDB;
     81my $sth;
    7982
    8083# Slurp up the master block list - we need this several places
    8184# While we're at it, initialize the related hashes.
    82 my $sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
     85$sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
    8386$sth->execute;
    8487for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
     
    9194}
    9295
     96# Initialize the city and poplist arrays
     97$sth = $ip_dbh->prepare("select * from cities order by city");
     98$sth->execute;
     99my $i = 0;
     100my $j = 0;
     101while (my @data = $sth->fetchrow_array) {
     102  $citylist[$i++] = $data[0];
     103  if ($data[1] eq 'y') {
     104    $poplist[$j++] = $data[0];
     105  }
     106}
    93107
    94108
     
    778792        or croak "Could not open assign.html: $!";
    779793    $html = join('',<HTML>);
     794    close HTML;
    780795    my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
    781796    foreach my $master (@masterblocks) {
     
    784799    $masterlist .= "</select>\n";
    785800    $html =~ s|\$\$MASTERLIST\$\$|$masterlist|g;
    786     close HTML;
    787   }
     801    my $pops = '';
     802    foreach my $pop (@poplist) {
     803      $pops .= "<option>$pop</option>\n";
     804    }
     805    $html =~ s|\$\$POPLIST\$\$|$pops|g;
     806  }
     807  my $cities = '';
     808  foreach my $city (@citylist) {
     809    $cities .= "<option>$city</option>\n";
     810  }
     811  $html =~ s|\$\$ALLCITIES\$\$|$cities|g;
    788812
    789813  print $html;
     
    940964  $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g;
    941965  $webvar{desc} = desanitize($webvar{desc});
     966  $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
    942967  $webvar{notes} = desanitize($webvar{notes});
    943   $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
    944968  $html =~ s|\$\$NOTES\$\$|$webvar{notes}|g;
    945969  $html =~ s|\$\$ACTION\$\$|insert|g;
     
    13031327
    13041328  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
     1329  $webvar{city} = desanitize($webvar{city});
    13051330  $html =~ s/\$\$CITY\$\$/$webvar{city}/g;
    13061331  $html =~ s/\$\$ALLOCTYPE\$\$/$webvar{alloctype}/g;
    13071332  $html =~ s/\$\$TYPEFULL\$\$/$full_alloc_types{$webvar{alloctype}}/g;
    13081333  $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g;
     1334  $webvar{circid} = desanitize($webvar{circid});
    13091335  $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g;
     1336  $webvar{desc} = desanitize($webvar{desc});
    13101337  $html =~ s/\$\$DESC\$\$/$webvar{desc}/g;
     1338  $webvar{notes} = desanitize($webvar{notes});
    13111339  $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g;
    13121340
Note: See TracChangeset for help on using the changeset viewer.