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 / +24 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 152-157 span.overridden { Link Here
152
    resize:  vertical;
164
    resize:  vertical;
153
}
165
}
154
166
167
#prefModal label {
168
    display: block;
169
    font-weight: bold;
170
    line-height: 1.5em;
171
}
172
173
.dbcolumn {
174
    font-weight: normal;
175
    font-family: monospace;
176
    color: #666;
177
}
155
#menu ul li.active a.pref_sublink {
178
#menu ul li.active a.pref_sublink {
156
    background: #FFF none;
179
    background: #FFF none;
157
    border: 0;
180
    border: 0;
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+5 lines)
Lines 4051-4056 input.renew { Link Here
4051
    margin:  .5em 0;
4051
    margin:  .5em 0;
4052
}
4052
}
4053
4053
4054
.columns-2 {
4055
    columns: 2 auto;
4056
    column-gap: 2.5em;
4057
}
4058
4054
.columns-3 {
4059
.columns-3 {
4055
    columns: 3 auto;
4060
    columns: 3 auto;
4056
    column-gap: 2.5em;
4061
    column-gap: 2.5em;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-1 / +28 lines)
Lines 108-113 Link Here
108
                        </option>
108
                        </option>
109
                        [% END %]
109
                        [% END %]
110
                    </select>
110
                    </select>
111
                    [% ELSIF ( CHUNK.type_modalselect ) %]
112
                        <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 %]"/>
111
                    [% ELSIF ( CHUNK.type_multiple ) %]
113
                    [% ELSIF ( CHUNK.type_multiple ) %]
112
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
114
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
113
                        [% 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 %]
115
                        [% 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 179-184 Link Here
179
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
181
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
180
     </div> <!-- /.row -->
182
     </div> <!-- /.row -->
181
183
184
<!-- Modal -->
185
<div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
186
    <div class="modal-dialog modal-wide" role="document">
187
        <div class="modal-content">
188
            <div class="modal-header">
189
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
190
                <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
191
            </div>
192
            <div class="modal-body">
193
                <p>
194
                    <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
195
                    |
196
                    <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
197
                </p>
198
                <form action="#" id="prefModalForm">
199
                </form>
200
            </div>
201
            <div class="modal-footer">
202
                <button id="saveModalPrefs" data-target="" type="button" class="btn btn-default">Save</button>
203
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
204
            </div>
205
        </div>
206
    </div>
207
</div>
208
182
[% MACRO jsinclude BLOCK %]
209
[% MACRO jsinclude BLOCK %]
183
    [% INCLUDE 'datatables.inc' %]
210
    [% INCLUDE 'datatables.inc' %]
184
    [% Asset.js("lib/hc-sticky.js") | $raw %]
211
    [% Asset.js("lib/hc-sticky.js") | $raw %]
Lines 200-205 Link Here
200
227
201
    <script>
228
    <script>
202
        var Sticky;
229
        var Sticky;
230
        var themelang = "[% themelang | html %]";
203
        $(document).ready(function(){
231
        $(document).ready(function(){
204
            [% UNLESS ( searchfield ) %]
232
            [% UNLESS ( searchfield ) %]
205
                Sticky = $("#toolbar");
233
                Sticky = $("#toolbar");
Lines 219-225 Link Here
219
                e.preventDefault();
247
                e.preventDefault();
220
                window.location.reload(true);
248
                window.location.reload(true);
221
            });
249
            });
222
223
        });
250
        });
224
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
251
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
225
        var to_highlight = "[% To.json( searchfield ) | $raw %]";
252
        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 834-851 OPAC: Link Here
834
        -
834
        -
835
            - "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:"
835
            - "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:"
836
            - pref: PatronSelfRegistrationBorrowerMandatoryField
836
            - pref: PatronSelfRegistrationBorrowerMandatoryField
837
              class: multi
837
              type: modalselect
838
            - (separate columns with |)
838
              source: borrowers
839
        -
839
        -
