예제 #1
0
         $rawsvg = filterthroughcmd2("{$svghitmol}", "{$MOL2SVG} {$svgopt} - ");
     }
     //$svg = tweak_svg($rawsvg,$scalingfactor);   // function is defined in dbfunct.php
     $svg = $rawsvg;
     // for mol2svg v0.4 or higher
     if (strlen($svg) > 0 && $svg_mode == 1) {
         print "{$svg}\n";
         $struc_shown = TRUE;
     } elseif ($svg_mode == 2) {
         echo "<img src=\"showsvg.php?id={$id}&db={$db_id}\" alt=\"hit structure\">\n";
         $struc_shown = TRUE;
     }
 }
 if (($enable_jme == "y" || $enable_jsme == "y") && $struc_shown == FALSE) {
     // JME needs MDL molfiles with the "|" character instead of linebreaks
     $jmehitmol = tr4jme($molstruc);
     echo "<{$edtag} code=\"JME.class\" {$codebase} archive=\"JME.jar\" \n";
     echo "width=\"{$jmewidth}\" height=\"120\">";
     echo "<param name=\"options\" value=\"depict\"> \n";
     echo "<param name=\"mol\" value=\"{$jmehitmol}\">\n";
     echo "</{$edtag}>\n";
 }
 // show data fields
 echo "<table class=\"highlight\">\n";
 echo "<tr align=\"left\"><th>Field:</th><th>Value:</th></tr>\n";
 $i = 0;
 $qstr = "SHOW FULL COLUMNS FROM {$datatable}";
 $result = mysql_query($qstr) or die("Query failed! (1c5)");
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
     $field = $line["Field"];
     $type = $line["Type"];
예제 #2
0
</td>
				<?php 
        } else {
            ?>
					<td><?php 
            e($record->mol_weight);
            ?>
</td>
				<?php 
        }
        ?>
                <?php 
        $mol = $record->structure;
        $mol = str_replace("\r\n", "\n", $mol);
        $mol = str_replace("\n", "\r\n", $mol);
        $jmehitmol = tr4jme($mol);
        ?>
                    <td>
						<applet code="JME.class" name="JME" archive="/app/public/JME.jar" width="360" height="315" id="JME">
							<param name="options" value="depict">
							<param name="mol" value="<?php 
        echo $jmehitmol;
        ?>
" >
		                     You have to enable Java and JavaScript in your browser to use JME!
			             </applet>
                        
                    </td>
					
					<td><?php 
        e($record->formula);
