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 4285-4290 span { Link Here
4285
    margin:  .5em 0;
4285
    margin:  .5em 0;
4286
}
4286
}
4287
4287
4288
.columns-2 {
4289
    columns: 2 auto;
4290
    column-gap: 2.5em;
4291
}
4292
4288
.columns-3 {
4293
.columns-3 {
4289
    columns: 3 auto;
4294
    columns: 3 auto;
4290
    column-gap: 2.5em;
4295
    column-gap: 2.5em;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-1 / +28 lines)
Lines 92-97 Link Here
92
                        </option>
92
                        </option>
93
                        [% END %]
93
                        [% END %]
94
                    </select>
94
                    </select>
95
                    [% ELSIF ( CHUNK.type_modalselect ) %]
96
                        <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 %]"/>
95
                    [% ELSIF ( CHUNK.type_multiple ) %]
97
                    [% ELSIF ( CHUNK.type_multiple ) %]
96
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
98
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
97
                        [% 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 %]
99
                        [% 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 163-168 Link Here
163
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
165
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
164
     </div> <!-- /.row -->
166
     </div> <!-- /.row -->
165
167
168
<!-- Modal -->
169
<div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
170
    <div class="modal-dialog modal-wide" role="document">
171
        <div class="modal-content">
172
            <div class="modal-header">
173
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
174
                <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
175
            </div>
176
            <div class="modal-body">
177
                <p>
178
                    <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
179
                    |
180
                    <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
181
                </p>
182
                <form action="#" id="prefModalForm">
183
                </form>
184
            </div>
185
            <div class="modal-footer">
186
                <button id="saveModalPrefs" data-target="" type="button" class="btn btn-default">Save</button>
187
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
188
            </div>
189
        </div>
190
    </div>
191
</div>
192
166
[% MACRO jsinclude BLOCK %]
193
[% MACRO jsinclude BLOCK %]
167
    [% INCLUDE 'datatables.inc' %]
194
    [% INCLUDE 'datatables.inc' %]
168
    [% Asset.js("lib/hc-sticky.js") | $raw %]
195
    [% Asset.js("lib/hc-sticky.js") | $raw %]
Lines 174-179 Link Here
174
    [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
201
    [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
175
    <script>
202
    <script>
176
        var Sticky;
203
        var Sticky;
204
        var themelang = "[% themelang | html %]";
177
        $(document).ready(function(){
205
        $(document).ready(function(){
178
            [% UNLESS ( searchfield ) %]
206
            [% UNLESS ( searchfield ) %]
179
                Sticky = $("#toolbar");
207
                Sticky = $("#toolbar");
Lines 193-199 Link Here
193
                e.preventDefault();
221
                e.preventDefault();
194
                window.location.reload(true);
222
                window.location.reload(true);
195
            });
223
            });
196
197
        });
224
        });
198
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
225
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
199
        var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
226
        var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json (+53 lines)
Line 0 Link Here
1
{
2
    "Card number": "cardnumber",
3
    "Surname": "surname",
4
    "First name": "firstname",
5
    "Salutation": "title",
6
    "Other name": "othernames",
7
    "Initials": "initials",
8
    "Street number": "streetnumber",
9
    "Street type": "streettype",
10
    "Address": "address",
11
    "Address 2": "address2",
12
    "City": "city",
13
    "State": "state",
14
    "ZIP/Postal code": "zipcode",
15
    "Country": "country",
16
    "Primary email": "email",
17
    "Primary phone": "phone",
18
    "Other phone": "mobile",
19
    "Fax": "fax",
20
    "Secondary email": "emailpro",
21
    "Secondary phone": "phonepro",
22
    "Alternate address street number": "B_streetnumber",
23
    "Alternate address street type": "B_streettype",
24
    "Alternate address": "B_address",
25
    "Alternate address 2": "B_address2",
26
    "Alternate address city": "B_city",
27
    "Alternate address state": "B_state",
28
    "Alternate address ZIP/Postal code": "B_zipcode",
29
    "Alternate address country": "B_country",
30
    "Alternate email": "B_email",
31
    "Alternate phone": "B_phone",
32
    "Date of birth": "dateofbirth",
33
    "Library": "branchcode",
34
    "Category": "categorycode",
35
    "Guarantor surname": "contactname",
36
    "Guarantor first name": "contactfirstname",
37
    "Circulation note": "borrowernotes",
38
    "Gender": "sex",
39
    "Password": "password",
40
    "Username": "userid",
41
    "Opac note": "opacnote",
42
    "Contact note": "contactnote",
43
    "Alternate contact first name": "altcontactfirstname",
44
    "Alternate contact surname": "altcontactsurname",
45
    "Alternate contact address": "altcontactaddress1",
46
    "Alternate contact address 2": "altcontactaddress2",
47
    "Alternate contact city": "altcontactaddress3",
48
    "Alternate contact state": "altcontactstate",
49
    "Alternate contact ZIP/Postal code": "altcontactzipcode",
50
    "Alternate contact country": "altcontactcountry",
51
    "Alternate contact phone": "altcontactphone",
52
    "SMS number": "smsalertnumber"
53
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 / +6 lines)
Lines 793-810 OPAC: Link Here
793
        -
