[Netpass-devel] NetPass/www/htdocs/Admin autohandler,1.10,1.11 netgroups.mhtml,1.1,1.2 user.mhtml,1.
Brought to you by:
jeffmurphy
From: jeff m. <jef...@us...> - 2005-05-04 03:09:54
|
Update of /cvsroot/netpass/NetPass/www/htdocs/Admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11419/www/htdocs/Admin Modified Files: autohandler netgroups.mhtml user.mhtml Log Message: netgroup UI Index: autohandler =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/autohandler,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- autohandler 3 May 2005 16:13:30 -0000 1.10 +++ autohandler 4 May 2005 03:09:45 -0000 1.11 @@ -39,7 +39,7 @@ <a class="sbLinks" href="/Admin/gencfg.mhtml" title="">General</a><br> <a class="sbLinks" href="/Admin/network.mhtml" title="">Network</a><br> <a class="sbLinks" href="/Admin/netgroups.mhtml" title="">Netgroup</a><br> -<a class="sbLinks" href="/Admin/urlfilter.mhtml" title="">URL Filter</a><br> +<!--<a class="sbLinks" href="/Admin/urlfilter.mhtml" title="">URL Filter</a><br>--> <a class="sbLinks" href="/Admin/greset.mhtml" title="">Global Reset</a><br> <a class="sbLinks" href="/Admin/Scan/ids.mhtml" title="">IDS Config</a><br> </DIV> @@ -73,7 +73,8 @@ if ($m->session->{'logged_in'} && ($m->session->{'username'} ne "")); $m->comp('/style/back/end_sidebar', %ARGS) unless $printable; -$m->call_next; +my $LI = $m->comp('/Admin/Login', %ARGS); +$m->call_next if $LI; $m->comp('/style/back/end_content', %ARGS) unless $printable; </%perl> Index: user.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/user.mhtml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- user.mhtml 1 May 2005 05:44:12 -0000 1.21 +++ user.mhtml 4 May 2005 03:09:45 -0000 1.22 @@ -23,7 +23,6 @@ --></script> <%perl> - use Data::Dumper; my $D = 0; # DEBUG ON/OFF @@ -243,6 +242,7 @@ </%perl> <script src="/resources/js/userform.js" type="text/javascript"></script> +<script src="/resources/js/common.js" type="text/javascript"></script> <script language="JavaScript"> DBG_init(); var whoami = "<%$whoami%>"; Index: netgroups.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/netgroups.mhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- netgroups.mhtml 3 May 2005 16:13:30 -0000 1.1 +++ netgroups.mhtml 4 May 2005 03:09:45 -0000 1.2 @@ -13,9 +13,9 @@ RO none </%doc> <%args> - $submit => ''; - $netgroups => ''; - $networks => ''; + $submitButton => ''; + $netgroups => ''; + $networks => ''; </%args> <%perl> return unless $m->comp('/Admin/Login', %ARGS); @@ -38,35 +38,45 @@ my $ng = $np->cfg->getNetgroup($nw); push @$allNetgroups, $ng if ($ng ne "") && (!grep(/^$ng$/, @$allNetgroups)); } - </%perl> <h2> Network Configuration </h2> -% $m->comp('/Admin/LockConfig', 'enableWhenLocked' => 'addNetgroup'); -% my $WH = "-" x 20; +<%perl> +$m->comp('/Admin/LockConfig', 'enableWhenLocked' => [ 'addNetgroup', 'submitButton' ]); +my $WH = "-" x 20; -<script language='JavaScript'>//<!-- -var pageDirty = false; -setWhereAmI('Configuration > Netgroups'); +my $restartnetpass = 0; +my $restartnessus = 0; +my $restarthttpd = 0; -function netgroup_onchange_netgroups() { - var o = document.getElementById("netgroups"); - if (!o) return; - if (o.options[0].selected == true) { //IE - o.options[0].selected == false; - return; +if ($submitButton eq 'Commit Changes') { + foreach my $ak ( keys %ARGS ) { + if ($ak =~ /^(\S+):(\S+)$/) { + my $section = $1; + my $var = $2; + + if ($section eq "policy") { + if ($ARGS{"usedefault:$var"}) { + $np->cfg->removePolicy(-key => $var, + -location => 'group', + -network => $netgroups); + } else { + $np->cfg->policy(-key => $var, -network => $netgroups, + -val => $ARGS{$ak}); + } + } + } } - document.forms[0].submit(); -} -var reservedGroups = new Array; -<%perl> -foreach my $rg ($WH, keys %$reservedGroups) { - print qq{reservedGroups.push('$rg');\n}; + my $rv = $np->cfg->save(-user => $m->session->{'username'}); + if ($rv) { + print "<P class='error'>Failed to save configuration: $rv</P>"; + } else { + print "<P class='error'>Netgroup Configuration Saved.</P>"; + } } </%perl> -//--></script> <form method="post"> <table border=0> @@ -86,13 +96,50 @@ <td style='text-align:center; vertical-align: top;'> <%$q->scrolling_list(-name => 'networks', -id => 'networks', -values => [ $WH, sort @$allNetworks ], -attributes => { $WH => { 'disabled' => 1 } }, - -default => $networks, -size => 15, -multiple => 'false')%><BR> + -default => $networks, -size => 15, -multiple => 'false')%><P> + <input type='submit' name='submitButton' id='submitButton' value='Commit Changes' disabled> </td> </tr> </table> <P> % if ($netgroups) { -% $m->comp('/Admin/TableEditPolicy', %ARGS, 'tableName' => 'Netgroup General Settings for '.$netgroups, 'network' => $netgroups); +% $m->comp('/Admin/TableEditPolicy', %ARGS, 'tableName' => 'Netgroup General Settings for '.$netgroups, 'network' => $netgroups, 'suppressKeys' => { 'PID_DIR' => 1, 'BASE_DIR' => 1 } ); % } - </form> + +<script language='JavaScript'> +var pageDirty = false; +setWhereAmI('Configuration > Netgroups'); +var reservedGroups = new Array; +<%perl> +foreach my $rg ($WH, keys %$reservedGroups) { + print qq{reservedGroups.push('$rg');\n}; +} +</%perl> +</script> +<script src="/resources/js/common.js" type="text/javascript"></script> +<script src="/resources/js/netgroups.js" type="text/javascript"></script> + + +<%perl> +my $lstat = $np->db->isConfigLocked(); + +if (ref($lstat) eq "HASH") { + # the config is locked + if ($lstat->{'user'} eq $m->session->{'username'}) { + # by us, so show the unlock button + print qq{<script>lockConfig_results("OK lock");lockConfig_enableElements();</script>}; + } else { + # but not by us, show the force unlock button + print qq{<script>lockConfig_results("NOK lock $lstat->{'user'}");lockConfig_disableElements();</script>}; + } +} +elsif ($lstat) { + # there was a problem +} +else { + # the config is not locked, show the lock button + print qq{<script>lockConfig_results("OK unlock");lockConfig_disableElements();</script>}; +} + +</%perl> |