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

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+9 lines)
Lines 3882-3887 span { Link Here
3882
    }
3882
    }
3883
}
3883
}
3884
3884
3885
3886
.form-message {
3887
    background-color: #FFF;
3888
    border: 1px solid #A4BEDD;
3889
    border-radius: 5px;
3890
    margin: 1em;
3891
    padding: .5em;
3892
}
3893
3885
.modal-textarea {
3894
.modal-textarea {
3886
    width: 98%;
3895
    width: 98%;
3887
}
3896
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-46 / +4 lines)
Lines 1083-1134 Link Here
1083
[% IF ( step_5 ) %][% IF ( EnhancedMessagingPreferences ) %]
1083
[% IF ( step_5 ) %][% IF ( EnhancedMessagingPreferences ) %]
1084
  <fieldset class="rows" id="memberentry_messaging_prefs">
1084
  <fieldset class="rows" id="memberentry_messaging_prefs">
1085
    <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1085
    <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1086
    [% IF ( opadd ) %]
1086
    <div id="messaging_prefs_loading" class="form-message" style="display:none">
1087
    <!-- handle changing prefs if creating new patron and changing
1087
        <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1088
         the patron category
1088
    </div>
1089
    -->
1090
    <script type="text/javascript">//<![CDATA[
1091
       $(document).ready(function(){
1092
            var message_prefs_dirty = false;
1093
            $('#memberentry_messaging_prefs > *').change(function() {
1094
                message_prefs_dirty = true;
1095
            });
1096
            $('#categorycode_entry').change(function() {
1097
                var categorycode = $(this).val();
1098
                if (message_prefs_dirty) {
1099
                    if (!confirm(_("Change messaging preferences to default for this category?"))) {
1100
                        return;
1101
                    }
1102
                }
1103
                $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode,
1104
                    function(data) {
1105
                        $.each(data.messaging_preferences, function(i, item) {
1106
                            var attrid = item.message_attribute_id;
1107
                            var transports = ['email', 'rss', 'sms'];
1108
                            $.each(transports, function(j, transport) {
1109
                                if (item['transports_' + transport] == 1) {
1110
                                    $('#' + transport + attrid).prop('checked', true);
1111
                                } else {
1112
                                    $('#' + transport + attrid).prop('checked', false);
1113
                                }
1114
                            });
1115
                            if (item.digest && item.digest != ' ') {
1116
                                $('#digest' + attrid).prop('checked', true);
1117
                            } else {
1118
                                $('#digest' + attrid).prop('checked', false);
1119
                            }
1120
                            if (item.takes_days == '1') {
1121
                                $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
1122
                            }
1123
                        });
1124
                        message_prefs_dirty = false;
1125
                    }
1126
                );
1127
            });
1128
        });
1129
    //]]>
1130
    </script>
1131
    [% END %]
1132
    <input type="hidden" name="setting_messaging_prefs" value="1" />
1089
    <input type="hidden" name="setting_messaging_prefs" value="1" />
1133
    [% INCLUDE 'messaging-preference-form.inc' %]
1090
    [% INCLUDE 'messaging-preference-form.inc' %]
1134
    [% IF ( SMSSendDriver ) %]
1091
    [% IF ( SMSSendDriver ) %]
Lines 1299-1304 Link Here
1299
        var LABEL_CHANGE = _("Change");
1256
        var LABEL_CHANGE = _("Change");
1300
        var LABEL_SET_TO_PATRON = _("Set to patron");
1257
        var LABEL_SET_TO_PATRON = _("Set to patron");
1301
        var LABEL_AGE = _("Age");
1258
        var LABEL_AGE = _("Age");
1259
        var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?");
1302
1260
1303
        [% IF quickadd && opadd  && !check_member %]
1261
        [% IF quickadd && opadd  && !check_member %]
1304
            $(document).ready(function () {
1262
            $(document).ready(function () {
(-)a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js (-1 / +48 lines)
Lines 17-20 $(document).ready(function(){ Link Here
17
        }
17
        }
18
    });
18
    });
19
    $("#info_digests").tooltip();
19
    $("#info_digests").tooltip();
20
21
    var message_prefs_dirty = false;
22
    $('#memberentry_messaging_prefs > *').change(function() {
23
        message_prefs_dirty = true;
24
    });
25
26
    if( $("#messaging_prefs_loading").length ){ // This element only appears in the template if op=add
27
        $('#categorycode_entry').change(function() {
28
            var messaging_prefs_loading = $("#messaging_prefs_loading");
29
            // Upon selecting a new patron category, show "Loading" message for messaging defaults
30
            messaging_prefs_loading.show();
31
            var categorycode = $(this).val();
32
            if (message_prefs_dirty) {
33
                if (!confirm( MSG_MESSAGING_DFEAULTS )) {
34
                    // Not loading messaging defaults. Hide loading indicator
35
                    messaging_prefs_loading.hide();
36
                    return;
37
                }
38
            }
39
            $(".none").prop("checked", false); // When loading default prefs the "Do not notify" boxes should be cleared
40
            var jqxhr = $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, function(data) {
41
                $.each(data.messaging_preferences, function(i, item) {
42
                    var attrid = item.message_attribute_id;
43
                    var transports = ['email', 'rss', 'sms'];
44
                    $.each(transports, function(j, transport) {
45
                        if (item['transports_' + transport] == 1) {
46
                            $('#' + transport + attrid).prop('checked', true);
47
                        } else {
48
                            $('#' + transport + attrid).prop('checked', false);
49
                        }
50
                    });
51
                    if (item.digest && item.digest != ' ') {
52
                        $('#digest' + attrid).prop('checked', true);
53
                    } else {
54
                        $('#digest' + attrid).prop('checked', false);
55
                    }
56
                    if (item.takes_days == '1') {
57
                        $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
58
                    }
59
                });
60
                message_prefs_dirty = false;
61
            })
62
                .always(function() {
63
                    // Loaded messaging defaults. Hide loading indicator
64
                    messaging_prefs_loading.hide();
65
                });
66
        });
67
    }
20
});
68
});
21
- 

Return to bug 21813