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

(-)a/admin/preferences.pl (+6 lines)
Lines 64-69 sub _get_chunk { Link Here
64
    if( $options{'syntax'} ){
64
    if( $options{'syntax'} ){
65
        $chunk->{'syntax'} = $options{'syntax'};
65
        $chunk->{'syntax'} = $options{'syntax'};
66
    }
66
    }
67
68
    if( $options{'type'} && $options{'type'} eq 'modalselect' ){
69
        $chunk->{'source'} = $options{'source'};
70
        $chunk->{'type'} = 'modalselect';
71
    }
72
67
    if ( $options{'class'} && $options{'class'} eq 'password' ) {
73
    if ( $options{'class'} && $options{'class'} eq 'password' ) {
68
        $chunk->{'input_type'} = 'password';
74
        $chunk->{'input_type'} = 'password';
69
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
75
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
(-)a/koha-tmpl/intranet-tmpl/prog/css/preferences.css (-1 / +25 lines)
Lines 1-4 Link Here
1
.preference-url, .preference-multi, .preference-long, .preference-file {
1
.preference-url,
2
.preference-multi,
3
.preference-long,
4
.preference-file,
5
.preference-modalselect {
2
    width: 20em;
6
    width: 20em;
3
}
7
}
4
8
Lines 10-15 Link Here
10
    width: 5em;
14
    width: 5em;
11
}
15
}
12
16
17
input[type="text"].modalselect {
18
    cursor: pointer;
19
}
20
21
input[type="text"].modalselect:hover {
22
    background-color: #FFC;
23
}
24
13
textarea.preference {
25
textarea.preference {
14
    width: 35em;
26
    width: 35em;
15
	height: 20em;
27
	height: 20em;
Lines 134-137 span.overridden { Link Here
134
    border: 1px solid #EEE;
146
    border: 1px solid #EEE;
135
    margin: 1em 1em 1em 0;
147
    margin: 1em 1em 1em 0;
136
    resize:  vertical;
148
    resize:  vertical;
149
}
150
151
#prefModal label {
152
    display: block;
153
    font-weight: bold;
154
    line-height: 1.5em;
155
}
156
157
.dbcolumn {
158
    font-weight: normal;
159
    font-family: monospace;
160
    color: #666;
137
}
161
}
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+5 lines)
Lines 4023-4028 input.renew { Link Here
4023
    margin:  .5em 0;
4023
    margin:  .5em 0;
4024
}
4024
}
4025
4025
4026
.columns-2 {
4027
    columns: 2 auto;
4028
    column-gap: 2.5em;
4029
}
4030
4026
.columns-3 {
4031
.columns-3 {
4027
    columns: 3 auto;
4032
    columns: 3 auto;
4028
    column-gap: 2.5em;
4033
    column-gap: 2.5em;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-1 / +28 lines)
Lines 98-103 Link Here
98
                        </option>
98
                        </option>
99
                        [% END %]
99
                        [% END %]
100
                    </select>
100
                    </select>
101
                    [% ELSIF ( CHUNK.type_modalselect ) %]
102
                        <input type="text" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="modalselect preference preference-[% CHUNK.type | html %]" data-source="[% CHUNK.source | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/>
101
                    [% ELSIF ( CHUNK.type_multiple ) %]
103
                    [% ELSIF ( CHUNK.type_multiple ) %]
102
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
104
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
103
                        [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
105
                        [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
Lines 169-174 Link Here
169
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
171
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
170
     </div> <!-- /.row -->
172
     </div> <!-- /.row -->
171
173
174
<!-- Modal -->
175
<div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
176
    <div class="modal-dialog modal-wide" role="document">
177
        <div class="modal-content">
178
            <div class="modal-header">
179
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
180
                <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
181
            </div>
182
            <div class="modal-body">
183
                <p>
184
                    <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
185
                    |
186
                    <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
187
                </p>
188
                <form action="#" id="prefModalForm">
189
                </form>
190
            </div>
191
            <div class="modal-footer">
192
                <button id="saveModalPrefs" data-target="" type="button" class="btn btn-default">Save</button>
193
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
194
            </div>
195
        </div>
196
    </div>
197
</div>
198
172
[% MACRO jsinclude BLOCK %]
199
[% MACRO jsinclude BLOCK %]
173
    [% INCLUDE 'datatables.inc' %]
200
    [% INCLUDE 'datatables.inc' %]
174
    [% Asset.js("lib/hc-sticky.js") | $raw %]
201
    [% Asset.js("lib/hc-sticky.js") | $raw %]
Lines 190-195 Link Here
190
217
191
    <script>
218
    <script>
192
        var Sticky;
219
        var Sticky;
220
        var themelang = "[% themelang | html %]";
193
        $(document).ready(function(){
221
        $(document).ready(function(){
194
            [% UNLESS ( searchfield ) %]
222
            [% UNLESS ( searchfield ) %]
195
                Sticky = $("#toolbar");
223
                Sticky = $("#toolbar");
Lines 209-215 Link Here
209
                e.preventDefault();
237
                e.preventDefault();
210
                window.location.reload(true);
238
                window.location.reload(true);
211
            });
239
            });
212
213
        });
240
        });
