diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 15 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 20 |
2 files changed, 32 insertions, 3 deletions
diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 2bb4f5e41..a6ccaf867 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -77,6 +77,7 @@ that field. <TH BGCOLOR="#cccccc">Field</TH> <TH BGCOLOR="#cccccc">Label</TH> <TH BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH> + <TH BGCOLOR="#cccccc">Required?</TH> </TR> % $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now % my $i = 0; @@ -210,9 +211,17 @@ that field. &> % } </TD> + <TD> +% if (!$def->{'type'} || !(grep {$_ eq $def->{'type'}} ('checkbox','disabled'))) { + <INPUT ID="<% $name.'_required' %>" TYPE="checkbox" NAME="<% $svcdb %>__<% $field %>_required" VALUE="Y" + <% ($part_svc_column->required || $def->{'required'}) ? 'CHECKED' : '' %> + <% $def->{'required'} ? 'DISABLED' : '' %> + > +% } + </TD> </TR> <TR CLASS="row<%$i%>"> - <TD COLSPAN=2 CLASS="def_info"> + <TD COLSPAN=3 CLASS="def_info"> % if ( $def->{def_info} ) { (<% $def->{def_info} %>) </TD> @@ -228,7 +237,7 @@ that field. <TD COLSPAN=3 ALIGN="right"> <% emt('Require "Provision" access right to edit password') %> </TD> - <TD> + <TD COLSPAN=2> <INPUT TYPE="checkbox" NAME="restrict_edit_password" VALUE="Y" \ <% $part_svc->restrict_edit_password ? 'CHECKED' : '' %>> </TD> @@ -244,7 +253,7 @@ that field. <TD COLSPAN=3 ALIGN="right"> <% emt('This service has an attached router') %> </TD> - <TD> + <TD COLSPAN=2> <INPUT TYPE="checkbox" NAME="has_router" VALUE="Y" \ <% $part_svc->has_router ? 'CHECKED' : '' %>> </TD> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 47b020c5a..7a47f1550 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -101,6 +101,15 @@ function flag_changed(obj) { } } } + var required = document.getElementById(layer + '__' + field + '_required'); + if (required && !required.disabledinit) { + if (newflag == "F") { + required.checked = false; + required.disabled = true; + } else { + required.disabled = false; + } + } } window.onload = function() { @@ -111,6 +120,17 @@ window.onload = function() { obj.setAttribute('should_be_multiple', true); } } + var inputs = document.getElementsByTagName('INPUT'); + for(i = 0; i < inputs.length; i++) { + var obj = inputs[i]; + if (obj.type == 'checkbox') { + if ( obj.name.match(/_required$/) ) { + if ( obj.disabled ) { + obj.disabledinit = 1; + } + } + } + } for(i = 0; i < selects.length; i++) { var obj = selects[i]; if ( obj.name.match(/_flag$/) ) { |