id=$p_id;
$this->item=array();
$this->value=$value;
$this->cnt=0;
$this->default_value=-1;
$this->style_box="";
$this->filter="";
}
function input()
{
$list_id=sprintf('%s_list',$this->id);
// Show when click
$javascript=sprintf('$("%s_bt").onclick=function() {
try {
var newDiv=$("select_box%s");
var pos=$("%s_bt").cumulativeOffset();
newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id, $list_id,$list_id);
// Hide when out of the zone
$javascript.=sprintf('$("select_box%s").onmouseleave=function() {
try {
var newDiv=$("select_box%s");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}',$this->id,$this->id);
// display the button
printf('',
$this->id, $this->value);
printf('', $this->id,
$this->id, $this->default_value);
printf('
',
$this->id, $this->style_box);
// Show the filter if there is one,
if ( $this->filter != "" ) {
echo HtmlInput::filter_list($list_id);
}
// Print the list of possible options
printf('
',$list_id);
for ($i=0; $iitem); $i++)
{
if ($this->item[$i]['type']=="url")
{
printf('