214
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
241
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
215
        var to_highlight = "[% To.json( searchfield ) | $raw %]";
242
        var to_highlight = "[% To.json( searchfield ) | $raw %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json (+53 lines)
Line 0 Link Here
1
{
2
    "cardnumber": "cardnumber",
3
    "surname": "surname",
4
    "firstname": "firstname",
5
    "title": "title",
6
    "othernames": "othernames",
7
    "initials": "initials",
8
    "streetnumber": "streetnumber",
9
    "streettype": "streettype",
10
    "address": "address",
11
    "address2": "address2",
12
    "city": "city",
13
    "state": "state",
14
    "zipcode": "zipcode",
15
    "country": "country",
16
    "email": "email",
17
    "phone": "phone",
18
    "mobile": "mobile",
19
    "fax": "fax",
20
    "emailpro": "emailpro",
21
    "phonepro": "phonepro",
22
    "B_streetnumber": "B_streetnumber",
23
    "B_streettype": "B_streettype",
24
    "B_address": "B_address",
25
    "B_address2": "B_address2",
26
    "B_city": "B_city",
27
    "B_state": "B_state",
28
    "B_zipcode": "B_zipcode",
29
    "B_country": "B_country",
30
    "B_email": "B_email",
31
    "B_phone": "B_phone",
32
    "dateofbirth": "dateofbirth",
33
    "branchcode": "branchcode",
34
    "categorycode": "categorycode",
35
    "contactname": "contactname",
36
    "contactfirstname": "contactfirstname",
37
    "borrowernotes": "borrowernotes",
38
    "sex": "sex",
39
    "password": "password",
40
    "userid": "userid",
41
    "opacnote": "opacnote",
42
    "contactnote": "contactnote",
43
    "altcontactfirstname": "altcontactfirstname",
44
    "altcontactsurname": "altcontactsurname",
45
    "altcontactaddress1": "altcontactaddress1",
46
    "altcontactaddress2": "altcontactaddress2",
47
    "altcontactaddress3": "altcontactaddress3",
48
    "altcontactstate": "altcontactstate",
49
    "altcontactzipcode": "altcontactzipcode",
50
    "altcontactcountry": "altcontactcountry",
51
    "altcontactphone": "altcontactphone",
52
    "smsalertnumber": "smsalertnumber"
53
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 / +6 lines)
Lines 823-840 OPAC: Link Here
823
        -
823
        -
824
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
824
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
825
            - pref: PatronSelfRegistrationBorrowerMandatoryField
825
            - pref: PatronSelfRegistrationBorrowerMandatoryField
826
              class: multi
826
              type: modalselect
827
            - (separate columns with |)
827
              source: borrowers
828
        -
828
        -
829
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron self-registration screen:"
829
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron self-registration screen:"
830
            - pref: PatronSelfRegistrationBorrowerUnwantedField
