google-nomulus/java/google/registry/ui/soy/registrar/RegistrarCreateConsole.soy
jianglai b12a462f5e Add Google Analytics to registrar console
To support the open source community, which may want to use different analytics services, we implement a soy template for analytics services that:

1) Does not require users to implement Google Analytics
2) Allows users to add their own analytics code to `Analytics.soy`
3) Gives users the flexibility to pass as much or as little static configuration to their custom analytics code as needed.
4) Ensures that users can merge upstream Nomulus code in the future without having to delete their custom analytics implementations
5) Does not allow code to be injected from configuration, which Soy as a framework actively discourages.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=248340081
2019-05-21 11:35:34 -04:00

368 lines
14 KiB
Text

// Copyright 2018 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace registry.soy.registrar.registrarcreate}
/**
* Main page for the registrar creation. Holds a form with the required data.
*/
{template .formPage}
{@param xsrfToken: string} /** Security token. */
{@param username: string} /** Arbitrary username to display. */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param productName: string} /** Name to display for this software product. */
{@param logoFilename: string}
{@param analyticsConfig: [googleAnalyticsId: string|null]}
{@param? errorMessage: string} /** If set - display the error message above the form. */
{@param? clientId: string} /** If set - an initial value for the client ID. */
{@param? name: string} /** If set - an initial value for the Registrar name. */
{@param? billingAccount: string} /** If set - the billing accounts data. */
{@param? ianaId: int} /** If set - an initial value for the IANA ID. */
{@param? referralEmail: string} /** If set - an initial value for the ICANN referral email. */
{@param? driveId: string} /** If set - an initial value for the DRIVE ID. */
{@param? consoleUserEmail: string} /** If set - the user to be given console access. */
{@param? street1: string} /** If set - the first line of the street address. */
{@param? street2: string} /** If set - the second line of the street address. */
{@param? street3: string} /** If set - the third line of the street address. */
{@param? city: string} /** If set - the address city. */
{@param? state: string} /** If set - the state/region of the address. */
{@param? countryCode: string} /** If set - the 2 letter country code. */
{@param? zip: string} /** If set - the zip code of the address. */
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Create Registrar' /}
{param analyticsConfig: $analyticsConfig /}
{/call}
{call registry.soy.console.googlebar data="all" /}
<div id="reg-content-and-footer">
<div id="reg-content">
<h1>Create Registrar</h1>
{if isNonnull($errorMessage)}
<h2 class="{css('kd-errormessage')}">Failed: {$errorMessage}</h2>
{/if}
{call .form_ data="all" /}
</div>
{call registry.soy.console.footer /}
</div>
{/template}
/**
* Result page for a successful registrar creation.
*/
{template .resultSuccess}
{@param clientId: string} /** The clientId of the registrar. */
{@param consoleUserEmail: string} /** The email of the account with web access to the registrar. */
{@param passcode: string} /** The phone passcode for this registrar. */
{@param password: string} /** The password given for the created registrars. */
{@param username: string} /** Arbitrary username to display. */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param productName: string} /** Name to display for this software product. */
{@param logoFilename: string}
{@param analyticsConfig: [googleAnalyticsId: string|null]}
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Create Registrar' /}
{param analyticsConfig: $analyticsConfig /}
{/call}
{call registry.soy.console.googlebar data="all" /}
<div id="reg-content-and-footer">
<div id="reg-content" class="{css('item')} {css('registrar')}">
<h1>Successfully created Registrar {$clientId}</h1>
<table>
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Client ID' /}
{param name: 'clientId' /}
{param value: $clientId /}
{param description kind="text"}
The registrar's Client ID
{/param}
{param readonly: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'EPP password' /}
{param name: 'password' /}
{param value: $password /}
{param description kind="text"}
The password used to for EPP login.
{/param}
{param readonly: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Phone passcode' /}
{param name: 'passcode' /}
{param value: $passcode /}
{param description kind="text"}
Passcode used for phone authentication.
{/param}
{param readonly: true /}
{/call}
<tr>
<td>
<label class="{css('setting-label')}">Registrar credentials</label>
<span class="{css('description')}">Copy and paste this into an email to the registrars</span>
</td>
<td class="{css('setting')}">
<textarea rows="5" cols="30" spellcheck="false" readonly>
Login: {$clientId}{\n}
Password: {$password}{\n}
Phone passcode: {$passcode}{\n}
</textarea>
</td>
</table>
Gave <label>{$consoleUserEmail}</label> web-console access to this registrar.
<h1>You may want to set additional values using the web console:</h1>
<span class="{css('description')}">
<ol type="1">
<li>phone number, email, URL on the {sp}
<a href="/registrar?clientId={$clientId}#whois-settings" target="_blank">WHOIS page</a>
<li>allowed TLDs on the {sp}
<a href="/registrar?clientId={$clientId}#admin-settings" target="_blank">admin page</a>
<li>certificate, IP whitelist on the {sp}
<a href="/registrar?clientId={$clientId}#security-settings" target="_blank">security page</a>
</ol>
</span>
</div>
{call registry.soy.console.footer /}
</div>
{/template}
/** Form for getting registrar info. */
{template .form_ visibility="private"}
{@param xsrfToken: string} /** Security token. */
{@param? clientId: string} /** If set - an initial value for the client ID. */
{@param? name: string} /** If set - an initial value for the Registrar name. */
{@param? billingAccount: string} /** If set - the billing accounts data. */
{@param? ianaId: int} /** If set - an initial value for the IANA ID. */
{@param? referralEmail: string} /** If set - an initial value for the ICANN referral email. */
{@param? driveId: string} /** If set - an initial value for the DRIVE ID. */
{@param? consoleUserEmail: string} /** If set - the user to be given console access. */
{@param? street1: string} /** If set - the first line of the street address. */
{@param? street2: string} /** If set - the second line of the street address. */
{@param? street3: string} /** If set - the third line of the street address. */
{@param? city: string} /** If set - the address city. */
{@param? state: string} /** If set - the state/region of the address. */
{@param? countryCode: string} /** If set - the 2 letter country code. */
{@param? zip: string} /** If set - the zip code of the address. */
<form name="item" class="{css('item')}" method="post" action="/registrar-create">
<table>
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Name' /}
{param name: 'name' /}
{param value: $name /}
{param placeholder: 'required' /}
{param description kind="text"}
Name of the registrar.
{/param}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Client ID' /}
{param name: 'clientId' /}
{param value: $clientId /}
{param placeholder: 'required' /}
{param description kind="text"}
Client identifier of the registrar account.
{/param}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Registrar Console Username' /}
{param name: 'consoleUserEmail' /}
{param value: $consoleUserEmail /}
{param placeholder: 'required' /}
{param description kind="text"}
The email we created for the registrar.
Will be granted web-console access to the registrar.
{/param}
{param required: true /}
{/call}
<tr class="{css('kd-settings-pane-section')}">
<td>
{call registry.soy.forms.inputFieldLabel}
{param label: 'Billing accounts' /}
{param description kind="text"}
Registrar billing account IDs.
Each currency in a separate line in the format
[currency]=[account ID].
{/param}
{/call}
</td>
<td class="{css('setting')}">
<textarea
name="billingAccount"
id="billingAccount"
rows="4"
cols="50"
placeholder=
"Example:{\n}
USD=billing-id-for-usd{\n}
JPY=billing-id-for-yen{\n}"
spellcheck="false"
required>{$billingAccount ?: ''}</textarea>
</td>
</tr>
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'IANA ID' /}
{param name: 'ianaId' /}
{param value: $ianaId /}
{param placeholder: 'required' /}
{param description kind="text"}
Registrar IANA ID.
{/param}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'ICANN referral email' /}
{param name: 'referralEmail' /}
{param value: $referralEmail /}
{param placeholder: 'required' /}
{param description kind="text"}
ICANN referral email, as specified in registrar contract.
{/param}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'DRIVE ID' /}
{param name: 'driveId' /}
{param value: $driveId /}
{param placeholder: 'required' /}
{param description kind="text"}
Id of this registrar's folder in Drive.
{/param}
{param required: true /}
{/call}
<tr>
<td colspan="2">
<hr>
<h1>Contact Info</h1>
</td>
</tr>
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Street address' /}
{param name: 'street1' /}
{param value: $street1 /}
{param placeholder: 'required' /}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: '' /}
{param name: 'street2' /}
{param value: $street2 /}
{param placeholder: 'optional' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: '' /}
{param name: 'street3' /}
{param value: $street3 /}
{param placeholder: 'optional' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'City' /}
{param name: 'city' /}
{param value: $city /}
{param placeholder: 'required' /}
{param required: true /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'State/region' /}
{param name: 'state' /}
{param value: $state /}
{param placeholder: 'optional' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Zip/postal code' /}
{param name: 'zip' /}
{param value: $zip /}
{param placeholder: 'optional' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Country Code (e.g. US)' /}
{param name: 'countryCode' /}
{param value: $countryCode /}
{param placeholder: 'required' /}
{param required: true /}
{/call}
<tr>
<td colspan="2">
<hr>
<h1>Optional fields</h1>
Don't fill unless you have a good reason to.
</td>
</tr>
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'EPP password' /}
{param name: 'password' /}
{param placeholder: 'optional' /}
{param description kind="text"}
The password used to for EPP login. Leave blank to auto-generate.
{/param}
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Phone passcode' /}
{param name: 'passcode' /}
{param placeholder: 'optional' /}
{param description kind="text"}
The passcode used for phone authentication. Leave blank to auto-generate.
{/param}
{/call}
{call registry.soy.forms.submitRow}
{param label: 'create' /}
{/call}
</table>
<input type="hidden" name="xsrfToken" value="{$xsrfToken}">
</form>
{/template}
/**
* Who goes thar?!
*/
{template .whoareyou}
{@param username: string} /** Arbitrary username to display. */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param logoFilename: string}
{@param productName: string}
{@param analyticsConfig: [googleAnalyticsId: string|null]}
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Not Authorized' /}
{param analyticsConfig: $analyticsConfig /}
{/call}
<div class="{css('whoAreYou')}">
<a class="{css('logo')}" href="/registrar">
<img src="/assets/images/{$logoFilename}" alt="{$productName}">
</a>
<h1>You need permission</h1>
<p>
Only {$productName} Admins have access to this page.
You are signed in as <strong>{$username}</strong>.
<div>
<a href="{$logoutUrl}"
class="{css('kd-button')} {css('kd-button-submit')}"
tabindex="-1">Logout and switch to another account</a>{sp}
<a href="/registrar"
class="{css('kd-button')} {css('kd-button-submit')}"
tabindex="-1">Go to the Registrar web console</a>
</div>
</div>
{/template}