Changeset 348 for trunk/cgi-bin


Ignore:
Timestamp:
10/06/06 12:19:14 (18 years ago)
Author:
Kris Deugau
Message:

/trunk

Backport fix from /branches/stable r269 to pull admin.cgi alloctype
pulldown data from database instead of using hardcoded entries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/admin.cgi

    r340 r348  
    560560    print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
    561561        qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
    562         qq(<td><input name=custid value="$data[1]"></td>\n);
    563 
    564     print "<td><select name=alloctype><option".
    565         (($data[2] eq 'cn') ? ' selected' : '') ." value='cn'>Customer netblock</option>\n<option".
    566         (($data[2] eq 'si') ? ' selected' : '') ." value='si'>Static IP - Server pool</option>\n<option".
    567         (($data[2] eq 'ci') ? ' selected' : '') ." value='ci'>Static IP - Cable</option>\n<option".
    568         (($data[2] eq 'di') ? ' selected' : '') ." value='di'>Static IP - DSL</option>\n<option".
    569         (($data[2] eq 'mi') ? ' selected' : '') ." value='mi'>Static IP - Dialup</option>\n<option".
    570         (($data[2] eq 'wi') ? ' selected' : '') ." value='wi'>Static IP - Wireless</option>\n<option".
    571         (($data[2] eq 'sd') ? ' selected' : '') ." value='sd'>Static Pool - Server pool</option>\n<option".
    572         (($data[2] eq 'cd') ? ' selected' : '') ." value='cd'>Static Pool - Cable</option>\n<option".
    573         (($data[2] eq 'dp') ? ' selected' : '') ." value='dp'>Static Pool - DSL</option>\n<option".
    574         (($data[2] eq 'mp') ? ' selected' : '') ." value='mp'>Static Pool - Dialup</option>\n<option".
    575         (($data[2] eq 'wp') ? ' selected' : '') ." value='wp'>Static Pool - Wireless</option>\n<option".
    576         (($data[2] eq 'en') ? ' selected' : '') ." value='en'>End-use netblock</option>\n<option".
    577         (($data[2] eq 'me') ? ' selected' : '') ." value='me'>Dialup netblock</option>\n<option".
    578         (($data[2] eq 'de') ? ' selected' : '') ." value='de'>Dynamic DSL netblock</option>\n<option".
    579         (($data[2] eq 'ce') ? ' selected' : '') ." value='ce'>Dynamic cable netblock</option>\n<option".
    580         (($data[2] eq 'we') ? ' selected' : '') ." value='we'>Dynamic WiFi netblock</option>\n<option".
    581         (($data[2] eq 'in') ? ' selected' : '') ." value='in'>Internal netblock</option>\n".
    582         "</select></td>\n";
     562        qq(<td><input name=custid value="$data[1]"></td>\n).
     563        "<td><select name=alloctype>";
     564
     565    my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
     566        " where listorder < 500 and not (type like '_i') order by listorder");
     567    $sth2->execute;
     568    while (my @types = $sth2->fetchrow_array) {
     569      print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
     570        " value='$types[0]'>$types[1]</option>\n";
     571    }
     572    print "<option". (($data[2] eq 'in') ? ' selected' : '') .
     573        " value='in'>Internal netblock</option>\n</select></td>\n";
     574
    583575    print qq(<td><input name=city value="$data[3]"></td>\n).
    584576        "<td>$data[4]</td><td>$data[5]</td>".
     
    631623<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
    632624<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
    633 <tr><td align=right>Type:</td><td><select name=type><option selected>-</option>
    634 <option value="si">Static IP - Server pool</option>
    635 <option value="ci">Static IP - Cable</option>
    636 <option value="di">Static IP - DSL</option>
    637 <option value="mi">Static IP - Dialup</option>
    638 <option value="wi">Static IP - Wireless</option>
    639 </select></td></tr>
     625<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
     626
     627  $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
     628  $sth->execute;
     629  while (my @data = $sth->fetchrow_array) {
     630    print "<option value='$data[0]'>$data[1]</option>\n";
     631  }
     632
     633  print qq(</select></td></tr>
    640634<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
    641635<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.