Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt
Owen Leonard 859e3ce41b Bug 15936 - Revise layout and behavior of SMS cellular providers management
This patch changes the behavior of the SMS cellular providers management
page so that sections of the page are shown or hidden based on what the
current task is. Other changes include:

- Moving JavaScript to a separate file
- Adding a toolbar with a "New SMS provider" button.
- Adding the "generic" catalog search header form to the top of the
  page.
- Adding "Required" classes to required fields so that the staff
  client's built-in JS validation library can be used.

To test, the  SMSSendDriver system preference must be set to "Email."
Apply the patch and go to Administration -> SMS cellular providers.

- Confirm that the add/edit form is hidden initially. A toolbar with a
  "New SMS provider" button should appear with existing SMS cellular
  providers in a table below. If there are no existing providers a
  message dialog should say so.
- Confirm that the "New SMS provider" button works:
  - The table should be hidden and an empty "add" form displayed.
  - Confirm that an empty form cannot be submitted.
  - Confirm that submitting valid data works.
  - Confirm that clicking the "Cancel" button hides the form and
    redisplays the table.
- Test the "edit" button for an existing provider:
  - Confirm that the edit form is displayed and populated with the
    correct data.
  - Confirm that edits are saved correctly.
- When viewing the table of existing providers, confirm that clicking
  the "Delete" button triggers a confirmation dialog. Test both
  cancelling and confirming that dialog.
- Ponder whether all this is an improvement or not.

Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-08 21:56:44 +00:00

114 lines
5.4 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; SMS cellular providers</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
var MSG_SMS_PATRONS_USING = _("Are you sure you want to delete %s? %s patron(s) are using it!");
var MSG_SMS_DELETE_CONFIRM = _("Are you sure you want to delete %s?");
var LABEL_SMS_ADD_PROVIDER = _("Add an SMS cellular provider");
var LABEL_SMS_EDIT_PROVIDER = _("Edit provider %s");
//]]>
</script>
<script type="text/javascript" src="[% themelang %]/js/sms_providers.js"></script>
</head>
<body id="admin_sms_providers" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; SMS cellular providers</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-small" id="new_provider" href="#"><i class="fa fa-plus"></i> New SMS provider</a>
</div>
<h2>SMS cellular providers</h2>
[% IF providers.size %]
<table id="providerst">
<thead>
<tr>
<th>Name</th>
<th>Domain</th>
<th title="Patrons using this provider">Patrons</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH p IN providers %]
<tr>
<td id="name_[% p.id %]">[% p.name %]</td>
<td id="domain_[% p.id %]">[% p.domain %]</td>
<td id="patrons_using_[% p.id %]">[% p.patrons_using %]</td>
<td>
<a class="btn edit" href="#" id="edit_[% p.id %]" onclick="edit_provider( [% p.id %] );">
<i class="fa fa-pencil"></i> Edit
</a>
</td>
<td>
[% IF p.patrons_using %]
<a class="btn btn-danger" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %], [% p.patrons_using %] );">
<span style="color:white"><i class="fa fa-trash"></i> Delete</span>
</a>
[% ELSE %]
<a class="btn delete" href="#" id="delete_[% p.id %]" onclick="delete_provider( [% p.id %] );">
<i class="fa fa-trash"></i> Delete
</a>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<div class="dialog message">
There are no SMS cellular providers defined.
</div>
[% END %]
<div id="sms_add_form">
<form id="sms_form" action="sms_providers.pl" method="post" class="validated">
<fieldset class="rows">
<legend>Add an SMS cellular provider</legend>
<input type="hidden" id="id" name="id" value="" />
<input type="hidden" id="op" name="op" value="add_update" />
<ol>
<li>
<label for="name" class="required">Name: </label>
<input type="text" id="name" name="name" required="required" />
<span class="required">Required</span>
</li>
<li>
<label for="domain" class="required">Domain: </label>
<input type="text" id="domain" name="domain" required="required" size="40"/>
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" id="submit_save" value="Submit" />
<input type="submit" value="Submit" id="submit_update" />
<a class="cancel" id="cancel" href="#" onclick="cancel_edit()">Cancel</a>
</fieldset>
</form>
</div>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]