MT#3925 Add more field descriptions to forms.

agranig/pbxapi
Andreas Granig 11 years ago
parent c799df3ebd
commit 2c49abb49e

@ -20,7 +20,7 @@ class_has 'api_description' => (
is => 'ro',
isa => 'Str',
default =>
'Specifies certain settings (preferences) for a <a href="#domains">Domain</a>. The full list of settings can be obtained via <a href="/api/domainpreferencedefs/">DomainPreferenceDefs</a>.'
'Specifies certain properties (preferences) for a <a href="#domains">Domain</a>. The full list of properties can be obtained via <a href="/api/domainpreferencedefs/">DomainPreferenceDefs</a>.'
);
with 'NGCP::Panel::Role::API';
@ -63,9 +63,8 @@ sub GET :Allow {
rows => $rows,
});
my (@embedded, @links);
my $form = $self->get_form($c);
for my $domain ($domains->search({}, {order_by => {-asc => 'me.id'}})->all) {
push @embedded, $self->hal_from_item($c, $domain, $form);
push @embedded, $self->hal_from_item($c, $domain);
push @links, Data::HAL::Link->new(
relation => 'ngcp:'.$self->resource_name,
href => sprintf('%s%d', $self->dispatch_path, $domain->id),

@ -60,7 +60,7 @@ sub GET : Allow {
$c->stash->{collections}->{$rel} = {
name => $mod,
description => $full_mod->api_description,
fields => $self->get_collection_properties($form),
fields => $form ? $self->get_collection_properties($form) : [],
};
}

@ -6,6 +6,10 @@ extends 'NGCP::Panel::Form::BillingProfile::Reseller';
has_field 'reseller' => (
type => '+NGCP::Panel::Field::Reseller',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The reseller id this profile belongs to.']
},
);
has_block 'fields' => (

@ -21,7 +21,7 @@ has_field 'name' => (
maxlength => 31,
element_attr => {
rel => ['tooltip'],
title => ['human readable profile name']
title => ['A human readable profile name.']
},
);
@ -30,20 +30,24 @@ has_field 'handle' => (
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['unique identifier string (only alphanumeric chars)']
title => ['A unique identifier string (only alphanumeric chars and _).']
},
);
has_field 'prepaid' => (
type => 'Boolean',
default => 0,
element_attr => {
rel => ['tooltip'],
title => ['Whether customers using this profile are handled prepaid.']
},
);
has_field 'interval_charge' => (
type => 'Money',
element_attr => {
rel => ['tooltip'],
title => ['base fee charged per billing interval, float, specifying Euro']
title => ['The base fee charged per billing interval (a monthly fixed fee, e.g. 10) in Euro/Dollars/etc. This fee can be used on the invoice.']
},
default => '0',
);
@ -52,7 +56,7 @@ has_field 'interval_free_time' => (
type => 'Integer',
element_attr => {
rel => ['tooltip'],
title => ['included time per billing interval, integer, specifying seconds']
title => ['The included free minutes per billing interval (in seconds, e.g. 60000 for 1000 free minutes).']
},
default => '0',
);
@ -61,7 +65,7 @@ has_field 'interval_free_cash' => (
type => 'Money',
element_attr => {
rel => ['tooltip'],
title => ['included money per billing interval, float, specifying EUR, USD, etc.']
title => ['The included free money per billing interval (in Euro, Dollars etc., e.g. 10).']
},
default => '0',
);
@ -71,7 +75,7 @@ has_field 'fraud_interval_limit' => (
label => 'Fraud Monthly Limit',
element_attr => {
rel => ['tooltip'],
title => ['fraud detection threshold per month, specifying cents']
title => ['The fraud detection threshold per month (in cents, e.g. 10000).']
},
);
@ -87,7 +91,7 @@ has_field 'fraud_interval_lock' => (
],
element_attr => {
rel => ['tooltip'],
title => ['lock accounts if the monthly limit is exceeded']
title => ['Options to lock customer if the monthly limit is exceeded.']
},
);
@ -97,7 +101,7 @@ has_field 'fraud_interval_notify' => (
maxlength => 255,
element_attr => {
rel => ['tooltip'],
title => ['where e-mail notifications are sent, a list of e-mail addreses separated by comma']
title => ['Comma-Separated list of Email addresses to send notifications when tresholds are exceeded.']
},
);
@ -105,7 +109,7 @@ has_field 'fraud_daily_limit' => (
type => 'Integer',
element_attr => {
rel => ['tooltip'],
title => ['fraud detection threshold per day, specifying cents']
title => ['The fraud detection threshold per day (in cents, e.g. 1000).']
},
required => 0,
default => undef,
@ -122,7 +126,7 @@ has_field 'fraud_daily_lock' => (
],
element_attr => {
rel => ['tooltip'],
title => ['lock accounts if the daily limit is exceeded']
title => ['Options to lock customer if the daily limit is exceeded.']
},
);
@ -131,7 +135,7 @@ has_field 'fraud_daily_notify' => (
maxlength => 255,
element_attr => {
rel => ['tooltip'],
title => ['where e-mail notifications are sent, a list of e-mail addreses separated by comma']
title => ['Comma-Separated list of Email addresses to send notifications when tresholds are exceeded.']
},
);
@ -140,7 +144,7 @@ has_field 'currency' => (
maxlength => 31,
element_attr => {
rel => ['tooltip'],
title => ['currency symbol or ISO code, string, will be used on invoices and webinterfaces']
title => ['The currency symbol or ISO code, used on invoices and webinterfaces.']
},
);
@ -151,7 +155,7 @@ has_field 'vat_rate' => (
range_end => 100,
element_attr => {
rel => ['tooltip'],
title => ['integer, specifying the percentage']
title => ['The VAT rate in percentage (e.g. 20).']
},
);
@ -160,7 +164,7 @@ has_field 'vat_included' => (
label => 'VAT Included',
element_attr => {
rel => ['tooltip'],
title => ['check if fees are inclusive VAT']
title => ['Whether the fees already incluside VAT.']
},
default => 0,
);

