Zeile 8 | Zeile 8 |
---|
$("#to").select2({ placeholder: "{$lang->search_user}", minimumInputLength: 2,
|
$("#to").select2({ placeholder: "{$lang->search_user}", minimumInputLength: 2,
|
maximumSelectionSize: {$mybb->usergroup['maxpmrecipients']}, multiple: true, ajax: { // instead of writing the function to execute the request we use Select2's convenient helper url: "xmlhttp.php?action=get_users", dataType: 'json', data: function (term, page) { return { query: term, // search term }; },
| maximumSelectionSize: function() { if ({$mybb->usergroup['maxpmrecipients']} == 0) { return 0; } return Math.max(1, {$mybb->usergroup['maxpmrecipients']} - $("#bcc").select2('data').length); }, multiple: true, ajax: { // instead of writing the function to execute the request we use Select2's convenient helper url: "xmlhttp.php?action=get_users", dataType: 'json', data: function (term, page) { return { query: term, // search term }; },
|
results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data};
| results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data};
|
Zeile 25 | Zeile 30 |
---|
}, initSelection: function(element, callback) { var query = $(element).val().replace(', ', ',');
|
}, initSelection: function(element, callback) { var query = $(element).val().replace(', ', ',');
|
if (query !== "") { var newqueries = []; exp_queries = query.split(","); $.each(exp_queries, function(index, value ){ if(value.replace(/\s/g, '') != "") { var newquery = { id: value.replace(/,\s?/g, ", "), text: value.replace(/,\s?/g, ", ") };
| if (query !== "") { var newqueries = []; exp_queries = query.split(","); $.each(exp_queries, function(index, value ){ if(value.replace(/\s/g, '') != "") { var newquery = { id: value.replace(/,\s?/g, ", "), text: value.replace(/,\s?/g, ", ") };
|
newqueries.push(newquery); } }); callback(newqueries); }
|
newqueries.push(newquery); } }); callback(newqueries); }
|
| } }) .on("change", function(e) { if ({$mybb->usergroup['maxpmrecipients']} == 0) { return; } if (e.val.length >= {$mybb->usergroup['maxpmrecipients']}) { $("#bcc").select2("enable", false); } else { $("#bcc").select2("enable", true);
|
} });
|
} });
|
$("#bcc").select2({
| $("#bcc").select2({
|
placeholder: "{$lang->search_user}", minimumInputLength: 2,
|
placeholder: "{$lang->search_user}", minimumInputLength: 2,
|
maximumSelectionSize: {$mybb->usergroup['maxpmrecipients']},
| maximumSelectionSize: function() { if ({$mybb->usergroup['maxpmrecipients']} == 0) { return 0; } return Math.max(1, {$mybb->usergroup['maxpmrecipients']} - $("#to").select2('data').length); },
|
multiple: true, ajax: { // instead of writing the function to execute the request we use Select2's convenient helper url: "xmlhttp.php?action=get_users",
| multiple: true, ajax: { // instead of writing the function to execute the request we use Select2's convenient helper url: "xmlhttp.php?action=get_users",
|
Zeile 78 | Zeile 103 |
---|
}); callback(newqueries); }
|
}); callback(newqueries); }
|
| } }) .on("change", function(e) { if ({$mybb->usergroup['maxpmrecipients']} == 0) { return; } if (e.val.length >= {$mybb->usergroup['maxpmrecipients']}) { $("#to").select2("enable", false); } else { $("#to").select2("enable", true);
|
} }); }
| } }); }
|