2 * Javascript to insert the field tags into the textarea.
3 * Used when editing a data template
5 function insert_field_tags(selectlist) {
6 var value = selectlist.options[selectlist.selectedIndex].value;
7 var editorname = 'template';
8 if (typeof tinyMCE == 'undefined') {
9 if (document.execCommand('insertText')) {
10 document.execCommand('insertText', false, value);
12 var element = document.getElementsByName(editorname)[0];
13 // For inserting when in normal textareas
14 insertAtCursor(element, value);
17 tinyMCE.execInstanceCommand(editorname, 'mceInsertContent', false, value);
22 * javascript for hiding/displaying advanced search form when viewing
24 function showHideAdvSearch(checked) {
25 var divs = document.getElementsByTagName('div');
26 for (var i = 0; i < divs.length; i++) {
27 if(divs[i].id.match('data_adv_form')) {
29 divs[i].style.display = 'inline';
31 divs[i].style.display = 'none';
33 } else if (divs[i].id.match('reg_search')) {
35 divs[i].style.display = 'inline';
37 divs[i].style.display = 'none';
39 } else if (divs[i].id.match('advsearch-save-sec')) {
41 divs[i].style.display = 'inline';
43 divs[i].style.display = 'none';
49 M.data_urlpicker = {};
51 M.data_urlpicker.init = function(Y, options) {
52 options.formcallback = M.data_urlpicker.callback;
53 if (!M.core_filepicker.instances[options.client_id]) {
54 M.core_filepicker.init(Y, options);
56 Y.on('click', function(e, client_id) {
58 M.core_filepicker.instances[client_id].show();
59 }, '#filepicker-button-'+options.client_id, null, options.client_id);
63 M.data_urlpicker.callback = function (params) {
64 document.getElementById('field_url_'+params.client_id).value = params.url;