1 var coursetagdivs = null;
2 var coursetag_tags = new Array();
4 function init_tag_autocomplete() {
6 var myDataSource = new YAHOO.util.XHRDataSource("./tag_autocomplete.php");
7 myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
8 myDataSource.responseSchema = {
12 myDataSource.maxCacheEntries = 60;
13 myDataSource.minQueryLength = 3;
15 // Instantiate the AutoComplete
16 var myAutoComp = new YAHOO.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_divs(ctagdivs) {
49 window.coursetagdivs = ctagdivs;
52 function set_course_tag(key) {
53 window.coursetag_tags[window.coursetag_tags.length] = key;
56 function add_tag_footer_link(eid, ltitle, laction, ltext) {
57 var e = document.getElementById(eid);
59 var link = document.createElement('a');
60 link.setAttribute('href', '');
61 link.setAttribute('title', ltitle);
62 link.appendChild(document.createTextNode(ltext));
63 var callback = function () {
64 ctags_show_div(laction);
66 YAHOO.util.Event.addListener(link, 'click', callback);
67 if (e.childNodes.length > 0) {
68 e.appendChild(document.createTextNode(' | '));
70 e.appendChild(document.createElement('hr'));