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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc (-1 / +2 lines)
Lines 16-22 $(document).ready(function(){ Link Here
16
        rangelength: $.validator.format(_("Please enter a value between {0} and {1} characters long.")),
16
        rangelength: $.validator.format(_("Please enter a value between {0} and {1} characters long.")),
17
        range: $.validator.format(_("Please enter a value between {0} and {1}.")),
17
        range: $.validator.format(_("Please enter a value between {0} and {1}.")),
18
        max: $.validator.format(_("Please enter a value less than or equal to {0}.")),
18
        max: $.validator.format(_("Please enter a value less than or equal to {0}.")),
19
        min: $.validator.format(_("Please enter a value greater than or equal to {0}."))
19
        min: $.validator.format(_("Please enter a value greater than or equal to {0}.")),
20
        letters_numbers: $.validator.format(_("This field can only contain the following characters: letters, numbers, hyphen, and underscore."))
20
    });
21
    });
21
});
22
});
22
//]]>
23
//]]>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/categories.js (-10 lines)
Lines 1-13 Link Here
1
jQuery.validator.addMethod( "letters_numbers", function(value,element){
2
    var patt = /^[a-zA-Z0-9\-_]+$/g;
3
    if (patt.test(element.value)) {
4
        return true;
5
    } else {
6
        return false;
7
    }
8
    }, MSG_CATEGORYCODE_CHARS
9
);
10
11
jQuery.validator.addMethod( "enrollment_period", function(){
1
jQuery.validator.addMethod( "enrollment_period", function(){
12
        enrolmentperiod = $("#enrolmentperiod").val();
2
        enrolmentperiod = $("#enrolmentperiod").val();
13
        enrolmentperioddate = $("#enrolmentperioddate").val();
3
        enrolmentperioddate = $("#enrolmentperioddate").val();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-14 / +20 lines)
Lines 25-41 Link Here
25
            "sPaginationType": "four_button"
25
            "sPaginationType": "four_button"
26
        }));
26
        }));
27
27
28
        [% UNLESS library %]
28
        $("#library_entry").validate({
29
            $("#Aform").on("submit", function( event ) {
29
            rules: {
30
                if ( $("#branchcode").val().match(/\s/) ) {
30
                branchcode: {
31
                    event.preventDefault();
31
                    required: true,
32
                    alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
32
                    letters_numbers: true
33
                    return false;
33
                },
34
                } else {
34
                branchname: "required"
35
                    return true;
35
            }
36
                }
36
        });
37
            });
38
        [% END %]
39
    });
37
    });
40
tinyMCE.init({
38
tinyMCE.init({
41
    mode : "textareas",
39
    mode : "textareas",
Lines 132-138 tinyMCE.init({ Link Here
132
130
133
[% IF op == 'add_form' %]
131
[% IF op == 'add_form' %]
134
    <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
132
    <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
135
    <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
133
    <form action="/cgi-bin/koha/admin/branches.pl" id="library_entry" method="post">
136
        <fieldset class="rows">
134
        <fieldset class="rows">
137
            <input type="hidden" name="op" value="add_validate" />
135
            <input type="hidden" name="op" value="add_validate" />
138
            [% IF library %]
136
            [% IF library %]
Lines 271-277 tinyMCE.init({ Link Here
271
                        <td>[% library.branchip %]</td>
269
                        <td>[% library.branchip %]</td>
272
                        <td class="actions">
270
                        <td class="actions">
273
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode=[% library.branchcode %]"><i class="fa fa-pencil"></i> Edit</a>
271
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode=[% library.branchcode %]"><i class="fa fa-pencil"></i> Edit</a>
274
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=delete_confirm&amp;branchcode=[% library.branchcode %]"><i class="fa fa-trash"></i> Delete</a>
272
                            <form action="/cgi-bin/koha/admin/branches.pl" method="post">
273
                                <input type="hidden" name="branchcode" value="[% library.branchcode %]" />
274
                                <input type="hidden" name="op" value="delete_confirm" />
275
                                <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
276
                            </form>
275
                        </td>
277
                        </td>
276
                    </tr>
278
                    </tr>
277
                [% END %]
279
                [% END %]
Lines 302-308 tinyMCE.init({ Link Here
302
                                <td>[% category.codedescription |html %]</td>
304
                                <td>[% category.codedescription |html %]</td>
303
                                <td class="actions">
305
                                <td class="actions">
304
                                  <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?categorycode=[% category.categorycode %]&amp;op=add_form_category"><i class="fa fa-pencil"></i> Edit</a>
306
                                  <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?categorycode=[% category.categorycode %]&amp;op=add_form_category"><i class="fa fa-pencil"></i> Edit</a>
305
                                  <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?categorycode=[% category.categorycode %]&amp;op=delete_confirm_category"><i class="fa fa-trash"></i> Delete</a>
307
                                  <form action="/cgi-bin/koha/admin/branches.pl" method="post">
308
                                      <input type="hidden" name="categorycode" value="[% category.categorycode %]" />
309
                                      <input type="hidden" name="op" value="delete_confirm_category" />
310
                                      <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
311
                                  </form>
306
                                </td>
312
                                </td>
307
                            </tr>
313
                            </tr>
308
                        [% END %]
314
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-1 lines)
Lines 10-16 Link Here
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11
[% INCLUDE 'datatables.inc' %]
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript">
12
<script type="text/javascript">
13
    var MSG_CATEGORYCODE_CHARS = _("Category code can only contain the following characters: letters, numbers, - and _.");
14
    var MSG_BOTH_ENROLLMENTPERIODS = _("Please choose only one enrollment period setting.");
13
    var MSG_BOTH_ENROLLMENTPERIODS = _("Please choose only one enrollment period setting.");
15
    var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
14
    var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
16
</script>
15
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +8 lines)
Lines 15-20 function formatstr(str, col) { Link Here
15
    });
15
    });
16
}
16
}
17
17
18
jQuery.validator.addMethod( "letters_numbers", function(value,element){
19
    var patt = /^[a-zA-Z0-9\-_]+$/g;
20
    if (patt.test(element.value)) {
21
        return true;
22
    } else {
23
        return false;
24
    }
25
});
18
26
19
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
27
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
20
$.fn.tabIndex = function () {
28
$.fn.tabIndex = function () {
21
- 

Return to bug 19560