예제 #3
0
function showHitRxn($id, $s)
{
    // version for SVG, bitmap, JME or JSME output
    global $enable_svg;
    global $enable_bitmaps;
    global $enable_jme;
    global $enable_jsme;
    global $bitmapURLdir;
    global $rxnstructable;
    global $rxndatatable;
    global $digits;
    global $subdirdigits;
    global $db_id;
    global $pic2dtable;
    global $codebase;
    global $svg_mode;
    global $edtag;
    $result2 = mysql_query("SELECT rxn_name FROM {$rxndatatable} WHERE rxn_id = {$id}") or die("Query failed! (showHitRxn)");
    while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
        $txt = $line2["rxn_name"];
    }
    mysql_free_result($result2);
    echo "<tr>\n<td class=\"highlight\" width=\"10%\">\n";
    print "<a href=\"details.php?rxn={$id}&db={$db_id}\" target=\"_blank\">{$db_id}:{$id}</a></td>\n";
    echo "<td class=\"highlight\"> <b>{$txt}</b>";
    if ($s != '') {
        echo " {$s}";
    }
    echo "</td>\n</tr>\n";
    $whatstr = "status";
    if ($svg_mode == 1) {
        $whatstr = "status, svg";
    }
    $svg = "";
    $qstr = "SELECT {$whatstr} FROM {$pic2dtable} WHERE rxn_id = {$id}";
    $result2 = mysql_query($qstr) or die("Query failed! (pic2d)");
    while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
        $status = $line2["status"];
        @($svg = $line2["svg"]);
    }
    mysql_free_result($result2);
    //if (($status != 1) || ($svg_mode > 0)) { $usebmp = false; } else { $usebmp = true; }
    if ($status == 1) {
        $usebmp = TRUE;
    } else {
        $usebmp = FALSE;
    }
    echo "<tr>\n<td colspan=\"2\">\n";
    $struc_shown = FALSE;
    if ($enable_svg == "y") {
        if (strlen($svg) > 0 && $svg_mode == 1) {
            print "{$svg}\n";
            $struc_shown = TRUE;
        } elseif ($svg_mode == 2) {
            echo "<img src=\"showsvg.php?id={$id}&db={$db_id}\" alt=\"hit reaction\">\n";
            $struc_shown = TRUE;
        }
    }
    if ($enable_bitmaps == "y" && $struc_shown == FALSE) {
        if (isset($bitmapURLdir) && $bitmapURLdir != "" && $usebmp == true) {
            while (strlen($id) < $digits) {
                $id = "0" . $id;
            }
            $subdir = '';
            if ($subdirdigits > 0) {
                $subdir = substr($id, 0, $subdirdigits) . '/';
            }
            print "<img src=\"{$bitmapURLdir}/{$db_id}/{$subdir}{$id}.png\" alt=\"hit reaction\">\n";
            $struc_shown = TRUE;
        }
    }
    if (($enable_jme == "y" || $enable_jsme == "y") && $struc_shown == FALSE) {
        // if no bitmaps are available, we must invoking another instance of JME
        // in "depict" mode for libraries display of each hit
        $qstr = "SELECT struc FROM {$rxnstructable} WHERE rxn_id = {$id}";
        $result3 = mysql_query($qstr) or die("Query failed! (struc)");
        while ($line3 = mysql_fetch_array($result3, MYSQL_ASSOC)) {
            $molstruc = $line3["struc"];
        }
        mysql_free_result($result3);
        // JME needs MDL molfiles with the "|" character instead of linebreaks
        $jmehitmol = tr4jme($molstruc);
        echo "<{$edtag} code=\"JME.class\" archive=\"JME.jar\" {$codebase}\n";
        echo "width=\"250\" height=\"120\">";
        echo "<param name=\"options\" value=\"depict\"> \n";
        echo "<param name=\"mol\" value=\"{$jmehitmol}\">\n";
        echo "</{$edtag}>\n";
        $struc_shown = TRUE;
    }
    echo "</td>\n</tr>\n";
}
예제 #4
0
echo "<table border=\"1\">\n<tr>\n<td>\n";
echo "<div class=\"moldiv\" id=\"strucdiv\" onclick=\"openeditorwindow()\" >\n";
if ($mol != '') {
    if ($svg_mode == 1) {
        if (is_rxnfile($mol)) {
            $mol2svgopt = "-R " . $mol2svgopt;
        }
        if ($ostype == 1) {
            print filterThroughCmd("{$safemol}", "{$MOL2SVG} {$mol2svgopt} -");
        }
        if ($ostype == 2) {
            print filterThroughCmd2("{$safemol}", "{$MOL2SVG} {$mol2svgopt} -");
        }
    } else {
        // use JME/JSME as fallback
        $jmehitmol = tr4jme($safemol);
        echo "<{$edtag} code=\"JME.class\" archive=\"JME.jar\" {$codebase}\n";
        echo "width=\"250\" height=\"120\">";
        echo "<param name=\"options\" value=\"depict\"> \n";
        echo "<param name=\"mol\" value=\"{$jmehitmol}\">\n";
        if ($edtag == "applet") {
            echo "</{$edtag}>click here to edit...\n";
        }
    }
    #print "<pre>$safemol</pre>\n";
} else {
    if ($svg_mode == 1) {
        echo "<?xml version=\"1.0\" standalone=\"no\" ?>\n";
        echo "<svg width=\"186\" height=\"94\" viewbox=\"0 5 186 94\" xmlns=\"http://www.w3.org/2000/svg\">\n";
        echo "<style type=\"text/css\"><![CDATA[ circle { stroke: #FFFFFF; fill: #FFFFFF; }\n";
        echo "text { font-family: Helvetica; font-size: 14px; } line { stroke: #BBBBBB; stroke-width: 1.0; } ]]> </style>\n";
예제 #5
0
    $outmol = str_replace("\r", "", $outmol);
    $outmol = strtr($outmol, "\n", "|");
    return $outmol;
}
?>
	
        <hr/>
        <div class="row">
            <div class="col-md-1 col-sm-1"></div>
            <div class="col-md-8 col-sm-8">

                <?php 
foreach ($records->result() as $record) {
    ?>
                    <?php 
    $jmehitmol = tr4jme($record->cd_structure);
    ?>
                    <table class="table table-bordered">
                        <caption><h3><?php 
    echo $record->molecule_name;
    ?>
</h3></caption>
                        <tr>
                            <td rowspan="8">
                                <div code="JME.class" name="JME" archive="JME.jar" width="360" height="315" id="JME">
                                    <param name="options" value="oldlook, nopaste, depict">
                                    <param name="mol" value="<?php 
    echo $jmehitmol;
    ?>
">   
                                    You have to enable JavaScript in your browser to use JSME! 
예제 #6
0
function showHit2($id, $type)
{
    global $enable_svg;
    global $enable_bitmaps;
    global $enable_jme;
    global $enable_jsme;
    global $bitmapURLdir;
    global $molstructable;
    global $moldatatable;
    global $rxnstructable;
    global $rxndatatable;
    global $pic2dtable;
    global $digits;
    global $subdirdigits;
    global $db_id;
    global $access;
    global $codebase;
    global $svg_mode;
    global $edtag;
    // by default, assume $type is 1 (structure data collection)
    $item_name = "mol_name";
    $structable = $molstructable;
    $datatable = $moldatatable;
    $id_name = "mol_id";
    $par = "mol";
    if ($type == 2) {
        $item_name = "rxn_name";
        $structable = $rxnstructable;
        $datatable = $rxndatatable;
        $id_name = "rxn_id";
        $par = "rxn";
    }
    $result3 = mysql_query("SELECT {$item_name} FROM {$datatable} WHERE {$id_name} = {$id}") or die("Query failed! (showHit2)");
    while ($line3 = mysql_fetch_array($result3, MYSQL_ASSOC)) {
        $txt = $line3["{$item_name}"];
    }
    mysql_free_result($result3);
    echo "<table width=\"100%\">\n";
    echo "<tr>\n<td class=\"highlight\">\n";
    print "<b>{$txt}</b> (<a href=\"showmol.php?{$par}={$id}&db={$db_id}\" target=\"blank\">{$id}</a>)\n";
    echo "</td>\n</tr>\n";
    echo "</table>\n";
    if ($access >= 2) {
        // display an "edit", "copy" and "erase" link for read/write data collections
        echo "<small>\n";
        print "<a class=\"menu\" href=\"admin/editdata.php?db={$db_id}&id={$id}&action=editdata\" target=\"admin\">edit</a>\n";
        print "<a class=\"menu\" href=\"admin/editdata.php?db={$db_id}&id={$id}&action=duplcopy\" target=\"admin\">copy</a>\n";
        print "<a class=\"menu\" href=\"admin/editdata.php?db={$db_id}&id={$id}&action=eraserecord\">erase</a><br>\n";
        echo "</small>\n";
    }
    $whatstr = "status";
    if ($svg_mode == 1) {
        $whatstr = "status, svg";
    }
    $svg = "";
    $qstr = "SELECT {$whatstr} FROM {$pic2dtable} WHERE {$id_name} = {$id}";
    $result2 = mysql_query($qstr) or die("Query failed! (pic2d)");
    while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
        $status = $line2["status"];
        @($svg = $line2["svg"]);
    }
    mysql_free_result($result2);
    if ($status == 1) {
        $usebmp = TRUE;
    } else {
        $usebmp = FALSE;
    }
    echo "<tr>\n<td colspan=\"2\">\n";
    $struc_shown = FALSE;
    if ($enable_svg == "y") {
        if (strlen($svg) > 0 && $svg_mode == 1) {
            print "{$svg}\n";
            $struc_shown = TRUE;
        } elseif ($svg_mode == 2) {
            echo "<img src=\"showsvg.php?id={$id}&db={$db_id}\" alt=\"hit structure\">\n";
            $struc_shown = TRUE;
        }
    }
    if ($enable_bitmaps == "y" && $struc_shown == FALSE) {
        if (isset($bitmapURLdir) && $bitmapURLdir != "" && $usebmp == true) {
            while (strlen($id) < $digits) {
                $id = "0" . $id;
            }
            $subdir = '';
            if ($subdirdigits > 0) {
                $subdir = substr($id, 0, $subdirdigits) . '/';
            }
            print "<img src=\"{$bitmapURLdir}/{$db_id}/{$subdir}{$id}.png\" alt=\"hit structure\">\n";
            $struc_shown = TRUE;
        }
    }
    if (($enable_jme == "y" || $enable_jsme == "y") && $struc_shown == FALSE) {
        // if no bitmaps are available, we must invoke another instance of JME/JSME
        // in "depict" mode for structure display of each hit
        $qstr = "SELECT struc FROM {$structable} WHERE {$id_name} = {$id}";
        $result3 = mysql_query($qstr) or die("Query failed! (struc)");
        while ($line3 = mysql_fetch_array($result3, MYSQL_ASSOC)) {
            $molstruc = $line3["struc"];
        }
        mysql_free_result($result3);
        // JME needs MDL molfiles with the "|" character instead of linebreaks
        $jmehitmol = tr4jme($molstruc);
        echo "<{$edtag} code=\"JME.class\" archive=\"JME.jar\" {$codebase}\n";
        echo "width=\"250\" height=\"120\">";
        echo "<param name=\"options\" value=\"depict\"> \n";
        echo "<param name=\"mol\" value=\"{$jmehitmol}\">\n";
        echo "</{$edtag}>\n";
        $struc_shown = TRUE;
    }
    echo "</td>\n</tr>\n";
}