img=="divider") { $o .= "\n"; } else { if(strlen($this->link)>1) { $o .= "link."\" onMouseOut=\"".$this->onMouseOut."\""; $o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">\n"; $o .= "img."\" title=\"".inp_htmlize(language($this->alt))."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\">"; $o .= "\n"; } else { $o .= "img."\" title=\"".inp_htmlize(language($this->alt))."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\""; $o .= " onMouseOut=\"".$this->onMouseOut."\""; $o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">"; } } return $o; } function GetID() { // get image id (for javascript operations) return $this->img; } } class clsToolBar { var $Items; var $m_section; var $m_load_menu_func; var $m_CheckClass; var $m_CheckForm; var $InitScript; var $DoubleClickAction; var $ContextMenu; function clsToolBar() { $this->Items = array(); $this->InitScript = array(); $this->ContextMenu = array(); } function Get($name) { $var = "m_" . $name; return $this->$var; } function Set($name, $value) { if (is_array($name)) { for ($i=0; $i$var = $value[$i]; $this->m_dirtyFieldsMap[$name[$i]] = $value[$i]; echo "$var = ".$value[$i]."
\n"; } } else { $var = "m_" . $name; $this->$var = $value; $this->m_dirtyFieldsMap[$name] = $value; } } function Add($img,$alt="",$link="",$MouseOver="",$MouseOut="",$onClick="", $filename="",$IsDblClick=FALSE,$ContextMenu=FALSE) { global $imagesURL; $t = new clsToolBarItem(); $t->img = $img; $t->alt = $alt; $t->link = $link; $t->onMouseOver = $MouseOver; $t->onMouseOut = $MouseOut; $t->onClick = $onClick; if(strlen($filename)==0) { $t->filename = $imagesURL."/toolbar/tool_".$img.".gif"; } else { if(substr($filename,0,4)=="http") { $t->filename = $filename; } else { if(substr($filename,0,8)!="toolbar/") $filename = "toolbar/".$filename; if(substr($filename,0,1)!="/") $filename = "/".$filename; $t->filename = $imagesURL.$filename; } } array_push($this->Items,$t); if($IsDblClick) $this->DoubleClickAction=$onClick; if($ContextMenu) $this->ContextMenu[] = "contextMenu.addMenuItem('".admin_language($alt)."',\"$onClick\",\"\");"; return $t; } function AddToInitScript($s) { if(is_array($s)) { for($i=0;$iInitScript,$s[$i]); } else array_push($this->InitScript,$s); } function GetInitScript() { global $envar; $s=""; if(count($this->InitScript)>0) $s = implode("\n",$this->InitScript); if(strlen($this->Get("CheckClass"))) { $c = $this->Get("CheckClass")." = new CheckArray();\n"; $c .=$this->Get("CheckClass").".formname='".$this->Get("CheckForm")."';\n"; $c .=$this->Get("CheckClass").".envar='$envar';\n"; $s = $c.$s; } $s .= "\n".$this->GetActionHandlerScript(); // $s .= "\n".$this->Get("CheckClass").".setImages();\n"; return ""; } function GetActionHandlerScript() { $o = ''; $o .= "function handleDoubleClick()\n{\n"; if(strlen($this->DoubleClickAction)>0) { $o .= " ".$this->DoubleClickAction."\n"; } else { $o .= 'return'; } $o .= "}\n\n"; if(count($this->ContextMenu)) { $o .= "function initContextMenu()\n{\n"; $o .= " window.contextMenu = new Menu(\"Context\");"; for($x=0;$xContextMenu);$x++) { $o .= " ".$this->ContextMenu[$x]."\n"; } $o .= " window.triedToWriteMenus = false;\n window.contextMenu.writeMenus();\n return true;\n}\n"; } return $o; } function Build() { global $imagesURL; $btn_ids = Array(); $o = ''; //$o .= ''."\n"; foreach($this->Items as $t) { $o .= ''; $btn_ids[] = $t->GetID(); } $o .= '
'.$t->GetItem().'
'."\n"; $btn_ids = "'".implode("','", $btn_ids)."'"; $o .= ''; return $o; } function onLoadString() { return ""; } } class clsItemTabs { var $Tabs; var $ItemCount; function clsItemTabs() { $this->Tabs = array(); $this->ItemCount = array(); } function SetItemCount($divname,$Value) { $this->ItemCount[$divname] = $Value; } function GetItemCount($divname) { return (int)$this->ItemCount[$divname]; } function AddTab($Caption,$divname,$ItemCount,$selected,$numfunc="") { $t["caption"]=$Caption; $t["divname"]=$divname; $this->SetItemCount($divname,$ItemCount); $t["selected"]=$selected; $t["numfunc"]=$numfunc; $this->Tabs[] = $t; } function TabItem($i) { global $imagesURL; $t = $this->Tabs[$i]; if($t["selected"]==1) { $divimage="/divider_up.gif"; } else $divimage="/divider_dn.gif"; $div = $t["divname"]; $o .= "\n"; $o .= " "; $o .= $t["caption"].""; $func = $t["numfunc"]; if(is_numeric($func)) { $total = $func; } else { if(function_exists($func)) { $total = $func(); } } if(!is_numeric($total)) $total = $this->GetItemCount($div); if($total==$this->GetItemCount($div)) { $o .= "(".$this->GetItemCount($div).")\n"; } else $o .= "(".$this->GetItemCount($div)." / ".$total.")\n"; return $o; } function tabRow() { $o = ""; $o .= ""; for($i=0;$iTabs);$i++) { $o .= $this->TabItem($i); } $o .= ""; //$o .= ""; //$o .= ""; $o .= "
"; return $o; } } ?>