Mercurial > hg > extraction-interface
view interface/check_sections_details.php @ 8:da10158c6d0a
add toc_correction status in books table. On TOC correction list page, providing the status checking box for users.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 09 Feb 2015 12:28:09 +0100 |
parents | 0e9a7c69f22c |
children |
line wrap: on
line source
<?php include_once('Lib_mb_utf8.php'); include_once('config.php'); include_once('edit_section_db.php'); set_time_limit(0); ini_set('memory_limit', '-1'); $link_mysql = mysql_connect($mysql_server, $mysql_user, $mysql_password); mysql_query("SET NAMES utf8"); if (!$link_mysql) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($mysql_database, $link_mysql); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } function getBookInfo($bookId){ $query="SELECT * FROM books WHERE id=".$bookId; $result=mysql_query($query); $bookInfo=mysql_fetch_assoc($result); return $bookInfo; } function printBookInfo($bookInfo){ $str="<table>"; $str.="<tr><td class='bookId'>book id <td class='bookName'>book name <td class='level1'>level1 <td class='level2'>level2 <td class='period'>period <td class='bookId'>pages <td class='bookId'>version <td class='bookName'>last_editor <td class='bookName'>date"; $str.="<tr>"; $str.="<td>".$bookInfo['id']; $str.="<td>".$bookInfo['name']; $str.="<td>".$bookInfo['level1']; $str.="<td>".$bookInfo['level2']; $str.="<td>".$bookInfo['period']; $str.="<td>".$bookInfo['line']; $str.="<td>".$bookInfo['version']; $str.="<td>".$bookInfo['editor']; $str.="<td>".$bookInfo['date']; $str.="</table>"; echo $str; } function printSectionArray($sectionArray,$missingPageArray){ $str="<div id='bookContainer'>"; echo $str; $i=0; foreach($sectionArray as $idx=>$row){ /* $flag=""; if($i!=sizeof($pageArray) && $pageArray[$i]['start_page']==$row['start_page'] && $pageArray[$i]['end_page']==$row['end_page']){ $flag="overlapper"; $i++; } if($i!=0 && $pageArray[$i-1]['start_page']==$row['start_page'] && $pageArray[$i-1]['end_page']==$row['end_page']){ $flag="overlapper"; }*/ if(!($idx!=0 && $sectionArray[$idx-1]['start_page']==$row['start_page'] && $sectionArray[$idx-1]['end_page']==$row['end_page']) && $i<sizeof($missingPageArray) && $missingPageArray[$i]['end_page']==$row['start_page']){ $str="<div class='missingPageContainer'><div class='missingPage'>Missing pages: ".$missingPageArray[$i]['start_page']." - ".$missingPageArray[$i]['end_page']."</div></div>"; //$str.="<br>"; $i++; echo $str; } $str="<div class='entry level".$row['level']." ".$row['flag']." ".$row['deleted']."'>"; $str.="<div class='hiddenInfo'>"; $str.="<div class='id'>".$row['id']."</div>"; $str.="<div class='booksId'>".sprintf("%05d",$row['books_id'])."</div>"; $str.="<div class='splitFrom'>".$row['split_from']."</div>"; $str.="<div class='sectionAfter'>".$row['section_after']."</div>"; $str.="</div>";//end of hiddenInfo $str.="<div class='sequence'>".($idx+1)."</div>"; $str.="<div class='name'>".$row['name']."</div>"; $str.="<div class='page'>"; $str.="<div class='startPage'>".$row['start_page']."</div>"; $str.=" - "; $str.="<div class='endPage'>".$row['end_page']."</div>"; $str.="</div>";//end of page $str.="</div>"; //end of class entry echo $str; } if($i<sizeof($missingPageArray)){ $str="<div class='missingPage'>Missing pages: ".$missingPageArray[$i]['start_page']." - ".$missingPageArray[$i]['end_page']."</div>"; echo $str; } $str="</div>"; echo $str; } function show_history() { } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/> <!-- <link href="css/search.css" type="text/css" rel="stylesheet"/> --> <link href="css/check_sections.css" type="text/css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> <script src="js/check_sections_details.js" type="text/javascript"></script> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js" type="text/javascript"></script> <!--<script src="js/check_sections.js" charset="utf-8"></script>!--> </head> <body> <div id="loading">...</div> <div id="container"> <?php $version=0; $editor=""; $date=""; if(isset($_GET['book_id']) && isset($_GET['count']) && is_numeric($_GET['count'])){ $bookId=$_GET['book_id']; $count=$_GET['count']; $bookInfo=getBookInfo($bookId); $info=checkSectionInfo($bookId); $version=$info['version']; $editor=$info['editor']; $date=$info['date']; $bookInfo=array_merge($bookInfo,["version"=>$version,"editor"=>$editor,"date"=>$date]); printBookInfo($bookInfo); //echo "version: ".$version."<br>last editor: ".$editor; $missingPageArray=checkMissingPage($bookInfo,$info); ?> <table> <thead>Show editing records: <button id="show_all">Show all</button> <button id="close">Close</button> </thead> <tbody> <tr> <td id="editor_th"></td> <td id="date_th"></td> </tr> <tr> <td><div id="editor"></div></td> <td><div id="date"></div></td> </tr> </tbody> </table> <div id="searchResults"> <?php $sectionArray=getSectionArray($bookId,$count,$info); printSectionArray($sectionArray,$missingPageArray); }else{ echo "Cannot process the data due to incomplete input."; } ?> </div> </div> <div id="panel"></div> <script>var version=<?php echo $version;?>;</script> <script type="text/javascript"> /* document.getElementById("participator").onclick = function(){participator()}; function participator() { document.getElementById("editor").innerHTML = 'some_one\'s_name('+1+')'; document.getElementById("date").innerHTML = Date()+"<br>"+"asdfasdf"+"<br>"+"asdfasdf"+"<br>"+"asdfasdf"; } */ document.getElementById("show_all").onclick = function(){showAll()}; function showAll() { document.getElementById("editor_th").innerHTML = "Editor(version)"; document.getElementById("date_th").innerHTML = "Date/Time"; <?php $editors = ""; $editing_time = ""; $query_editor = "(SELECT editor, date, version from sections_versions WHERE books_id='".$bookId."' ORDER BY version DESC)"; $result = mysql_query($query_editor); while ($row = mysql_fetch_assoc($result)) { $editor = $row['editor']; $edit_time = $row['date']; $version = $row['version']; ?> document.getElementById("editor").innerHTML += '<?php echo $editor; ?>' +'('+'<?php echo $version;?>' +')<br>'; document.getElementById("date").innerHTML += '<?php echo $edit_time; ?>' + '<br>'; <?php } ?> } document.getElementById("close").onclick = function(){closeAll()}; function closeAll() { document.getElementById("editor_th").innerHTML = ""; document.getElementById("date_th").innerHTML = ""; document.getElementById("editor").innerHTML = ""; document.getElementById("date").innerHTML = ""; } </script> </body> </html>