Skip to content

Commit

Permalink
use tpl in gateway module nexmo
Browse files Browse the repository at this point in the history
  • Loading branch information
antonraharja committed Oct 26, 2013
1 parent 4a7e8c7 commit ae71a2e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 25 deletions.
6 changes: 4 additions & 2 deletions web/docs/development/TEMPLATE
Expand Up @@ -60,8 +60,10 @@ located in:
- plugin/feature/inboxgroup/inboxgroup.php
- plugin/feature/inboxgroup/templates/inboxgroup.html
- plugin/tools/report/report.php
- plugin/tools/report/templates/report_admin.tpl
- plugin/tools/report/templates/report_user.tpl
- plugin/tools/report/templates/report_admin.html
- plugin/tools/report/templates/report_user.html
- plugin/gateway/nexmo/nexmo.php
- plugin/gateway/nexmo/templates/nexmo.html
- plugin/themes/default/fn.php
- plugin/themes/default/page*.php
- plugin/themes/default/templates/*
Expand Down
55 changes: 32 additions & 23 deletions web/plugin/gateway/nexmo/nexmo.php
Expand Up @@ -19,30 +19,39 @@
switch ($op) {
case "manage":
if ($err = $_SESSION['error_string']) {
$content = "<div class=error_string>$err</div>";
$error_content = "<div class=error_string>$err</div>";
}
$content .= "
<h2>"._('Manage nexmo')."</h2>
<form action=index.php?app=menu&inc=gateway_nexmo&op=manage_save method=post>
<table width=100% cellpadding=1 cellspacing=2 border=0>
<tbody>
<tr><td width=270>"._('Gateway name')."</td><td>nexmo $status_active</td></tr>
<tr><td>"._('Nexmo URL')."</td><td><input type=text size=30 maxlength=250 name=up_url value=\"".$nexmo_param['url']."\"> "._hint(_('Use JSON format URL'))."</td></tr>
<tr><td>"._('API key')."</td><td><input type=text size=30 maxlength=30 name=up_api_key value=\"".$nexmo_param['api_key']."\"></td></tr>
<tr><td>"._('API secret')."</td><td><input type=password size=30 maxlength=30 name=up_api_secret value=\"\"> "._hint(_('Fill to change the API secret'))."</td></tr>
<tr><td>"._('Module sender ID')."</td><td><input type=text size=30 maxlength=16 name=up_global_sender value=\"".$nexmo_param['global_sender']."\"> "._hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable'))."</td></tr>
<tr><td>"._('Module timezone')."</td><td><input type=text size=5 maxlength=5 name=up_global_timezone value=\"".$nexmo_param['datetime_timezone']."\"> "._hint(_('Eg: +0700 for Jakarta/Bangkok timezone'))."</td></tr>
</tbody>
</table>
<p><input type=submit class=button value=\""._('Save')."\">
</form>
<br />
"._('Notes').":<br />
- "._('Your callback URL is')." ".$callback_url."<br />
- "._('Your callback URL should be accessible from Nexmo')."<br />
- "._('Nexmo will push DLR and incoming SMS to your callback URL')."<br />
- "._('Nexmo is a bulk SMS provider').", <a href=\"http://www.nexmo.com\" target=\"_blank\">"._('free credits are available for testing purposes')."</a><br />";
echo $content;
$tpl = array(
'name' => 'nexmo',
'var' => array(
'ERROR' => $error_content,
'Manage nexmo' => _('Manage nexmo'),
'Gateway name' => _('Gateway name'),
'Nexmo URL' => _('Nexmo URL'),
'API key' => _('API key'),
'API secret' => _('API secret'),
'Module sender ID' => _('Module sender ID'),
'Module timezone' => _('Module timezone'),
'Save' => _('Save'),
'Notes' => _('Notes'),
'HINT_JSON_FORMAT' => _hint(_('Use JSON format URL')),
'HINT_FILL_SECRET' => _hint(_('Fill to change the API secret')),
'HINT_GLOBAL_SENDER' => _hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable')),
'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')),
'CALLBACK_URL_IS' => _('Your callback URL is'),
'CALLBACK_URL_ACCESSIBLE' => _('Your callback URL should be accessible from Nexmo'),
'NEXMO_PUSH_DLR' => _('Nexmo will push DLR and incoming SMS to your callback URL'),
'NEXMO_IS_BULK' => _('Nexmo is a bulk SMS provider'),
'NEXMO_FREE_CREDIT' => _('free credits are available for testing purposes'),
'status_active' => $status_active,
'nexmo_param_url' => $nexmo_param['url'],
'nexmo_param_api_key' => $nexmo_param['api_key'],
'nexmo_param_global_sender' => $nexmo_param['global_sender'],
'nexmo_param_datetime_timezone' => $nexmo_param['datetime_timezone'],
'callback_url' => $callback_url
)
);
echo tpl_apply($tpl);
break;
case "manage_save":
$up_url = $_POST['up_url'];
Expand Down
21 changes: 21 additions & 0 deletions web/plugin/gateway/nexmo/templates/nexmo.html
@@ -0,0 +1,21 @@
{ERROR}
<h2>{Manage nexmo}</h2>
<form action=index.php?app=menu&inc=gateway_nexmo&op=manage_save method=post>
<table width=100%>
<tbody>
<tr><td width=270>{Gateway name}</td><td>nexmo {status_active}</td></tr>
<tr><td>{Nexmo URL}</td><td><input type=text size=30 maxlength=250 name=up_url value="{nexmo_param_url}"> {HINT_JSON_FORMAT}</td></tr>
<tr><td>{API key}</td><td><input type=text size=30 maxlength=30 name=up_api_key value="{nexmo_param_api_key}"></td></tr>
<tr><td>{API secret}</td><td><input type=password size=30 maxlength=30 name=up_api_secret value=""> {HINT_FILL_SECRET}</td></tr>
<tr><td>{Module sender ID}</td><td><input type=text size=30 maxlength=16 name=up_global_sender value="{nexmo_param_global_sender}"> {HINT_GLOBAL_SENDER}</td></tr>
<tr><td>{Module timezone}</td><td><input type=text size=5 maxlength=5 name=up_global_timezone value="{nexmo_param_datetime_timezone}"> {HINT_TIMEZONE}</td></tr>
</tbody>
</table>
<p><input type=submit class=button value="{Save}">
</form>
<br />
{Notes}:<br />
- {CALLBACK_URL_IS} {callback_url}<br />
- {CALLBACK_URL_ACCESSIBLE}<br />
- {NEXMO_PUSH_DLR}<br />
- {NEXMO_IS_BULK}, <a href="http://www.nexmo.com" target="_blank">{NEXMO_FREE_CREDIT}</a><br />

0 comments on commit ae71a2e

Please sign in to comment.