Changeset 461


Ignore:
Timestamp:
Aug 4, 2010, 5:59:51 PM (11 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Checkpoint - confirm.html almost completely converted to template.
Still need to fix up allocfrom (see ##fixme at line 790 in main.cgi).
See #3.

Location:
branches/htmlform
Files:
1 added
2 edited

Legend:

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

    r456 r461  
    788788    } # check for freeblocks assignment or IPDB-controlled assignment
    789789
     790##fixme:  HTML must be removed from script!
    790791    $alloc_from = qq($cidr<input type=hidden name=alloc_from value="$cidr">);
    791792
     
    802803  } # if ($webvar{alloctype} =~ /^.i$/)
    803804
    804   open HTML, "../confirm.html"
    805         or croak "Could not open confirm.html: $!";
    806   my $html = join '', <HTML>;
    807   close HTML;
    808 
    809805## node hack
    810806  if ($webvar{node} && $webvar{node} ne '-') {
     
    812808    $sth->execute($webvar{node});
    813809    my ($nodename) = $sth->fetchrow_array();
    814     $html =~ s/\$\$NODENAME\$\$/$nodename/;
    815     $html =~ s/\$\$NODEID\$\$/$webvar{node}/;
    816   } else {
    817     $html =~ s/\$\$NODENAME\$\$//;
    818     $html =~ s/\$\$NODEID\$\$//;
     810    $page->param(nodename => $nodename);
     811    $page->param(nodeid => $webvar{node});
    819812  }
    820813## end node hack
    821814
    822 ### gotta fix this in final
    823   # Stick in customer info as necessary - if it's blank, it just ends
    824   # up as blank lines ignored in the rendering of the page
    825         my $custbits;
    826   $html =~ s|\$\$CUSTBITS\$\$|$custbits|g;
    827 ###
    828 
    829815  # Stick in the allocation data
    830   $html =~ s|\$\$ALLOC_TYPE\$\$|$webvar{alloctype}|g;
    831   $html =~ s|\$\$TYPEFULL\$\$|$disp_alloctypes{$webvar{alloctype}}|g;
    832   $html =~ s|\$\$ALLOC_FROM\$\$|$alloc_from|g;
    833   $html =~ s|\$\$CIDR\$\$|$cidr|g;
    834   $webvar{city} = $q->escapeHTML($webvar{city});
    835   $html =~ s|\$\$CITY\$\$|$webvar{city}|g;
    836   $html =~ s|\$\$CUSTID\$\$|$webvar{custid}|g;
    837   $webvar{circid} = $q->escapeHTML($webvar{circid});
    838   $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g;
    839   $webvar{desc} = $q->escapeHTML($webvar{desc});
    840   $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
    841   $webvar{notes} = $q->escapeHTML($webvar{notes});
    842   $html =~ s|\$\$NOTES\$\$|$webvar{notes}|g;
    843   $html =~ s|\$\$ACTION\$\$|insert|g;
    844 
    845   my $i=1;
     816  $page->param(alloc_type => $webvar{alloctype});
     817  $page->param(typefull => $q->escapeHTML($disp_alloctypes{$webvar{alloctype}}));
     818  $page->param(alloc_from => $alloc_from);
     819  $page->param(cidr => $cidr);
     820  $page->param(city => $q->escapeHTML($webvar{city}));
     821  $page->param(custid => $webvar{custid});
     822  $page->param(circid => $q->escapeHTML($webvar{circid}));
     823  $page->param(desc => $q->escapeHTML($webvar{desc}));
     824
     825##fixme: find a way to have the displayed copy have <br> substitutions
     826# for newlines, and the <input> value have either encoded or bare newlines.
     827# Also applies to privdata.
     828  $page->param(notes => $q->escapeHTML($webvar{notes},'y'));
     829
    846830  # Check to see if user is allowed to do anything with sensitive data
    847831  my $privdata = '';
    848   if ($IPDBacl{$authuser} =~ /s/) {
    849     $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>).
    850         "<td class=regular>".$q->escapeHTML($webvar{privdata}).
    851         qq(<input type=hidden name=privdata value=").$q->escapeHTML($webvar{privdata}).
    852         qq("></td></tr>\n);
    853     $i++;
    854   }
    855 # We're going to abuse $$PRIVDATA$$ to stuff in some stuff for billing.
    856   $privdata .= "<input type=hidden name=billinguser value=$webvar{userid}>\n"
     832  $page->param(privdata => $q->escapeHTML($webvar{privdata},'y'))
     833        if $IPDBacl{$authuser} =~ /s/;
     834
     835  # Yay!  This now has it's very own little home.
     836  $page->param(billinguser => $webvar{userid})
    857837        if $webvar{userid};
    858   $html =~ s/\$\$PRIVDATA\$\$/$privdata/g;
    859 
    860   $i = $i % 2;
    861   $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/;
    862 
    863   print $html;
     838
     839##fixme:  this is only needed iff confirm.tmpl/confirm.html and
     840# confirmRemove.html/confirmRemove.tmpl are merged (quite possible, just
     841# a little tedious)
     842  $page->param(action => "insert");
    864843
    865844} # end confirmAssign
  • branches/htmlform/ipdb.css

    r456 r461  
    138138}
    139139
     140td {
     141        padding-right: 2px;
     142        padding-left: 2px;
     143}
     144
    140145/* Generic classes */
    141146.indent {
Note: See TracChangeset for help on using the changeset viewer.