Mercurial > hg > extraction-interface
changeset 7:0e9a7c69f22c
add editing records/log into TOC correction list page, more editing records could be shown on the TOC page
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 06 Feb 2015 09:44:17 +0100 |
parents | 63e08b98032f |
children | da10158c6d0a |
files | interface/add_dynasty.php interface/check_sections.php interface/check_sections_details.php |
diffstat | 3 files changed, 150 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/interface/add_dynasty.php Thu Feb 05 16:07:53 2015 +0100 +++ b/interface/add_dynasty.php Fri Feb 06 09:44:17 2015 +0100 @@ -37,7 +37,7 @@ $result=mysql_query($query); if(!$result){ - echo json_encode("Failed during querying records."); + echo json_encode("Failed during querying books records."); return; } while($row=mysql_fetch_assoc($result)){
--- a/interface/check_sections.php Thu Feb 05 16:07:53 2015 +0100 +++ b/interface/check_sections.php Fri Feb 06 09:44:17 2015 +0100 @@ -70,9 +70,14 @@ // sorting by the $sort_by parameter function checkSections_sort_by($sort_by){ switch ($sort_by) { - case 'time': + case '_time': $query="(SELECT name AS book_name,level1,level2,period,dynasty,start_year,id from books ORDER BY start_year)"; $result = mysql_query($query); + if (!$result){ + echo ("Failed during selecting books table."); + } + + echo mysql_num_rows($result)." result(s)<br><br>"; echo "<table>"; echo "<tr>"; @@ -91,6 +96,41 @@ echo "</table>"; break; + case 'time': + $query="(SELECT name AS book_name,level1,level2,period,dynasty,start_year,id from books ORDER BY start_year)"; + $result = mysql_query($query); + if (!$result){ + echo ("Failed during selecting books table."); + } + + + echo mysql_num_rows($result)." result(s)<br><br>"; + echo "<table>"; + echo "<tr>"; + echo "<td class='bookName'>book name<td class='level1'>level1<td class='level2'>level2 <td class='period'>period<td class='dynasty'>dynasty<td class='start_year'>start_year<td class='last_editor'>last_editor<td class='edit_time'>edit_time"; + while ($row = mysql_fetch_assoc($result)) { + $str="<tr>"; + $str.="<td>".$row['book_name']; + $str.="<td>".$row['level1']; + $str.="<td>".$row['level2']; + $str.="<td>".$row['period']; + $str.="<td>".$row['dynasty']; + $str.="<td>".$row['start_year']; + + // query last_editor and last_edit_time + $query_editor = "(SELECT editor, date from sections_versions WHERE books_id='".$row['id']."' ORDER BY version DESC)"; + $row_sections_versions = mysql_fetch_assoc(mysql_query($query_editor)); // the first one + $last_editor = $row_sections_versions['editor']; + $last_edit_time = $row_sections_versions['date']; + $str.="<td>".$last_editor; + $str.="<td>".$last_edit_time; + + $str.="<td><a href='check_sections_details.php?book_id=".$row['id']."&count=100"."' target='_blank'>"."click here"."</a>"; + echo $str; + } + echo "</table>"; + break; + default: # code... echo "no sorting parameter set"; @@ -98,6 +138,7 @@ } } + ?>
--- a/interface/check_sections_details.php Thu Feb 05 16:07:53 2015 +0100 +++ b/interface/check_sections_details.php Fri Feb 06 09:44:17 2015 +0100 @@ -31,7 +31,7 @@ <td class='period'>period <td class='bookId'>pages <td class='bookId'>version - <td class='bookName'>editor + <td class='bookName'>last_editor <td class='bookName'>date"; $str.="<tr>"; $str.="<td>".$bookInfo['id']; @@ -94,57 +94,130 @@ 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> +<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 + <?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); + 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); - $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); - ?> - <div id="searchResults"> - <?php + ?> + <table> + <thead>Show editing record: + <button id="show_all">Show all</button> + <button id="close">Close</button> + </thead> + <tbody> + <tr> + <td>Editor(version)</td> + <td>Date/Time</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."; - } + }else{ + echo "Cannot process the data due to incomplete input."; + } + ?> - </div> + </div> + + </div> <div id="panel"></div> <script>var version=<?php echo $version;?>;</script> - </body> + + + <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() { + + <?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").innerHTML = ""; + document.getElementById("date").innerHTML = ""; + } + </script> + +</body> </html>