Page MenuHomeIn-Portal Phabricator

toolbar.php
No OneTemporary

File Metadata

Created
Thu, Nov 20, 12:47 PM

toolbar.php

<?php
##############################################################
## In-portal :: Administration Interfaces :: Tool Bar ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
class clsToolBarItem
{
var $m_img;
var $m_alt;
var $link;
var $onMouseOver;
var $onMouseOut;
var $onClick;
var $filename;
function clsToolBarItem()
{
}
function GetItem()
{
global $imagesURL;
$o = "";
if ($this->img=="divider")
{
$o .= "<img src=\"".$imagesURL."/toolbar/tool_divider.gif\" width=\"4\" height=\"32\" border=\"0\">\n";
}
else
{
if(strlen($this->link)>1)
{
$o .= "<a href=\"".$this->link."\" onMouseOut=\"".$this->onMouseOut."\"";
$o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">\n";
$o .= "<img ID=\"".$this->img."\" title=\"".inp_htmlize(language($this->alt))."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\">";
$o .= "</a>\n";
}
else
{
$o .= "<img ID=\"".$this->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<sizeof($name); $i++)
{ $var = "m_" . $name[$i];
$this->$var = $value[$i];
$this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
echo "$var = ".$value[$i]."<br>\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;$i<count($s);$i++)
array_push($this->InitScript,$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 "<SCRIPT language=\"JavaScript\">$s</SCRIPT>";
}
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;$x<count($this->ContextMenu);$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 = '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="toolbar">';
//$o .= '<tr><td><img title="|" src="'.$imagesURL.'/toolbar_start.gif" width="10" height="50" border="0"></td>'."\n";
foreach($this->Items as $t)
{
$o .= '<TD>'.$t->GetItem().'</TD>';
$btn_ids[] = $t->GetID();
}
$o .= '<TD width="100%"></TD></TR></TABLE>'."\n";
$btn_ids = "'".implode("','", $btn_ids)."'";
$o .= '<script language="javascript">
var toolbar_btns = Array('.$btn_ids.');
var i = 0, btn_count = toolbar_btns.length;
while(i < btn_count)
{
SetButtonStateByImage(toolbar_btns[i]);
i++;
}
</script>';
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 .= "<td width=\"138\" height=\"22\" noWrap";
$o .= " background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" ";
$o .= "tabHeaderOf=\"$div\" ";
$o .= "onclick=\"toggleTab('$div');\" style=\"cursor:hand\">\n";
$o .= " <img height=\"20\" src=\"".$imagesURL."/itemtabs/divider_empty.gif\" ";
$o .= "width=\"20\" border=\"0\" align=\"middle\">";
$o .= $t["caption"]."<span class=\"cats_stats\">";
$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).")</span></td>\n";
}
else
$o .= "(".$this->GetItemCount($div)." / ".$total.")</span></td>\n";
return $o;
}
function tabRow()
{
$o = "<table width=\"100%\" border=0 cellspacing=0 cellpadding=0>";
$o .= "<tr>";
for($i=0;$i<count($this->Tabs);$i++)
{
$o .= $this->TabItem($i);
}
$o .= "<td width=\"100%\"></td>";
//$o .= "<tr class=\"divider\">";
//$o .= "<td colspan=4><img src=\"".$imagesURL."/spacer.gif\" border=0 width=1 height=1></td>";
$o .= "</tr></table>";
return $o;
}
}
?>

Event Timeline