793
        -
794
            - "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:"
794
            - "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:"
795
            - pref: PatronSelfRegistrationBorrowerMandatoryField
795
            - pref: PatronSelfRegistrationBorrowerMandatoryField
796
              class: multi
796
              type: modalselect
797
            - (separate columns with |)
797
              source: borrowers
798
        -
798
        -
799
            - "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:"
799
            - "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:"
800
            - pref: PatronSelfRegistrationBorrowerUnwantedField
800
            - pref: PatronSelfRegistrationBorrowerUnwantedField
801
              class: multi
801
              type: modalselect
802
            - (separate columns with |)
802
              source: borrowers
803
        -
803
        -
804
            - "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:"
804
            - "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:"
805
            - pref: PatronSelfModificationBorrowerUnwantedField
805
            - pref: PatronSelfModificationBorrowerUnwantedField
806
              class: multi
806
              type: modalselect
807
            - (separate columns with |)
807
              source: borrowers
808
        -
808
        -
809
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
809
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
810
            - pref: PatronSelfRegistrationAdditionalInstructions
810
            - pref: PatronSelfRegistrationAdditionalInstructions
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-3 / +4 lines)
Lines 39-51 Patrons: Link Here
39
     -
39
     -
40
         - "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:"
40
         - "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:"
41
         - pref: BorrowerMandatoryField
41
         - pref: BorrowerMandatoryField
42
           class: multi
42
           type: modalselect
43
         - (separate columns with |)
43
           source: borrowers
44
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
44
         - "<strong>NOTE:</strong> If autoMemberNum is enabled, the system preference BorrowerMandatoryField must not contain the field cardnumber."
45
     -
45
     -
46
         - "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:"
46
         - "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:"
47
         - pref: BorrowerUnwantedField
47
         - pref: BorrowerUnwantedField
48
           class: multi
48
           type: modalselect
49
           source: borrowers
49
         - (separate columns with |)
50
         - (separate columns with |)
50
     -
51
     -
51
         - "Guarantors can be the following of those they guarantee:"
52
         - "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 205-208 $( document ).ready( function () { Link Here
205
            email: true
205
            email: true
206
        });
206
        });
207
    });
207
    });
208
209
210
    $(".modalselect").on("click", function(){
211
        var datasource = $(this).data("source");
212
        var pref_name = this.id.replace(/pref_/, '');
213
        var pref_value = this.value;
214
        var prefs = pref_value.split("|");
215
216
        $.getJSON( themelang + "/modules/admin/preferences/" + datasource + ".json", function( data ){
217
            var items = [];
218
            var checked = "";
219
            $.each( data, function( key, val ){
220
                if( prefs.indexOf( val ) >= 0 ){
221
                    checked = ' checked="checked" ';
222
                } else {
223
                    checked = "";
224
                }
225
                items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + ' name="pref" value="' + val + '" /> ' + key + ' <span class="dbcolumn">(' + val + ')</span></label>');
226
            });
227
            $("<div/>", {
228
                "class": "columns-2",
229
                html: items.join("")
230
            }).appendTo("#prefModalForm");
231
        });
232
        $("#saveModalPrefs").data("target", this.id );
233
        $("#prefModalLabel").text( pref_name );
234
        $("#prefModal").modal("show");
235
    });
236
237
    $("#saveModalPrefs").on("click", function(){
238
        var formfieldid = $("#" + $(this).data("target") );
239
        var prefs = [];
240
        $("#prefModal input[type='checkbox']").each(function(){
241
            if( $(this).prop("checked") ){
242
                prefs.push( this.value );
243
            }
244
        });
245
246
        formfieldid.val( prefs.join("|") )
247
            .addClass("modified");
248
        mark_modified.call( formfieldid );
249
        KOHA.Preferences.Save( formfieldid.closest("form") );
250
        $("#prefModal").modal("hide");
251
    });
252
253
    $("#prefModal").on("hide.bs.modal", function(){
254
        $("#prefModalLabel,#prefModalForm").html("");
255
        $("#saveModalPrefs").data("target", "" );
256
    });
257
258
    $("#select_all").on("click",function(e){
259
        e.preventDefault();
260
        $(".dbcolumn_selection").prop("checked", true);
261
    });
262
    $("#clear_all").on("click",function(e){
263
        e.preventDefault();
264
        $(".dbcolumn_selection").prop("checked", false);
265
    });
266
208
} );
267
} );
209
- 

Return to bug 22844