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(i=0;i<divs.length;i++) {
27 if(divs[i].id.match('data_adv_form')) {
29 divs[i].style.display = 'inline';
32 divs[i].style.display = 'none';
35 else if (divs[i].id.match('reg_search')) {
37 divs[i].style.display = 'inline';
40 divs[i].style.display = 'none';
46 M.data_urlpicker = {};
48 M.data_urlpicker.init = function(Y, options) {
49 options.formcallback = M.data_urlpicker.callback;
50 if (!M.core_filepicker.instances[options.client_id]) {
51 M.core_filepicker.init(Y, options);
53 Y.on('click', function(e, client_id) {
55 M.core_filepicker.instances[client_id].show();
56 }, '#filepicker-button-'+options.client_id, null, options.client_id);
60 M.data_urlpicker.callback = function (params) {
61 document.getElementById('field_url_'+params.client_id).value = params.url;