[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 var coursetagdivs = null; 2 var coursetag_tags = new Array(); 3 4 function init_tag_autocomplete() { 5 YUI().use('yui2-autocomplete', 'yui2-datasource', 'yui2-animation', 'yui2-connection', function(Y) { 6 var myDataSource = new Y.YUI2.util.XHRDataSource("./tag_autocomplete.php"); 7 myDataSource.responseType = Y.YUI2.util.XHRDataSource.TYPE_TEXT; 8 myDataSource.responseSchema = { 9 recordDelim: "\n", 10 fieldDelim: "\t" 11 }; 12 myDataSource.maxCacheEntries = 60; 13 14 // Instantiate the AutoComplete 15 var myAutoComp = new Y.YUI2.widget.AutoComplete("id_relatedtags", "relatedtags-autocomplete", myDataSource); 16 document.getElementById('id_relatedtags').style.width = '30%'; 17 myAutoComp.allowBrowserAutocomplete = false; 18 myAutoComp.maxResultsDisplayed = 20; 19 myAutoComp.minQueryLength = 3; 20 myAutoComp.delimChar = [","," "]; 21 myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) { 22 return (sResultMatch); 23 }; 24 25 return { 26 myDataSource: myDataSource, 27 myAutoComp: myAutoComp 28 }; 29 }); 30 } 31 32 function ctags_checkinput(val) { 33 var len = val.length; 34 if (len < 2 || len > 50) { 35 alert(M.str.block_tags.jserror1); 36 return false; 37 } else if (val.indexOf("<") > 0) { 38 alert(M.str.block_tags.jserror2); 39 return false; 40 } else if (val.indexOf(">") > 0) { 41 alert(M.str.block_tags.jserror2); 42 return false; 43 } else { 44 return true; 45 } 46 } 47 48 function set_course_tag(key) { 49 window.coursetag_tags[window.coursetag_tags.length] = key; 50 } 51 52 function add_tag_footer_link(eid, ltitle, laction, ltext) { 53 var e = document.getElementById(eid); 54 if (e) { 55 var link = document.createElement('a'); 56 link.setAttribute('href', ''); 57 link.setAttribute('title', ltitle); 58 link.appendChild(document.createTextNode(ltext)); 59 var callback = function () { 60 ctags_show_div(laction); 61 }; 62 YUI().use('yui2-event', function(Y) { 63 Y.YUI2.util.Event.addListener(link, 'click', callback); 64 }); 65 if (e.childNodes.length > 0) { 66 e.appendChild(document.createTextNode(' | ')); 67 } else { 68 e.appendChild(document.createElement('hr')); 69 } 70 e.appendChild(link); 71 } 72 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |