1 var coursetagdivs = null;
2 var coursetag_tags = new Array();
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 = {
12 myDataSource.maxCacheEntries = 60;
13 myDataSource.minQueryLength = 3;
15 // Instantiate the AutoComplete
16 var myAutoComp = new Y.YUI2.widget.AutoComplete("id_relatedtags", "relatedtags-autocomplete", myDataSource);
17 document.getElementById('id_relatedtags').style.width = '30%';
18 myAutoComp.allowBrowserAutocomplete = false;
19 myAutoComp.maxResultsDisplayed = 20;
20 myAutoComp.delimChar = [","," "];
21 myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) {
22 return (sResultMatch);
26 myDataSource: myDataSource,
27 myAutoComp: myAutoComp
32 function ctags_checkinput(val) {
34 if (len < 2 || len > 50) {
35 alert(M.str.block_tags.jserror1);
37 } else if (val.indexOf("<") > 0) {
38 alert(M.str.block_tags.jserror2);
40 } else if (val.indexOf(">") > 0) {
41 alert(M.str.block_tags.jserror2);
48 function set_course_tag(key) {
49 window.coursetag_tags[window.coursetag_tags.length] = key;
52 function add_tag_footer_link(eid, ltitle, laction, ltext) {
53 var e = document.getElementById(eid);
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);
62 YUI().use('yui2-event', function(Y) {
63 Y.YUI2.util.Event.addListener(link, 'click', callback);
65 if (e.childNodes.length > 0) {
66 e.appendChild(document.createTextNode(' | '));
68 e.appendChild(document.createElement('hr'));