TT#32996 correct "POSIX" re labels to "PCRE"

Change-Id: I310b2e99060b89a0a71d85f2200307ce4a2689bc
changes/48/19148/6
Rene Krenn 7 years ago
parent 6e93a2551d
commit ae937a1429

@ -16,7 +16,7 @@ has_field 'source' => (
maxlength => 255, maxlength => 255,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['A POSIX regular expression to match the calling number (e.g. ^.+$).'] title => ['A PCRE regular expression to match the calling number (e.g. ^.+$).']
}, },
); );
@ -26,7 +26,7 @@ has_field 'destination' => (
required => 1, required => 1,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['A POSIX regular expression to match the called number (e.g. ^431.+$).'] title => ['A PCRE regular expression to match the called number (e.g. ^431.+$).']
}, },
); );

@ -42,7 +42,7 @@ has_field 'pattern' => (
required => 1, required => 1,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['A regular expression the dialed number (CDR \'destination user in\') has to match in case of \'outgoing\' direction, or the inbound number (CDR \'source cli\') in case of \'incoming\' direction.'] title => ['A PCRE regular expression the dialed number (CDR \'destination user in\') has to match in case of \'outgoing\' direction, or the inbound number (CDR \'source cli\') in case of \'incoming\' direction.']
}, },
); );

@ -10,7 +10,7 @@ has_field 'submitid' => ( type => 'Hidden' );
sub build_render_list {[qw/submitid fields actions/]} sub build_render_list {[qw/submitid fields actions/]}
sub build_form_element_class {[qw(form-horizontal)]} sub build_form_element_class {[qw(form-horizontal)]}
has_field 'field' => ( has_field 'field' => (
type => 'Select', type => 'Select',
label => 'Match Field', label => 'Match Field',
options => [ options => [
@ -38,7 +38,7 @@ has_field 'pattern' => (
max_length => 1023, max_length => 1023,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => [q!A POSIX regex matching against the specified field (e.g. '^sip:.+@example\.org$' or '^sip:431') when matching against a full URI!] title => [q!A PCRE regex matching against the specified field (e.g. '^sip:.+@example\.org$' or '^sip:431') when matching against a full URI!]
}, },
); );
@ -109,4 +109,3 @@ sub validate {
} }
1; 1;

@ -10,7 +10,7 @@ has_field 'submitid' => ( type => 'Hidden' );
sub build_render_list {[qw/submitid fields actions/]} sub build_render_list {[qw/submitid fields actions/]}
sub build_form_element_class {[qw(form-horizontal)]} sub build_form_element_class {[qw(form-horizontal)]}
has_field 'callee_prefix' => ( has_field 'callee_prefix' => (
type => 'Text', type => 'Text',
not_nullable => 1, not_nullable => 1,
element_attr => { element_attr => {
@ -24,7 +24,7 @@ has_field 'callee_pattern' => (
type => '+NGCP::Panel::Field::Regexp', type => '+NGCP::Panel::Field::Regexp',
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => [q!A POSIX regex matching against the full Request-URI (e.g. '^sip:.+@example\.org$' or '^sip:431')!] title => [q!A PCRE regex matching against the full Request-URI (e.g. '^sip:.+@example\.org$' or '^sip:431')!]
}, },
); );
@ -32,7 +32,7 @@ has_field 'caller_pattern' => (
type => '+NGCP::Panel::Field::Regexp', type => '+NGCP::Panel::Field::Regexp',
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => [q!A POSIX regex matching against 'sip:user@domain' (e.g. '^sip:.+@example\.org$' matching the whole URI, or '999' matching if the URI contains '999')!] title => [q!A PCRE regex matching against 'sip:user@domain' (e.g. '^sip:.+@example\.org$' matching the whole URI, or '999' matching if the URI contains '999')!]
}, },
); );

@ -17,7 +17,7 @@ has_field 'match_pattern' => (
deflate_value_method => \&deflate_match_pattern, deflate_value_method => \&deflate_match_pattern,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['Match pattern, a regular expression.'], title => ['Match pattern, a PCRE regular expression.'],
}, },
); );
@ -106,7 +106,7 @@ sub deflate_match_pattern {
sub inflate_match_pattern { sub inflate_match_pattern {
my ($self, $value) = @_; my ($self, $value) = @_;
$value =~ s/\$avp\(s\:(\w+)\)/\${$1}/g; $value =~ s/\$avp\(s\:(\w+)\)/\${$1}/g;
$value =~ s/\$\(avp\(s\:(\w+)\)\[\+\]\)/\@{$1}/g; $value =~ s/\$\(avp\(s\:(\w+)\)\[\+\]\)/\@{$1}/g;
return $value; return $value;
@ -121,7 +121,7 @@ sub deflate_replace_pattern {
sub inflate_replace_pattern { sub inflate_replace_pattern {
my ($self, $value) = @_; my ($self, $value) = @_;
$value =~ s/\$avp\(s\:(\w+)\)/\${$1}/g; $value =~ s/\$avp\(s\:(\w+)\)/\${$1}/g;
return $value; return $value;
} }
@ -133,13 +133,13 @@ sub validate {
my $re = "s/$s/$r/"; my $re = "s/$s/$r/";
eval { use warnings FATAL => qw(all); $_ = ''; m/$re/; }; eval { use warnings FATAL => qw(all); $_ = ''; m/$re/; };
if( $@ && $self->field('match_pattern')->num_errors < 1 ) { if( $@ && $self->field('match_pattern')->num_errors < 1 ) {
my $err_msg = 'Match pattern and Replace Pattern do not work together.'; my $err_msg = 'Match pattern and Replace Pattern do not work together.';
$self->field('match_pattern')->add_error($err_msg); $self->field('match_pattern')->add_error($err_msg);
$self->field('replace_pattern')->add_error($err_msg); $self->field('replace_pattern')->add_error($err_msg);
} }
if ( $r =~ m/\$$/ ) { if ( $r =~ m/\$$/ ) {
$self->field('replace_pattern')->add_error('Cannot end with "$"'); $self->field('replace_pattern')->add_error('Cannot end with "$"');
} }

Loading…
Cancel
Save