1/* DOKUWIKI:include title.js */ 2 3function addBtnActionNumberingNext($btn, props, edid) { 4 $btn.click(function() { 5 numberingNextNumber(edid) ; 6 return false; 7 }); 8 9 return true; 10} 11 12 13if (window.toolbar != undefined) { 14 window.toolbar[window.toolbar.length] = { 15 "type":"NumberingNext", 16 "title": window.NumberingToolBarTtitle || "Insert next number", 17 "icon":"../../plugins/numbering/sernum_2.png" 18 }; 19} 20 21jQuery( document ).ready(function() { 22 jQuery("[id^=bureau_num_]").on('click',function(e) { 23 var id = this.id.replace(/num/,'nmbr'); 24 var _ret = jQuery('#' + id); 25 var params = ""; 26 params = 'call=numbr_bureau'; 27 if(JSINFO['nmbring_multi_db']) { 28 params += '&data-db=' + _ret.attr("data-db"); 29 } 30 jQuery.ajax({ 31 url: DOKU_BASE + 'lib/exe/ajax.php', 32 async: true, 33 data: params, 34 type: 'POST', 35 dataType: 'html', 36 success: function(data){ 37 if(data) _ret.val(data); 38 } 39 }); 40 }); 41}); 42 43 44function numberingNextNumber(edid) { 45 var debug = false; 46 var params = ""; 47 jQuery.ajax({ 48 url: DOKU_BASE + 'lib/plugins/numbering/scripts/getnum.php', 49 async: true, 50 data: params, 51 type: 'POST', 52 dataType: 'html', 53 success: function(data){ 54 if(debug) { 55 alert(data); 56 } 57 58 if(DWgetSelection) { 59 numberInsertAtCarret(edid,data); 60 } 61 else window.insertAtCarret(edid,data); 62 } 63 }); 64 65} 66 67 var numberInsertAtCarret = function (textAreaID, text) 68 { 69 var txtarea = jQuery('#' + textAreaID)[0]; 70 var selection = DWgetSelection(txtarea); 71 add = selection.getText(); 72 if(add) { 73 add = add.replace(/^\s+/); 74 add = add.replace(/\s+$/); 75 text = text.replace(/%R/,add); 76 } 77 pasteText(selection,text); 78 }; 79 80