$fields[$field]['#value'] = 'Nobody'; } else { $user = new User($defaults[$what]); $fields[$field]['#value'] = $user->name() . " (" . $user->uid() . ")"; } } } if (isset($idx)) { $query_result = DBQueryFatal("select * from emulab_pubs where idx={$idx}"); if (mysql_num_rows($query_result) < 1) { echo "Pub #{$idx} does not exist\n"; PAGEFOOTER(); return; } $r = mysql_fetch_assoc($query_result); if (!MayEditPub($this_user, $isadmin, $r)) { echo "You Do Not Have Permission to Edit this Publication Submission\n"; PAGEFOOTER(); return; } $defaults = $r; if ($isadmin && !isset($submit)) { GetName('submitted_by'); GetName('owner', 'submitted_by'); GetName('last_edit_by', 'submitted_by'); if ($defaults['created'] == $defaults['last_edit']) { unset($fields['last_edit']); } } $fields['submit'] = array('#type' => 'submit', '#value' => "Update"); } else {
function MakeBib($user, $isadmin, $r) { global $thesis_map; $res = ''; if ($r['url'] != '') { $res .= "<a href=\"" . $r['url'] . "\">"; } $res .= $r['title']; #if row[3][-1] != '.' and row[3][-1] != '?' and row[3][-1] != '!': $res .= "."; if ($r['url'] != '') { $res .= "</a>"; } $res .= "\n"; $res .= ' ' . $r['authors']; $res .= '.'; $type = $r['type']; if ($type == "talk") { $res .= "Talk. "; } if ($type == "article" || $type == "talk") { $res .= ' <em>' . $r['conf'] . '</em>'; if ($r['volume'] != '') { $res .= ', Vol. ' . $r['volume']; } if ($r['number'] != '') { if ($r['volume'] != '') { $res .= ' No.'; } $res .= ' ' . $r['number']; } if ($r['pages'] != '') { $res .= ', pages ' . $r['pages']; } if ($r['where'] != '') { $res .= ', ' . $r['where']; } # if Tech report } else { if ($type == 'techreport') { $res .= ' Technical Report ' . $r['number']; # Affiliation here, but can't for techreports because of our data if (!preg_match('/,/', $r['affil'])) { $res .= ', ' . $r['affil']; } # if Thesis } else { if (preg_match('/^([a-z]+ |)thesis$/', $type)) { $res .= ' ' . $thesis_map[$type]; if ($r['affil'] != '') { $res .= ', ' . $r['affil']; } } } } # Not an Article/Tech report/Thesis? Add nothing special (for now) if ($r['month_name'] != '' || $r['year'] != '') { $res .= ', '; } if ($r['month_name'] != '') { $res .= $r['month_name'] . ' '; } $res .= $r['year']; if (MayEditPub($user, $isadmin, $r)) { # $res .= " <a href=\"submitpub.php?idx=". $r['idx'] . "\" style=\"background:#ffffaa \">Edit</a>"; $res .= " <a href=\"submitpub.php?idx=" . $r['idx'] . "\" style=\"background:yellow\">Edit</a>"; } return $res; }