src/Easy/EasyForm.php
protected function renderContextMenu()
    {
        $menuList = array();
        foreach ($this->panels as $panel) {
            $panel->rewind();
            while ($element = $panel->current()) {
                $panel->next();
                if (method_exists($element, 'getContextMenu') && $menus = $element->getContextMenu()) {
                    foreach ($menus as $m)
                        $menuList[] = $m;
                }
            }
        }
        if (count($menuList) == 0)
            return "";
        $str = "<div  class='contextMenu' id='" . $this->objectName . "_contextmenu'>\n";
        $str .= "<div class=\"contextMenu_header\" ></div>\n";
        $str .= "<ul>\n";
        foreach ($menuList as $m) {
            $func = $m['func'];
            $shortcutKey = isset($m['key']) ? " (" . $m['key'] . ")" : "";
            $str .= "<li><a href=\"javascript:void(0)\" onclick=\"$func\">" . $m['text'] . $shortcutKey . "</a></li>\n";
        }
        $str .= "</ul>\n";
        $str .= "<div class=\"contextMenu_footer\" ></div>\n";
        $str .= "</div>\n";
        if (defined('OPENBIZ_JSLIB_BASE') && OPENBIZ_JSLIB_BASE == 'JQUERY') {
            $str .= "
<script>
$(jq('" . $this->objectName . "')).removeAttr('onContextMenu');
$(jq('" . $this->objectName . "'))[0].oncontextmenu=function(event){return Openbizx.Menu.show(event, '" . $this->objectName . "_contextmenu');};
$(jq('" . $this->objectName . "')).bind('click',Openbizx.Menu.hide);
</script>";
        } else {
            $str .= "
<script>
$('" . $this->objectName . "').removeAttribute('onContextMenu');
$('" . $this->objectName . "').oncontextmenu=function(event){return Openbizx.Menu.show(event, '" . $this->objectName . "_contextmenu');};
$('" . $this->objectName . "').observe('click',Openbizx.Menu.hide);
</script>";
        }
        return $str;
    }
protected function renderContextMenu()
    {
        $menuList = array();
        foreach ($this->panels as $panel) {
            $panel->rewind();
            while ($element = $panel->current()) {
                $panel->next();
                if (method_exists($element, 'getContextMenu') && $menus = $element->getContextMenu()) {
                    foreach ($menus as $m)
                        $menuList[] = $m;
                }
            }
        }
        if (count($menuList) == 0)
            return "";
        $str = "<div  class='contextMenu' id='" . $this->objectName . "_contextmenu'>\n";
        $str .= "<div class=\"contextMenu_header\" ></div>\n";
        $str .= "<ul>\n";
        foreach ($menuList as $m) {
            $func = $m['func'];
            $shortcutKey = isset($m['key']) ? " (" . $m['key'] . ")" : "";
            $str .= "<li><a href=\"javascript:void(0)\" onclick=\"$func\">" . $m['text'] . $shortcutKey . "</a></li>\n";
        }
        $str .= "</ul>\n";
        $str .= "<div class=\"contextMenu_footer\" ></div>\n";
        $str .= "</div>\n";
        if (defined('OPENBIZ_JSLIB_BASE') && OPENBIZ_JSLIB_BASE == 'JQUERY') {
            $str .= "
<script>
$(jq('" . $this->objectName . "')).removeAttr('onContextMenu');
$(jq('" . $this->objectName . "'))[0].oncontextmenu=function(event){return Openbizx.Menu.show(event, '" . $this->objectName . "_contextmenu');};
$(jq('" . $this->objectName . "')).bind('click',Openbizx.Menu.hide);
</script>";
        } else {
            $str .= "
<script>
$('" . $this->objectName . "').removeAttribute('onContextMenu');
$('" . $this->objectName . "').oncontextmenu=function(event){return Openbizx.Menu.show(event, '" . $this->objectName . "_contextmenu');};
$('" . $this->objectName . "').observe('click',Openbizx.Menu.hide);
</script>";
        }
        return $str;
    }
Render context menu code

@return string html code for context menu