Changeset 469


Ignore:
Timestamp:
08/12/10 18:00:54 (14 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Checkpoint - convert editDisplay.html to template
Still need to finish type dropdown
Still need to clean up formatting, tr/div/form nesting/classes,
etc around buttons and restricted data
See #3

Location:
branches/htmlform
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/main.cgi

    r468 r469  
    982982##fixme
    983983# Needs thinking.  Have to allow changes to city to correct errors, no?
     984# Also have areas where a routed block at a POP serves "many" cities/towns/named crossroads
    984985  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
     986
     987# cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip
     988
     989$page->param(block => $webvar{block});
     990
     991$page->param(custid => $data[1]);
     992$page->param(city => $data[3]);
     993$page->param(circid => $data[4]);
     994$page->param(desc => $data[5]);
     995$page->param(notes => $data[6]);
    985996
    986997  if ($IPDBacl{$authuser} =~ /c/) {
    987998    $html =~ s/\$\$CUSTID\$\$/<input type=text name=custid value="$data[1]" maxlength=15 class="regular">/;
    988 
    989 # Screw it.  Changing allocation types gets very ugly VERY quickly- especially
    990 # with the much longer list of allocation types.
    991 # We'll just show what type of block it is.
    992 
    993 # this has now been Requested, so here goes.
    994 
    995999##fixme The check here should be built from the database
     1000# Need to expand to support pool types too
    9961001    if ($data[2] =~ /^.[ne]$/) {
     1002$page->param(changetype => $IPDBacl{$authuser} =~ /c/);
     1003$page->param(alloctype => [
     1004                { selme => ($data[2] eq 'me'), type => "me", disptype => "Dialup netblock" },
     1005                { selme => ($data[2] eq 'de'), type => "de", disptype => "Dynamic DSL netblock" },
     1006                { selme => ($data[2] eq 'ce'), type => "ce", disptype => "Dynamic cable netblock" },
     1007                { selme => ($data[2] eq 'we'), type => "we", disptype => "Dynamic wireless netblock" },
     1008                { selme => ($data[2] eq 'cn'), type => "cn", disptype => "Customer netblock" },
     1009                { selme => ($data[2] eq 'en'), type => "en", disptype => "End-use netblock" },
     1010                { selme => ($data[2] eq 'in'), type => "in", disptype => "Internal netblock" },
     1011                ]
     1012        );
     1013
    9971014      # Block that can be changed
    9981015      my $blockoptions = "<select name=alloctype><option".
     
    10101027    }
    10111028## node hack
     1029##fixme:  this whole hack needs cleanup and generalization for all alloctypes
    10121030  $sth = $ip_dbh->prepare("SELECT node_id FROM noderef WHERE block='$webvar{block}'");
    10131031  $sth->execute;
    10141032  my ($nodeid) = $sth->fetchrow_array();
     1033$page->param(havenodeid => $nodeid);
     1034$page->param(typesupportsnodes => ($data[2] eq 'fr' || $data[2] eq 'bi'));
    10151035  if ($nodeid) {
    10161036    $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
    10171037    $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n";
    10181038    my $nodes = "<select name=node>\n";
     1039    my @nodelist;
    10191040    while (my ($nid,$nname) = $sth->fetchrow_array()) {
    10201041      $nodes .= "<option".($nodeid == $nid ? ' selected' : '')." value='$nid'>$nname</option>\n";
    1021     }
     1042      my %row = (
     1043        selme => ($nodeid == $nid),
     1044        nodeid => $nid,
     1045        nodename => $nname,
     1046        );
     1047      push (@nodelist, \%row);
     1048    }
     1049$page->param(nodelist => \@nodelist);
    10221050    $nodes .= "</select>\n";
    10231051    $html =~ s/\$\$NODE\$\$/$nodes/;
     
    10611089  }
    10621090  my ($lastmod,undef) = split /\s+/, $data[7];
    1063   $html =~ s/\$\$LASTMOD\$\$/$lastmod/g;
     1091  $page->param(lastmod => $lastmod);
    10641092
    10651093## Hack time!  SWIP isn't going to stay, so I'm not going to integrate it with ACLs.
     
    10771105  # Check to see if we can display sensitive data
    10781106  my $privdata = '';
     1107$page->param(nocling => $IPDBacl{$authuser} =~ /s/);
     1108$page->param(privdata => $data[8]);
     1109
    10791110  if ($IPDBacl{$authuser} =~ /s/) {
    10801111    $privdata = qq(<tr class="color).($i%2).qq("><td class=heading>Restricted data:</td>).
     
    10891120  # can't leave the submit buttons there.
    10901121  my $updok = '';
     1122$page->param(maychange => $IPDBacl{$authuser} =~ /c/);
    10911123  if ($IPDBacl{$authuser} =~ /c/) {
    10921124    $updok = qq(<tr class="color).($i%2).qq("><td colspan=2><div class="center">).
     
    10981130
    10991131  my $delok = '';
     1132$page->param(maydel => $IPDBacl{$authuser} =~ /d/);
    11001133  if ($IPDBacl{$authuser} =~ /d/) {
    11011134    $delok = qq(<form method="POST" action="main.cgi">
     
    11091142  $html =~ s/\$\$DELOK\$\$/$delok/;
    11101143
    1111   print $html;
     1144#  print $html;
    11121145
    11131146} # edit()
  • branches/htmlform/ipdb.css

    r466 r469  
    9696        font-family: Verdana, Arial, Helvetica, sans-serif;
    9797}
    98 tr.row0 {
     98/* for reasons of Please The Validation Gods, these may be applied to
     99   things that are not technically table rows */
     100.row0 {
    99101        background-color: #D0E0E0;
    100102        font-family: Verdana, Arial, Helvetica, sans-serif;
    101103        font-size: 90%;
    102104}
    103 tr.row1 {
     105.row1 {
    104106        background-color: #A8C4D0;
    105107        font-family: Verdana, Arial, Helvetica, sans-serif;
Note: See TracChangeset for help on using the changeset viewer.