function principal_collection_browser()
{
    global $c, $page_elements, $id, $editor;
    $browser = new Browser(translate('Principal Collections'));
    $browser->AddColumn('collection_id', translate('ID'), 'right', '##collection_link##');
    $rowurl = $c->base_url . '/admin.php?action=edit&t=collection&id=';
    $browser->AddHidden('collection_link', "'<a href=\"{$rowurl}' || collection_id || '\">' || collection_id || '</a>'");
    $browser->AddColumn('dav_name', translate('Path'));
    $browser->AddColumn('dav_displayname', translate('Display Name'));
    $browser->AddColumn('publicly_readable', translate('Public'), 'centre', '', 'CASE WHEN publicly_readable THEN \'' . translate('Yes') . '\' ELSE \'' . translate('No') . '\' END');
    $browser->AddColumn('privs', translate('Privileges'), '', '', "COALESCE( privileges_list(default_privileges), '[" . translate('from principal') . "]')");
    $delurl = $c->base_url . '/admin.php?action=edit&t=principal&id=' . $id . '&dav_name=##URL:dav_name##&subaction=delete_collection';
    $browser->AddColumn('delete', translate('Action'), 'center', '', "'<a class=\"submit\" href=\"{$delurl}\">" . translate('Delete') . "</a>'");
    $browser->SetOrdering('dav_name', 'A');
    $browser->SetJoins("collection ");
    $browser->SetWhere('user_no = ' . intval($editor->Value('user_no')));
    $browser->AddRow(array('dav_name' => '<a href="' . $rowurl . '&user_no=' . intval($editor->Value('user_no')) . '" class="submit">' . translate('Create Collection') . '</a>'));
    if ($c->enable_row_linking) {
        $browser->RowFormat('<tr onMouseover="LinkHref(this,1);" title="' . translate('Click to edit principal details') . '" class="r%d">', '</tr>', '#even');
    } else {
        $browser->RowFormat('<tr class="r%d">', '</tr>', '#even');
    }
    $browser->DoQuery();
    return $browser;
}
Exemple #2
0
 $browser->SetWhere('by_collection = ' . $id);
 if ($c->enable_row_linking) {
     $browser->RowFormat('<tr onMouseover="LinkHref(this,1);" title="' . translate('Click to edit principal details') . '" class="r%d">', '</tr>', '#even');
 } else {
     $browser->RowFormat('<tr class="r%d">', '</tr>', '#even');
 }
 $browser->DoQuery();
 $page_elements[] = $browser;
 if ($can_write_collection) {
     if (isset($_GET['edit_grant'])) {
         $browser->MatchedRow('to_principal', $_GET['edit_grant'], 'edit_grant_row');
     } else {
         $extra_row = array('to_principal' => -1);
         $browser->MatchedRow('to_principal', -1, 'edit_grant_row');
         $extra_row = (object) $extra_row;
         $browser->AddRow($extra_row);
     }
 }
 $browser = new Browser(translate('Access Tickets'));
 $browser->AddHidden('dav_owner_id');
 $browser->AddColumn('ticket_id', translate('Ticket ID'), '', '');
 $browser->AddColumn('target', translate('Target'), '', '<td style="white-space:nowrap;">%s</td>', "'" . $c->base_url . '/caldav.php' . "' ||COALESCE(d.dav_name,c.dav_name)");
 $browser->AddColumn('expiry', translate('Expires'), '', '', 'TO_CHAR(expires,\'YYYYMMDD"T"HH:MI:SS\')');
 $browser->AddColumn('privs', translate('Privileges'), '', '', "privileges_list(privileges)");
 $delurl = $c->base_url . '/admin.php?action=edit&t=principal&id=##dav_owner_id##&ticket_id=##URL:ticket_id##&subaction=delete_ticket';
 $browser->AddColumn('delete', translate('Action'), 'center', '', "'<a class=\"submit\" href=\"{$delurl}\">" . translate('Delete') . "</a>'");
 $browser->SetOrdering('target', 'A');
 $browser->SetJoins('access_ticket t LEFT JOIN collection c ON (target_collection_id=collection_id) LEFT JOIN caldav_data d ON (target_resource_id=dav_id)');
 $browser->SetWhere('target_collection_id = ' . intval($editor->Value('collection_id')));
 $browser->RowFormat('<tr class="r%d">', '</tr>', '#even');
 $browser->DoQuery();