forked from extern/egroupware
dragdrop: make class aware of multiple instances and make wz_dragdrop::ADD_DTHML() more performant
This commit is contained in:
parent
7cb034e071
commit
4a0af9f977
@ -120,7 +120,7 @@ class dragdrop
|
||||
if(!$GLOBALS['egw_info']['flags']['wz_dragdrop_included'])
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_dragdrop/wz_dragdrop.js"></script>'."\n";
|
||||
$GLOBALS['egw_info']['flags']['wz_dragdrop_included'] = True;
|
||||
$GLOBALS['egw_info']['flags']['wz_dragdrop_included'] = true;
|
||||
}
|
||||
|
||||
// include actionScripts
|
||||
@ -128,7 +128,7 @@ class dragdrop
|
||||
{
|
||||
foreach($this->actionScripts as $i => $actionScript)
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= "<script language='JavaScript' type='text/javascript' src='".$actionScript['file']."'></script>\n";
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript" src="'.$actionScript['file'].'"></script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,20 +137,22 @@ class dragdrop
|
||||
{
|
||||
foreach($this->draggables as $i=>$element)
|
||||
{
|
||||
$element_names_array[] = "\"".$element['name']."\"";
|
||||
$element_names_array[] = '"'.$element['name'].'"+CURSOR_HAND+TRANSPARENT+SCROLL';
|
||||
}
|
||||
}
|
||||
if(is_array($this->droppables))
|
||||
{
|
||||
foreach($this->droppables as $i=>$element)
|
||||
{
|
||||
$element_names_array[] = "\"".$element['name']."\"";
|
||||
$element_names_array[] = '"'.$element['name'].'"';
|
||||
}
|
||||
}
|
||||
if(is_array($element_names_array))
|
||||
{
|
||||
$element_names=implode(",",$element_names_array);
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript">SET_DHTML(SCROLL,TRANSPARENT,CURSOR_HAND,'.$element_names.');</script>'."\n";
|
||||
$element_names=implode(',',$element_names_array);
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript">'."\n";
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= $this->DHTMLcommand().'('.$element_names.')'."\n";
|
||||
$GLOBALS['egw_info']['flags']['need_footer'] .= '</script>'."\n";
|
||||
}
|
||||
|
||||
// set special params for draggable elements
|
||||
@ -315,4 +317,22 @@ class dragdrop
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* evaluate the right DHTML command for adding DHTML objects
|
||||
*
|
||||
* @return string 'SET_DHTML' or 'ADD_DHTML'
|
||||
*/
|
||||
function DHTMLcommand()
|
||||
{
|
||||
if(!$GLOBALS['egw_info']['flags']['wz_dragdrop_runonce_SET_DHTML'])
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['wz_dragdrop_runonce_SET_DHTML'] = true;
|
||||
return 'SET_DHTML';
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'ADD_DHTML';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1360,11 +1360,14 @@ function SET_DHTML()
|
||||
window.onunload = dd.finlz;
|
||||
dd.setDwnHdl(PICK);
|
||||
}
|
||||
function ADD_DHTML(d_o) // layers only!
|
||||
function ADD_DHTML() // layers only!
|
||||
{
|
||||
d_o = new DDObj(d_o);
|
||||
dd.addElt(d_o);
|
||||
dd.addProps(d_o);
|
||||
var d_a = arguments, d_o, d_i = d_a.length; while(d_i--)
|
||||
{
|
||||
d_o = new DDObj(d_a[d_i]);
|
||||
dd.addElt(d_o);
|
||||
dd.addProps(d_o);
|
||||
}
|
||||
dd.mkWzDom();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user