Changeset 117 for trunk/dns.cgi


Ignore:
Timestamp:
09/01/11 15:55:00 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Add getParents (untested) and isParent (tested) subs
Add some supporting hashes for entity -> parent(entity)

relationships in the database - private to DNSDB.pm

Rename tmp_ruri to uri_self for clarity and reuse
Move uri_self munging from ##common area so that more

subs can use it

Update group tree to change the current group by clicking

the group name. Working comments need to be cleaned up
and choose-a-group dropdown removed from the menu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r114 r117  
    9999my $footer = HTML::Template->new(filename => "$templatedir/footer.tmpl");
    100100
     101## set up "URL to self"
     102# @#$%@%@#% XHTML - & in a URL must be escaped.  >:(
     103my $uri_self = $ENV{REQUEST_URI};
     104$uri_self =~ s/\&([a-z])/\&amp\;$1/g;
     105
     106# le sigh.  and we need to strip any previous action
     107$uri_self =~ s/\&action=[^&]+//g;
     108
     109# and search filter options.  these get stored in the session, but discarded
     110# as soon as you switch to a different page.
     111##fixme:  think about retaining these on a per-page basis, as well as offset;  same as the sort-order bits
     112no warnings qw(uninitialized);
     113$uri_self =~ s/\&startwith=[a-z09-]*(\&)?/$1/g;
     114$uri_self =~ s/\&searchsubs=[a-z09-]*(\&)?/$1/g;
     115$uri_self =~ s/\&filter=[a-z09-]*(\&)?/$1/g;
     116use warnings qw(uninitialized);
     117
    101118# default
    102119#my $perpage = 15;
     
    160177    # fiddle session-stored group data
    161178    # magic incantation to... uhhh...
     179
     180    # ... and the "change group" bits...
     181    $uri_self =~ s/\&group=[^&]*//g;
     182
    162183    $session->param('curgroup', $webvar{group});
    163184    $curgroup = ($webvar{group} ? $webvar{group} : $session->param('curgroup'));
     
    12121233  $page->param(groupname => groupName($dbh,$curgroup));
    12131234  $page->param(logingrp => groupName($dbh,$logingroup));
     1235  $page->param(logingrp_num => $logingroup);
    12141236
    12151237  $page->param(mayimport => $permissions{admin} || $permissions{domain_create});
     
    12251247  fill_grouplist("grouplist");
    12261248
    1227 ## set up "URL to self"
    1228 # @#$%@%@#% XHTML - & in a URL must be escaped.  >:(
    1229   my $tmp_ruri = $ENV{REQUEST_URI};
    1230   $tmp_ruri =~ s/\&([a-z])/\&amp\;$1/g;
    1231 
    1232 # le sigh.  and we need to strip any previous action
    1233   $tmp_ruri =~ s/\&action=[^&]+//g;
    1234 
    1235 # and search filter options.  these get stored in the session, but discarded
    1236 # as soon as you switch to a different page.
    1237 ##fixme:  think about retaining these on a per-page basis, as well as offset;  same as the sort-order bits
    1238   no warnings qw(uninitialized);
    1239   $tmp_ruri =~ s/\&startwith=[a-z09-]*(\&)?/$1/g;
    1240   $tmp_ruri =~ s/\&searchsubs=[a-z09-]*(\&)?/$1/g;
    1241   $tmp_ruri =~ s/\&filter=[a-z09-]*(\&)?/$1/g;
    1242   use warnings qw(uninitialized);
    1243 
    12441249# fill in the URL-to-self
    1245   $page->param(whereami => $tmp_ruri);
     1250  $page->param(whereami => $uri_self);
    12461251}
    12471252
     
    12921297    my %row;
    12931298    $row{grpname} = groupName($dbh,$_);
     1299    $row{grpnum} = $_;
     1300    $row{whereami} = $uri_self;
    12941301        # for all that HTML::Template is supposed to keep the HTML out of the Perl, this is so much more compact...
    1295     $row{grpdisp} = ($_ == $cur ? "<b>$row{grpname}</b>" : $row{grpname});
     1302#    $row{grpdisp} = ($_ == $cur ? "<b>$row{grpname}</b>" : $row{grpname});
     1303$row{curgrp} = ($_ == $cur);
     1304$row{expanded} = isParent($dbh, $_, 'group', $cur, 'group');
     1305$row{expanded} = 1 if $_ == $cur;
    12961306    $row{subs} = fill_grptree($_,$cur,$indent.'    ');
    12971307    $row{indent} = $indent;
     
    16911701  my $childlist = join(',',@childgroups);
    16921702
     1703##fixme:  need to reorder list so that we can display a pseudotree in group dropdowns
     1704
    16931705  # weesa gonna discard parent_group_id for now
    16941706  my $sth = $dbh->prepare("SELECT group_id,parent_group_id,group_name FROM groups ".
Note: See TracChangeset for help on using the changeset viewer.