Index: openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl 14 Aug 2008 00:48:06 -0000 1.8 +++ openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl 9 Sep 2008 01:10:49 -0000 1.9 @@ -673,6 +673,8 @@ {-delimchar ","} {-useiframe "true"} {-maxresults "20"} + {-forceselection "false"} + {-events {}} } { Generates the javascript to create a YUI autocomplete object from a tcl list http://developer.yahoo.com/yui/autocomplete/ @@ -732,11 +734,21 @@ append script "${varname}.maxResultsDisplayed=${maxresults};" append script "${varname}.useIFrame=${useiframe};" append script "${varname}.delimChar=\"${delimchar}\";" - append script "${varname}.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {var pos = YAHOO.util.Dom.getXY(oTextbox);pos\[1\] += YAHOO.util.Dom.get(oTextbox).offsetHeight;YAHOO.util.Dom.setXY(oContainer,pos);YAHOO.util.Dom.setStyle(oContainer,'overflow-y','auto');YAHOO.util.Dom.setStyle(oContainer,'overflow-x','hidden');YAHOO.util.Dom.setStyle(oContainer,'position','absolute');YAHOO.util.Dom.setStyle(oContainer,'height','150px');YAHOO.util.Dom.setStyle(oContainer,'z-index','100');return true;};" - append script ${format} - append script "${varname}.containerCollapseEvent.subscribe([ah::create_js_function -body "YAHOO.util.Dom.setStyle('${id}', 'height', 0)" -parameters [list "type" "args"] ]);" - append script "${varname}.itemArrowToEvent.subscribe([ah::create_js_function -body "elItem\[1\].scrollIntoView(false)" -parameters [list "oSelf" "elItem"] ]); " - + + append script "${varname}.forceSelection=\"${forceselection}\";" + append script "${varname}.allowBrowserAutocomplete=false;" + append script "${varname}.typeAhead=true;" + append script ${format} + +# append script "${varname}.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {var pos = YAHOO.util.Dom.getXY(oTextbox);pos\[1\] += YAHOO.util.Dom.get(oTextbox).offsetHeight;YAHOO.util.Dom.setXY(oContainer,pos);YAHOO.util.Dom.setStyle(oContainer,'overflow-y','auto');YAHOO.util.Dom.setStyle(oContainer,'overflow-x','hidden');YAHOO.util.Dom.setStyle(oContainer,'position','absolute');YAHOO.util.Dom.setStyle(oContainer,'height','150px');YAHOO.util.Dom.setStyle(oContainer,'z-index','100');return true;};" +# append script ${format} +# append script "${varname}.containerCollapseEvent.subscribe([ah::create_js_function -body "YAHOO.util.Dom.setStyle('${id}', 'height', 0)" -parameters [list "type" "args"] ]);" +# append script "${varname}.itemArrowToEvent.subscribe([ah::create_js_function -body "elItem\[1\].scrollIntoView(false)" -parameters [list "oSelf" "elItem"] ]); " + + foreach {name value} $events { + append script "${varname}.${name}.subscribe${value};\n" + } + # prevent the container from overlapping other elements, e.g. buttons, links # remove the yui-ac-input class @@ -752,4 +764,5 @@ append ajax_helper_init_scripts $script } -} \ No newline at end of file +} +