View | Details | Raw Unified | Return to bug 15936
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js (+58 lines)
Line 0 Link Here
1
$(document).ready(function() {
2
    $('#submit_update').hide();
3
    $("#name").focus();
4
    $("#sms_add_form").hide();
5
    $("#new_provider").on("click",function(){
6
        add_provider();
7
    });
8
});
9
10
function clear_form(){
11
    $("#id,#name,#domain").val("");
12
}
13
14
function add_provider(){
15
    clear_form();
16
    $(".dialog").hide();
17
    $("legend").text( LABEL_SMS_ADD_PROVIDER );
18
    $("#toolbar,#submit_update,#providerst").hide();
19
    $("#sms_add_form,#submit_save").show();
20
    $("#name").focus();
21
}
22
23
function edit_provider( id ) {
24
    clear_form();
25
    $("legend").text( LABEL_SMS_EDIT_PROVIDER.format( $("#name_" + id).text() ) );
26
    $("#sms_add_form,#submit_update").show();
27
28
    $("#id").val( id );
29
    $("#name").val( $("#name_" + id).text() );
30
    $("#domain").val( $("#domain_" + id).text() );
31
32
    $("#toolbar,#submit_save,#providerst").hide();
33
34
    $("#name").focus();
35
}
36
37
38
function cancel_edit() {
39
    clear_form();
40
    $(".dialog").show();
41
    $("#sms_add_form,#submit_update").hide();
42
    $("#toolbar,#submit_save,#providerst").show();
43
}
44
45
function delete_provider( id, users ) {
46
    var c;
47
    if ( users ) {
48
        c = confirm( MSG_SMS_PATRONS_USING.format( $("#name_" + id).html(), users ) );
49
    } else {
50
        c = confirm( MSG_SMS_DELETE_CONFIRM.format( $("#name_" + id).html() ) );
51
    }
52
53
    if ( c ) {
54
        $("#op").val('delete');
55
        $("#id").val( id );
56
        $("#sms_form").submit();
57
    }
58
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt (-106 / +86 lines)
Lines 1-128 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; SMS cellular providers</title>
2
<title>Koha &rsaquo; Administration &rsaquo; SMS cellular providers</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<script type="text/javascript">
4
<script type="text/javascript">
7
$(document).ready(function() {
5
    //<![CDATA[
8
    $('#submit_update').hide();
6
        var MSG_SMS_PATRONS_USING = _("Are you sure you want to delete %s? %s patron(s) are using it!");
9
    $("#name").focus();
7
        var MSG_SMS_DELETE_CONFIRM = _("Are you sure you want to delete %s?");
10
});
8
        var LABEL_SMS_ADD_PROVIDER = _("Add an SMS cellular provider");
11
9
        var LABEL_SMS_EDIT_PROVIDER = _("Edit provider %s");
12
function edit_provider( id ) {
10
    //]]>
13
    cancel_edit();
14
15
    $("#id").val( id );
16
    $("#name").val( $("#name_" + id).text() );
17
    $("#domain").val( $("#domain_" + id).text() );
18
19
    $("#name_" + id).parent().children().addClass("highlighted-row");
20
21
    $("#submit_save").hide();
22
    $("#submit_update").show();
23
24
    $("#name").focus();
25
}
26
27
function cancel_edit() {
28
    $("#id").val("");
29
    $("#name").val("");
30
    $("#domain").val("");
31
32
    $("tr").children().removeClass("highlighted-row");
33
34
    $("#submit_update").hide();
35
    $("#submit_save").show();
36
37
}
38
39
function delete_provider( id, users ) {
40
    var c;
41
    if ( users ) {
42
        c = confirm( _("Are you sure you want to delete %s? %s patron(s) are using it!").format( $("#name_" + id).html(), users ) );
43
    } else {
44
        c = confirm( _("Are you sure you want to delete %s?").format( $("#name_" + id).html() ) );
45
    }
46
47
    if ( c ) {
48
        $("#op").val('delete');
49
        $("#id").val( id );
50
        $("#sms_form").submit();
51
    }
52
}
53
</script>
11
</script>
12
<script type="text/javascript" src="[% themelang %]/js/sms_providers.js"></script>
13
</head>
14
54
<body id="admin_sms_providers" class="admin">
15
<body id="admin_sms_providers" class="admin">
55
[% INCLUDE 'header.inc' %]
16
[% INCLUDE 'header.inc' %]
17
[% INCLUDE 'cat-search.inc' %]
56
18
57
<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>
19
<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>
58
20
59
<div id="doc3" class="yui-t2">
21
<div id="doc3" class="yui-t2">
60
    <div id="bd">
22
    <div id="bd">
61
        <div id="yui-main">
23
        <div id="yui-main">
62
     <div class="yui-b">
24
            <div class="yui-b">
25
26
                <div id="toolbar" class="btn-toolbar">
27
                    <a class="btn btn-small" id="new_provider" href="#"><i class="fa fa-plus"></i> New SMS provider</a>
28
                </div>
29
63
                <h2>SMS cellular providers</h2>
30
                <h2>SMS cellular providers</h2>
64
31
65
                <table>
32
                [% IF providers.size %]
66
                    <thead>
67
                        <tr>
68
                            <th>Name</th>
69
                            <th>Domain</th>
70
                            <th title="Patrons using this provider">Patrons</th>
71
                            <th>&nbsp;</th>
72
                            <th>&nbsp;</th>
73
                        </tr>
74
                    </thead>
75
33
76
                    <tbody>
34
                    <table id="providerst">
77
                        [% FOREACH p IN providers %]
35
                        <thead>
78
                            <tr>
36
                            <tr>
79
                                <td id="name_[% p.id %]">[% p.name %]</td>
37
                                <th>Name</th>
80
                                <td id="domain_[% p.id %]">[% p.domain %]</td>
38
                                <th>Domain</th>
81
                                <td id="patrons_using_[% p.id %]">[% p.patrons_using %]</td>
39
                                <th title="Patrons using this provider">Patrons</th>
82
                                <td>
40
                                <th>&nbsp;</th>
83
                                    <a class="btn" href="#" id="edit_[% p.id %]" class="edit" onclick="edit_provider( [% p.id %] );">
41
                                <th>&nbsp;</th>
84
                                        <i class="fa fa-pencil"></i> Edit
85
                                    </a>
86
                                </td>
87
                                <td>
88
                                    [% IF p.patrons_using %]
89
                                        <a class="btn btn-danger" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %], [% p.patrons_using %] );">
