require_once('config.php');
?>
emit_prefs_javascript($acc);
////////////////////////////////////////
// Shared header section
////////////////////////////////////////
print '';
print 'Browser Control Panel ';
$username = $acc->getSetting('name');
if ($username == '') {
print 'Not logged in. (Log in )';
} else {
print '
Logged in as '.$username.' . (Log out )';
}
print '
';
///////////////////////////////////////
// Debugging dump stuff
///////////////////////////////////////
if ($acc->getPriv('developer')) {
print 'Developer-Only Debugging Stuff ';
print '';
print '$_SESSION: ';
print_r($_SESSION);
print " \n";
print '$_COOKIE: ';
print_r($_COOKIE);
print " \n";
print ' ';
}
////////////////////////////////////////
// Section for settables and things similar to settables
//
// Mind that the select boxes require lame initialization code fbjs.php, so
// keep that in sync with changes here.
////////////////////////////////////////
print 'Current Settings ';
print '';
print settable_html($acc, 'kb');
if ($acc->getPriv('kb_fb_read')) {
if ($acc->getPriv('kb_fb_write')) {
print 'Your feedback will be tagged with: "'.$acc->getSetting('fbname').'" ';
} else {
print 'You are not authorized to give new feedback on the current KB ';
}
print settable_html($acc, 'show_feedback');
}
print settable_html($acc, 'suppress_parens');
print settable_html($acc, 'suppress_implied');
print settable_html($acc, 'suppress_candidates');
print settable_html($acc, 'list_sort');
print settable_html($acc, 'list_len');
print settable_html($acc, 'source_filter');
print ' ';
////////////////////////////////////////
// Links to handy internal stuffs
////////////////////////////////////////
if ($acc->getPriv('kb_fb_read')) {
$kb = $acc->getSetting('kb');
$kb = str_replace(' (default)', '', $kb);
$resources_url = RESOURCES_WEB."/$kb";
$resources_dir = RESOURCES_FS."/$kb";
print 'Internal Links ';
print ' ';
}
// bkdb TODO: dump the fbjump stuff in here for now. Later, we'll have curator instead
if ($acc->getPriv('kb_fb_write')) {
$populateOnly = true;
$splitByPerson = true;
$all_cats = $db->get_preds(FALSE);
$all_rels = $db->get_preds(TRUE);
$people = array("asaparov", "azariaa", "bbd", "bkisiel", "dwijaya", "eplatani", "estevam", "jayantk", "mitchell", "mg1", "ndapa", "shashans");
if (!$splitByPerson) $people = array("Everybody");
// Optionally restrict to preds that are populate=true
$cats = array();
$rels = array();
foreach ($all_cats as $c)
if (!$populateOnly || $c['populate']) $cats[] = $c;
foreach ($all_rels as $r)
if (!$populateOnly || $r['populate']) $rels[] = $r;
$numP = sizeof($people);
$numC = sizeof($cats);
$numR = sizeof($rels);
// Make mapping from pred to person, filtering slave relations, and getting OKI status
$assign = array();
for ($p = 0; $p < sizeof($people); $p++) {
$person = $people[$p];
$assign[$person]['cat'] = array();
$assign[$person]['rel'] = array();
for ($c = 0; $c < sizeof($cats); $c++) {
if ($c % $numP == $p) {
$pid = $cats[$c]['pid'];
$pfbmap = fb_loadp($acc, $pid);
$riestate = fb_get_riestate($pfbmap);
if ($riestate[3] >= 0) {
$cats[$c]['oki'] = $riestate[3];
}
$assign[$person]['cat'][] = $cats[$c];
}
}
for ($r = 0; $r < sizeof($rels); $r++) {
if ($rels[$r]['slave'] == 0) {
if ($r % $numP == $p) {
$pid = $rels[$r]['pid'];
$pfbmap = fb_loadp($acc, $pid);
$riestate = fb_get_riestate($pfbmap);
if ($riestate[3] >= 0) {
$rels[$r]['oki'] = $riestate[3];
}
$assign[$person]['rel'][] = $rels[$r];
}
}
}
}
// Put current user at the top of the listing if possible
$user = $acc->getSetting('name');
for ($p = 1; $p < sizeof($people); $p++) {
if ($people[$p] == $user) {
$tmp = $people[0];
$people[0] = $user;
$people[$p] = $tmp;
}
}
print 'Feedback Jump ';
print '';
foreach ($people as $person) {
print ''.$person.' (categories) ';
print '';
foreach ($assign[$person]['cat'] as $cat) {
print ''.link_arg($cat['name'], 'pred', $cat['name']);
if (isset($cat['oki'])) print " (Reviewed up to iteration ".$cat['oki'].")";
print ' ';
}
print ' ';
print ''.$person.' (relations) ';
print '';
foreach ($assign[$person]['rel'] as $rel) {
print ''.link_arg($rel['name'], 'pred', $rel['name']);
if (isset($rel['oki'])) print " (Reviewed up to iteration ".$rel['oki'].")";
print ' ';
}
print " \n";
}
print ' ';
}
include('../inc/kb_footer.php');
?>