Пример #1
0
function doEditorLine(&$o)
{
    global $isEditor, $isOwner;
    $class = get_class($o);
    if ($class == "site") {
        $level = 0;
    }
    if ($class == "section") {
        $level = 1;
    }
    if ($class == "page") {
        $level = 2;
    }
    if ($class == "story") {
        $level = 3;
    }
    $bgColor = getBgColor($class, "normal");
    $bgColorL = getBgColor($class, "locked");
    $bgColorV = getBgColor($class, "view");
    $indent = getIndent($class);
    $textSize = getTextSize($class);
    print "\n\n<tr>";
    print "\n<td style='background-color: {$bgColor}; padding-left: " . $indent . "px; font-size: {$textSize}'>";
    $noLinkTypes = array("url", "heading", "divider");
    if (!in_array($o->getField("type"), $noLinkTypes) && $_REQUEST['show'] != 'wiki') {
        print "\n\t<a href='#' onClick{$nl}='opener.window.location=\"index.php?{$sid}&action=viewsite&site=" . $o->owning_site;
        if ($level == 1) {
            print "&section=" . $o->id;
        }
        if ($level > 1) {
            print "&section=" . $o->owning_section;
        }
        if ($level == 2) {
            print "&page=" . $o->id;
        }
        if ($level > 2) {
            print "&page=" . $o->owning_page;
        }
        print "\"'>";
    }
    if ($o->getField("type") == "url") {
        print "\n\t<a href='#' onclick='opener.window.location=\"" . $o->getField("url") . "\"'>";
    }
    if ($o->getField("type") == "divider") {
        print " &nbsp; ";
    }
    if ($class == "story") {
        if ($o->getField("title") != "") {
            if ($_REQUEST['show'] != 'wiki') {
                print $o->getField("title");
            } else {
                print "[[" . $o->getField("title") . "]]";
            }
        } else {
            if ($_REQUEST['show'] != 'wiki') {
                print $o->getFirst(25);
            } else {
                print "no title...";
                print "<span style='font-size: 9px;'><i>(" . $o->getFirst(25) . ")</i></span>";
            }
        }
    } else {
        if ($_REQUEST['show'] != 'wiki') {
            print "\n\t" . $o->getField("title");
        } else {
            print "\n\t[[" . $o->getField("title") . "]]";
        }
    }
    print "\n\t</a>";
    print "\n</td>";
    print "\n</tr>";
}
function doEditorLine(&$o)
{
    global $isEditor, $isOwner;
    $class = get_class($o);
    $bgColor = getBgColor($class, "normal");
    $bgColorL = getBgColor($class, "locked");
    $bgColorV = getBgColor($class, "view");
    $indent = getIndent($class);
    $textSize = getTextSize($class);
    if ($class == "story") {
        /* 		if ($o->getField("title") !="") $extra = $o->getField("title"); */
        /* 		else $extra = $o->getFirst(25);		 */
        if ($o->getField("title") == "") {
            $extra = $o->getFirst(25);
        } else {
            $extra = '';
        }
    } else {
        $extra = "";
    }
    print "\n\t\t<tr>";
    print "\n\t\t\t<td style='background-color: {$bgColor}; padding-left: " . $indent . "px; font-size: {$textSize}'>" . $o->getField("title") . $extra . "</td>";
    // reference $args = "'scope',site,section,page,story";
    if ($class == 'site') {
        $args = "'{$class}','" . $o->name . "',0,0,0";
    }
    if ($class == 'section') {
        $args = "'{$class}','" . $o->owning_site . "'," . $o->id . ",0,0";
    }
    if ($class == 'page') {
        $args = "'{$class}','" . $o->owning_site . "'," . $o->owning_section . "," . $o->id . ",0";
    }
    if ($class == 'story') {
        $args = "'{$class}','" . $o->owning_site . "'," . $o->owning_section . "," . $o->owning_page . "," . $o->id;
    }
    print "\n\t\t\t<td align='center' class='lockedcol' style='background-color: {$bgColorL}' width='18'>" . ($class != 'site' ? "<input type='checkbox'" . ($o->getField("locked") ? " checked='checked'" : "") . " onclick=\"doFieldChange('',{$args},'locked'," . ($o->getField("locked") ? "0" : "1") . ");\" " . (!$isOwner ? "disabled='disabled'" : "") . " />" : "&nbsp;") . "</td>";
    $type = $o->getField("type");
    $o->buildPermissionsArray();
    $p = $o->getPermissions();
    $_a = array("view" => 3, "add" => 0, "edit" => 1, "delete" => 2);
    foreach ($_SESSION[editors] as $e) {
        $args1 = "'{$e}'," . $args;
        foreach ($_a as $v => $i) {
            //			print "l-$e$v";
            $skip = 0;
            if (($e == 'everyone' || $e == 'institute') && $i < 3) {
                $skip = 1;
            }
            if ($class == 'story' && $v == 'add') {
                $skip = 1;
            }
            if ($type != 'story' && $type != 'page' && $type != 'section' && $class != 'site' && $v == 'add') {
                $skip = 1;
            }
            if ($skip) {
                print "\n\t\t\t<td width='18' align='center'" . ($i == 3 ? " class='viewcol' style='background-color: {$bgColorV}'" : " style='background-color: {$bgColor}'") . ">&nbsp;</td>";
            } else {
                print "\n\t\t\t<td width='18' align='center'" . ($i == 3 ? " class='viewcol' style='background-color: {$bgColorV}'" : " style='background-color: {$bgColor}'") . "><input type='checkbox'" . ($p[$e][$i] ? " checked='checked'" : "") . " onclick=\"doFieldChange({$args1},'perms-{$v}'," . ($p[$e][$i] ? "0" : "1") . ");\" " . ($o->getField("l%{$e}%{$v}") || !$isOwner ? "disabled='disabled'" : "") . " /></td>";
            }
        }
    }
    print "\n\t\t</tr>";
}