Mercurial > hg > extraction-interface
comparison interface/check_sections_details.php @ 0:b12c99b7c3f0
commit for previous development
| author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
|---|---|
| date | Mon, 19 Jan 2015 17:13:49 +0100 |
| parents | |
| children | ef6d0c6a13d7 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b12c99b7c3f0 |
|---|---|
| 1 <?php | |
| 2 include_once('Lib_mb_utf8.php'); | |
| 3 include_once('config.php'); | |
| 4 include_once('edit_section_db.php'); | |
| 5 set_time_limit(0); | |
| 6 ini_set('memory_limit', '-1'); | |
| 7 | |
| 8 $link_mysql = mysql_connect($mysql_server, $mysql_user, $mysql_password); | |
| 9 mysql_query("SET NAMES utf8"); | |
| 10 | |
| 11 if (!$link_mysql) { | |
| 12 die('Could not connect: ' . mysql_error()); | |
| 13 } | |
| 14 | |
| 15 $db_selected = mysql_select_db($mysql_database, $link_mysql); | |
| 16 if (!$db_selected) { | |
| 17 die ('Can\'t use foo : ' . mysql_error()); | |
| 18 } | |
| 19 function getBookInfo($bookId){ | |
| 20 $query="SELECT * FROM books WHERE id=".$bookId; | |
| 21 $result=mysql_query($query); | |
| 22 $bookInfo=mysql_fetch_assoc($result); | |
| 23 return $bookInfo; | |
| 24 } | |
| 25 function printBookInfo($bookInfo){ | |
| 26 $str="<table>"; | |
| 27 $str.="<tr><td class='bookId'>book id | |
| 28 <td class='bookName'>book name | |
| 29 <td class='level1'>level1 | |
| 30 <td class='level2'>level2 | |
| 31 <td class='period'>period | |
| 32 <td class='bookId'>pages | |
| 33 <td class='bookId'>version | |
| 34 <td class='bookName'>editor | |
| 35 <td class='bookName'>date"; | |
| 36 $str.="<tr>"; | |
| 37 $str.="<td>".$bookInfo['id']; | |
| 38 $str.="<td>".$bookInfo['name']; | |
| 39 $str.="<td>".$bookInfo['level1']; | |
| 40 $str.="<td>".$bookInfo['level2']; | |
| 41 $str.="<td>".$bookInfo['period']; | |
| 42 $str.="<td>".$bookInfo['line']; | |
| 43 $str.="<td>".$bookInfo['version']; | |
| 44 $str.="<td>".$bookInfo['editor']; | |
| 45 $str.="<td>".$bookInfo['date']; | |
| 46 $str.="</table>"; | |
| 47 echo $str; | |
| 48 } | |
| 49 function printSectionArray($sectionArray,$missingPageArray){ | |
| 50 $str="<div id='bookContainer'>"; | |
| 51 echo $str; | |
| 52 $i=0; | |
| 53 foreach($sectionArray as $idx=>$row){ | |
| 54 /* | |
| 55 $flag=""; | |
| 56 if($i!=sizeof($pageArray) && $pageArray[$i]['start_page']==$row['start_page'] && $pageArray[$i]['end_page']==$row['end_page']){ | |
| 57 $flag="overlapper"; | |
| 58 $i++; | |
| 59 } | |
| 60 if($i!=0 && $pageArray[$i-1]['start_page']==$row['start_page'] && $pageArray[$i-1]['end_page']==$row['end_page']){ | |
| 61 $flag="overlapper"; | |
| 62 }*/ | |
| 63 if(!($idx!=0 && $sectionArray[$idx-1]['start_page']==$row['start_page'] && $sectionArray[$idx-1]['end_page']==$row['end_page']) | |
| 64 && $i<sizeof($missingPageArray) && $missingPageArray[$i]['end_page']==$row['start_page']){ | |
| 65 $str="<div class='missingPageContainer'><div class='missingPage'>Missing pages: ".$missingPageArray[$i]['start_page']." - ".$missingPageArray[$i]['end_page']."</div></div>"; | |
| 66 //$str.="<br>"; | |
| 67 $i++; | |
| 68 echo $str; | |
| 69 } | |
| 70 | |
| 71 $str="<div class='entry level".$row['level']." ".$row['flag']." ".$row['deleted']."'>"; | |
| 72 $str.="<div class='hiddenInfo'>"; | |
| 73 $str.="<div class='id'>".$row['id']."</div>"; | |
| 74 $str.="<div class='booksId'>".sprintf("%05d",$row['books_id'])."</div>"; | |
| 75 $str.="<div class='splitFrom'>".$row['split_from']."</div>"; | |
| 76 $str.="<div class='sectionAfter'>".$row['section_after']."</div>"; | |
| 77 $str.="</div>";//end of hiddenInfo | |
| 78 $str.="<div class='sequence'>".($idx+1)."</div>"; | |
| 79 $str.="<div class='name'>".$row['name']."</div>"; | |
| 80 $str.="<div class='page'>"; | |
| 81 $str.="<div class='startPage'>".$row['start_page']."</div>"; | |
| 82 $str.=" - "; | |
| 83 $str.="<div class='endPage'>".$row['end_page']."</div>"; | |
| 84 $str.="</div>";//end of page | |
| 85 $str.="</div>"; //end of class entry | |
| 86 echo $str; | |
| 87 | |
| 88 } | |
| 89 if($i<sizeof($missingPageArray)){ | |
| 90 $str="<div class='missingPage'>Missing pages: ".$missingPageArray[$i]['start_page']." - ".$missingPageArray[$i]['end_page']."</div>"; | |
| 91 echo $str; | |
| 92 } | |
| 93 $str="</div>"; | |
| 94 echo $str; | |
| 95 } | |
| 96 | |
| 97 ?> | |
| 98 | |
| 99 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| 100 <html> | |
| 101 <head> | |
| 102 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
| 103 <link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/> | |
| 104 <link href="css/search.css" type="text/css" rel="stylesheet"/> | |
| 105 <link href="css/check_sections.css" type="text/css" rel="stylesheet"/> | |
| 106 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> | |
| 107 <script src="js/check_sections_details.js" type="text/javascript"></script> | |
| 108 <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js" type="text/javascript"></script> | |
| 109 <!--<script src="js/check_sections.js" charset="utf-8"></script>!--> | |
| 110 </head> | |
| 111 <body> | |
| 112 <div id="loading">...</div> | |
| 113 <div id="container"> | |
| 114 <?php | |
| 115 $version=0; | |
| 116 $editor=""; | |
| 117 $date=""; | |
| 118 if(isset($_GET['book_id']) && isset($_GET['count']) && is_numeric($_GET['count'])){ | |
| 119 $bookId=$_GET['book_id']; | |
| 120 $count=$_GET['count']; | |
| 121 $bookInfo=getBookInfo($bookId); | |
| 122 $info=checkSectionInfo($bookId); | |
| 123 $version=$info['version']; | |
| 124 $editor=$info['editor']; | |
| 125 $date=$info['date']; | |
| 126 $bookInfo=array_merge($bookInfo,["version"=>$version,"editor"=>$editor,"date"=>$date]); | |
| 127 printBookInfo($bookInfo); | |
| 128 //echo "version: ".$version."<br>last editor: ".$editor; | |
| 129 $missingPageArray=checkMissingPage($bookInfo,$info); | |
| 130 ?> | |
| 131 <div id="searchResults"> | |
| 132 <?php | |
| 133 $sectionArray=getSectionArray($bookId,$count,$info); | |
| 134 printSectionArray($sectionArray,$missingPageArray); | |
| 135 }else{ | |
| 136 echo "Cannot process the data due to incomplete input."; | |
| 137 } | |
| 138 ?> | |
| 139 </div> | |
| 140 </div> | |
| 141 <div id="panel"></div> | |
| 142 <script>var version=<?php echo $version;?>;</script> | |
| 143 </body> | |
| 144 | |
| 145 </html> | |
| 146 |
