MDL-37380 mod_data: remove unused JS functions
[moodle.git] / mod / data / data.js
CommitLineData
9d0cffa5 1/**
2 * Javascript to insert the field tags into the textarea.
3 * Used when editing a data template
4 */
5function insert_field_tags(selectlist) {
b83f54f8
DC
6 var value = selectlist.options[selectlist.selectedIndex].value;
7 var editorname = 'template';
8 if (typeof tinyMCE == 'undefined') {
9 var element = document.getElementsByName(editorname)[0];
10 // For inserting when in normal textareas
11 insertAtCursor(element, value);
12 } else {
13 tinyMCE.execInstanceCommand(editorname, 'mceInsertContent', false, value);
14 }
9d0cffa5 15}
16
17/**
18 * javascript for hiding/displaying advanced search form when viewing
19 */
20function showHideAdvSearch(checked) {
21 var divs = document.getElementsByTagName('div');
22 for(i=0;i<divs.length;i++) {
23 if(divs[i].id.match('data_adv_form')) {
24 if(checked) {
25 divs[i].style.display = 'inline';
26 }
27 else {
28 divs[i].style.display = 'none';
29 }
30 }
31 else if (divs[i].id.match('reg_search')) {
32 if (!checked) {
33 divs[i].style.display = 'inline';
34 }
35 else {
36 divs[i].style.display = 'none';
37 }
38 }
39 }
26032c2d
DC
40}
41
e4256380
DC
42M.data_urlpicker = {};
43
44M.data_urlpicker.init = function(Y, options) {
e4256380
DC
45 options.formcallback = M.data_urlpicker.callback;
46 if (!M.core_filepicker.instances[options.client_id]) {
9d8de346 47 M.core_filepicker.init(Y, options);
e4256380
DC
48 }
49 Y.on('click', function(e, client_id) {
50 e.preventDefault();
51 M.core_filepicker.instances[client_id].show();
52 }, '#filepicker-button-'+options.client_id, null, options.client_id);
53
54};
55
56M.data_urlpicker.callback = function (params) {
cd4a1897 57 document.getElementById('field_url_'+params.client_id).value = params.url;
9d8de346 58};