<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>template.con_str_overview.html</title>
{_META_HEAD_CONTENIDO_}
{_CSS_HEAD_CONTENIDO_}
    <link rel="stylesheet" type="text/css" href="styles/tree.css">
{_JS_HEAD_CONTENIDO_}
    <script type="text/javascript" src="scripts/rowMark.js"></script>
    <script type="text/javascript" src="scripts/cfoldingrow.js"></script>
    <script type="text/javascript" src="scripts/parameterCollector.js"></script>
</head>
<body>

<!--{SYNCRONIZATION}-->
<ul class="con_str_tree" {DIRECTION}>
  <li class="root"><em>Root</em>
    {CATS}
  </li>
</ul>
<!--div style="margin-top:10px"></div-->

<script type="text/javascript">

function reloadRightFrame() {
    try {
        var frameRightBottom = Con.getFrame('right_bottom');
        frameRightBottom.location.href = Con.UtilUrl.replaceParams(frameRightBottom.location.href, {action: null});

        // Con.getFrame('right_bottom').location.reload();

        var frameRightTop = Con.getFrame('right_top');
        frameRightTop.location.href = Con.UtilUrl.replaceParams(frameRightTop.location.href, {action: null});

        // Con.getFrame('right_top').location.reload();
    } catch (e) {
        Con.log(['reloadRightFrame() fail', e], 'template.con_str_overwiew.html', 'warn');
    }
}

function getReference() {
    var refCfg = null;
    try {
        refCfg = Con.getFrame('left_top').cfg;
    } catch (e) {
        Con.log(['getReference() fail', e], 'template.con_str_overwiew.html', 'warn');
    }
    return refCfg;
}

function irgendwas() {
    var refCfg = getReference();
    if (refCfg) {
        var oRow = document.getElementById(refCfg.getRowId());
        // @TODO What is con???
        if (Con.isNs) {
            window.scrollTo(refCfg.scrollX, refCfg.scrollY);
        }

        if (oRow) {
            // @TODO What is con???
            con.overColor = 'transparent';
            con.markedColor = 'transparent';
            con.overMarked = 'transparent';
            con.over(oRow);
            //con.click(oRow); Uncomment for CON-2538
        } else {
            con.reset();
            //cfg.reset();
            rowMarkRefreshSyncScreen(0);
        }
    }
}

// Ugly frame concept seems to lead to ugly timeout problem -> wait some millis
if (!getReference()) {
    setTimeout(function() {
        irgendwas();
    }, 1000);
} else {
    irgendwas();
}

{RELOAD_RIGHT}

var catlist = [{WHOLELIST}];
var scatlist = catlist.join(',');

(function(Con, $) {
    $(function() {

        try {
            var frameResize = Con.getFrame('content').frameResize;
            var elems = document.getElementsByClassName('con_str_tree');
            var myTable = elems[0];

            frameResize.optimalSize = myTable.offsetWidth;
        } catch (e) {
            Con.log(['frameResize update fail', e], 'template.con_str_overwiew.html', 'warn');
        }

        $(".con_str_tree li:last-child").addClass('last');

        $(".con_str_tree .root li div em a").click(function() {
            $(this).parent().parent().parent().toggleClass("collapsed");
            var sRowid = $(this).parent().parents("li").attr('id');
            var aRowids = sRowid.split("-");
            var iIdcat = aRowids[0];
            $.post("{AJAXURL}", { area: "{AREA}", action: "toggle", idcat: iIdcat, wholelist: scatlist, contenido: Con.sid });
            return false;
        });

        $(".con_str_tree li div > a").click(function() {
            if ($(this).attr('class') != 'off_disabled') {
                var collapsed = $(this).parent().parent("li").hasClass("collapsed");
                $(this).parent().parent("li").removeClass("collapsed");
                $(".con_str_tree li.active").removeClass('active');
                $(this).parent().parent("li").addClass("active");
                var sRowid = $(this).parent().parent("li").attr('id');
                var aRowids = sRowid.split("-");
                var iIdcat = aRowids[0];
                var iIdtpl = aRowids[1];
                rowMarkConClick(this.parentNode.parentNode);
                Con.multiLink(
                    'right_top', 'main.php?area={AREA}&frame=3&idcat=' + iIdcat + '&idtpl=' + iIdtpl + '&display_menu=1&syncoptions={SYNCOPTIONS}&contenido=' + Con.sid,
                    'right_bottom', 'main.php?area={AREA}&frame=4&idcat=' + iIdcat + '&idtpl=' + iIdtpl + '&syncoptions={SYNCOPTIONS}&contenido=' + Con.sid
                );
                if (collapsed) {
                    $.post("{AJAXURL}", { area: "{AREA}", action: "expand", idcat: iIdcat, wholelist: scatlist, contenido: Con.sid });
                }
            }
            return false;
        });

        $(".con_str_tree li div > a.off_disabled").css('cursor', 'default');

        $(".con_str_tree .root li div").hover(function() {
            $(this).addClass('hover');
        }, function() {
            $(this).removeClass('hover');
        });

        $(".con_str_tree .root li div").mousedown(function() {
            $(".con_str_tree .root li div.active").removeClass("active");
            $(this).addClass("active");
        });

        $(".con_str_tree .root li div").click(function() {
            rowMarkConClick(this.parentNode);
        });
    });
})(Con, Con.$);

</script>

</body>
</html>
