- Timestamp:
- 12/03/09 17:59:06 (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r39 r41 74 74 75 75 # NB: these must match the field name and SQL ascend/descend syntax respectively 76 my $sort field = "domains";77 my $sortorder = " asc";76 my $sortby = "domain"; 77 my $sortorder = "ASC"; 78 78 79 79 my ($dbh,$msg) = connectDB("dnsdb","dnsdb","secret","dbhost"); … … 663 663 # le sigh. and we need to strip any previous action 664 664 $tmp_ruri =~ s/\&action=[^&]+//g; 665 # and any bits from the "starts with" letter block - (ab)using this widget 666 # to fill the bulk of the URI so the template doesn't grow to insanity 667 $tmp_ruri =~ s/\&startwith=[a-z09-]+//g; 665 668 # $page->param(whereami => $ENV{REQUEST_URI}); 666 669 $page->param(whereami => $tmp_ruri); … … 860 863 ##fixme 861 864 if ($offset eq 'all') { 862 push @debugbits, "foo! wanna see'em all\n"; 865 # uhm.... 863 866 } else { 864 867 # all these bits only have sensible behaviour if offset is numeric. err, probably. … … 901 904 902 905 sub listdomains { 906 907 ##fixme: account for searches and starts-with filters 903 908 my $sth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?"); 904 909 $sth->execute($curgroup); … … 910 915 fill_fpnla($count); 911 916 912 ##fixme - group 917 # sort/order 918 $sortby= $webvar{sortby} if $webvar{sortby}; 919 $sortorder = $webvar{order} if $webvar{order}; 920 921 if ($sortby eq 'domain') { 922 $page->param(domorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC')); 923 $page->param(statorder => 'ASC'); 924 $page->param(grporder => 'ASC'); 925 $page->param(sortdomain => 1); 926 } elsif ($sortby eq 'status') { 927 $page->param(domorder => 'ASC'); 928 $page->param(statorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC')); 929 $page->param(grporder => 'ASC'); 930 $page->param(sortstatus => 1); 931 } elsif ($sortby eq 'group') { 932 $page->param(domorder => 'ASC'); 933 $page->param(statorder => 'ASC'); 934 $page->param(grporder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC')); 935 $page->param(sortgroup => 1); 936 } else { 937 $page->param(domorder => 'ASC'); 938 $page->param(statorder => 'ASC'); 939 $page->param(grporder => 'ASC'); 940 } 941 942 $page->param(sortorder => $sortorder); 943 # hack! hack! pthbttt. have to rethink the status column storage, 944 # or inactive comes "before" active. *sigh* 945 $sortorder = ($sortorder eq 'ASC' ? 'DESC' : 'ASC') if $sortby eq 'status'; 946 947 $page->param("start$webvar{startwith}" => 1) if $webvar{startwith} && $webvar{startwith} =~ /^[a-z]$/; 948 949 $page->param(filter => $webvar{filter}) if $webvar{filter}; 950 951 ##fixme 952 ##fixme push the SQL and direct database fiddling off into a sub in DNSDB.pm 953 ##fixme 954 913 955 $page->param(group => $curgroup); 914 956 my @domlist; 915 $sth = $dbh->prepare("SELECT domain_id,domain,status,groups.group_nameFROM domains".957 my $sql = "SELECT domain_id,domain,status,groups.group_name AS group FROM domains". 916 958 " INNER JOIN groups ON domains.group_id=groups.group_id". 917 959 " WHERE domains.group_id=?". 918 " ORDER BY domain".($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage)); 960 ##fixme: don't do variable subs in SQL, use placeholders and params in ->execute() 961 (defined($webvar{startwith}) ? " AND domain ~* '^[$webvar{startwith}]'" : ''). 962 (defined($webvar{filter}) ? " AND domain ~* '$webvar{filter}'" : ''). 963 " ORDER BY ".($sortby eq 'group' ? 'groups.group_name' : $sortby). 964 " $sortorder ".($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage); 965 $sth = $dbh->prepare($sql); 919 966 $sth->execute($curgroup); 920 967 my $rownum = 0; … … 1029 1076 my $rownum = 0; 1030 1077 while (my @data = $sth->fetchrow_array) { 1078 no warnings "uninitialized"; # Just In Case something stupid happens and a user gets no first or last name 1031 1079 my %row; 1032 1080 $row{userid} = $data[0]; -
trunk/templates/dns.css
r39 r41 115 115 background-color: #e0e0e0; 116 116 } 117 td.leftthird { 118 width: 36%; 119 text-align: left; 120 } 121 td.rightthird { 122 width: 36%; 123 text-align: right; 124 } 117 125 118 126 .meat { … … 126 134 margin-left: 10px; 127 135 padding: 0px; 128 list-style-type:none; 129 } 130 136 } 137 /* F*** ME BUT THIS LOOKS LIKE CRAP! */ 138 /* Need to find a way to vertically centre the plus image on the text. >:( */ 139 li.hassub { 140 list-style: none outside url('../images/plus.gif'); 141 } 142 li.leaf { 143 list-style: none outside none; 144 } 145 #grptree { 146 margin-left: 15px; 147 } 131 148 /* general classes */ 132 149 .errmsg { … … 190 207 } 191 208 /* somewhat generic/reusable */ 192 # borderme{193 border: thin solid #666666;209 #datatablewrapper { 210 border: none; 194 211 width: 98%; 195 float:left;196 clear:left;197 } 212 margin-left: 1%; 213 margin:right: 1%; 214 } -
trunk/templates/domlist.tmpl
r40 r41 9 9 </TMPL_IF> 10 10 11 <div id=" borderme">11 <div id="datatablewrapper"> 12 12 13 13 <table width="98%"> 14 14 <tr><th colspan="3" align="center">Domain list</th></tr> 15 <tr> <td align="left"><TMPL_INCLUDE NAME="pgcount.tmpl"></td>16 <td align="center">17 < TMPL_INCLUDE NAME="fpnla.tmpl">18 < /td><td align="right">insert search box here</td></tr>19 15 <tr> 16 <td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td> 17 <td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td> 18 <td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td> 19 </tr> 20 20 <tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr> 21 22 21 <tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newdomain">New Domain</a></td></tr> 23 22 </table> … … 42 41 </TMPL_LOOP> 43 42 <TMPL_ELSE> 44 <tr><td colspan="5" >No domains found</td></tr>43 <tr><td colspan="5" align="center">No domains found</td></tr> 45 44 </TMPL_IF> 46 45 </table> -
trunk/templates/grpman.tmpl
r40 r41 9 9 </TMPL_IF> 10 10 11 <div id=" borderme">11 <div id="datatablewrapper"> 12 12 13 13 <table width="98%"> 14 <tr><t d colspan="3" align="center"><span class="pgtitle">Manage groups</span></td></tr>15 <tr> <td><TMPL_INCLUDE NAME="pgcount.tmpl"></td>16 <td >17 < TMPL_INCLUDE NAME="fpnla.tmpl">18 < /td><td align="right">insert search box here</td></tr>19 14 <tr><th colspan="3" align="center">Manage groups</th></tr> 15 <tr> 16 <td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td> 17 <td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td> 18 <td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td> 19 </tr> 20 20 <tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr> 21 22 21 <tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newgrp">New Group</a></td></tr> 23 22 </table> 24 23 25 <table border="0" cellspacing="5" cellpadding="3">24 <table width="98%" border="0" cellspacing="4" cellpadding="3"> 26 25 <tr> 27 <TMPL_IF NAME=foobarbaz> 28 <!-- This block to be un-TMPL_IF'ed once we care about sort order - by default, we sort by domain, ascending --> 29 <td class="underline"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Domain<TMPL_IF NAME=sortdomain> <img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td> 30 <td class="underline"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Status<TMPL_IF NAME=sortstatus> <img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td> 31 <td class="underline" align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Group<TMPL_IF NAME=sortgroup> <img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td> <TMPL_ELSE> 32 <td class="underline">Group</td> 33 <td class="underline">Parent Group</td> 34 <td class="underline">Users</td> 35 <td class="underline" align="center">Domains</td> 36 </TMPL_IF> 37 <td class="underline">Delete</td> 26 <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=group&order=<TMPL_VAR NAME=grporder>">Domain</a><TMPL_IF NAME=sortgrp> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 27 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=parent&order=<TMPL_VAR NAME=parentorder>">Parent Group</a><TMPL_IF NAME=sortparent> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 28 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=nusers&order=<TMPL_VAR NAME=nusersorder>">Users</a><TMPL_IF NAME=sortnusers> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 29 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=ndomains&order=<TMPL_VAR NAME=ndomainsorder>">Domains</a><TMPL_IF NAME=sortndomains> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 30 <td class="datahead_s">Delete</td> 38 31 </tr> 39 32 <TMPL_IF name=grouptable> … … 48 41 </TMPL_LOOP> 49 42 <TMPL_ELSE> 50 <tr><td colspan="5" >No groups found</td></tr>43 <tr><td colspan="5" align="center">No groups found</td></tr> 51 44 </TMPL_IF> 52 45 </table> -
trunk/templates/grptree.tmpl
r24 r41 1 1 <ul> 2 <TMPL_LOOP NAME=treelvl><li <TMPL_IF NAME=subs> class="hassub"</TMPL_IF>><TMPL_VAR NAME=grpname>2 <TMPL_LOOP NAME=treelvl><li class="<TMPL_IF NAME=subs>hassub<TMPL_ELSE>leaf</TMPL_IF>"><TMPL_VAR NAME=grpname> 3 3 <TMPL_VAR NAME=subs></li> 4 4 </TMPL_LOOP></ul> -
trunk/templates/menu.tmpl
r38 r41 22 22 <hr /> 23 23 <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman">Manage groups</a><br /> 24 < TMPL_VAR NAME=grptree>24 <div id="grptree"><TMPL_VAR NAME=grptree></div> 25 25 <!-- hmm: <TMPL_VAR NAME=groupname> --> 26 26 <hr /> -
trunk/templates/useradmin.tmpl
r40 r41 9 9 </TMPL_IF> 10 10 11 <div id=" borderme">11 <div id="datatablewrapper"> 12 12 13 13 <table width="98%"> 14 <tr><t d colspan="3" align="center"><span class="pgtitle">Manage users</span></td></tr>15 <tr> <td><TMPL_INCLUDE NAME="pgcount.tmpl"></td>16 <td >17 < TMPL_INCLUDE NAME="fpnla.tmpl">18 < /td><td align="right">insert search box here</td></tr>19 14 <tr><th colspan="3" align="center">Manage users</th></tr> 15 <tr> 16 <td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td> 17 <td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td> 18 <td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td> 19 </tr> 20 20 <tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr> 21 22 21 <tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newuser">New User</a></td></tr> 23 22 </table> 24 23 25 <table border="0" cellspacing="5" cellpadding="3">24 <table width="98%" border="0" cellspacing="4" cellpadding="3"> 26 25 <tr> 27 <TMPL_IF NAME=foobarbaz> 28 <!-- This block to be un-TMPL_IF'ed once we care about sort order - by default, we sort by domain, ascending --> 29 <td class="underline" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Domain<TMPL_IF NAME=sortdomain> <img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td> 30 <td class="underline" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Status<TMPL_IF NAME=sortstatus> <img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td> 31 <td class="underline" align="center" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=<TMPL_VAR NAME=offset>">Group<TMPL_IF NAME=sortuser> <img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td> <TMPL_ELSE> 32 <td>Username</td> 33 <td>Full name</td> 34 <td>Type</td> 35 <td>Group</td> 36 <td>Status</td> 37 </TMPL_IF> 38 <td>Delete</td> 26 <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=username&order=<TMPL_VAR NAME=userorder>">Username</a><TMPL_IF NAME=sortuser> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 27 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=fullname&order=<TMPL_VAR NAME=fnameorder>">Full Name</a><TMPL_IF NAME=sortfname> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 28 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=type&order=<TMPL_VAR NAME=typeorder>">Type</a><TMPL_IF NAME=sorttype> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 29 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=group&order=<TMPL_VAR NAME=grouporder>">Group</a><TMPL_IF NAME=sortgroup> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 30 <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&</TMPL_IF>sortby=status&order=<TMPL_VAR NAME=statusorder>">Full Name</a><TMPL_IF NAME=sortstatus> <img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td> 31 <td class="datahead_s">Delete</td> 39 32 </tr> 40 33 <TMPL_IF name=usertable> … … 50 43 </TMPL_LOOP> 51 44 <TMPL_ELSE> 52 <tr><td colspan=" 5">No users found</td></tr>45 <tr><td colspan="6">No users found</td></tr> 53 46 </TMPL_IF> 54 47 </table>
Note:
See TracChangeset
for help on using the changeset viewer.