Ignore:
Timestamp:
11/15/11 18:08:14 (12 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Make the fixed web path at least configurable in one place rather
than completely hardcoded across many files.
Update initial database tabledef SQL
Bump version

File:
1 edited

Legend:

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

    r506 r507  
    77# Last update by $Author$
    88###
    9 # Copyright (C) 2004-2010 - Kris Deugau
     9# Copyright (C) 2004-2011 - Kris Deugau
    1010
    1111use strict;             
     
    5050
    5151# Headerize!  Make sure we replace the $$EXTRA0$$ bit as needed.
    52 printHeader('', ($IPDBacl{$authuser} =~ /a/ ?
    53         '<td align=right><a href="/ip/cgi-bin/main.cgi?action=assign">Add new assignment</a>' : ''
     52printHeader('', $IPDB::webpath, ($IPDBacl{$authuser} =~ /a/ ?
     53        '<td align=right><a href="'.$IPDB::webpath.'/cgi-bin/main.cgi?action=assign">Add new assignment</a>' : ''
    5454        ));
    5555
     
    7373  } else {
    7474    open HTML, "<../addmaster.html";
    75     print while <HTML>;
     75    my $html = join('',<HTML>);
     76    close HTML;
     77    $html =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
     78    print $html;
    7679  }
    7780} elsif ($webvar{action} eq 'newmaster') {
     
    136139  my $html = join('',<HTML>);
    137140  close HTML;
     141  $html =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
    138142
    139143  $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
     
    168172
    169173print qq(<div align=right style="position: absolute; right: 30px;">).
    170         qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
     174        qq(<a href="$IPDB::webpath/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
    171175        if $IPDBacl{$authuser} =~ /A/;
    172176
     
    263267  my $count=0;
    264268  foreach my $master (@masterblocks) {
    265     my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=showmaster&block=$master\">$master</a>",
     269    my @row = ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=showmaster&block=$master\">$master</a>",
    266270        $routed{"$master"}, $allocated{"$master"}, $free{"$master"},
    267271        ( ($bigfree{"$master"} eq '') ? ("&lt;NONE&gt;") : ("/".$bigfree{"$master"}) )
     
    274278  print "</table>\n";
    275279  if ($IPDBacl{$authuser} =~ /a/) {
    276     print qq(<a href="/ip/cgi-bin/main.cgi?action=addmaster">Add new master block</a><br><br>\n);
     280    print qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=addmaster">Add new master block</a><br><br>\n);
    277281  }
    278282  print "Note:  Free blocks noted here include both routed and unrouted blocks.\n";
     
    348352    my $count=0;
    349353    foreach my $master (@localmasters) {
    350       my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=showrouted&block=$master\">$master</a>",
     354      my @row = ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=showrouted&block=$master\">$master</a>",
    351355        $routed{"$master"}, $allocated{"$master"},
    352356        $free{"$master"},
     
    363367        qq($master.</div>\n).
    364368        ($IPDBacl{$authuser} =~ /d/ ?
    365                 qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
     369                qq(<form action="$IPDB::webpath/cgi-bin/main.cgi" method=POST>\n).
    366370                qq(<input type=hidden name=action value="delete">\n).
    367371                qq(<input type=hidden name=block value="$master">\n).
     
    437441    # Prefix subblocks with "Sub "
    438442    my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
    439         qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]&reallyblock=1">$data[0]</a>),
     443        qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=edit&block=$data[0]&reallyblock=1">$data[0]</a>),
    440444        $data[1], $disp_alloctypes{$data[2]}, $data[3],
    441445        ($data[4] eq 'y' ? ($ncust == 0 ? 'Yes<small>*</small>' : 'Yes') : 'No'), $data[5]);
    442446    # If the allocation is a pool, allow listing of the IPs in the pool.
    443447    if ($data[2] =~ /^.[pd]$/) {
    444       $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
     448      $row[0] .= ' &nbsp; <a href="$IPDB::webpath/cgi-bin/main.cgi?action=listpool'.
    445449        "&pool=$data[0]\">List IPs</a>";
    446450    }
     
    459463        qq($master.</div></center>\n).
    460464        ($IPDBacl{$authuser} =~ /d/ ?
    461                 qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
     465                qq(<form action="$IPDB::webpath/cgi-bin/main.cgi" method=POST>\n).
    462466                qq(<input type=hidden name=action value="delete">\n).
    463467                qq(<input type=hidden name=block value="$master">\n).
     
    484488    # Include some HairyPerl(TM) to prefix subblocks with "Sub "
    485489    my @row = ((($data[1] ne 'y' && $data[1] ne 'n') ? 'Sub ' : '').
    486         ($IPDBacl{$authuser} =~ /a/ ? qq(<a href="/ip/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>) : $cidr),
     490        ($IPDBacl{$authuser} =~ /a/ ? qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>) : $cidr),
    487491        $cidr->range);
    488492    printRow(\@row, 'color1') if ($count%2 == 0);
     
    540544    #   -> if $data[2] (aka poolips.available) == 'n' then we print the unassign link
    541545    #      else we print a blank space
    542     my @row = ( qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
     546    my @row = ( qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    543547        $data[1],$data[2],$data[3],
    544548        ( (($data[2] eq 'n') && ($IPDBacl{$authuser} =~ /d/)) ?
    545           ("<a href=\"/ip/cgi-bin/main.cgi?action=delete&block=$data[0]&".
     549          ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=delete&block=$data[0]&".
    546550           "alloctype=$data[4]\">Unassign this IP</a>") :
    547551          ("&nbsp;") )
     
    577581    $html =~ s|\$\$MASKBITS\$\$|$block->masklen|;
    578582    my $typelist = '';
     583
     584    $html =~ s|\$\$WEBPATH\$\$|$IPDB::webpath|g;
    579585
    580586    # This is a little dangerous, as it's *theoretically* possible to
     
    607613    $html = join('',<HTML>);
    608614    close HTML;
     615    $html =~ s|\$\$WEBPATH\$\$|$IPDB::webpath|g;
    609616    my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
    610617    foreach my $master (@masterblocks) {
     
    12181225
    12191226  # Link back to browse-routed or list-pool page on "Update complete" page.
    1220   my $backlink = "/ip/cgi-bin/main.cgi?action=";
     1227  my $backlink = "$IPDB::webpath/cgi-bin/main.cgi?action=";
    12211228  my $cblock;   # to contain the CIDR of the container block we're retrieving.
    12221229  my $sql;
     
    14061413sub exitError {
    14071414  my $errStr = $_[0];
    1408   printHeader('','');
     1415  printHeader('', $IPDB::webpath, '');
    14091416  print qq(<center><p class="regular"> $errStr </p>
    14101417<input type="button" value="Back" onclick="history.go(-1)">
Note: See TracChangeset for help on using the changeset viewer.