Changeset 269 for branches/stable


Ignore:
Timestamp:
07/19/05 11:37:40 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Tweak admin.cgi to snag alloctypes from db rather than hardcoding

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/admin.cgi

    r260 r269  
    429429    print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
    430430        qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
    431         qq(<td><input name=custid value="$data[1]"></td>\n);
    432 
    433     print "<td><select name=alloctype><option".
    434         (($data[2] eq 'cn') ? ' selected' : '') ." value='cn'>Customer netblock</option>\n<option".
    435         (($data[2] eq 'si') ? ' selected' : '') ." value='si'>Static IP - Server pool</option>\n<option".
    436         (($data[2] eq 'ci') ? ' selected' : '') ." value='ci'>Static IP - Cable</option>\n<option".
    437         (($data[2] eq 'di') ? ' selected' : '') ." value='di'>Static IP - DSL</option>\n<option".
    438         (($data[2] eq 'mi') ? ' selected' : '') ." value='mi'>Static IP - Dialup</option>\n<option".
    439         (($data[2] eq 'wi') ? ' selected' : '') ." value='wi'>Static IP - Wireless</option>\n<option".
    440         (($data[2] eq 'sd') ? ' selected' : '') ." value='sd'>Static Pool - Server pool</option>\n<option".
    441         (($data[2] eq 'cd') ? ' selected' : '') ." value='cd'>Static Pool - Cable</option>\n<option".
    442         (($data[2] eq 'dp') ? ' selected' : '') ." value='dp'>Static Pool - DSL</option>\n<option".
    443         (($data[2] eq 'mp') ? ' selected' : '') ." value='mp'>Static Pool - Dialup</option>\n<option".
    444         (($data[2] eq 'wp') ? ' selected' : '') ." value='wp'>Static Pool - Wireless</option>\n<option".
    445         (($data[2] eq 'en') ? ' selected' : '') ." value='en'>End-use netblock</option>\n<option".
    446         (($data[2] eq 'me') ? ' selected' : '') ." value='me'>Dialup netblock</option>\n<option".
    447         (($data[2] eq 'de') ? ' selected' : '') ." value='de'>Dynamic DSL netblock</option>\n<option".
    448         (($data[2] eq 'ce') ? ' selected' : '') ." value='ce'>Dynamic cable netblock</option>\n<option".
    449         (($data[2] eq 'we') ? ' selected' : '') ." value='we'>Dynamic WiFi netblock</option>\n<option".
    450         (($data[2] eq 'in') ? ' selected' : '') ." value='in'>Internal netblock</option>\n".
    451         "</select></td>\n";
     431        qq(<td><input name=custid value="$data[1]"></td>\n).
     432        "<td><select name=alloctype>";
     433
     434    my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
     435        " where listorder < 500 and not (type like '_i') order by listorder");
     436    $sth2->execute;
     437    while (my @types = $sth2->fetchrow_array) {
     438      print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
     439        " value='$types[0]'>$types[1]</option>\n";
     440    }
     441    print "<option". (($data[2] eq 'in') ? ' selected' : '') .
     442        " value='in'>Internal netblock</option>\n</select></td>\n";
     443
    452444    print qq(<td><input name=city value="$data[3]"></td>\n).
    453445        "<td>$data[4]</td><td>$data[5]</td>".
     
    500492<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
    501493<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
    502 <tr><td align=right>Type:</td><td><select name=type><option selected>-</option>
    503 <option value="si">Static IP - Server pool</option>
    504 <option value="ci">Static IP - Cable</option>
    505 <option value="di">Static IP - DSL</option>
    506 <option value="mi">Static IP - Dialup</option>
    507 <option value="wi">Static IP - Wireless</option>
    508 </select></td></tr>
     494<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
     495
     496  $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
     497  $sth->execute;
     498  while (my @data = $sth->fetchrow_array) {
     499    print "<option value='$data[0]'>$data[1]</option>\n";
     500  }
     501
     502  print qq(</select></td></tr>
    509503<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
    510504<tr><td align=right>Description/name:</td><td><input name=desc size=40></td></tr>
Note: See TracChangeset for help on using the changeset viewer.