Example #1
0
function PrintMsg($f, $level)
{
    global $l10nstr;
    global $table;
    global $FirstMsg;
    global $ThreadTop;
    global $ShowMsg;
    global $mainfile;
    global $editscript;
    global $descscript;
    global $banscript;
    global $scriptsurl;
    global $addfilescript;
    global $nulfrm;
    global $userfiles;
    global $MsgPerPage;
    global $msgread;
    global $IsManager;
    global $name;
    $query = "SELECT * FROM {$table} WHERE ancestor={$f}";
    if ($f == 0 && $FirstMsg > 0) {
        $query .= " AND num<={$FirstMsg}";
    }
    if ($f == 0) {
        if ($ThreadTop) {
            $query .= " AND num={$ThreadTop}";
        }
        $query .= " ORDER BY lastmod DESC, date DESC, time DESC";
        $query .= " LIMIT {$MsgPerPage}";
        //print "$query<BR>\n";
    } else {
        $query .= " ORDER BY date DESC, time DESC";
    }
    $result = mysql_query($query);
    if (!$result) {
        echo mysql_error();
        exit;
    }
    if (mysql_num_rows($result) == 0) {
        return;
    }
    /* end of recursive call */
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $msgnum = $line['num'];
        $title = $line['title'];
        $user = $line['name'];
        $title = SpecialCodes($title);
        //print "<LI type=disc dir=RTL><BIG><A id=t$msgnum HREF=\"javascript:void(0)\" onclick=\"blocking('msg$msgnum', 't$msgnum')\">$title</A></BIG> - ";
        // search if message was read...
        /*	if($level == 0)
        			print "<BR>\n";
        		print "<LI type=disc dir=RTL>"; */
        if ($level == 0) {
            print "<TABLE width=100% height=\$3px><TR><TD></TABLE>\n";
        }
        print "<TABLE dir=RTL border=0 width=100% cellpadding=0 cellspacing=0>\n";
        print "<TR>\n";
        print "<TD width={$i}%>\n";
        print "<TD dir=RTL>\n";
        if ($level == 0) {
            print "<UL><LI type=disk>";
        } else {
            print "<UL><LI type=circle>";
        }
        if (array_search($msgnum, $msgread)) {
            print "<A id=t{$msgnum} HREF={$nulfrm}?msg={$msgnum}&forum={$table} target=trce onclick=\"blocking('msg{$msgnum}', 't{$msgnum}')\"><FONT color=#ff0000>{$title}</FONT></A>";
        } else {
            print "<A id=t{$msgnum} HREF={$nulfrm}?msg={$msgnum}&forum={$table} target=trce onclick=\"blocking('msg{$msgnum}', 't{$msgnum}')\">{$title}</A>";
        }
        print "<TD width=20%>\n";
        print "<A HREF={$descscript}?action=user&usrname={$user}&forum={$table} target=_blank>";
        $alias = GetAlias($user);
        if (IsForumManager($user)) {
            print "<BIG><B><FONT color=blue>{$alias}</FONT></B></BIG></A>\n";
        } else {
            if ($user == $name) {
                print "<BIG><B><FONT color=black>{$alias}</FONT></B></BIG></A>\n";
            } else {
                print "{$alias}</A>\n";
            }
        }
        $date = $line['date'];
        $time = $line['time'];
        $datearr = explode('-', $date);
        $timearr = explode(':', $time);
        $datetimestr = GetTimeStr($timearr[0], $timearr[1], $timearr[2], $datearr[1], $datearr[2], $datearr[0]);
        // $date = "$datearr[2]/$datearr[1]/$datearr[0]";
        print "<TD width=25%>\n";
        print "<FONT dir=LTR>";
        print "{$datetimestr}</FONT></LI>\n";
        /* Put message contents as DIV that will be displayed when clicking on message */
        $contents = $line['contents'];
        $contents = SpecialCodes($contents);
        print "<TR>\n";
        $i = $level * 2;
        print "<TD width={$i}%>\n";
        print "<TD bgcolor=#fff8ff colspan=3>\n";
        if ($ShowMsg == $msgnum) {
            print "<DIV id=msg{$msgnum}>";
        } else {
            print "<DIV class=para id=msg{$msgnum}>";
        }
        print "{$contents}<BR>\n";
        $pic = $line['picture'];
        if (!empty($pic)) {
            $ext = GetExt($pic);
            if (IsImg($ext)) {
                $s = getimagesize("{$userfiles}/{$pic}");
                $w = $s[0];
                $h = $s[1];
                if ($w > 100) {
                    $ar = $h / $w;
                    $h = 100 * $ar;
                    $w = 100;
                }
                print "<A HREF={$userfiles}/{$pic}><IMG SRC={$userfiles}/{$pic} width={$w} height={$h} border=0></A><BR><BR>\n";
            } else {
                print "<A HREF={$userfiles}/{$pic}>";
                print "מצורף קובץ: ";
                print "{$ext}</A><BR>\n";
            }
        }
        $url = $line['url1'];
        $urldesc = $line['urldesc1'];
        if (!empty($urldesc) && !empty($url)) {
            print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n";
        }
        $url = $line['url2'];
        $urldesc = $line['urldesc2'];
        if (!empty($urldesc) && !empty($url)) {
            print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n";
        }
        $url = $line['url3'];
        $urldesc = $line['urldesc3'];
        if (!empty($urldesc) && !empty($url)) {
            print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n";
        }
        print "<BR><A href={$editscript}?forum={$table}&action=reply&ancestor={$msgnum}>{$l10nstr['22']}</A>\n";
        /* response */
        if (editable($user)) {
            print "&nbsp; &nbsp;\n";
            print "<A href={$editscript}?forum={$table}&action=edit&num={$msgnum}>{$l10nstr['23']}</A>\n";
            /* edit message */
            print "&nbsp; &nbsp;\n";
            print "<A HREF=\"javascript:void(0)\" onclick=\"javascript:AddFile('{$addfilescript}?forum={$table}&num={$msgnum}');\">";
            print "{$l10nstr['24']}";
            /* add file to message */
            print "</A>\n";
        }
        if (deleteable($user, $msgnum)) {
            print "&nbsp; &nbsp;\n";
            print "<A href={$editscript}?forum={$table}&action=delete&num={$msgnum}>{$l10nstr['25']}</A>\n";
            /* delete message */
        }
        if ($IsManager) {
            print "&nbsp; &nbsp;<A HREF={$banscript}?forum={$table}&user={$user}>{$l10nstr['26']}</A>\n";
            /* ban a user */
            print "&nbsp; &nbsp; &nbsp; {$msgnum}\n";
        }
        print "<BR><BR></DIV>\n";
        print "</TABLE>\n";
        /* spacing table */
        print "<TABLE width=100% height=\$3px><TR><TD></TABLE>\n";
        /* recursive call */
        PrintMsg($msgnum, $level + 1);
    }
}
Example #2
0
 function render_row(&$row)
 {
     global $gDisableEditing;
     $html = "";
     $this->row_transition($row);
     $id_prefix = "v_{$row['variant_id']}__a_{$row['article_pmid']}__g_{$row['genome_id']}__d_{$row['disease_id']}__p_{$row['edit_id']}__";
     $title = "";
     foreach (array("article_pmid", "genome_id", "disease_id") as $keyfield) {
         if (strlen($row[$keyfield]) == 0) {
             $row[$keyfield] = 0;
         }
     }
     if ($row["disease_id"] != "0") {
         $tr = editable("{$id_prefix}f_summary_short__8x1__oddsratio", $row["summary_short"], $row["disease_name"] . "<BR />", array("rownumber" => $this->rownumber, "tip" => "Indicate the contribution of this article to OR statistics for " . htmlspecialchars($row["disease_name"]) . "."));
         if ($tr != "") {
             if ($this->rownumber == 0) {
                 $html .= $this->starttable;
             }
             $html .= $tr;
             ++$this->rownumber;
         }
     } else {
         if ($row["article_pmid"] != "0") {
             $html .= "<A name=\"a" . htmlentities($row["article_pmid"]) . "\"></A>\n";
             $summary = article_get_summary($row["article_pmid"]);
             $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], $summary . "<BR />", array("tip" => "Explain this article's contribution to the conclusions drawn in the variant summary above."));
         } else {
             if ($row["genome_id"] != "0") {
                 $html .= "<A name=\"g" . $row["genome_id"] . "\"></A>\n";
                 // Pick the most human-readable name for this genome/person
                 if (!($name = $row["name"])) {
                     if (!($name = $row["global_human_id"])) {
                         $name = "[" . $row["genome_id"] . "]";
                     }
                 }
                 $name = htmlspecialchars($name);
                 // Link to the full genome(s)
                 if ($row["dataset_count"] > 0) {
                     $name = "<A href=\"{$row['dataset_url']}\">{$name}</A>";
                 }
                 if ($row["dataset_count"] > 1) {
                     $more = $row["dataset_count"] - 1;
                     $name .= " (";
                     if ($row["dataset_url_2"]) {
                         $name .= "<A href=\"{$row['dataset_url_2']}\">alternate</A>, ";
                         --$more;
                     }
                     if ($more > 1) {
                         $name .= "plus {$more} other data sets";
                     } else {
                         if ($more == 1) {
                             $name .= "plus 1 other data set";
                         } else {
                             $name = ereg_replace(", \$", "", $name);
                         }
                     }
                     $name .= ")";
                 }
                 // Indicate the SNP that causes the variant
                 if ($row["chr"]) {
                     $name .= htmlspecialchars("\n" . substr($row["zygosity"], 0, 3) . " " . $row["allele"] . " @ " . $row["chr"] . ":" . $row["chr_pos"]);
                     $name = nl2br($name);
                 }
                 $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], $name);
             } else {
                 if ($row["disease_id"] != "0") {
                     // Disease summary not attached to any particular publication
                 } else {
                     $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], "Short summary", array("tip" => "Provide a one line summary of clinical action to be undertaken given this variant (possibly modified by known phenotypes)."));
                     $html .= editable("{$id_prefix}f_variant_quality", $row, "Variant quality");
                     global $gImpactOptions;
                     $opts =& $gImpactOptions;
                     $qualified_impact = evidence_qualify_impact($row["variant_quality"], $row["variant_impact"]);
                     $html .= editable("{$id_prefix}f_variant_impact__", $row["variant_impact"], "Impact", array("select_options" => $opts, "previewtextile" => $qualified_impact, "tip" => "Categorize the expected impact of this variant."));
                     if (strtolower($qualified_impact) != strtolower($row["variant_impact"])) {
                         $html .= "<P><I>(The \"" . strtolower(eregi_replace(",? " . $row["variant_impact"], "", $qualified_impact)) . "\" qualifier is assigned automatically based on the above evidence and importance scores.)</I></P>";
                     }
                     global $gInheritanceOptions;
                     $html .= editable("{$id_prefix}f_variant_dominance__", $row[variant_dominance], "Inheritance pattern", array("select_options" => $gInheritanceOptions));
                     $html .= editable("{$id_prefix}f_summary_long__70x8__textile", $row[summary_long], "Summary of published research, and additional commentary", array("tip" => "Provide a comprehensive review of the variant including youngest age of onset, oldest age of onset and oldest asymptomatic individual."));
                 }
             }
         }
     }
     if ($html == "") {
         return;
     }
     if (ereg('^<(TABLE|TR)', $html)) {
         // TODO: handle is_delete and flag_edited_id for table rows
         // somehow; for now just don't indicate them at all
         if ($row["is_delete"]) {
             return;
         }
         if ($row["flag_edited_id"]) {
             $this->html .= $html;
             return;
         }
     } else {
         if (!$gDisableEditing && getCurrentUser() || 0 < strlen($row["talk_text"])) {
             $show_label = 0 < strlen($row["talk_text"]) ? "<B>show discussion</B>" : "start discussion";
             $html .= "<DIV class=\"rectangle-speech-border-hidden\"><DIV>{$show_label}</DIV>";
             $html .= editable("{$id_prefix}f_talk_text__70x8__textile", $row[talk_text], "Discussion<BR />", array("tip" => "Comments about this section"));
             $html .= "</DIV>";
         }
     }
     if ($row["is_delete"]) {
         $html .= "<DIV style=\"outline: 1px dashed #300; background-color: #fdd; color: #300; padding: 20px 20px 0 20px; margin: 0 0 10px 0;\"><P>Deleted in this revision:</P>{$html}</DIV>";
     } else {
         if ($row["flag_edited_id"]) {
             if ($row["previous_edit_id"]) {
                 $edited = "Edited";
             } else {
                 $edited = "Added";
             }
             $html = "<DIV style=\"outline: 1px dashed #300; background-color: #dfd; color: #300; padding: 20px 20px 0 20px; margin: 0 0 10px 0;\"><P>{$edited} in this revision:</P>\n{$html}</DIV>";
         }
     }
     $this->html .= $html;
 }
Example #3
0
File: admin.php Project: dawaa/taco
            <ul id="page-nav">
              <?php 
?>
              <?php 
foreach ($nav_items as $item) {
    $item_slug = strtolower($item);
    $active = $page_slugs[1] === $item_slug ? ' class="active"' : '';
    echo '<li' . $active . '><a href="?section=' . $item_slug . '"><span>' . $item . '</span></a></li>';
}
?>
            </ul>
          </div>
          <div class="right">
            <ul id="control-panel">
              <li id="edit"<?php 
editable($page);
?>
><a href="?section=<?php 
echo $page_slugs[1];
?>
&edit=<?php 
echo $page['id'];
?>
"><i class="ion-edit"></i>Edit</a></li>
              <li id="settings"><a href="#"><i class="fa fa-cog"></i></a></li>
              <li id="home"><a href="/"><i class="fa fa-home"></i></a></li>
              <li id="logout"><a href="#"><i class="fa fa-sign-out"></i></a></li>
              <li id="profile">
                <a href="#">
                  <span class="name">Admin</span>
                  <div class="avatar" style="background-image: url('images/test-avatar.jpg');"></div>