185 lines
3.8 KiB
PHP
185 lines
3.8 KiB
PHP
<?php
|
|
namespace Phast\WebControls;
|
|
|
|
use Phast\System;
|
|
use Phast\WebControl;
|
|
use Phast\Enumeration;
|
|
|
|
use Phast\HTMLControl;
|
|
|
|
use Phast\WebControls\Menu;
|
|
|
|
abstract class AdditionalDetailWidgetDisplayStyle extends Enumeration
|
|
{
|
|
const Magnify = 1;
|
|
const Ellipsis = 2;
|
|
const Arrow = 3;
|
|
}
|
|
|
|
class AdditionalDetailWidget extends WebControl
|
|
{
|
|
public $DisplayStyle; /* AdditionalDetailWidgetDisplayStyle */
|
|
public $Text;
|
|
|
|
public $ShowText; /* bool */
|
|
public $ShowURL; /* bool */
|
|
|
|
public $TargetFrame;
|
|
public $TargetURL;
|
|
public $TargetScript;
|
|
|
|
public $MenuItems;
|
|
public $MenuItemHeaderText;
|
|
|
|
public $PreviewContentURL;
|
|
|
|
public $ClassTitle;
|
|
|
|
public function __construct($id)
|
|
{
|
|
parent::__construct($id);
|
|
$this->ClassTitle = "";
|
|
$this->DisplayStyle = AdditionalDetailWidgetDisplayStyle::Ellipsis;
|
|
$this->MenuItemHeaderText = "Available Actions";
|
|
$this->MenuItems = array();
|
|
$this->ShowText = true;
|
|
$this->ShowURL = true;
|
|
}
|
|
|
|
private function RenderMenuItem($mi)
|
|
{
|
|
if (get_class($mi) == "Phast\\WebControls\\MenuItemCommand")
|
|
{
|
|
echo("<a href=\"");
|
|
if ($mi->PostBackUrl == "")
|
|
{
|
|
echo("#");
|
|
}
|
|
else
|
|
{
|
|
echo(System::ExpandRelativePath($mi->PostBackUrl));
|
|
}
|
|
echo("\"");
|
|
if ($mi->OnClientClick != "")
|
|
{
|
|
echo(" onclick=\"" . $mi->OnClientClick . "\"");
|
|
}
|
|
echo(">");
|
|
echo($mi->Title);
|
|
echo("</a>");
|
|
}
|
|
else if (get_class($mi) == "Phast\\WebControls\\MenuItemSeparator")
|
|
{
|
|
echo("<br />");
|
|
}
|
|
}
|
|
|
|
protected function OnInitialize()
|
|
{
|
|
$this->TagName = "div";
|
|
$this->ClassList[] = "uwt-actionpreviewbutton";
|
|
if ($this->ShowText)
|
|
{
|
|
$this->ClassList[] = "apb-show-text";
|
|
}
|
|
switch ($this->DisplayStyle)
|
|
{
|
|
case AdditionalDetailWidgetDisplayStyle::Magnify:
|
|
{
|
|
$this->ClassList[] = "apb-style-magnify";
|
|
break;
|
|
}
|
|
case AdditionalDetailWidgetDisplayStyle::Arrow:
|
|
{
|
|
$this->ClassList[] = "apb-style-arrow";
|
|
break;
|
|
}
|
|
case AdditionalDetailWidgetDisplayStyle::Ellipsis:
|
|
{
|
|
$this->ClassList[] = "apb-style-ellipsis";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private function renderMainLink()
|
|
{
|
|
if ($this->ShowURL)
|
|
{
|
|
echo("<a class=\"apb-text\" href=\"");
|
|
if ($this->TargetURL != "")
|
|
{
|
|
echo(System::ExpandRelativePath($this->TargetURL));
|
|
}
|
|
else
|
|
{
|
|
echo("#");
|
|
}
|
|
echo("\"");
|
|
|
|
if ($this->TargetFrame != "")
|
|
{
|
|
echo(" target=\"" . $this->TargetFrame . "\"");
|
|
}
|
|
|
|
echo(">");
|
|
echo($this->Text);
|
|
echo("</a>");
|
|
}
|
|
else
|
|
{
|
|
echo ("<a class=\"apb-text apb-empty\" href=\"#\">" . $this->Text . "</span>");
|
|
}
|
|
}
|
|
|
|
protected function BeforeContent()
|
|
{
|
|
$this->renderMainLink();
|
|
|
|
echo("<a class=\"apb-button\" href=\"#\" tabindex=\"-1\"> </a>");
|
|
|
|
echo("<div class=\"apb-preview uwt-popup\">");
|
|
|
|
echo("<div class=\"apb-actions");
|
|
if (count($this->MenuItems) <= 0)
|
|
{
|
|
echo(" uwt-empty");
|
|
}
|
|
echo("\">");
|
|
echo("<h2>" . $this->MenuItemHeaderText . "</h2>");
|
|
|
|
$menu = new Menu();
|
|
foreach ($this->MenuItems as $mi)
|
|
{
|
|
if (is_array($mi->Items) && count($mi->Items) > 0)
|
|
{
|
|
$mi->ClassList[] = "uwt-menu-item-popup";
|
|
}
|
|
$mi->SubmenuClasslist[] = "uwt-popup";
|
|
$menu->Items[] = $mi;
|
|
}
|
|
$menu->Render();
|
|
|
|
echo("</div>");
|
|
|
|
echo("<div class=\"apb-preview-content\">");
|
|
echo("<div class=\"apb-header\">");
|
|
echo("<h2>");
|
|
echo("<span class=\"apb-class-title\">" . $this->ClassTitle . "</span>");
|
|
|
|
$this->renderMainLink();
|
|
|
|
echo("</h2>");
|
|
echo("</div>");
|
|
echo("<div class=\"apb-content\">");
|
|
}
|
|
protected function AfterContent()
|
|
{
|
|
echo("</div>");
|
|
echo("</div>");
|
|
echo("<div class=\"uwt-spinner\"> </div>");
|
|
|
|
echo("</div>");
|
|
}
|
|
}
|
|
?>
|