From: ivan Date: Sun, 17 Oct 2010 22:35:58 +0000 (+0000) Subject: dns editing improvements: show an error from adding default records, redirect back... X-Git-Tag: TORRUS_1_0_9~215 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=f3b1e139720b2262516ee3690b1d4b2b9941b500;hp=9a98d39e3ce40c1f2c324991e8ad469271093fb5 dns editing improvements: show an error from adding default records, redirect back to the dns section on all operations, finish editing. RT#8933 --- diff --git a/httemplate/edit/domain_record.html b/httemplate/edit/domain_record.html new file mode 100644 index 000000000..3ea6c77da --- /dev/null +++ b/httemplate/edit/domain_record.html @@ -0,0 +1,53 @@ +<% include('/elements/header-popup.html', 'Edit nameservice record') %> + +<% include('/elements/error.html') %> + +
+ + + +<% ntable("#cccccc", 2) %> + + + + +
+ Zone + + + +
+ Type + + + +
+ Data + + + +
+ TTL + + + + +
+ + +
+ +<%init> + +my %opt = @_; + +my $domain_record = qsearchs('domain_record', { 'recnum' => $opt{'recnum'} } ) + or die "unknown recnum"; + + diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index ff0f2d414..8369f7114 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -1,8 +1,14 @@ %if ( $error ) { % errorpage($error); -%} else { +%} elsif ( $recnum ) { #editing +<% header('Nameservice record changed') %> + + +%} else { #adding % my $svcnum = $new->svcnum; -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> %} <%init> @@ -21,10 +27,11 @@ my $new = new FS::domain_record ( { my $error; if ( $recnum ) { - $error=$new->replace($old); + $new->svcnum( $old->svcnum ); + $error = $new->replace($old); } else { - $error=$new->insert; - $recnum=$new->getfield('recnum'); + $error = $new->insert; + #$recnum = $new->getfield('recnum'); } diff --git a/httemplate/edit/process/svc_domain-defaultrecords.cgi b/httemplate/edit/process/svc_domain-defaultrecords.cgi index feb58406c..ec3d221f3 100644 --- a/httemplate/edit/process/svc_domain-defaultrecords.cgi +++ b/httemplate/edit/process/svc_domain-defaultrecords.cgi @@ -1,4 +1,8 @@ -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> +% } <%init> die "access denied" diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index 49b624c84..fbb6ce3b8 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -11,7 +11,7 @@ Example: 'label' => 'click me', # text of tag #strongly recommended - 'actionlabel => 'You clicked', # popup title + 'actionlabel' => 'You clicked', # popup title #opt 'width' => 540, diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi index 08eedde5f..200365d2f 100755 --- a/httemplate/misc/delete-domain_record.cgi +++ b/httemplate/misc/delete-domain_record.cgi @@ -1,7 +1,7 @@ % if ( $error ) { % errorpage($error); % } else { -<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum) %> +<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum. '#dns') %> % } <%init> diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html index 82cab068a..184286c31 100644 --- a/httemplate/view/svc_domain/dns.html +++ b/httemplate/view/svc_domain/dns.html @@ -7,28 +7,30 @@ return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?"); } +<% include('/elements/init_overlib.html') %> +
DNS Records
-% my @records; if ( @records = $svc_domain->domain_record ) { - - <% include('/elements/table-grid.html') %> +<% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = $bgcolor2; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; Zone Type Data TTL + +% my @records = $svc_domain->domain_record; % foreach my $domain_record ( @records ) { % my $type = $domain_record->rectype eq '_mstr' % ? "(slave)" @@ -45,9 +47,20 @@ % unless ( $domain_record->rectype eq 'SOA' % || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') % ) { +% my $edit_link = include('/elements/popup_link.html', +% 'label' => 'edit', +% 'action' => $p.'edit/domain_record.html?recnum='. +% $domain_record->recnum, +% 'actionlabel' => 'Edit nameservice record', +% 'width' => 655, +% 'height' => 176, +% #'color' => '#ff0000', +% ); % ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g; - (edit) - (delete) +% my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?". +% $domain_record->recnum. "', 'Delete ". +% $domain_record->reczone. " $type $recdata ?' )"; + <%$edit_link%> | delete % } @@ -61,50 +74,48 @@ % } - -% } else { +% if ( ! @records ) {
+ + + +
% } % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { -
- - - - - - + + - - - - -
-
- Zone -
- IN - + +
+
+ Zone +
+
Type -
-
- Data -
-
- TTL -
- -
+ + +
+ Data + + +
+ TTL + + + + +

@@ -122,9 +133,12 @@ +

% } + +
<%init>