90
                                            <span style="color:white"><i class="fa fa-trash"></i> Delete</span>
91
                                        </a>
92
                                    [% ELSE %]
93
                                        <a class="btn" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );">
94
                                            <i class="fa fa-trash"></i> Delete
95
                                        </a>
96
                                    [% END %]
97
                                </td>
98
                            </tr>
42
                            </tr>
99
                        [% END %]
43
                        </thead>
100
                    </tbody>
44
101
45
                        <tbody>
102
                    <tfoot>
46
                            [% FOREACH p IN providers %]
103
                        <form id="sms_form" action="sms_providers.pl" method="post">
47
                                <tr>
48
                                    <td id="name_[% p.id %]">[% p.name %]</td>
49
                                    <td id="domain_[% p.id %]">[% p.domain %]</td>
50
                                    <td id="patrons_using_[% p.id %]">[% p.patrons_using %]</td>
51
                                    <td>
52
                                        <a class="btn edit" href="#" id="edit_[% p.id %]" onclick="edit_provider( [% p.id %] );">
53
                                            <i class="fa fa-pencil"></i> Edit
54
                                        </a>
55
                                    </td>
56
                                    <td>
57
                                        [% IF p.patrons_using %]
58
                                            <a class="btn btn-danger" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %], [% p.patrons_using %] );">
59
                                                <span style="color:white"><i class="fa fa-trash"></i> Delete</span>
60
                                            </a>
61
                                        [% ELSE %]
62
                                            <a class="btn delete" href="#" id="delete_[% p.id %]" onclick="delete_provider( [% p.id %] );">
63
                                                <i class="fa fa-trash"></i> Delete
64
                                            </a>
65
                                        [% END %]
66
                                    </td>
67
                                </tr>
68
                            [% END %]
69
                        </tbody>
70
                    </table>
71
72
                [% ELSE %]
73
74
                    <div class="dialog message">
75
                        There are no SMS cellular providers defined.
76
                    </div>
77
78
                [% END %]
79
80
                <div id="sms_add_form">
81
                    <form id="sms_form" action="sms_providers.pl" method="post" class="validated">
82
                        <fieldset class="rows">
83
                            <legend>Add an SMS cellular provider</legend>
104
                            <input type="hidden" id="id" name="id" value="" />
84
                            <input type="hidden" id="id" name="id" value="" />
105
                            <input type="hidden" id="op" name="op" value="add_update" />
85
                            <input type="hidden" id="op" name="op" value="add_update" />
106
                            <tr>
86
                            <ol>
107
                                <td><input type="text" id="name" name="name" /></td>
87
                                <li>
108
                                <td><input type="text" id="domain" name="domain" size="40"/></td>
88
                                    <label for="name" class="required">Name: </label>
109
                                <td colspan="2">
89
                                    <input type="text" id="name" name="name" required="required" />
110
                                    <button class="btn" id="submit_save" type="submit">
90
                                    <span class="required">Required</span>
111
                                        <i class="fa fa-plus"></i> Add new
91
                                </li>
112
                                    </button>
92
                                <li>
113
                                    <button class="btn" id="submit_update" type="submit">
93
                                    <label for="domain" class="required">Domain: </label>
114
                                        <i class="fa fa-plus-circle"></i> Update
94
                                    <input type="text" id="domain" name="domain" required="required" size="40"/>
115
                                    </button>
95
                                    <span class="required">Required</span>
116
                                </td>
96
                                </li>
117
                                <td>
97
                            </ol>
118
                                    <a class="btn" id="cancel" href="#" onclick="cancel_edit()">
98
                        </fieldset>
119
                                        <i class="fa fa-ban"></i> Cancel
99
                        <fieldset class="action">
120
                                    </a>
100
                            <input type="submit" id="submit_save" value="Submit" />
121
                                </td>
101
                            <input type="submit" value="Submit" id="submit_update" />
122
                            </tr>
102
                            <a class="cancel" id="cancel" href="#" onclick="cancel_edit()">Cancel</a>
123
                        </form>
103
                        </fieldset>
124
                    </tfoot>
104
                    </form>
125
                </table>
105
                </div>
106
126
            </div>
107
            </div>
127
        </div>
108
        </div>
128
        <div class="yui-b">
109
        <div class="yui-b">
129
- 

Return to bug 15936