|
0
|
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="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/>
|
|
|
104 <link href="css/check_sections.css" type="text/css" rel="stylesheet"/>
|
|
|
105 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
|
|
|
106 <script src="js/check_sections_details.js" type="text/javascript"></script>
|
|
|
107 <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js" type="text/javascript"></script>
|
|
|
108 <!--<script src="js/check_sections.js" charset="utf-8"></script>!-->
|
|
|
109 </head>
|
|
|
110 <body>
|
|
|
111 <div id="loading">...</div>
|
|
|
112 <div id="container">
|
|
|
113 <?php
|
|
|
114 $version=0;
|
|
|
115 $editor="";
|
|
|
116 $date="";
|
|
|
117 if(isset($_GET['book_id']) && isset($_GET['count']) && is_numeric($_GET['count'])){
|
|
|
118 $bookId=$_GET['book_id'];
|
|
|
119 $count=$_GET['count'];
|
|
|
120 $bookInfo=getBookInfo($bookId);
|
|
|
121 $info=checkSectionInfo($bookId);
|
|
|
122 $version=$info['version'];
|
|
|
123 $editor=$info['editor'];
|
|
|
124 $date=$info['date'];
|
|
|
125 $bookInfo=array_merge($bookInfo,["version"=>$version,"editor"=>$editor,"date"=>$date]);
|
|
|
126 printBookInfo($bookInfo);
|
|
|
127 //echo "version: ".$version."<br>last editor: ".$editor;
|
|
|
128 $missingPageArray=checkMissingPage($bookInfo,$info);
|
|
|
129 ?>
|
|
|
130
|
|
|
131 <table>
|
|
|
132 <thead>Show editing records:
|
|
|
133 <button id="show_all">Show all</button>
|
|
|
134 <button id="close">Close</button>
|
|
|
135 </thead>
|
|
|
136 <tbody>
|
|
|
137 <tr>
|
|
|
138 <td id="editor_th"></td>
|
|
|
139 <td id="date_th"></td>
|
|
|
140 </tr>
|
|
|
141 <tr>
|
|
|
142 <td><div id="editor"></div></td>
|
|
|
143 <td><div id="date"></div></td>
|
|
|
144 </tr>
|
|
|
145 </tbody>
|
|
|
146 </table>
|
|
|
147
|
|
|
148
|
|
|
149
|
|
|
150 <div id="searchResults">
|
|
|
151 <?php
|
|
|
152 $sectionArray=getSectionArray($bookId,$count,$info);
|
|
|
153 printSectionArray($sectionArray,$missingPageArray);
|
|
|
154 }else{
|
|
|
155 echo "Cannot process the data due to incomplete input.";
|
|
|
156 }
|
|
|
157 ?>
|
|
|
158 </div>
|
|
|
159 </div>
|
|
|
160 <div id="panel"></div>
|
|
|
161 <script>var version=<?php echo $version;?>;</script>
|
|
|
162
|
|
|
163 <script type="text/javascript">
|
|
|
164
|
|
|
165 document.getElementById("show_all").onclick = function(){showAll()};
|
|
|
166
|
|
|
167 function showAll() {
|
|
|
168 document.getElementById("editor_th").innerHTML = "Editor(version)";
|
|
|
169 document.getElementById("date_th").innerHTML = "Date/Time";
|
|
|
170
|
|
|
171 <?php
|
|
|
172 $editors = "";
|
|
|
173 $editing_time = "";
|
|
|
174
|
|
|
175 $query_editor = "(SELECT editor, date, version from sections_versions WHERE books_id='".$bookId."' ORDER BY version DESC)";
|
|
|
176 $result = mysql_query($query_editor);
|
|
|
177
|
|
|
178 while ($row = mysql_fetch_assoc($result)) {
|
|
|
179 $editor = $row['editor'];
|
|
|
180 $edit_time = $row['date'];
|
|
|
181 $version = $row['version'];
|
|
|
182 ?>
|
|
|
183 document.getElementById("editor").innerHTML += '<?php echo $editor; ?>' +'('+'<?php echo $version;?>' +')<br>';
|
|
|
184 document.getElementById("date").innerHTML += '<?php echo $edit_time; ?>' + '<br>';
|
|
|
185 <?php
|
|
|
186
|
|
|
187 }
|
|
|
188 ?>
|
|
|
189
|
|
|
190 }
|
|
|
191
|
|
|
192 document.getElementById("close").onclick = function(){closeAll()};
|
|
|
193
|
|
|
194 function closeAll() {
|
|
|
195 document.getElementById("editor_th").innerHTML = "";
|
|
|
196 document.getElementById("date_th").innerHTML = "";
|
|
|
197 document.getElementById("editor").innerHTML = "";
|
|
|
198 document.getElementById("date").innerHTML = "";
|
|
|
199 }
|
|
|
200 </script>
|
|
|
201
|
|
|
202
|
|
|
203 </body>
|
|
|
204
|
|
|
205 </html>
|
|
|
206
|