840
            - "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:"
840
            - "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:"
841
            - pref: PatronSelfRegistrationBorrowerUnwantedField
841
            - pref: PatronSelfRegistrationBorrowerUnwantedField
842
              class: multi
842
              type: modalselect
843
            - (separate columns with |)
843
              source: borrowers
844
        -
844
        -
845
            - "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:"
845
            - "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:"
846
            - pref: PatronSelfModificationBorrowerUnwantedField
846
            - pref: PatronSelfModificationBorrowerUnwantedField
847
              class: multi
847
              type: modalselect
848
            - (separate columns with |)
848
              source: borrowers
849
        -
849
        -
850
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
850
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
851
            - pref: PatronSelfRegistrationAdditionalInstructions
851
            - pref: PatronSelfRegistrationAdditionalInstructions
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-3 / +4 lines)
Lines 172-184 Patrons: Link Here
172
     -
172
     -
173
         - "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:"
173
         - "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:"
174
         - pref: BorrowerMandatoryField
174
         - pref: BorrowerMandatoryField
175
           class: multi
175
           type: modalselect
176
         - (separate columns with |)
176
           source: borrowers
177
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
177
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
178
     -
178
     -
179
         - "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:"
179
         - "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:"
180
         - pref: BorrowerUnwantedField
180
         - pref: BorrowerUnwantedField
181
           class: multi
181
           type: modalselect
182
           source: borrowers
182
         - (separate columns with |)
183
         - (separate columns with |)
183
     -
184
     -
184
         - "Borrowers can have the following titles:"
185
         - "Borrowers can have the following titles:"
(-)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 221-224 $( document ).ready( function () { Link Here
221
            email: true
221
            email: true
222
        });
222
        });
223
    });
223
    });
224
225
226
    $(".modalselect").on("click", function(){
227
        var datasource = $(this).data("source");
228
        var pref_name = this.id.replace(/pref_/, '');
229
        var pref_value = this.value;
230
        var prefs = pref_value.split("|");
231
232
        $.getJSON( themelang + "/modules/admin/preferences/" + datasource + ".json", function( data ){
233
            var items = [];
234
            var checked = "";
235
            $.each( data, function( key, val ){
236
                if( prefs.indexOf( val ) >= 0 ){
237
                    checked = ' checked="checked" ';
238
                } else {
239
                    checked = "";
240
                }
241
                items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + ' name="pref" value="' + val + '" /> ' + key + '</label>');
242
            });
243
            $("<div/>", {
244
                "class": "columns-2",
245
                html: items.join("")
246
            }).appendTo("#prefModalForm");
247
        });
248
        $("#saveModalPrefs").data("target", this.id );
249
        $("#prefModalLabel").text( pref_name );
250
        $("#prefModal").modal("show");
251
    });
252
253
    $("#saveModalPrefs").on("click", function(){
254
        var formfieldid = $("#" + $(this).data("target") );
255
        var prefs = [];
256
        $("#prefModal input[type='checkbox']").each(function(){
257
            if( $(this).prop("checked") ){
258
                prefs.push( this.value );
259
            }
260
        });
261
262
        formfieldid.val( prefs.join("|") )
263
            .addClass("modified");
264
        mark_modified.call( formfieldid );
265
        KOHA.Preferences.Save( formfieldid.closest("form") );
266
        $("#prefModal").modal("hide");
267
    });
268
269
    $("#prefModal").on("hide.bs.modal", function(){
270
        $("#prefModalLabel,#prefModalForm").html("");
271
        $("#saveModalPrefs").data("target", "" );
272
    });
273
274
    $("#select_all").on("click",function(e){
275
        e.preventDefault();
276
        $(".dbcolumn_selection").prop("checked", true);
277
    });
278
    $("#clear_all").on("click",function(e){
279
        e.preventDefault();
280
        $(".dbcolumn_selection").prop("checked", false);
281
    });
282
224
} );
283
} );
225
- 

Return to bug 22844