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 var element = document.getElementsByName(editorname)[0];
10 // For inserting when in normal textareas
11 insertAtCursor(element, value);
13 tinyMCE.execInstanceCommand(editorname, 'mceInsertContent', false, value);
18 * javascript for hiding/displaying advanced search form when viewing
20 function 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')) {
25 divs[i].style.display = 'inline';
28 divs[i].style.display = 'none';
31 else if (divs[i].id.match('reg_search')) {
33 divs[i].style.display = 'inline';
36 divs[i].style.display = 'none';
42 M.data_filepicker = {};
45 M.data_filepicker.callback = function(params) {
46 var html = '<a href="'+params['url']+'">'+params['file']+'</a>';
47 document.getElementById('file_info_'+params['client_id']).innerHTML = html;
51 * This fucntion is called for each file picker on page.
53 M.data_filepicker.init = function(Y, options) {
54 options.formcallback = M.data_filepicker.callback;
55 if (!M.core_filepicker.instances[options.client_id]) {
56 M.core_filepicker.init(Y, options);
58 Y.on('click', function(e, client_id) {
60 M.core_filepicker.instances[client_id].show();
61 }, '#filepicker-button-'+options.client_id, null, options.client_id);
63 var item = document.getElementById('nonjs-filepicker-'+options.client_id);
65 item.parentNode.removeChild(item);
67 item = document.getElementById('filepicker-wrapper-'+options.client_id);
69 item.style.display = '';
73 M.data_urlpicker = {};
75 M.data_urlpicker.init = function(Y, options) {
76 options.formcallback = M.data_urlpicker.callback;
77 if (!M.core_filepicker.instances[options.client_id]) {
78 M.core_filepicker.init(Y, options);
80 Y.on('click', function(e, client_id) {
82 M.core_filepicker.instances[client_id].show();
83 }, '#filepicker-button-'+options.client_id, null, options.client_id);
87 M.data_urlpicker.callback = function (params) {
88 document.getElementById('field_url_'+params.client_id).value = params.url;
91 M.data_imagepicker = {};
93 M.data_imagepicker.callback = function(params) {
94 var html = '<a href="'+params['url']+'"><img src="'+params['url']+'" /> '+params['file']+'</a>';
95 document.getElementById('file_info_'+params['client_id']).innerHTML = html;
99 * This fucntion is called for each file picker on page.
101 M.data_imagepicker.init = function(Y, options) {
102 options.formcallback = M.data_imagepicker.callback;
103 if (!M.core_filepicker.instances[options.client_id]) {
104 M.core_filepicker.init(Y, options);
106 Y.on('click', function(e, client_id) {
108 M.core_filepicker.instances[client_id].show();
109 }, '#filepicker-button-'+options.client_id, null, options.client_id);
111 var item = document.getElementById('nonjs-filepicker-'+options.client_id);
113 item.parentNode.removeChild(item);
115 item = document.getElementById('filepicker-wrapper-'+options.client_id);
117 item.style.display = '';