Пример #1
0
function display_hierarchy(&$root, &$userid, $modifyall, &$users, &$menupos, &$openedArray, &$pagelist, &$image_true, &$image_set_false, &$image_set_true, &$upImg, &$downImg, &$viewImg, &$editImg, &$copyImg, &$deleteImg, &$expandImg, &$contractImg, &$mypages, &$page, $columnstodisplay, $author_allpages)
{
    global $thisurl;
    global $urlext;
    global $currow;
    global $config;
    global $page;
    global $indent;
    if (empty($currow)) {
        $currow = 'row1';
    }
    $children = $root->getChildren(false, true);
    $one = $root->getContent();
    $thelist = '';
    if (!(isset($one) && $one != NULL)) {
        audit($root->get_tag('id'), 'Core', 'failed to get content for valid content id ' . $root->get_tag('id'));
        return;
    }
    if (!array_key_exists($one->Owner(), $users)) {
        $userops = cmsms()->GetUserOperations();
        $users[$one->Owner()] = $userops->LoadUserById($one->Owner());
    }
    $display = 'none';
    if (check_modify_all($userid) || check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) {
        $display = 'edit';
    } else {
        if (check_children($root, $mypages, $userid)) {
            $display = 'view';
        } else {
            if (check_permission($userid, 'Manage All Content')) {
                $display = 'structure';
            }
        }
    }
    $columns = array();
    if ($display != 'none') {
        $thelist .= "<tr id=\"tr_" . $one->Id() . "\" class=\"{$currow}\">\n";
        /* expand/collapse column */
        $columns['expand'] = '&nbsp;';
        if ($columnstodisplay['expand']) {
            $txt = '';
            if ($root->hasChildren()) {
                if (!in_array($one->Id(), $openedArray)) {
                    $txt .= "<a class=\"expand\" href=\"{$thisurl}&amp;content_id=" . $one->Id() . "&amp;col=0&amp;page=" . $page . "\" onclick=\"xajax_content_toggleexpand(" . $one->Id() . ", 'false'); return false;\">";
                    $txt .= $expandImg;
                    $txt .= "</a>";
                } else {
                    $txt .= "<a class=\"contract\" href=\"{$thisurl}&amp;content_id=" . $one->Id() . "&amp;col=1&amp;page=" . $page . "\" onclick=\"xajax_content_toggleexpand(" . $one->Id() . ", 'true'); return false;\">";
                    $txt .= $contractImg;
                    $txt .= "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['expand'] = $txt;
            }
        }
        /* hierarchy column */
        if ($columnstodisplay['hier']) {
            $columns['hier'] = $one->Hierarchy();
        }
        /* page column */
        if ($columnstodisplay['page']) {
            $columns['page'] = '&nbsp;';
            $txt = '';
            if ($one->MenuText() != CMS_CONTENT_HIDDEN_NAME) {
                if ($indent) {
                    for ($i = 0; $i < $root->getLevel(); $i++) {
                        $txt .= "-&nbsp;&nbsp;&nbsp;";
                    }
                }
                $str = $one->MenuText();
                if (get_site_preference('listcontent_showtitle', 0)) {
                    $str = $one->Name();
                }
                if ($display == 'edit') {
                    $txt .= '<a class="tooltip" href="editcontent.php' . $urlext . '&amp;content_id=' . $one->Id() . '&amp;page=' . $page . '" title="' . cms_htmlentities($one->Name() . ' (' . $one->Alias() . ')', '', '', true) . '" onmouseover="document.getElementById(\'' . $one->Id() . '_info\').style.display = \'inline-block\';" onmouseout="document.getElementById(\'' . $one->Id() . '_info\').style.display = \'none\';">
			' . cms_htmlentities($str, '', '', true) . '<span id="' . $one->Id() . '_info"><strong>' . lang('content_id') . ':</strong> ' . $one->Id() . '<br /> <strong>' . lang('title') . ':</strong> ' . cms_htmlentities($one->Name()) . '<br /> <strong>' . lang('pagealias') . ':</strong> ' . $one->Alias() . '</span></a>';
                } else {
                    $txt .= cms_htmlentities($str, '', '', true);
                }
            }
            if (!empty($txt)) {
                $columns['page'] = $txt;
            }
        }
        /* alias column */
        if ($columnstodisplay['alias']) {
            $columns['alias'] = '&nbsp;';
            $txt = '';
            if ($one->HasUsableLink() && $one->Alias() != '') {
                $txt = $one->Alias();
            }
            if (!empty($txt)) {
                $columns['alias'] = $txt;
            }
        }
        /* url column */
        if ($columnstodisplay['url']) {
            $columns['url'] = '&nbsp;';
            $txt = '';
            if ($one->HasUsableLink() && $one->URL() != '') {
                $url = $one->URL();
                if (strlen($url) > 30) {
                    $url = '...' . substr($url, strlen($url) - 27);
                }
                $txt = $url;
            }
            if (!empty($txt)) {
                if (!prettyurls_ok()) {
                    $txt = '<span style="color: red;" title="' . lang('prettyurls_noeffect') . '">' . $txt . '<span>';
                }
            }
            if (!empty($txt)) {
                $columns['url'] = $txt;
            }
        }
        /* template column */
        if ($columnstodisplay['template']) {
            $columns['template'] = '&nbsp;';
            $txt = '';
            if ($one->Type() != 'pagelink' && $one->Type() != 'link' && $one->Type() != 'sectionheader' && $one->Type() != 'separator') {
                $template = TemplateOperations::get_instance()->LoadTemplateById($one->TemplateId());
                if ($template && check_permission($userid, 'Modify Template')) {
                    $txt .= "<a title=\"" . lang('edittemplate') . "\" href=\"edittemplate.php" . $urlext . "&amp;template_id=" . $one->TemplateId() . "&amp;from=content\">" . cms_htmlentities($template->name, '', '', true) . "</a>";
                } else {
                    if ($template) {
                        $txt .= $template->name;
                    }
                }
            }
            if (!empty($txt)) {
                $columns['template'] = $txt;
            }
        }
        /* friendly name column */
        if ($columnstodisplay['friendlyname']) {
            $columns['friendlyname'] = $one->FriendlyName();
        }
        /* owner column */
        if ($columnstodisplay['owner']) {
            $columns['owner'] = '&nbsp;';
            if ($one->Owner() > -1) {
                $columns['owner'] = $users[$one->Owner()]->username;
            }
        }
        /* active column */
        if ($columnstodisplay['active']) {
            $columns['active'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content') && $one->Type() != 'errorpage') {
                if ($one->Active()) {
                    $txt = $one->DefaultContent() ? $image_true : "<a href=\"{$thisurl}&amp;setinactive=" . $one->Id() . "\" onclick=\"xajax_content_setinactive(" . $one->Id() . ");return false;\">" . $image_set_false . "</a>";
                } else {
                    $txt = "<a href=\"{$thisurl}&amp;setactive=" . $one->Id() . "\" onclick=\"xajax_content_setactive(" . $one->Id() . ");return false;\">" . $image_set_true . "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['active'] = $txt;
            }
        }
        /* default content */
        if ($columnstodisplay['default']) {
            $columns['default'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content')) {
                if ($one->IsDefaultPossible()) {
                    $txt = $one->DefaultContent() ? $image_true : "<a href=\"{$thisurl}&amp;makedefault=" . $one->Id() . "\" onclick=\"if(confirm('" . cms_html_entity_decode_utf8(lang("confirmdefault", $one->Name()), true) . "')) xajax_content_setdefault(" . $one->Id() . ");return false;\">" . $image_set_true . "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['default'] = $txt;
            }
        }
        /* move column */
        if ($columnstodisplay['move']) {
            // code for move up is simple
            $columns['move'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content') || $author_allpages) {
                $sameLevel = $root->getSiblingCount();
                if ($sameLevel > 1) {
                    if ($one->ItemOrder() - 1 <= 0) {
                        $txt .= "<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                        $txt .= $downImg;
                        $txt .= "</a>&nbsp;&nbsp;";
                    } else {
                        if ($one->ItemOrder() - 1 == $sameLevel - 1) {
                            $txt .= "&nbsp;&nbsp;<a class=\"move_up\" onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $upImg;
                            $txt .= "</a>";
                        } else {
                            $txt .= "<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $downImg;
                            $txt .= "</a>&nbsp;<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $upImg;
                            $txt .= "</a>";
                        }
                    }
                }
                // $txt .= '<input clsss="hidden" type="text" name="order-'. $one->Id().'" value="'.$one->ItemOrder().'" class="order" />';
            }
            if (!empty($txt)) {
                $columns['move'] = $txt;
            }
            // end of move code
        }
        /* view column */
        if ($columnstodisplay['view']) {
            $columns['view'] = '&nbsp;';
            $txt = '';
            $url = $one->GetURL();
            if ($url != '' && $url != '#' && $one->IsViewable() && $one->Active()) {
                $txt .= "<a href=\"" . $url . "\" rel=\"external\" target=\"_blank\">";
                $txt .= $viewImg . "</a>";
            }
            if (!empty($txt)) {
                $columns['view'] = $txt;
            }
        }
        /* copy column */
        if ($columnstodisplay['copy']) {
            $columns['copy'] = '&nbsp;';
            $txt = '';
            if ($one->IsCopyable() && (check_permission($userid, 'Add Pages') && (check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) || check_permission($userid, 'Manage All Content'))) {
                $txt .= '<a href="copycontent.php' . $urlext . '&amp;content_id=' . $one->Id() . '">';
                $txt .= $copyImg . "</a>";
            }
            if (!empty($txt)) {
                $columns['copy'] = $txt;
            }
        }
        /* edit column */
        if ($columnstodisplay['edit']) {
            $columns['edit'] = '&nbsp;';
            $txt = '';
            if (check_modify_all($userid) || check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages) || check_permission($userid, 'Manage All Content')) {
                // edit link
                $txt .= "<a href=\"editcontent.php" . $urlext . "&amp;content_id=" . $one->Id() . "\">";
                $txt .= $editImg;
                $txt .= "</a>";
            }
            if (!empty($txt)) {
                $columns['edit'] = $txt;
            }
        }
        /* delete column */
        if ($columnstodisplay['delete']) {
            $columns['delete'] = '&nbsp;';
            $txt = '';
            if ($one->DefaultContent() != true) {
                if ($root->getChildrenCount() == 0 && (check_permission($userid, 'Remove Pages') && (check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) || check_permission($userid, 'Manage All Content'))) {
                    //$txt .= "<a href=\"{$thisurl}&amp;deletecontent=".$one->Id()."\" onclick=\"confirm('".cms_html_entity_decode_utf8(lang('deleteconfirm', $one->mName), true)."');\">";
                    $txt .= "<a href=\"{$thisurl}&amp;deletecontent=" . $one->Id() . "\" onclick=\"if (confirm('" . cms_html_entity_decode_utf8(lang('deleteconfirm', $one->Name()), true) . "')) xajax_content_delete(" . $one->Id() . "); return false;\">";
                    $txt .= $deleteImg;
                    $txt .= "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['delete'] = $txt;
            }
        }
        if ($columnstodisplay['multiselect']) {
            /* multiselect */
            $columns['multiselect'] = '&nbsp;';
            $txt = '';
            $remove = check_permission($userid, 'Remove Pages') ? 1 : 0;
            $structure = check_permission($userid, 'Manage All Content') ? 1 : 0;
            $editperms = check_permission($userid, 'Modify Any Page') || quick_check_authorship($one->Id(), $mypages) || check_ownership($userid, $one->Id()) ? 1 : 0;
            if (($structure == 1 || $remove == 1 && $editperms == 1) && $one->Type() != 'errorpage') {
                $txt .= '<label class="invisible" for="multicontent-' . $one->Id() . '">' . lang('toggle') . '</label><input type="checkbox" id="multicontent-' . $one->Id() . '" name="multicontent-' . $one->Id() . '" title="' . lang('toggle') . '"/>';
            }
            if (!empty($txt)) {
                $columns['multiselect'] = $txt;
            }
        }
        /* done */
        foreach ($columns as $name => $value) {
            if (!$columnstodisplay[$name]) {
                continue;
            }
            switch ($name) {
                case 'edit':
                case 'default':
                case 'view':
                case 'copy':
                case 'delete':
                case 'active':
                    $thelist .= '<td class="pagepos">' . $value . "</td>\n";
                    break;
                case 'move':
                    $thelist .= '<td class="move">' . $value . "</td>\n";
                    break;
                case 'multiselect':
                    $thelist .= '<td class="checkbox">' . $value . "</td>\n";
                    break;
                default:
                    $thelist .= '<td>' . $value . "</td>\n";
                    break;
            }
        }
        $thelist .= "</tr>\n";
        $currow == "row1" ? $currow = "row2" : ($currow = "row1");
    }
    $pagelist[] = $thelist;
    $indent = get_preference($userid, 'indent', true);
    if (in_array($one->Id(), $openedArray) && is_array($children) && count($children)) {
        // count through all the children and see if we can display the move column.
        $author_allpages = check_permission($userid, 'Reorder Content') && check_peer_authorship($userid, $children[0]->getId());
        foreach ($children as $child) {
            display_hierarchy($child, $userid, $modifyall, $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay, $author_allpages);
        }
    }
}
Пример #2
0
function display_hierarchy(&$root, &$userid, $modifyall, &$templates, &$users, &$menupos, &$openedArray, &$pagelist, &$image_true, &$image_set_false, &$image_set_true, &$upImg, &$downImg, &$viewImg, &$editImg, &$copyImg, &$deleteImg, &$expandImg, &$contractImg, &$mypages, &$page, $columnstodisplay)
{
    global $thisurl;
    global $urlext;
    global $currow;
    global $config;
    global $page;
    global $indent;
    if (empty($currow)) {
        $currow = 'row1';
    }
    $children =& $root->getChildren(false, true);
    $one =& $root->getContent();
    $thelist = '';
    if (!(isset($one) && $one != NULL)) {
        return;
    }
    if (!array_key_exists($one->TemplateId(), $templates)) {
        global $gCms;
        $templateops =& $gCms->GetTemplateOperations();
        $templates[$one->TemplateId()] = $templateops->LoadTemplateById($one->TemplateId());
    }
    if (!array_key_exists($one->Owner(), $users)) {
        global $gCms;
        $userops =& $gCms->GetUserOperations();
        $users[$one->Owner()] =& $userops->LoadUserById($one->Owner());
    }
    $display = 'none';
    if (check_modify_all($userid) || check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) {
        $display = 'edit';
    } else {
        if (check_children($root, $mypages, $userid)) {
            $display = 'view';
        } else {
            if (check_permission($userid, 'Manage All Content')) {
                $display = 'structure';
            }
        }
    }
    $columns = array();
    if ($display != 'none') {
        $thelist .= "<tr id=\"tr_" . $one->Id() . "\" class=\"{$currow}\" onmouseover=\"this.className='" . $currow . 'hover' . "';\" onmouseout=\"this.className='" . $currow . "';\">\n";
        /* expand/collapse column */
        $columns['expand'] = '&nbsp;';
        if ($columnstodisplay['expand']) {
            $txt = '';
            if ($root->hasChildren()) {
                if (!in_array($one->Id(), $openedArray)) {
                    $txt .= "<a href=\"{$thisurl}&amp;content_id=" . $one->Id() . "&amp;col=0&amp;page=" . $page . "\" onclick=\"xajax_content_toggleexpand(" . $one->Id() . ", 'false'); return false;\">";
                    $txt .= $expandImg;
                    $txt .= "</a>";
                } else {
                    $txt .= "<a href=\"{$thisurl}&amp;content_id=" . $one->Id() . "&amp;col=1&amp;page=" . $page . "\" onclick=\"xajax_content_toggleexpand(" . $one->Id() . ", 'true'); return false;\">";
                    $txt .= $contractImg;
                    $txt .= "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['expand'] = $txt;
            }
        }
        /* hierarchy column */
        if ($columnstodisplay['hier']) {
            $columns['hier'] = $one->Hierarchy();
        }
        /* page column */
        if ($columnstodisplay['page']) {
            $columns['page'] = '&nbsp;';
            $txt = '';
            if ($one->mMenuText != CMS_CONTENT_HIDDEN_NAME) {
                if ($indent) {
                    for ($i = 0; $i < $root->getLevel(); $i++) {
                        $txt .= "-&nbsp;&nbsp;&nbsp;";
                    }
                }
                if ($display == 'edit') {
                    $txt .= '<a href="editcontent.php' . $urlext . '&amp;content_id=' . $one->mId . '&amp;page=' . $page . '" title="' . cms_htmlentities($one->mName . ' (' . $one->mAlias . ')', '', '', true) . '">' . cms_htmlentities($one->mMenuText, '', '', true) . '</a>';
                } else {
                    $txt .= cms_htmlentities($one->mMenuText, '', '', true);
                }
            }
            if (!empty($txt)) {
                $columns['page'] = $txt;
            }
        }
        /* template column */
        if ($columnstodisplay['template']) {
            $columns['template'] = '&nbsp;';
            $txt = '';
            if ($one->Type() != 'pagelink' && $one->Type() != 'link' && $one->Type() != 'sectionheader' && $one->Type() != 'separator') {
                if (isset($templates[$one->TemplateId()]->name) && $templates[$one->TemplateId()]->name && check_permission($userid, 'Modify Templates')) {
                    $txt .= "<a href=\"edittemplate.php" . $urlext . "&amp;template_id=" . $one->TemplateId() . "&amp;from=content\">" . cms_htmlentities($templates[$one->TemplateId()]->name, '', '', true) . "</a>";
                } else {
                    $txt .= $templates[$one->TemplateId()]->name;
                }
            }
            if (!empty($txt)) {
                $columns['template'] = $txt;
            }
        }
        /* friendly name column */
        if ($columnstodisplay['friendlyname']) {
            $columns['friendlyname'] = $one->FriendlyName();
        }
        /* owner column */
        if ($columnstodisplay['owner']) {
            $columns['owner'] = '&nbsp;';
            if ($one->Owner() > -1) {
                $columns['owner'] = $users[$one->Owner()]->username;
            }
        }
        /* active column */
        if ($columnstodisplay['active']) {
            $columns['active'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content') && $one->Type() != 'errorpage') {
                if ($one->Active()) {
                    $txt = $one->DefaultContent() ? $image_true : "<a href=\"{$thisurl}&amp;setinactive=" . $one->Id() . "\" onclick=\"xajax_content_setinactive(" . $one->Id() . ");return false;\">" . $image_set_false . "</a>";
                } else {
                    $txt = "<a href=\"{$thisurl}&amp;setactive=" . $one->Id() . "\" onclick=\"xajax_content_setactive(" . $one->Id() . ");return false;\">" . $image_set_true . "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['active'] = $txt;
            }
        }
        /* default content */
        if ($columnstodisplay['default']) {
            $columns['default'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content')) {
                if ($one->IsDefaultPossible()) {
                    $txt = $one->DefaultContent() ? $image_true : "<a href=\"{$thisurl}&amp;makedefault=" . $one->Id() . "\" onclick=\"if(confirm('" . cms_html_entity_decode_utf8(lang("confirmdefault", $one->mName), true) . "')) xajax_content_setdefault(" . $one->Id() . ");return false;\">" . $image_set_true . "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['default'] = $txt;
            }
        }
        /* move column */
        if ($columnstodisplay['move']) {
            // code for move up is simple
            $columns['move'] = '&nbsp;';
            $txt = '';
            if (check_permission($userid, 'Manage All Content')) {
                $sameLevel = $root->getSiblingCount();
                if ($sameLevel > 1) {
                    if ($one->ItemOrder() - 1 <= 0) {
                        $txt .= "<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                        $txt .= $downImg;
                        $txt .= "</a>&nbsp;&nbsp;";
                    } else {
                        if ($one->ItemOrder() - 1 == $sameLevel - 1) {
                            $txt .= "&nbsp;&nbsp;<a class=\"move_up\" onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $upImg;
                            $txt .= "</a>";
                        } else {
                            $txt .= "<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $downImg;
                            $txt .= "</a>&nbsp;<a onclick=\"xajax_content_move(" . $one->Id() . ", " . $one->ParentId() . ", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=" . $one->Id() . "&amp;parent_id=" . $one->ParentId() . "&amp;page=" . $page . "\">";
                            $txt .= $upImg;
                            $txt .= "</a>";
                        }
                    }
                }
                // $txt .= '<input clsss="hidden" type="text" name="order-'. $one->Id().'" value="'.$one->ItemOrder().'" class="order" />';
            }
            if (!empty($txt)) {
                $columns['move'] = $txt;
            }
            // end of move code
        }
        /* view column */
        if ($columnstodisplay['view']) {
            $columns['view'] = '&nbsp;';
            $txt = '';
            $url = $one->GetURL();
            if ($url != '' && $url != '#' && $one->IsViewable() && $one->Active()) {
                $txt .= "<a href=\"" . $url . "\" rel=\"external\" target=\"_blank\">";
                $txt .= $viewImg . "</a>";
            }
            if (!empty($txt)) {
                $columns['view'] = $txt;
            }
        }
        /* copy column */
        if ($columnstodisplay['copy']) {
            $columns['copy'] = '&nbsp;';
            $txt = '';
            if ($one->IsCopyable() && (check_permission($userid, 'Add Pages') && (check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) || check_permission($userid, 'Manage All Content'))) {
                $txt .= '<a href="copycontent.php' . $urlext . '&amp;content_id=' . $one->Id() . '">';
                $txt .= $copyImg . "</a>";
            }
            if (!empty($txt)) {
                $columns['copy'] = $txt;
            }
        }
        /* edit column */
        if ($columnstodisplay['edit']) {
            $columns['edit'] = '&nbsp;';
            $txt = '';
            if (check_modify_all($userid) || check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages) || check_permission($userid, 'Manage All Content')) {
                // edit link
                $txt .= "<a href=\"editcontent.php" . $urlext . "&amp;content_id=" . $one->Id() . "\">";
                $txt .= $editImg;
                $txt .= "</a>";
            }
            if (!empty($txt)) {
                $columns['edit'] = $txt;
            }
        }
        /* delete column */
        if ($columnstodisplay['delete']) {
            $columns['delete'] = '&nbsp;';
            $txt = '';
            if ($one->DefaultContent() != true) {
                if ($root->getChildrenCount() == 0 && (check_permission($userid, 'Remove Pages') && (check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)) || check_permission($userid, 'Manage All Content'))) {
                    $txt .= "<a href=\"{$thisurl}&amp;deletecontent=" . $one->Id() . "\" onclick=\"if (confirm('" . cms_html_entity_decode_utf8(lang('deleteconfirm', $one->mName), true) . "')) xajax_content_delete(" . $one->Id() . "); return false;\">";
                    $txt .= $deleteImg;
                    $txt .= "</a>";
                }
            }
            if (!empty($txt)) {
                $columns['delete'] = $txt;
            }
        }
        if ($columnstodisplay['multiselect']) {
            /* multiselect */
            $columns['multiselect'] = '&nbsp;';
            $txt = '';
            $remove = check_permission($userid, 'Remove Pages') ? 1 : 0;
            $structure = check_permission($userid, 'Manage All Content') ? 1 : 0;
            $editperms = check_permission($userid, 'Modify Any Page') || quick_check_authorship($one->Id(), $mypages) || check_ownership($userid, $one->Id()) ? 1 : 0;
            if (($structure == 1 || $remove == 1 && $editperms == 1) && $one->Type() != 'errorpage') {
                $txt .= '<input type="checkbox" name="multicontent-' . $one->Id() . '" />';
            }
            if (!empty($txt)) {
                $columns['multiselect'] = $txt;
            }
        }
        /* done */
        foreach ($columns as $name => $value) {
            if (!$columnstodisplay[$name]) {
                continue;
            }
            switch ($name) {
                case 'edit':
                case 'default':
                case 'view':
                case 'copy':
                case 'delete':
                case 'active':
                    $thelist .= '<td class="pagepos">' . $value . "</td>\n";
                    break;
                case 'move':
                    $thelist .= '<td class="move">' . $value . "</td>\n";
                    break;
                case 'multiselect':
                    $thelist .= '<td class="checkbox">' . $value . "</td>\n";
                    break;
                default:
                    $thelist .= '<td>' . $value . "</td>\n";
                    break;
            }
        }
        $thelist .= "</tr>\n";
        $currow == "row1" ? $currow = "row2" : ($currow = "row1");
    }
    $pagelist[] =& $thelist;
    $indent = get_preference($userid, 'indent', true);
    if (in_array($one->Id(), $openedArray)) {
        foreach ($children as $child) {
            display_hierarchy($child, $userid, $modifyall, $templates, $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay);
        }
    }
}