";
}
function showTerm($term_id) {
$term_id = strval($term_id);
if ($term_id > 0) {
$sql = "SELECT t.context_id, c.context_nm, t.blob_id, t.term, t.term_full, t.short_desc
FROM Term t, Term_Context c
WHERE t.context_id = c.context_id
and t.term_id = ".$term_id;
list($context_id, $context_nm, $blob_id, $term, $term_full, $short_desc) = sqlRow($sql);
setTitle($term." definition");
displayHead();
termAd();
$context_str = "$context_nm";
hTable("Term Detail");
hPC("Term",$term);
hPC("Context",$context_str);
if ($term_full != "") hPC("Expanded",$term_full);
hPC("Definition","".$term." is here defined as ".$short_desc);
if ($blob_id > 0) {
hPC("Long Description",showBlob($blob_id));
//hPC(inpTextArea("long_desc",7,60,showBlob($blob_id)));
//hPC("",inpBtn(EDIT_BLOB_BTN));
} else {
//hPC(inpTextarea("long_desc",7,60,showBlob($blob_id)));
//hPC("",inpBtn(ADD_BLOB_BTN));
}
$rHold="";
$rInner="";
if ($result=mysql_query("SELECT r.related_id, t.term, r.type_id, c.code_nm
FROM Term_Related r, Term t, Number_Code c
WHERE r.term_id = $term_id
and r.related_id = t.term_id
and r.type_id = c.code_id
and c.class_id=6")) {
while (list($rid, $rTerm, $rType, $rTypeName) = mysql_fetch_row($result)) {
if ($rHold != $rTypeName) {
if ($rInner != "") hPC($rHold,$rInner);
$rHold = $rTypeName;
$rInner = "";
} else {
$rInner .= "
\n";
}
$rInner .= "$rTerm";
}
}
if ($rInner != "") hPC($rHold,$rInner);
$rInner = "";
$sql = "SELECT tl.link_nm, tl.article_id, tl.structure_id, tl.link_url, tl.short_desc, a.title_nm, a.file_nm
FROM Term_Link tl
LEFT JOIN Article a ON tl.article_id = a.article_id
WHERE tl.term_id = $term_id";
$acnt = 0;
if ($result = mysql_query($sql)) {
while (list($link_nm, $article_id, $structure_id, $link_url, $short_desc, $title_nm, $file_nm) = mysql_fetch_row($result)) {
if ($acnt++ > 0) $rInner .= "
\n";
$tlLink = ($link_url == "")? (($file_nm == "")? "page.html?a=$article_id" : $file_nm) : $link_url;
if ($link_nm == "") $link_nm = $title_nm;
$rInner .= "$link_nm ".$short_desc;
}
}
if ($rInner != "") hPC("Links",$rInner);
echo "";
// sqlTable("Article references","","SELECT r.article_id, r.structure_id, a.title_nm
// FROM Article_Resource r, Article a
// WHERE r.type_id = 2
// and r.reference_id = $term_id
// and r.article_id = a.article_id");
//hPC("","Edit ");
} else {
setTitle("Invalid Term");
displayHead();
termAd();
echo "Invalid Term ".$term_id;
}
}
function viewContext($context_id) {
$context_id = strval($context_id);
if ($context_id > 0) {
$sql = "SELECT c.parent_id, p.context_nm, u.user_id, u.user_nm,
c.context_nm, c.context_desc
FROM Term_Context c, Term_Context p LEFT JOIN PR_User u ON c.user_id = u.user_id
WHERE c.context_id = $context_id
and c.parent_id = p.context_id";
$row = sqlRow($sql);
setTitle($row[1]." - Dictionary of Terms");
displayHead();
termAd();
if ($row[0] == "") echo "Could not find context $context_id";
hTable("Dictionary Information",2,"width=728");
hPC("Name",$row[4]);
hPC("Parent","".$row[1]."");
hPC("Owner",$row[3]);
hPC("Description",$row[5]);
echo "
Out of Context = $context_id
"; } } if ($term_id == "") { $context_id = (strval($context_id) > 0)? strval($context_id) : 8; viewContext($context_id); } else { showTerm($term_id); } echo ""; displayFoot(); ?>