830
            - pref: PatronSelfRegistrationBorrowerUnwantedField
831
              class: multi
831
              type: modalselect
832
            - (separate columns with |)
832
              source: borrowers
833
        -
833
        -
834
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron self-modification screen:"
834
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron self-modification screen:"
835
            - pref: PatronSelfModificationBorrowerUnwantedField
835
            - pref: PatronSelfModificationBorrowerUnwantedField
836
              class: multi
836
              type: modalselect
837
            - (separate columns with |)
837
              source: borrowers
838
        -
838
        -
839
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
839
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
840
            - pref: PatronSelfRegistrationAdditionalInstructions
840
            - pref: PatronSelfRegistrationAdditionalInstructions
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-3 / +4 lines)
Lines 57-69 Patrons: Link Here
57
     -
57
     -
58
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
58
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
59
         - pref: BorrowerMandatoryField
59
         - pref: BorrowerMandatoryField
60
           class: multi
60
           type: modalselect
61
         - (separate columns with |)
61
           source: borrowers
62
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
62
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
63
     -
63
     -
64
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron entry screen:"
64
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron entry screen:"
65
         - pref: BorrowerUnwantedField
65
         - pref: BorrowerUnwantedField
66
           class: multi
66
           type: modalselect
67
           source: borrowers
67
         - (separate columns with |)
68
         - (separate columns with |)
68
     -
69
     -
69
         - "Guarantors can be the following of those they guarantee:"
70
         - "Guarantors can be the following of those they guarantee:"
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-2 / +60 lines)
Lines 1-4 Link Here
1
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults */
1
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults themelang */
2
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
2
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
3
3
4
KOHA.Preferences = {
4
KOHA.Preferences = {
Lines 208-211 $( document ).ready( function () { Link Here
208
            email: true
208
            email: true
209
        });
209
        });
210
    });
210
    });
211
212
213
    $(".modalselect").on("click", function(){
214
        var datasource = $(this).data("source");
215
        var pref_name = this.id.replace(/pref_/, '');
216
        var pref_value = this.value;
217
        var prefs = pref_value.split("|");
218
219
        $.getJSON( themelang + "/modules/admin/preferences/" + datasource + ".json", function( data ){
220
            var items = [];
221
            var checked = "";
222
            $.each( data, function( key, val ){
223
                if( prefs.indexOf( val ) >= 0 ){
224
                    checked = ' checked="checked" ';
225
                } else {
226
                    checked = "";
227
                }
228
                items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + ' name="pref" value="' + val + '" /> ' + key + '</label>');
229
            });
230
            $("<div/>", {
231
                "class": "columns-2",
232
                html: items.join("")
233
            }).appendTo("#prefModalForm");
234
        });
235
        $("#saveModalPrefs").data("target", this.id );
236
        $("#prefModalLabel").text( pref_name );
237
        $("#prefModal").modal("show");
238
    });
239
240
    $("#saveModalPrefs").on("click", function(){
241
        var formfieldid = $("#" + $(this).data("target") );
242
        var prefs = [];
243
        $("#prefModal input[type='checkbox']").each(function(){
244
            if( $(this).prop("checked") ){
245
                prefs.push( this.value );
246
            }
247
        });
248
249
        formfieldid.val( prefs.join("|") )
250
            .addClass("modified");
251
        mark_modified.call( formfieldid );
252
        KOHA.Preferences.Save( formfieldid.closest("form") );
253
        $("#prefModal").modal("hide");
254
    });
255
256
    $("#prefModal").on("hide.bs.modal", function(){
257
        $("#prefModalLabel,#prefModalForm").html("");
258
        $("#saveModalPrefs").data("target", "" );
259
    });
260
261
    $("#select_all").on("click",function(e){
262
        e.preventDefault();
263
        $(".dbcolumn_selection").prop("checked", true);
264
    });
265
    $("#clear_all").on("click",function(e){
266
        e.preventDefault();
267
        $(".dbcolumn_selection").prop("checked", false);
268
    });
269
211
} );
270
} );
212
- 

Return to bug 22844