@ -21,7 +21,7 @@ has_field 'zone' => (
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['string, e.g.: on-net']
title => ['A short name for the zone (e.g. US).']
},
);
@ -30,7 +30,7 @@ has_field 'detail' => (
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['string, e.g.: voicebox']
title => ['The detailed name for the zone (e.g. US Mobile Numbers).']
},
);

@ -7,6 +7,10 @@ use Moose::Util::TypeConstraints;
has_field 'reseller' => (
type => '+NGCP::Panel::Field::Reseller',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The reseller id this contact belongs to.']
},
);
has_block 'fields' => (

@ -15,50 +15,86 @@ has_field 'firstname' => (
type => 'Text',
label => 'First Name',
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['The given name of the contact.']
},
);
has_field 'lastname' => (
type => 'Text',
label => 'Last Name',
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['The surname of the contact.']
},
);
has_field 'company' => (
type => 'Text',
label => 'Company',
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['The company name of the contact.']
},
);
has_field 'email' => (
type => 'Email',
required => 1,
maxlength => 255,
element_attr => {
rel => ['tooltip'],
title => ['The email address of the contact.']
},
);
has_field 'street' => (
type => 'Text',
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['The street name of the contact.']
},
);
has_field 'postcode' => (
type => 'Text',
maxlength => 16,
element_attr => {
rel => ['tooltip'],
title => ['The postal code of the contact.']
},
);
has_field 'city' => (
type => 'Text',
maxlength => 127,
element_attr => {
rel => ['tooltip'],
title => ['The city name of the contact.']
},
);
has_field 'country' => (
type => 'Text',
maxlength => 2,
element_attr => {
rel => ['tooltip'],
title => ['The two-letter ISO 3166-1 country code of the contact (e.g. US or DE).']
},
);
has_field 'phonenumber' => (
type => 'Text',
maxlength => 31,
label => 'Phone Number',
element_attr => {
rel => ['tooltip'],
title => ['The phone number of the contact.']
},
);
has_field 'save' => (

@ -15,11 +15,19 @@ has_field 'contact' => (
type => '+NGCP::Panel::Field::Contact',
label => 'Contact',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The contact id this contract belongs to.']
},
);
has_field 'billing_profile' => (
type => '+NGCP::Panel::Field::BillingProfile',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The billing profile id used to charge this contract.']
},
);
has_field 'status' => (
@ -32,12 +40,20 @@ has_field 'status' => (
{ label => 'locked', value => 'locked' },
{ label => 'terminated', value => 'terminated' },
],
element_attr => {
rel => ['tooltip'],
title => ['The status of the contract.']
},
);
has_field 'external_id' => (
type => 'Text',
label => 'External #',
required => 0,
element_attr => {
rel => ['tooltip'],
title => ['An external id, e.g. provided by a 3rd party provisioning']
},
);
has_field 'save' => (

@ -15,17 +15,29 @@ has_field 'contract' => (
type => '+NGCP::Panel::Field::ResellerContract',
label => 'Contract',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The contract used for this reseller.']
},
);
has_field 'name' => (
type => 'Text',
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['The name of the reseller.']
},
);
has_field 'status' => (
type => '+NGCP::Panel::Field::ResellerStatusSelect',
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['The status of the reseller.']
},
);
has_field 'save' => (

@ -20,6 +20,10 @@ has_field 'contract' => (
type => '+NGCP::Panel::Field::CustomerContract',
label => 'Customer',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The contract used for this subscriber.']
},
);
has_field 'webusername' => (
@ -28,7 +32,7 @@ has_field 'webusername' => (
required => 0,
element_attr => {
rel => ['tooltip'],
title => ['The username to log into the CSC Panel']
title => ['The username to log into the CSC Panel.']
},
);
@ -39,7 +43,7 @@ has_field 'webpassword' => (
minlength => 6,
element_attr => {
rel => ['tooltip'],
title => ['The password to log into the CSC Panel']
title => ['The password to log into the CSC Panel.']
},
);
@ -50,6 +54,10 @@ has_field 'e164' => (
label => 'E164 Number',
do_label => 1,
do_wrapper => 1,
element_attr => {
rel => ['tooltip'],
title => ['The main E.164 number used for inbound and outbound calls.']
},
);
has_field 'username' => (
@ -59,7 +67,7 @@ has_field 'username' => (
noupdate => 1,
element_attr => {
rel => ['tooltip'],
title => ['The SIP username for the User-Agents']
title => ['The username for SIP and XMPP services.']
},
);
@ -67,6 +75,10 @@ has_field 'domain' => (
type => '+NGCP::Panel::Field::Domain',
label => 'SIP Domain',
validate_when_empty => 1,
element_attr => {
rel => ['tooltip'],
title => ['The domain name or domain id this subscriber belongs to.']
},
);
has_field 'password' => (
@ -76,13 +88,17 @@ has_field 'password' => (
minlength => 6,
element_attr => {
rel => ['tooltip'],
title => ['The SIP password for the User-Agents']
title => ['The password to authenticate for SIP and XMPP services.']
},
);
has_field 'status' => (
type => '+NGCP::Panel::Field::SubscriberStatusSelect',
label => 'Status',
element_attr => {
rel => ['tooltip'],
title => ['The status of the subscriber.']
},
);
has_field 'administrative' => (
@ -91,7 +107,7 @@ has_field 'administrative' => (
required => 0,
element_attr => {
rel => ['tooltip'],
title => ['Subscriber can configure other subscribers within the Customer Account']
title => ['Whether the subscriber can configure other subscribers within his Customer account.']
},
);
@ -102,7 +118,7 @@ has_field 'external_id' => (
required => 0,
element_attr => {
rel => ['tooltip'],
title => ['An external id, e.g. provided by a 3rd party provisioning']
title => ['An external id, e.g. provided by a 3rd party provisioning.']
},
);

@ -9,6 +9,10 @@ sub build_form_element_class {[qw(form-horizontal)]}
has_field 'display_name' => (
type => 'Text',
label => 'Display Name',
element_attr => {
rel => ['tooltip'],
title => ['The person\'s name, which is then used in XMPP contact lists or auto-provisioned phones, and which can be used as network-provided display name in SIP calls.']
},
);
has_field 'alias_numbers' => (
@ -20,22 +24,38 @@ has_field 'alias_numbers' => (
controls_div => 1,
},
wrapper_class => [qw/hfh-rep/],
element_attr => {
rel => ['tooltip'],
title => ['Additional E.164 numbers mapped to this subscriber for inbound calls.']
},
);
has_field 'lock' => (
type => '+NGCP::Panel::Field::SubscriberLockSelect',
label => 'Lock Level',
element_attr => {
rel => ['tooltip'],
title => ['The lock level of the subscriber.']
},
);
has_field 'is_pbx_group' => (
type => 'Boolean',
label => 'Is PBX Group?',
default => 0,
element_attr => {
rel => ['tooltip'],
title => ['Whether this subscriber is used as PBX group.']
},
);
has_field 'pbx_group' => (
type => '+NGCP::Panel::Field::SubscriberPbxGroup',
label => 'PBX Group',
element_attr => {
rel => ['tooltip'],
title => ['The PBX group id this subscriber belongs to.']
},
);
has_field 'save' => (

@ -8,10 +8,15 @@ use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Form::Contact::Admin;
use NGCP::Panel::Form::Contact::Reseller;
sub get_form {
my ($self, $c) = @_;
return NGCP::Panel::Form::Contact::Admin->new;
if($c->user->roles eq "admin") {
return NGCP::Panel::Form::Contact::Admin->new;
} elsif($c->user->roles eq "reseller") {
return NGCP::Panel::Form::Contact::Reseller->new;
}
}
sub hal_from_contact {

@ -13,16 +13,11 @@ use NGCP::Panel::Utils::Prosody;
sub get_form {
my ($self, $c) = @_;
if($c->user->roles eq "admin") {
return NGCP::Panel::Form::Domain::Admin->new;
} elsif($c->user->roles eq "reseller") {
return NGCP::Panel::Form::Domain::Reseller->new;
}
return;
}
sub hal_from_item {
my ($self, $c, $item, $form) = @_;
my ($self, $c, $item) = @_;
my $hal = Data::HAL->new(
links => [

@ -14,11 +14,15 @@
<h[% level + 1 %]>Properties</h[% level + 1%]>
[% UNLESS col.fields.size -%]
See description how to obtain properties, if any.
[% ELSE -%]
<ul id="[% id %]-props">
[% FOREACH f IN col.fields -%]
<li><b>[% f.name %] </b>(<i>[% f.types.join(', ') %]</i>): [% f.description %]</li>
[% END -%]
</ul>
[% END -%]
<h[% level + 1 %]>Examples</h[% level + 1 %]>
<div class="examples">
@ -307,7 +311,7 @@ Preference-Applied: return=minimal';
-%]
</p>
<h[% level + 2 %]>Update specific fields of an existing <i>systemcontacts</i> entry</h[% level + 2 %]>
<h[% level + 2 %]>Update specific fields of an existing <i>systemcontacts</i> item</h[% level + 2 %]>
<p>
[%
props = ''; rem = 0; rep = 0;

Loading…
Cancel
Save