Changeset 152 for trunk/matml/webselector
- Timestamp:
- 01/28/2005 01:37:50 PM (7 years ago)
- Location:
- trunk/matml/webselector/php
- Files:
-
- 1 added
- 1 removed
- 8 modified
-
Caliban.otf (modified) (previous)
-
Caliban.ttf (modified) (previous)
-
CaslonRoman.ttf (modified) (previous)
-
clicked.inc (deleted)
-
dbquery.php.inc (modified) (23 diffs)
-
plot.php (modified) (7 diffs)
-
select_other.php (modified) (9 diffs)
-
select.php (modified) (7 diffs)
-
setvars.inc.php (added)
-
vixar.ttf (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/matml/webselector/php/dbquery.php.inc
r144 r152 116 116 } 117 117 118 119 118 } 120 119 elseif($power < -1){ … … 147 146 $ret=new Unit( 148 147 "$name", 149 $this->num_name*$other->num_name,150 $this->scale*$other->scale148 pow($this->num_name,$power), 149 pow($this->scale,$power) 151 150 ); 152 151 return $ret; … … 154 153 function equals($other) 155 154 { 156 return abs($this->num_name-$other)<.00000001; 155 if(is_object($other)) 156 $num_name=$other->num_name; 157 else 158 $num_name=$other; 159 return abs($this->num_name-$num_name)<.00000001; 157 160 } 158 161 } … … 189 192 //average value out of all the matches 190 193 var $avg_value; 191 var $ num_unit;194 var $unit; 192 195 //number of matches 193 196 var $count; … … 195 198 { 196 199 $this->avg_value=0; 197 $this-> num_unit=0;200 $this->unit=0; 198 201 $this->count=0; 199 202 } … … 204 207 global $unit_infos; 205 208 global $dom; 206 $scale=1;207 209 if(get_class($units_element)=="DOMNodeList") 208 210 $units_element=$units_element->item(0); 209 211 if($units_element) 210 212 { 211 $num_unit=1; 213 $return_unit=new Unit( 214 "", 215 1, 216 1 217 ); 212 218 $factor=$units_element->getAttribute("factor"); 213 219 if($factor) 214 $ scale*=$factor;220 $return_unit->scale*=$factor; 215 221 //$units=$units_element->get_elements_by_tagname("Unit"); 216 222 $units=$units_element->getElementsByTagName("Unit"); … … 226 232 if(!$unit_info) 227 233 echo "Error: unknown unit $name\n"; 228 $scale*=pow($unit_info->scale,$power); 229 $num_unit*=pow($unit_info->num_name,$power); 234 $return_unit=$return_unit->mul($unit_info->pow($power)); 230 235 } 231 236 } 232 237 else 233 $ num_unit=0;234 return array($scale,$num_unit);238 $return_unit=null; 239 return $return_unit; 235 240 } 236 241 … … 243 248 244 249 $equivalencies=array( 245 array_flip(array("Young's Modulus"," Modulus of Elasticity","Tensile Modulus")),250 array_flip(array("Young's Modulus","Youngs Modulus","Modulus of Elasticity","Tensile Modulus")), 246 251 array_flip(array("Tensile Strength, Yield","Yield Strength","Tensile Strength @ Yield")), 247 252 array_flip(array("Heat Capacity","Specific Heat")) … … 303 308 { 304 309 $units=$detail->getElementsByTagName("Units"); 305 list($scale,$num_unit)=parse_units($units);306 if(!$data-> num_unit)307 $data-> num_unit=$num_unit;310 $unit=parse_units($units); 311 if(!$data->unit) 312 $data->unit=$unit; 308 313 else 309 314 { 310 force_unit_match($Matid, new Unit("unknown",$num_unit,$scale),$data);315 force_unit_match($Matid,$unit,$data); 311 316 } 312 317 … … 316 321 { 317 322 $data->count++; 318 $data->avg_value+=$property_data->nodeValue*$ scale;323 $data->avg_value+=$property_data->nodeValue*$unit->scale; 319 324 } 320 325 } … … 369 374 function force_unit_match($material,$unit,&$property_data) 370 375 { 376 global $unit_infos; 371 377 //Convert BTUs per degree F to Joules per degree C 372 $BTUs_per_degree_F=2*3*3/(7*7)/17; 373 $power=get_factor_power($property_data->num_unit,$BTUs_per_degree_F); 374 $property_data->num_unit*=pow($BTUs_per_degree_F,-$power)*pow( 375 2*3*3/(7*7)/11,$power); 378 $BTUs_per_degree_F=$unit_infos['BTU']->div($unit_infos['°F']); 379 $Joules_per_degree_C=$unit_infos['J']->div($unit_infos['°C']); 380 $power=get_factor_power($property_data->unit->num_name,$BTUs_per_degree_F->num_name); 381 $BTUs_to_Joules=$Joules_per_degree_C->div($BTUs_per_degree_F); 382 $BTUs_to_Joules->scale=1899.1009999999999/1000; 383 $property_data->unit=$property_data->unit->mul($BTUs_to_Joules->pow($power)); 376 384 $property_data->avg_value*=pow( 377 1899.1009999999999/1000,$power);378 379 if(!$unit->equals($property_data-> num_unit))380 { 381 $power=get_factor_power($property_data-> num_unit,13);382 if($unit->equals($property_data-> num_unit*pow(13,-$power)*pow(2*3/(7*7),$power)))385 $BTUs_to_Joules->scale,$power); 386 387 if(!$unit->equals($property_data->unit)) 388 { 389 $power=get_factor_power($property_data->unit->num_name,13); 390 if($unit->equals($property_data->unit->num_name*pow(13,-$power)*pow(2*3/(7*7),$power))) 383 391 { 384 392 //it uses pound as a force 385 $property_data->num_unit*=pow(13,-$power)*pow(2*3/(7*7),$power); 386 $property_data->avg_value*=pow(4.44822162*1000,$power); 393 $newtons_per_pound=$unit_infos['N']->div($unit_infos['lb']); 394 $newtons_per_pound->scale=4.44822162*1000; 395 $newtons_per_pound=$newtons_per_pound->pow($power); 396 397 $property_data->unit=$property_data->unit->mul($newtons_per_pound); 398 $property_data->avg_value*=$newtons_per_pound->scale; 387 399 return true; 388 400 } 389 if($unit->equals($property_data-> num_unit*pow(13,-$power)*pow(2,$power)))401 if($unit->equals($property_data->unit->num_name*pow(13,-$power)*pow(2,$power))) 390 402 { 391 403 //it uses pound as a mass 392 $property_data->num_unit*=pow(13,-$power)*pow(2,$power); 393 $property_data->avg_value*=pow(453.59237,$power); 404 $grams_per_pound=$unit_infos['g']->div($unit_infos['lb']); 405 $grams_per_pound->scale=453.59237; 406 $grams_per_pound=$grams_per_pound->pow($power); 407 $property_data->unit=$property_data->unit->mul($grams_per_pound); 408 $property_data->avg_value*=$grams_per_pound->scale; 394 409 return true; 395 410 } 396 echo "Error: unit mismatch ($unit->name $unit->num_name vs $property_data->num_unit) in $material\n";411 echo "Error: unit mismatch ($unit->name vs ".$property_data->unit->name.") and ($unit->num_name vs ".$property_data->unit->num_name.") in $material\n"; 397 412 return false; 398 413 } … … 474 489 $valuese = array(); 475 490 $categories = array(); 491 $filenames = array(); 476 492 477 493 $handle = opendir('materials'); … … 530 546 531 547 } 548 $filenames[]="materials/$file"; 532 549 } 533 550 } … … 568 585 } 569 586 570 return array(&$valuesX, &$valuesY, &$names, $xlabel, $ylabel, $categories); 571 587 $ret=array(&$valuesX, &$valuesY, &$names, $xlabel, $ylabel, $categories); 588 $ret["filenames"]=$filenames; 589 return $ret; 572 590 } 573 591 … … 580 598 581 599 582 $query = array( );600 $query = array("Matid"=>"Material Name"); 583 601 $power = array(); 584 602 $NXqueries = array(); 585 603 $NYqueries = array(); 586 604 587 $xml_name = array(588 "Density" => "Density",589 "E" => "Young's Modulus",590 "Cp" => "Heat Capacity",591 "K" => "Thermal Conductivity",592 "YS" => "Yield Strength"593 );594 595 596 605 $prop_units = array( 597 606 "Density" => $unit_infos["g"]->div($unit_infos["cc"]), 598 "E" => $unit_infos["MPa"], 599 "YS" => $unit_infos["MPa"], 600 "Cp" => $unit_infos["J"]->div($unit_infos["g"]->mul($unit_infos["°C"])), 601 "K" => $unit_infos["W"]->div($unit_infos["m"]->mul($unit_infos["K"])), 607 "Young's Modulus" => $unit_infos["MPa"], 608 "Youngs Modulus" => $unit_infos["MPa"], 609 "Yield Strength" => $unit_infos["MPa"], 610 "Heat Capacity" => $unit_infos["J"]->div($unit_infos["g"]->mul($unit_infos["°C"])), 611 "Thermal Conductivity" => $unit_infos["W"]->div($unit_infos["m"]->mul($unit_infos["K"])), 602 612 ); 603 613 … … 610 620 foreach( $property_listx as $property=>$pow){ 611 621 $index++; 612 $query["Xquery$index"]= "$xml_name[$property]";622 $query["Xquery$index"]=$property; 613 623 $power["Xquery$index"]= $pow; 614 624 $final_units["Xquery$index"] = $prop_units["$property"]; 615 625 616 626 if( $pow > 1){ 617 $xlabel_num = "$ xml_name[$property]^$pow *";627 $xlabel_num = "$property^$pow *"; 618 628 } 619 629 elseif($pow == 1){ 620 $xlabel_num = "$ xml_name[$property]*";630 $xlabel_num = "$property*"; 621 631 } 622 632 elseif($pow == -1){ 623 $xlabel_den = "$ xml_name[$property]*";633 $xlabel_den = "$property*"; 624 634 } 625 635 elseif($pow < -1){ 626 $xlabel_den = "$ xml_name[$property]^".abs($pow)."*";636 $xlabel_den = "$property^".abs($pow)."*"; 627 637 } 628 638 … … 635 645 foreach( $property_listy as $property=>$pow){ 636 646 $index++; 637 $query["Yquery$index"]= "$xml_name[$property]";647 $query["Yquery$index"]=$property; 638 648 $power["Yquery$index"]= $pow; 639 649 $final_units["Yquery$index"] = $prop_units["$property"]; 640 650 641 651 if( $pow > 1){ 642 $ylabel_num = "$ xml_name[$property]^$pow *";652 $ylabel_num = "$property^$pow *"; 643 653 } 644 654 elseif($pow == 1){ 645 $ylabel_num = "$ xml_name[$property]*";655 $ylabel_num = "$property*"; 646 656 } 647 657 elseif($pow == -1){ 648 $ylabel_den = "$ xml_name[$property]*";658 $ylabel_den = "$property*"; 649 659 } 650 660 elseif($pow < -1){ 651 $ylabel_den = "$ xml_name[$property]^".abs($pow)."*";661 $ylabel_den = "$property^".abs($pow)."*"; 652 662 } 653 663 … … 659 669 // Prepare final units 660 670 661 662 671 $first = 0; 663 672 foreach($NXqueries as $Nquery){ … … 711 720 $valuese = array(); 712 721 $categories = array(); 722 $filenames = array(); 713 723 714 724 $handle = opendir('materials'); … … 782 792 783 793 foreach( $NXqueries as $Nquery){ 784 $cont *= ( pow($values["$Nquery"]->avg_value,$power["$Nquery"]) /$final_units["$Nquery"]->scale); 794 $final_unit=$final_units["$Nquery"]->pow($power["$Nquery"]); 795 $cont *= ( pow($values["$Nquery"]->avg_value,$power["$Nquery"]) /$final_unit->scale); 785 796 } 786 797 $valuesX[]=$cont; … … 789 800 790 801 foreach( $NYqueries as $Nquery){ 791 $cont *= ( pow($values["$Nquery"]->avg_value,$power["$Nquery"]) /$final_units["$Nquery"]->scale); 802 $final_unit=$final_units["$Nquery"]->pow($power["$Nquery"]); 803 $cont *= ( pow($values["$Nquery"]->avg_value,$power["$Nquery"]) /$final_unit->scale); 792 804 } 793 805 $valuesY[]=$cont; … … 805 817 // Something else for category 806 818 $categories[]=$category; 819 $filenames[]="materials/$file"; 807 820 808 821 } … … 819 832 820 833 821 return array(&$valuesX, &$valuesY, &$names, $xlabel, $ylabel, $categories); 822 834 $ret=array(&$valuesX, &$valuesY, &$names, $xlabel, $ylabel, $categories); 835 $ret["filenames"]=$filenames; 836 return $ret; 823 837 } 824 838 -
trunk/matml/webselector/php/plot.php
r144 r152 2 2 include("functions.php.inc"); 3 3 include("dbquery.php.inc"); 4 include("setvars.inc.php"); 4 5 5 6 //by "likavcan at NOSPAN sturak nospan dot sk" at from php.net … … 28 29 } 29 30 30 function calc_tickscale($max_value,$min_ticks,$max_labels)31 {32 //First see how many labels we can get in33 $tickscale=pow(10,floor(log($max_value,10)));34 while($max_value/$tickscale*10<=$max_labels)35 $tickscale/=10;36 //That's as far as we can break up the labels for powers of 10.37 //Maybe we can break it up by 5 or 238 $ticks=$max_value/$tickscale;39 $divisions=1;40 if($ticks*5<=$max_labels)41 $divisions=5;42 else if($ticks*2<=$max_labels)43 $divisions=2;44 $tickscale/=$divisions;45 $ticks*=$divisions;46 47 //Label interval is how many ticks to have before a label48 $label_interval=1;49 if($ticks*$divisions<$min_ticks&&$divisions!=1)50 {51 //the tickscale needs to be broken up more for the ticks52 //(but not labels). Gotta undo the last factor then for the ticks.53 $label_interval=10/$divisions;54 $tickscale/=10/$divisions;55 }56 57 //Do we still need to break the ticks up more?58 while($max_value/$tickscale<$min_ticks)59 {60 if($max_value/$tickscale*2>=$min_ticks)61 {62 $label_interval*=2;63 $tickscale/=2;64 break;65 }66 if($max_value/$tickscale*5>=$min_ticks)67 {68 $label_interval*=5;69 $tickscale/=5;70 break;71 }72 $label_interval*=10;73 $tickscale/=10;74 }75 return array($tickscale,$label_interval);76 }77 78 //Request arguments79 80 if(isset($_REQUEST['plot']))81 $plottype = $_REQUEST['plot'];82 else83 $plottype = 'EvsYield';84 if(isset($_REQUEST['log']))85 $log = $_REQUEST['log'];86 else87 $log = 0;88 if(isset($_REQUEST['selected']))89 $selected = $_REQUEST['selected'];90 else91 $selected = '';92 $categorizations=array(array(""=>0),array("Metals"=>0,"Polymers"=>1,"Ceramics"=>2,"Fibers"=>1));93 if(isset($_REQUEST['categorization']))94 $categorization=$categorizations[$_REQUEST['categorization']];95 else96 $categorization=$categorizations[0];97 98 99 100 if(isset($_REQUEST["numvars"])){101 $numvars=$_REQUEST['numvars'];102 }103 104 $matstring = "";105 $property_listx = array();106 $property_listy = array();107 for($i=1;$i<=4;$i++){108 if(isset($_REQUEST["propname".$i])){109 $propname[$i]=$_REQUEST['propname'.$i];110 }111 if(isset($_REQUEST["xpow".$i])){112 $xpow[$i]=$_REQUEST['xpow'.$i];113 }114 if(isset($_REQUEST["ypow".$i])){115 $ypow[$i]=$_REQUEST['ypow'.$i];116 }117 118 if($xpow[$i] != 0){119 $property_listx["$propname[$i]"] = "$xpow[$i]";120 }121 if($ypow[$i] != 0){122 $property_listy["$propname[$i]"] = "$ypow[$i]";123 }124 125 }126 // print_r($ypow);127 // echo "<br><br>";128 // print_r($property_listx);129 // echo "<br><br>";130 // print_r($property_listy);131 132 133 134 135 //get the values from the database with these function136 if($plottype == "free")137 list($valuesX, $valuesY, $names, $xlabel, $ylabel, $categories) = db_get_plot_single_values($property_listx, $property_listy, $log, $categorization);138 else139 list($valuesX, $valuesY, $names, $xlabel, $ylabel, $categories) = db_get_plot_values($plottype, $log, $categorization);140 141 142 143 // print_r($valuesX);144 // echo "<br>";145 // print_r($valuesY);146 147 // return;148 149 31 $number_mat = count($names); 150 151 32 152 33 $Iwidth=600; … … 167 48 $grey = ImageColorAllocate($image, 220, 220, 220); 168 49 $black = ImageColorAllocate($image, 0, 0, 0); 169 $category_colors=array(ImageColorAllocate($image, 0, 0, 255),ImageColorAllocate($image, 255, 0, 0),ImageColorAllocate($image, 0, 255, 0)); 170 $selected_color = ImageColorAllocate($image, 255, 255, 255); 50 $category_raw_colors=array(array(0, 0, 255),array(255, 0, 0),array(0, 255, 0),array(255,255,255)); 51 $category_colors=array(); 52 for($index=0; $index<count($category_raw_colors)-1; $index++) 53 { 54 $raw_color=$category_raw_colors[$index]; 55 $category_colors[$index]=ImageColorAllocate($image,$raw_color[0],$raw_color[1],$raw_color[2]); 56 } 57 $raw_color=$category_raw_colors[$index]; 58 $selected_color=ImageColorAllocate($image,$raw_color[0],$raw_color[1],$raw_color[2]); 171 59 172 60 $bgcolor = ImageColorAllocate($image, 0xe5, 0xe8, 0xb2); … … 177 65 178 66 //Figure out extra left border for y axis values 179 if($ log== 1){67 if($_SESSION['log'] == 1){ 180 68 } 181 69 else{ … … 204 92 205 93 // Broken Log scale Attempt 206 if($ log== 1){94 if($_SESSION['log'] == 1){ 207 95 208 96 $maxx = log(max($valuesX)); … … 270 158 271 159 272 if($ log== 1){160 if($_SESSION['log'] == 1){ 273 161 $x = $x_initial + $width_bar * (log($valuesX[$i]) + abs($minx) ); 274 162 $y = $y_initial - $height_bar * (log($valuesY[$i]) + abs($miny) ); … … 283 171 // echo "X: $valuesX[$i] Y: $valuesY[$i]<br>"; 284 172 285 if( $selected==$names[$i])173 if(isset($_SESSION['selected_info'])&&$_SESSION['selected_info']['Material Name']==$names[$i]) 286 174 $color=$selected_color; 287 175 else -
trunk/matml/webselector/php/select_other.php
r145 r152 1 <?php 2 include("dbquery.php.inc"); 3 include "setvars.inc.php"; 4 ?> 1 5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 6 <!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> --> … … 29 33 <br> 30 34 <? 31 if(isset($_REQUEST["plot"])) 35 36 echo "<a href=\"select_other.php?clicked=\"><img width=600 height=450 src=\"plot.php\" ismap style=\"border-style: none\"></a>" 37 ?> 38 <div class="content"> 39 <br> 40 <br> 41 <? 42 echo"<table>\n"; 43 echo"<tr>\n"; 44 45 $category="Selected"; 46 $number=count($category_raw_colors)-1; 47 echo "<td>\n"; 48 echo "<table>\n"; 49 echo "<tr>\n"; 50 echo "<td>\n"; 51 $color=$category_raw_colors[$number]; 52 echo sprintf("<table border=1 width=8 height=8 bgcolor=#%02X%02X%02X></table>\n",$color[0],$color[1],$color[2]); 53 echo "</td>\n"; 54 echo "<td>\n"; 55 echo " $category\n"; 56 echo "</td>\n"; 57 echo "</tr>\n"; 58 echo "</table>\n"; 59 echo "</td>\n"; 60 61 foreach($category_raw_colors as $number=>$color) 32 62 { 33 $plot = $_REQUEST["plot"]; 63 $matching_category_names=array_keys($categorizations[$_SESSION['categorization']],$number); 64 if(!count($matching_category_names)) 65 continue; 66 echo "<td>\n"; 67 echo "<table>\n"; 68 echo "<tr>\n"; 69 echo "<td>\n"; 70 echo sprintf("<table border=1 width=8 height=8 bgcolor=#%02X%02X%02X></table>\n",$color[0],$color[1],$color[2]); 71 echo "</td>\n"; 72 echo "<td>\n "; 73 for($i=0; $i<count($matching_category_names); $i++) 74 { 75 $category=$matching_category_names[$i]; 76 if($category=="") 77 $category="All Others"; 78 if($i>0) 79 echo ", "; 80 echo "$category"; 81 } 82 echo "</td>\n"; 83 echo "</tr>\n"; 84 echo "</table>\n"; 85 echo "</td>\n"; 34 86 } 35 else 87 echo "</tr>"; 88 echo "</table>"; 89 90 if(isset($_SESSION['selected_info'])) 36 91 { 37 $plot = "free"; 38 } 39 if(isset($_REQUEST["selected"])) 40 { 41 $selected = $_REQUEST["selected"]; 42 } 43 else 44 $selected = ""; 45 if(isset($_REQUEST["categorization"])) 46 $categorization=$_REQUEST['categorization']; 47 else 48 $categorization=0; 49 include("clicked.inc"); 50 if(isset($_REQUEST["clicked"])) 51 { 52 list($clickX,$clickY)=explode(",",substr($_REQUEST["clicked"],1)); 53 clicked(); 54 } 55 56 if(isset($_REQUEST["numvars"])){ 57 $numvars=$_REQUEST['numvars']; 58 } 59 60 $matstring = ""; 61 for($i=1;$i<=4;$i++){ 62 if(isset($_REQUEST["propname".$i])){ 63 $propname[$i]=$_REQUEST['propname'.$i]; 64 } 65 if(isset($_REQUEST["xpow".$i])){ 66 $xpow[$i]=$_REQUEST['xpow'.$i]; 67 } 68 if(isset($_REQUEST["ypow".$i])){ 69 $ypow[$i]=$_REQUEST['ypow'.$i]; 70 } 71 $matstring .= "&propname$i=$propname[$i]"; 72 $matstring .= "&xpow$i=$xpow[$i]"; 73 $matstring .= "&ypow$i=$ypow[$i]"; 74 } 75 76 $matstring .= "&numvars=$numvars"; 77 78 79 if($selected) 80 get_selected_data(); 81 82 echo "<a href=\"select.php?plot=$plot&selected=".urlencode($selected)."&categorization=$categorization&clicked=\"><img width=600 height=450 src=\"plot.php?plot=$plot&selected=".urlencode($selected)."$matstring"."&categorization=$categorization\" ismap style=\"border-style: none\"></a>" 83 ?> 84 <div class="content"> 85 <br> 86 <br> 87 <? 88 if($selected) 89 { 92 echo "<br>"; 90 93 echo "<table>\n"; 91 94 echo "<tr>\n<td colspan=3 align=center><h3>Selected Material Information</h3></td>\n</tr>\n"; 92 echo "<tr><td>Name</td><td width=20></td><td>$selected</td></tr>\n"; 93 echo "<tr><td>$xlabel</td><td></td><td>$selected_xval</td></tr>\n"; 94 echo "<tr><td>$ylabel</td><td></td><td>$selected_yval</td></tr>\n"; 95 echo "<tr><td>Name</td><td width=20></td><td>".$_SESSION['selected_info']['Material Name']."</td></tr>\n"; 96 echo "<tr><td>$xlabel</td><td></td><td>".$_SESSION['selected_info'][$xlabel]."</td></tr>\n"; 97 echo "<tr><td>$ylabel</td><td></td><td>".$_SESSION['selected_info'][$ylabel]."</td></tr>\n"; 98 echo "<tr><td>MatML file</td><td></td><td><A TARGET=_blank HREF=\"".$_SESSION['selected_info']['MatML Filename']."\">".$_SESSION['selected_info']['MatML Filename']."</A></td></tr>\n"; 99 $selected_source=$_SESSION['selected_info']['Material Data Source']; 100 if($selected_source!="") 101 echo "<tr><td>Data Source</td><td></td><td><A TARGET=_blank HREF=\"$selected_source\">$selected_source</A></td></tr>\n"; 95 102 echo "</table>\n"; 96 103 } … … 113 120 <select name="propname1"> 114 121 <option value="Density" selected>Density</option> 115 <option value=" Cp">Heat Capacity</option>116 <option value=" K">Thermal Conductivity</option>117 <option value="Y S">Yield Strength</option>118 <option value=" E">Young's Modulus</option> <!--'-->122 <option value="Heat Capacity">Heat Capacity</option> 123 <option value="Thermal Conductivity">Thermal Conductivity</option> 124 <option value="Yield Strength">Yield Strength</option> 125 <option value="Youngs Modulus">Young's Modulus</option> <!--'--> 119 126 </select> 120 127 </td><td align="center"><input type="text" size="3" value="1" name="xpow1"></input></td><td align="center"><input type="text" size="3" value="0" name="ypow1"></td></tr> … … 122 129 <select name="propname2"> 123 130 <option value="Density">Density</option> 124 <option value=" Cp">Heat Capacity</option>125 <option value=" K">Thermal Conductivity</option>126 <option value="Y S">Yield Strength</option>127 <option value=" E" selected>Young's Modulus</option> <!--'-->131 <option value="Heat Capacity">Heat Capacity</option> 132 <option value="Thermal Conductivity">Thermal Conductivity</option> 133 <option value="Yield Strength">Yield Strength</option> 134 <option value="Youngs Modulus" selected>Young's Modulus</option> <!--'--> 128 135 </select> 129 136 </td><td align="center"><input type="text" size="3" value="0" name="xpow2"></input></td><td align="center"><input type="text" size="3" value="1" name="ypow2"></td></tr> … … 131 138 <select name="propname3"> 132 139 <option value="Density">Density</option> 133 <option value=" Cp">Heat Capacity</option>134 <option value=" K">Thermal Conductivity</option>135 <option value="Y S">Yield Strength</option>136 <option value=" E">Young's Modulus</option> <!--'-->140 <option value="Heat Capacity">Heat Capacity</option> 141 <option value="Thermal Conductivity">Thermal Conductivity</option> 142 <option value="Yield Strength">Yield Strength</option> 143 <option value="Youngs Modulus" selected>Young's Modulus</option> <!--'--> 137 144 </select> 138 145 </td><td align="center"><input type="text" size="3" value="0" name="xpow3"></input></td><td align="center"><input type="text" size="3" value="0" name="ypow3"></td></tr> … … 140 147 <select name="propname4"> 141 148 <option value="Density">Density</option> 142 <option value=" Cp">Heat Capacity</option>143 <option value=" K">Thermal Conductivity</option>144 <option value="Y S">Yield Strength</option>145 <option value=" E">Young's Modulus</option> <!--'-->149 <option value="Heat Capacity">Heat Capacity</option> 150 <option value="Thermal Conductivity">Thermal Conductivity</option> 151 <option value="Yield Strength">Yield Strength</option> 152 <option value="Youngs Modulus" selected>Young's Modulus</option> <!--'--> 146 153 </select> 147 154 </td><td align="center"><input type="text" size="3" value="0" name="xpow4"></input></td><td align="center"><input type="text" size="3" value="0" name="ypow4"></td></tr> … … 156 163 <td align="left"> 157 164 <? 158 $categorization s=array("None","Metals, Polymers, and Ceramics");165 $categorization_names=array("None","Metals, Polymers, and Ceramics"); 159 166 $left="<input type=\"radio\" name=\"categorization\" value=\""; 160 167 $right = "\">"; … … 162 169 163 170 164 foreach($categorization s as $index=>$name){171 foreach($categorization_names as $index=>$name){ 165 172 166 173 echo $left; … … 169 176 170 177 171 if($index == $ categorization){178 if($index == $_SESSION['categorization']){ 172 179 echo "\" checked>"; 173 180 } -
trunk/matml/webselector/php/select.php
r121 r152 1 <?php 2 include("dbquery.php.inc"); 3 include "setvars.inc.php"; 4 ?> 1 5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 6 <!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> --> … … 29 33 <br> 30 34 <? 31 if(isset($_REQUEST["plot"])) 35 //include("clicked.inc"); 36 37 echo "<a href=\"select.php?clicked=\"><img width=600 height=450 src=\"plot.php\" ismap style=\"border-style: none\"></a>" 38 ?> 39 <div class="content"> 40 <br> 41 <br> 42 <? 43 echo"<table>\n"; 44 echo"<tr>\n"; 45 46 $category="Selected"; 47 $number=count($category_raw_colors)-1; 48 echo "<td>\n"; 49 echo "<table>\n"; 50 echo "<tr>\n"; 51 echo "<td>\n"; 52 $color=$category_raw_colors[$number]; 53 echo sprintf("<table border=1 width=8 height=8 bgcolor=#%02X%02X%02X></table>\n",$color[0],$color[1],$color[2]); 54 echo "</td>\n"; 55 echo "<td>\n"; 56 echo " $category\n"; 57 echo "</td>\n"; 58 echo "</tr>\n"; 59 echo "</table>\n"; 60 echo "</td>\n"; 61 62 foreach($category_raw_colors as $number=>$color) 32 63 { 33 $plot = $_REQUEST["plot"]; 34 } 35 else 64 $matching_category_names=array_keys($categorizations[$_SESSION['categorization']],$number); 65 if(!count($matching_category_names)) 66 continue; 67 echo "<td>\n"; 68 echo "<table>\n"; 69 echo "<tr>\n"; 70 echo "<td>\n"; 71 echo sprintf("<table border=1 width=8 height=8 bgcolor=#%02X%02X%02X></table>\n",$color[0],$color[1],$color[2]); 72 echo "</td>\n"; 73 echo "<td>\n "; 74 for($i=0; $i<count($matching_category_names); $i++) 75 { 76 $category=$matching_category_names[$i]; 77 if($category=="") 78 $category="All Others"; 79 if($i>0) 80 echo ", "; 81 echo "$category"; 82 } 83 echo "</td>\n"; 84 echo "</tr>\n"; 85 echo "</table>\n"; 86 echo "</td>\n"; 87 } 88 echo "</tr>"; 89 echo "</table>"; 90 91 if(isset($_SESSION['selected_info'])) 36 92 { 37 $plot = "EvsD"; 38 } 39 if(isset($_REQUEST["selected"])) 40 { 41 $selected = $_REQUEST["selected"]; 42 } 43 else 44 $selected = ""; 45 if(isset($_REQUEST["categorization"])) 46 $categorization=$_REQUEST['categorization']; 47 else 48 $categorization=0; 49 include("clicked.inc"); 50 if(isset($_REQUEST["clicked"])) 51 { 52 list($clickX,$clickY)=explode(",",substr($_REQUEST["clicked"],1)); 53 clicked(); 54 } 55 if($selected) 56 get_selected_data(); 57 58 echo "<a href=\"select.php?plot=$plot&selected=".urlencode($selected)."&categorization=$categorization&clicked=\"><img width=600 height=450 src=\"plot.php?plot=$plot&selected=".urlencode($selected)."&categorization=$categorization\" ismap style=\"border-style: none\"></a>" 59 ?> 60 <div class="content"> 61 <br> 62 <br> 63 <? 64 if($selected) 65 { 93 echo "<br>"; 66 94 echo "<table>\n"; 67 95 echo "<tr>\n<td colspan=3 align=center><h3>Selected Material Information</h3></td>\n</tr>\n"; 68 echo "<tr><td>Name</td><td width=20></td><td>$selected</td></tr>\n"; 69 echo "<tr><td>$xlabel</td><td></td><td>$selected_xval</td></tr>\n"; 70 echo "<tr><td>$ylabel</td><td></td><td>$selected_yval</td></tr>\n"; 96 echo "<tr><td>Name</td><td width=20></td><td>".$_SESSION['selected_info']['Material Name']."</td></tr>\n"; 97 echo "<tr><td>$xlabel</td><td></td><td>".$_SESSION['selected_info'][$xlabel]."</td></tr>\n"; 98 echo "<tr><td>$ylabel</td><td></td><td>".$_SESSION['selected_info'][$ylabel]."</td></tr>\n"; 99 echo "<tr><td>MatML file</td><td></td><td><A TARGET=_blank HREF=\"".$_SESSION['selected_info']['MatML Filename']."\">".$_SESSION['selected_info']['MatML Filename']."</A></td></tr>\n"; 100 $selected_source=$_SESSION['selected_info']['Material Data Source']; 101 if($selected_source!="") 102 echo "<tr><td>Data Source</td><td></td><td><A TARGET=_blank HREF=\"$selected_source\">$selected_source</A></td></tr>\n"; 71 103 echo "</table>\n"; 72 104 } … … 85 117 <td align="left"> 86 118 <? 87 echo "<input type=\"hidden\" name=\"selected\" value=\"$selected\">\n";88 89 119 $plotypes = array("EvsD","EvsYield","EovDvsYieldovD","KvsDCp"); 90 120 $plotnames = array( … … 106 136 107 137 108 if($type == $ plot){138 if($type == $_SESSION['plottype']){ 109 139 echo "\" checked>"; 110 140 } … … 125 155 <td align="left"> 126 156 <? 127 $categorization s=array("None","Metals, Polymers, and Ceramics");157 $categorization_names=array("None","Metals, Polymers, and Ceramics"); 128 158 $left="<input type=\"radio\" name=\"categorization\" value=\""; 129 159 $right = "\">"; … … 131 161 132 162 133 foreach($categorization s as $index=>$name){163 foreach($categorization_names as $index=>$name){ 134 164 135 165 echo $left; … … 138 168 139 169 140 if($index == $ categorization){170 if($index == $_SESSION['categorization']){ 141 171 echo "\" checked>"; 142 172 }