reader.php 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  1. <?php
  2. require_once "../public/_pdo.php";
  3. require_once "../path.php";
  4. require_once '../public/load_lang.php';
  5. require_once '../public/function.php';
  6. require_once '../channal/function.php';
  7. require_once '../ucenter/function.php';
  8. global $_userinfo;
  9. global $_channal;
  10. $_userinfo = new UserInfo();
  11. $_channal = new Channal();
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  14. <html>
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  17. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link type="text/css" rel="stylesheet" href="../studio/css/font.css"/>
  19. <link type="text/css" rel="stylesheet" href="css/reader.css"/>
  20. <link type="text/css" rel="stylesheet" href="css/reader_mob.css" media="screen and (max-width:767px)">
  21. <title id="page_title">PCD Reader</title>
  22. <script src="js/jquery-3.3.1.min.js"></script>
  23. <script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
  24. <script src="js/fixedsticky.js"></script>
  25. <script src="js/reader.js"></script>
  26. <script src="../public/js/comm.js"></script>
  27. <script src="../public/js/notify.js"></script>
  28. <script src="../term/term.js"></script>
  29. <script src="../term/note.js"></script>
  30. </head>
  31. <body class="reader_body" >
  32. <a name="page_head"></a>
  33. <script type="text/javascript">
  34. $(document).ready(function(){
  35. $(".toc_1_title").click(function(){
  36. $(this).parent().siblings().children(".toc_2").hide();
  37. $(this).siblings().slideToggle("200");
  38. });
  39. });
  40. </script>
  41. <style>
  42. .par_translate_div{
  43. margin-left: 1em;
  44. border-left: 1px solid gray;
  45. padding-left: 0.5em;
  46. margin-top: 0.5em;
  47. }
  48. .edit_icon{
  49. display:inline-block;
  50. width:1.4em;
  51. height:1.4em;
  52. }
  53. #para_nav {
  54. display: flex;
  55. justify-content: space-between;
  56. padding: 5px 1em;
  57. border-top: 1px solid gray;
  58. }
  59. .word{
  60. display:inline-block;
  61. padding: 1px 3px;
  62. }
  63. .mean{
  64. font-size: 65%;
  65. }
  66. /* 下拉内容 (默认隐藏) */
  67. #mean_menu {
  68. margin: 0.3em;
  69. position: absolute;
  70. background-color: white;
  71. min-width: 8em;
  72. max-width: 30em;
  73. margin: -1px 0px;
  74. box-shadow: 0px 3px 13px 0px black;
  75. color: var(--main-color);
  76. z-index: 200;
  77. }
  78. /* 下拉菜单的链接 */
  79. #mean_menu a {
  80. /*padding: 0.3em 0.4em;*/
  81. line-height: 160%;
  82. text-decoration: none;
  83. display: block;
  84. cursor: pointer;
  85. text-align: left;
  86. font-size:80%;
  87. }
  88. /* 鼠标移上去后修改下拉菜单链接颜色 */
  89. .mean_menu a:hover {
  90. background-color: blue;
  91. color: white;
  92. }
  93. .par_pali_div{
  94. margin-top:1em;
  95. }
  96. .par_pali_div{
  97. font-weight:700;
  98. }
  99. sent{
  100. font-weight:500;
  101. font-size:110%;
  102. line-height: 150%;
  103. }
  104. sent:hover{
  105. background-color:#fefec1;
  106. }
  107. para {
  108. color: #d27e17;
  109. background-color: unset;
  110. min-width: 2em;
  111. display: inline-block;
  112. text-align: center;
  113. padding: 3px 5px;
  114. border-radius: 99px;
  115. margin-right: 5px;
  116. cursor:pointer;
  117. font-size:90%;
  118. font-weight:400;
  119. }
  120. para:hover{
  121. color: white;
  122. background-color: #F1CA23;
  123. }
  124. paranum {
  125. font-weight: 700;
  126. }
  127. .sent_count{
  128. font-size:80%;
  129. color: white;
  130. background-color: #1cb70985;
  131. min-width: 2em;
  132. display: inline-block;
  133. text-align: center;
  134. padding: 2px 0;
  135. border-radius: 99px;
  136. margin-left: 5px;
  137. cursor:pointer;
  138. }
  139. .toc_1{
  140. padding: 5px;
  141. cursor: pointer;
  142. border-left: 2px solid #aaaaaa;
  143. }
  144. .toc_1_title{
  145. font-weight:700;
  146. }
  147. .toc_2{
  148. font-weight:500;
  149. padding-left:1em;
  150. display:none;
  151. }
  152. .curr_chapter{
  153. border-color: #4d4dff;
  154. color: #4d4dff;
  155. }
  156. .toc_curr_chapter2{
  157. display:block;
  158. }
  159. .toc_title2 a{
  160. color:black;
  161. line-height:1.4em;
  162. text-decoration: none;
  163. }
  164. .toc_title2 a:hover{
  165. text-decoration: underline;
  166. }
  167. .curr_chapter_title2 a{
  168. color:#4d4dff;
  169. font-weight:900;
  170. }
  171. #leftmenuinner{
  172. width: 20em;
  173. max-width: 90%;
  174. overflow-y: scroll;
  175. border-right: unset;
  176. }
  177. #leftmenuinnerinner{
  178. }
  179. #leftmenuinnerinner{
  180. margin-left: 2em;
  181. font-size: 0.8em;
  182. border-right: unset;
  183. }
  184. .sent_toc{
  185. font-weight:700;
  186. font-family: Noto serif;
  187. font-size: 150%;
  188. }
  189. note{
  190. color:blue;
  191. }
  192. .mine{
  193. color:green;
  194. }
  195. </style>
  196. <!-- tool bar begin-->
  197. <div id="main_tool_bar" class='reader_toolbar'>
  198. <div id="index_nav">
  199. <button onclick="setNaviVisibility()">
  200. <svg t='1598084571450' class='icon' viewBox='0 0 1029 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6428' width='20px' height='20px'><path d='M159.744 69.632 53.248 69.632C28.672 69.632 4.096 90.112 4.096 118.784l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0C184.32 266.24 208.896 241.664 208.896 212.992L208.896 118.784C208.896 90.112 184.32 69.632 159.744 69.632zM970.752 69.632 368.64 69.632c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152L1024 118.784C1028.096 94.208 999.424 69.632 970.752 69.632zM159.744 413.696 53.248 413.696c-28.672 0-53.248 24.576-53.248 49.152l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0c28.672 0 53.248-24.576 53.248-49.152l0-94.208C208.896 438.272 184.32 413.696 159.744 413.696zM970.752 413.696 368.64 413.696c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152l0-94.208C1028.096 438.272 999.424 413.696 970.752 413.696zM159.744 757.76 53.248 757.76c-28.672 0-53.248 24.576-53.248 49.152l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0c28.672 0 53.248-24.576 53.248-49.152l0-94.208C208.896 782.336 184.32 757.76 159.744 757.76zM970.752 761.856 368.64 761.856c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152l0-94.208C1028.096 782.336 999.424 761.856 970.752 761.856z' fill='#757AF7' p-id='6429'></path></svg>
  201. </button>
  202. </div>
  203. <div>
  204. <span id="tool_bar_title" style="font-family: 'Noto Serif';"><?php echo $_local->gui->title; ?></span>
  205. </div>
  206. <div style="display: flex;">
  207. <form action="../studio/project.php" method="post" onsubmit="return pali_canon_edit_now(this)" target="_blank" style="display: inline-block;">
  208. <div style="display:none;">
  209. <input type="input" name="op" value="create">
  210. <input type="hidden" name="view" value="<?php echo $_GET["view"]?>" />
  211. <input type="hidden" name="book" value="<?php echo $_GET["book"]?>" />
  212. <input type="hidden" id = "para" name="para" value="" />
  213. <input type="hidden" id = "para_end" name="para_end" value="" />
  214. <input type="hidden" id = "chapter_title" name="chapter_title" value="" />
  215. <textarea id="project_new_res_data" rows="3" cols="18" name="data"></textarea>
  216. </div>
  217. <input type="submit" value="<?php echo $_local->gui->edit_now; ?>">
  218. </form>
  219. <div class="case_dropdown">
  220. <p class="case_dropbtn"><button>
  221. <svg t='1598086376923' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='8426' width='20px' height='20px'><path d='M609.745455 453.818182v130.327273h69.818181V535.272727H744.727273v377.018182h95.418182V535.272727H907.636364v48.872728h69.818181V453.818182z' p-id='8427' fill='#757AF7'></path><path d='M677.236364 300.218182V111.709091H46.545455V300.218182h69.818181v-51.2h162.909091v663.272727h165.236364V249.018182h162.909091v51.2z' p-id='8428' fill='#757AF7'></path></svg>
  222. </button></p>
  223. <div class="case_dropdown-content" style="right: 0;width:10em;">
  224. <div ><button>A+</button><button>A-</button></div>
  225. <div ><button><?php echo $_local->gui->white;?></button><button><?php echo $_local->gui->dawn;//棕?></button><button><?php echo $_local->gui->night;//夜?></button></div>
  226. </div>
  227. </div>
  228. <div class="case_dropdown">
  229. <p class="case_dropbtn"><button>
  230. <svg t='1598086493824' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='9217' width='20px' height='20px'><path d='M912.695652 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9218' fill='#757AF7'></path><path d='M512 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9219' fill='#757AF7'></path><path d='M111.304348 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9220' fill='#757AF7'></path></svg>
  231. </button></p>
  232. <div class="case_dropdown-content" style="right: 2em;min-width:6em;">
  233. <a onclick="tool_changed('dighest')"><?php echo $_local->gui->digest; //书摘?></a>
  234. <a onclick="tool_changed('comments')"><?php echo $_local->gui->comment; //批注?></a>
  235. <a onclick="tool_changed('target')"><?php echo $_local->gui->tag; //标签?></a>
  236. <a onclick="tool_changed('layout')"><?php echo $_local->gui->layout; //布局?></a>
  237. <a onclick="tool_changed('porpername')"><?php echo $_local->gui->dict_terms; //术语?></a>
  238. <a onclick="tool_changed('share')"><?php echo $_local->gui->share; //分享?></a>
  239. <a onclick="tool_changed('fix')"><?php echo $_local->gui->modify; //修改?></a>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. <div id="tool_bar_comments">
  245. <div class='reader_toolbar' style="height:auto;">
  246. <div>
  247. </div>
  248. <div>
  249. <span>单击段落文字添加批注</span>
  250. </div>
  251. <div>
  252. </div>
  253. </div>
  254. </div>
  255. <div id="tool_bar_dighest">
  256. <div class='reader_toolbar' style="height:auto;">
  257. <div>
  258. <button onclick="dighest_cancle()">取消</button>
  259. </div>
  260. <div>
  261. <span id="dighest_message">单击文字选择段落</span>
  262. </div>
  263. <div>
  264. <button onclick="dighest_ok()">完成</button>
  265. </div>
  266. </div>
  267. </div>
  268. <div id="tool_bar_fix">
  269. <div class='reader_toolbar' style="height:auto;">
  270. <div>
  271. <button onclick="fix_cancle()">取消</button>
  272. </div>
  273. <div>
  274. <span id="fix_message">单击按钮调整段落</span>
  275. </div>
  276. <div>
  277. <button onclick="fix_ok()">完成</button>
  278. </div>
  279. </div>
  280. </div>
  281. <!--tool bar end -->
  282. <div id="main_text_view" style="padding-bottom: 10em;">
  283. <?php
  284. $tocHtml="";
  285. if(isset($_GET["album"])){
  286. $album=$_GET["album"];
  287. }
  288. if(isset($_GET["channal"])){
  289. $channal=$_GET["channal"];
  290. }
  291. if(isset($_GET["book"])){
  292. $book=$_GET["book"];
  293. }
  294. else{
  295. echo "no book id";
  296. }
  297. if(substr($book,0,1)=='p'){
  298. $book=substr($book,1);
  299. }
  300. if(isset($_GET["paragraph"])){
  301. $paragraph = $_GET["paragraph"];
  302. }
  303. else if(isset($_GET["para"])){
  304. $paragraph = $_GET["para"];
  305. }
  306. else{
  307. $paragraph = -1;
  308. }
  309. if(isset($_GET["view"])){
  310. $_view = $_GET["view"];
  311. }
  312. else{
  313. echo "Error : 未定义必要的参数view";
  314. exit;
  315. }
  316. if(isset($_GET["display"])){
  317. $_display = $_GET["display"];
  318. }
  319. else{
  320. if($_view=="para" || $_view=="sent"){
  321. $_display = "sent";//默认值
  322. }
  323. else{
  324. $_display = "para";
  325. }
  326. }
  327. $tocList = array();
  328. if($_view=="chapter" || $_view=="para" || $_view=="sent" ){
  329. PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
  330. //生成目录
  331. $htmlToc2 = "<div><a href='#page_head'>页首</a></div>";
  332. //找到该位置对应的书
  333. $query = "select paragraph,level,chapter_len,parent from 'pali_text' where book='$book' and paragraph='$paragraph'";
  334. $FetchParInfo = PDO_FetchAll($query);
  335. $deep = 0;
  336. if(count($FetchParInfo)>0){
  337. $para = $FetchParInfo[0]["paragraph"];
  338. $level = $FetchParInfo[0]["level"];
  339. $chapter_len = $FetchParInfo[0]["chapter_len"];
  340. $parent = $FetchParInfo[0]["parent"];
  341. $currParaBegin = $para;
  342. $currParaEnd = $para + $chapter_len;
  343. $currParaLevel = $level;
  344. $currParaParentLevel = 0;
  345. //循环查找父标题 找到level=1的段落 也就是书名
  346. while($parent>-1){
  347. $query = "select paragraph,level,parent,chapter_len from pali_text where \"book\" = '{$book}' and \"paragraph\" = '{$parent}' limit 0,1";
  348. $FetParent = PDO_FetchAll($query);
  349. if(count($FetParent)>0){
  350. $para = $FetParent[0]["paragraph"];
  351. $level = $FetParent[0]["level"];
  352. $chapter_len = $FetParent[0]["chapter_len"];
  353. $parent = $FetParent[0]["parent"];
  354. if($currParaParentLevel==0){
  355. $currParaParentLevel = $level;
  356. }
  357. }
  358. $deep++;
  359. if($deep>8){
  360. break;
  361. }
  362. }
  363. $paraBegin = $para+1;
  364. $paraEnd = $para+$chapter_len;
  365. $query = "SELECT toc,paragraph,level,chapter_len,parent FROM 'pali_text' WHERE book='$book' AND (paragraph BETWEEN '$paraBegin' AND '$paraEnd') and level<100";
  366. $chapter_toc = PDO_FetchAll($query);
  367. $tocMaxLevel = 0;
  368. $tocMinLevel = 0;
  369. $tocBegin = 0;
  370. $tocEnd = 0;
  371. $toc1Level = 0;
  372. $toc2Level = 0;
  373. echo "<div><div>";
  374. foreach ($chapter_toc as $key => $value) {
  375. $tocList[$value["paragraph"]] = $value["level"];
  376. $classCurrToc="";
  377. $classCurrToc2 = "";
  378. $classCurrTocTitle2="";
  379. if($paragraph>=$value["paragraph"] && $paragraph<$value["paragraph"]+$value["chapter_len"]){
  380. $classCurrToc = " curr_chapter";
  381. $classCurrToc2 = " toc_curr_chapter2";
  382. $classCurrTocTitle2=" curr_chapter_title2";
  383. }
  384. if($tocBegin==0 || ($tocBegin>0 && $value["paragraph"]>=$tocEnd)){
  385. //开始新的标题1
  386. $tocBegin =$value["paragraph"];
  387. $tocEnd = $tocBegin + $value["chapter_len"];
  388. $toc1Level = $value["level"];
  389. if(isset($chapter_toc[$key+1])){
  390. if($chapter_toc[$key+1]["level"]>$toc1Level){
  391. $toc2Level = $chapter_toc[$key+1]["level"];
  392. }
  393. else{
  394. $tocBegin=0;
  395. }
  396. }
  397. $tocHtml .= "</div></div><div class='toc_1 {$classCurrToc}'>";
  398. $tocHtml .= "<div class='toc_1_title {$classCurrToc}'>{$value["toc"]}</div><div class='toc_2 $classCurrToc2'>";
  399. }
  400. else{
  401. //下一级标题
  402. if($value["level"]==$toc2Level ){
  403. $tocHtml .= "<div class='toc_title2 {$classCurrToc}{$classCurrTocTitle2}'><a href='reader.php?view=chapter&book={$book}&para={$value["paragraph"]}&display={$_display}'>{$value["toc"]}</a></div>";
  404. }
  405. }
  406. //右侧目录
  407. if($value["paragraph"]>$currParaBegin && $value["paragraph"]<$currParaEnd){
  408. //$tocList[$value["paragraph"]] = $value["level"];
  409. $htmlToc2 .= "<div><a href='#para_{$value["paragraph"]}'>{$value["toc"]}</a></div>";
  410. }
  411. }
  412. echo " </div></div>";
  413. }
  414. $htmlToc2 .= "<div><a href='#nav_foot'>导航</a></div>";
  415. $htmlToc2 .= "<div><a href='#sim_doc'>相关文档</a></div>";
  416. //获取段落信息 如 父段落 下一个段落等
  417. $query = "select * from 'pali_text' where book='$book' and paragraph='$paragraph'";
  418. $FetchParInfo = PDO_FetchAll($query);
  419. if(count($FetchParInfo)==0){
  420. echo "Error:no paragraph info";
  421. echo $query;
  422. }
  423. $currLevel = $FetchParInfo[0]["level"];
  424. $par_begin=$paragraph+1-1;
  425. if($_view=="para"){
  426. $par_end = $par_begin;
  427. }
  428. else{
  429. $par_end=$par_begin+$FetchParInfo[0]["chapter_len"]-1;
  430. }
  431. $par_next=$FetchParInfo[0]["next_chapter"];
  432. $par_prev=$FetchParInfo[0]["prev_chapter"];
  433. $par_parent=$FetchParInfo[0]["parent"];
  434. if($par_parent >= 0){
  435. $query = "select toc from 'pali_text' where book='$book' and paragraph='$par_parent'";
  436. $FetchToc = PDO_FetchAll($query);
  437. if(count($FetchToc)>0){
  438. $_parent_title = $FetchToc[0]["toc"];
  439. }
  440. }
  441. //查询标题
  442. if($_view=="chapter"){
  443. $par_title = $FetchParInfo[0]["toc"];
  444. }
  445. else{
  446. $par_title = $_parent_title;
  447. }
  448. //导航按钮
  449. if($_view=="sent"){
  450. $next_para_link = "";
  451. $prev_para_link = "";
  452. }
  453. else{
  454. if($par_next != -1){
  455. $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_next' ";
  456. $FetchPara = PDO_FetchAll($query);
  457. if(count($FetchPara)>0){
  458. $next_para_link = "<a href='reader.php?view={$_view}&book={$book}&para={$par_next}&display={$_display}'><span id='para_nav_next'>{$FetchPara[0]["toc"]}</span><span id='para_nav_next_a'>";
  459. $next_para_link .= "<svg t='1598093121925' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4451' width='32px' height='32px'><path d='M540.5696 102.4c-225.83296 0-409.6 183.74656-409.6 409.6s183.76704 409.6 409.6 409.6c225.85344 0 409.6-183.74656 409.6-409.6s-183.74656-409.6-409.6-409.6z m180.14208 439.84896l-109.19936 128.59392a46.65344 46.65344 0 0 1-65.86368 5.36576 46.71488 46.71488 0 0 1-5.38624-65.8432l43.86816-51.63008h-188.12928a46.6944 46.6944 0 1 1 0-93.42976h188.12928l-43.86816-51.63008a46.75584 46.75584 0 0 1 71.24992-60.47744l109.19936 128.59392c14.82752 17.408 14.82752 43.008 0 60.45696z' p-id='4452' fill='#757AF7'></path></svg>";
  460. $next_para_link .= "</span></a>";
  461. }
  462. else{
  463. $next_para_link = $_local->gui->text_without_title;
  464. }
  465. }
  466. else{
  467. $next_para_link = $_local->gui->end_of_text;
  468. }
  469. if($par_prev != -1){
  470. $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_prev' ";
  471. $FetchPara = PDO_FetchAll($query);
  472. if(count($FetchPara)>0){
  473. $prev_para_link = "<a href='reader.php?view={$_view}&book={$book}&para={$par_prev}&display={$_display}'><span id='para_nav_prev_a'>";
  474. $prev_para_link .= "<svg t='1598093521111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4644' width='32' height='32'><path d='M540.5696 102.4c-225.83296 0-409.6 183.74656-409.6 409.6s183.76704 409.6 409.6 409.6c225.85344 0 409.6-183.74656 409.6-409.6s-183.74656-409.6-409.6-409.6z m144.54784 456.31488h-188.12928l43.84768 51.63008a46.6944 46.6944 0 0 1-35.59424 76.96384 46.55104 46.55104 0 0 1-35.61472-16.4864l-109.24032-128.59392a46.71488 46.71488 0 0 1 0-60.47744l109.24032-128.59392a46.6944 46.6944 0 1 1 71.20896 60.47744l-43.84768 51.63008h188.12928a46.6944 46.6944 0 1 1 0 93.45024z' p-id='4645' fill='#757AF7'></path></svg>";
  475. if($FetchPara[0]["toc"]==""){
  476. $prev_para_link .= "</span><span id='para_nav_prev'>({$_local->gui->text_without_title})</span></a>";
  477. }
  478. else{
  479. $prev_para_link .= "</span><span id='para_nav_prev'>{$FetchPara[0]["toc"]}</span></a>";
  480. }
  481. }
  482. else{
  483. $prev_para_link = $_local->gui->text_without_title;
  484. }
  485. }
  486. else{
  487. $prev_para_link = $_local->gui->begin_of_text;
  488. }
  489. }
  490. //设置标题栏的经文名称
  491. echo "<script>";
  492. echo "document.getElementById('tool_bar_title').innerHTML='".$par_title."';\n";
  493. echo "$('#chapter_title').val('".$par_title."');\n";
  494. echo "$('#para_end').val('".$par_end."');\n";
  495. echo "$('#para').val('".$par_begin."');\n";
  496. echo "</script>";
  497. }
  498. if($currParaLevel==1 || $currParaParentLevel==1){
  499. echo $_local->gui->chapter_select;
  500. }
  501. else{
  502. //上一级
  503. echo "<div>";
  504. switch($_view){
  505. case 1 :
  506. break;
  507. case 2:
  508. break;
  509. case 3:
  510. break;
  511. case 4:
  512. break;
  513. case 5:
  514. break;
  515. case 5:
  516. break;
  517. case 6:
  518. break;
  519. case "chapter":
  520. if($par_parent >= 0 && $currLevel>$tocMinLevel){
  521. echo "<a href='reader.php?view={$_view}&book={$book}&para={$par_parent}'>";
  522. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  523. echo "{$_parent_title}</a>";
  524. }
  525. break;
  526. case "para":
  527. if($par_parent >= 0){
  528. echo "<a href='reader.php?view=chapter&book={$book}&para={$par_parent}'>";
  529. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  530. echo "{$_parent_title}</a>";
  531. }
  532. break;
  533. case "sent":
  534. echo "<a href='reader.php?view=para&book={$book}&para={$paragraph}'>";
  535. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  536. echo "{$paragraph}</a>";
  537. break;
  538. case 10:
  539. break;
  540. }
  541. echo "</div>";
  542. //生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去
  543. PDO_Connect("sqlite:"._FILE_DB_PALI_SENTENCE_);
  544. if($_display=="sent"){
  545. //逐句显示
  546. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  547. if($_view=="sent"){
  548. $query = "select html, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'";
  549. }
  550. else{
  551. $query = "select html, begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  552. }
  553. if(isset($tocList[$iPar])){
  554. $sentClass = " sent_toc";
  555. }
  556. else{
  557. $sentClass = "";
  558. }
  559. $FetchSent = PDO_FetchAll($query);
  560. echo "<div id='par-b$book-$iPar' class='par_div'>";
  561. if($_view=="chapter"){
  562. echo "<para book='$book' para='$iPar' ";
  563. if(isset($tocList[$iPar])){
  564. echo " level = '{$tocList[$iPar]}' ";
  565. }
  566. echo ">$iPar</para><a name='para_{$iPar}'></a>";
  567. }
  568. foreach ($FetchSent as $key => $value) {
  569. echo "<div id='sent-pali-b$book-$iPar-{$value["begin"]}' class='par_pali_div'>";
  570. $pali_sent=$value["html"];
  571. echo "<sent class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$pali_sent."</sent>";
  572. echo "</div>";
  573. echo "<div id='sent-wbwdiv-b$book-$iPar-{$value["begin"]}' class='par_wbw_div'>";
  574. echo "</div>";
  575. echo "<div id='sent-translate-b$book-$iPar-{$value["begin"]}' class='par_translate_div'>";
  576. echo "</div>";
  577. }
  578. echo "</div>";
  579. }
  580. }
  581. else{
  582. //段落显示
  583. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  584. if(isset($tocList[$iPar])){
  585. $sentClass = " sent_toc";
  586. }
  587. else{
  588. $sentClass = "";
  589. }
  590. $query = "select html , begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  591. $FetchSent = PDO_FetchAll($query);
  592. echo "<div id='par-b$book-$iPar' class='par_div'>";
  593. echo "<div id='par-pali-b$book-$iPar' class='par_pali_div'>";
  594. if($_view=="chapter"){
  595. echo "<para book='$book' para='$iPar' ";
  596. if(isset($tocList[$iPar])){
  597. echo " level = '{$tocList[$iPar]}' ";
  598. }
  599. echo ">$iPar</para><a name='para_{$iPar}'></a>";
  600. }
  601. foreach ($FetchSent as $key => $value) {
  602. $pali_sent=$value["html"];
  603. echo "<sent class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >{$pali_sent}</sent>";
  604. }
  605. echo "</div>";
  606. echo "<div id='par-wbwdiv-b$book-$iPar' class='par_wbw_div'>";
  607. echo "</div>";
  608. echo "<div id='par-translate-b$book-$iPar' class='par_translate_div'>";
  609. echo "</div>";
  610. echo "<div id='par-note-b$book-$iPar' class='par_note_div'>";
  611. echo "</div>";
  612. echo "</div>";
  613. }
  614. }
  615. $strSimSent = "";
  616. if($_GET["view"]=="sent"){
  617. $query = "select sim_sents from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'";
  618. $FetchSent = PDO_FetchOne($query);
  619. if(!empty($FetchSent)){
  620. $sim_sents = str_replace(",","','",$FetchSent);
  621. $sim_sents = "'".$sim_sents."'";
  622. $query = "SELECT book, paragraph,begin, end, text from 'pali_sent' where id IN ( {$sim_sents} ) ";
  623. $FetchSim = PDO_FetchAll($query);
  624. foreach ($FetchSim as $key => $value) {
  625. $strSimSent .= "<div>". $value["text"]."</div>";
  626. $strSimSent .= "<div><a href='../pcdl/reader.php?view=para&book={$value["book"]}&para={$value["paragraph"]}'>"._get_para_path($value["book"],$value["paragraph"])."</a></div><br/>";
  627. }
  628. }
  629. }
  630. if(isset($_GET["sent_mode"])){
  631. }
  632. //查询编辑者数量
  633. //查询句子译文内容
  634. PDO_Connect("sqlite:"._FILE_DB_SENTENCE_);
  635. $dbh = new PDO("sqlite:"._FILE_DB_PALI_SENTENCE_, "", "");
  636. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  637. //查询channal数量
  638. switch ($_view) {
  639. case 'chapter':
  640. $query = "SELECT channal from 'sentence' where book= ? and (paragraph between ? and ? ) group by channal";
  641. $FetchChannal = PDO_FetchAll($query,array($book,$par_begin,$par_end));
  642. break;
  643. case 'para':
  644. # code...
  645. $query = "SELECT channal from 'sentence' where book= ? and paragraph = ? group by channal";
  646. $FetchChannal = PDO_FetchAll($query,array($book,$par_begin));
  647. break;
  648. case 'sent':
  649. # code...
  650. $query = "SELECT channal from 'sentence' where book= ? and paragraph = ? AND begin = ? AND end = ? group by channal";
  651. $FetchChannal = PDO_FetchAll($query,array($book,$par_begin,$_GET["begin"],$_GET["end"]));
  652. break;
  653. default:
  654. $FetchChannal = array();
  655. break;
  656. }
  657. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  658. if($_view=="sent"){
  659. $FetchPaliSent = array(array("begin" => $_GET["begin"] , "end" => $_GET["end"]));
  660. }
  661. else{
  662. $query = "select begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  663. $stmt = $dbh->query($query);
  664. $FetchPaliSent = $stmt->fetchAll(PDO::FETCH_ASSOC);
  665. }
  666. //使用巴利语句子列表 查询译文
  667. foreach ($FetchPaliSent as $key => $value) {
  668. $begin = $value["begin"];
  669. $end = $value["end"];
  670. $query_channal = "";
  671. if(isset($_GET["channal"])){
  672. $query_channal = " AND channal=".$PDO->quote($_GET["channal"]);
  673. }
  674. $sent_count = 1;
  675. if($_view=="sent"){
  676. //显示一个巴利句子 以及相应的译文
  677. if(isset($_GET["sent"])){
  678. //如果指定译文句子编号,只显示该句子(和后面的跟帖)
  679. $query="SELECT * FROM \"sentence\" WHERE id = ".$PDO->quote($_GET["sent"]);
  680. }
  681. else{
  682. $query="SELECT * FROM \"sentence\" WHERE (book = ".$PDO->quote($book)." AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND strlen <> 0 AND (parent = '' OR parent IS NULL) ) {$query_channal} order by modify_time DESC";
  683. }
  684. }
  685. else{
  686. $query = "SELECT * FROM \"sentence\" WHERE book = ".$PDO->quote($book)." AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND strlen <> 0 {$query_channal} order by modify_time DESC limit 0, 1";
  687. $query_count = "SELECT count(book) FROM \"sentence\" WHERE book = ".$PDO->quote($book)." AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND strlen > 0 {$query_channal} ";
  688. $sent_count = PDO_FetchOne($query_count);
  689. if($sent_count>9){
  690. $sent_count = "9+";
  691. }
  692. }
  693. $FetchText = PDO_FetchAll($query);
  694. $i = 0;
  695. foreach ($FetchText as $key => $value) {
  696. $thisSent = $value;
  697. $sentClass = "";
  698. # 找出句子中 我贡献的,优先显示
  699. if($_view != "sent"){
  700. if(isset($_COOKIE["userid"])){
  701. if($thisSent["editor"] !== $_COOKIE["userid"]){
  702. $query="SELECT * FROM sentence WHERE parent = ".$PDO->quote($thisSent["id"])." AND editor = ".$PDO->quote($_COOKIE["userid"])." order by modify_time DESC limit 0,1";
  703. $myText = PDO_FetchAll($query);
  704. if(count($myText)>0){
  705. $thisSent = $myText[0];
  706. $sentClass = "mine";
  707. }
  708. }
  709. }
  710. }
  711. echo render_sent($thisSent,$i,$_display,$sent_count,$sentClass);
  712. $i++;
  713. }
  714. if(count($FetchText)>0){
  715. if(isset($_GET["sent"])){
  716. //如果指定句子译文编号,显示句子的跟帖
  717. $query="SELECT * FROM \"sentence\" WHERE parent = ".$PDO->quote($_GET["sent"]);
  718. $FetchChildren = PDO_FetchAll($query);
  719. $i = 0;
  720. echo "<div style='margin-left:1em;'>";
  721. foreach ($FetchChildren as $key => $value) {
  722. echo render_sent($value,$i,$_display,$sent_count);
  723. $i++;
  724. }
  725. echo "</div>";
  726. }
  727. }
  728. }
  729. }
  730. //查询句子译文内容结束
  731. echo "<div id='para_nav'><a name='nav_foot'></a>";
  732. echo "<div style='display:inline-flex;'>";
  733. echo "<svg t='1598094361320' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4933' width='32' height='32'><path d='M698.75712 684.4416a81.92 81.92 0 0 1-124.88704 106.06592l-191.488-225.4848a81.89952 81.89952 0 0 1 0-106.06592l191.488-225.4848a81.92 81.92 0 0 1 124.88704 106.06592l-146.45248 172.46208 146.45248 172.4416z' p-id='4934' fill='#757AF7'></path></svg>";
  734. echo "$prev_para_link</div>";
  735. echo "<div style='display:inline-flex;'>$next_para_link";
  736. echo "<svg t='1598094021808' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4451' width='32' height='32'><path d='M698.75712 565.02272l-191.488 225.4848a81.73568 81.73568 0 0 1-62.48448 28.89728 81.89952 81.89952 0 0 1-62.40256-134.94272l146.432-172.4416-146.432-172.4416a81.92 81.92 0 0 1 124.88704-106.06592l191.488 225.4848a81.87904 81.87904 0 0 1 0 106.02496z' p-id='4452' fill='#757AF7'></path></svg>";
  737. echo "</div>";
  738. echo "</div>";
  739. }
  740. ?>
  741. <?php
  742. function render_sent($sent_data,$sn,$display_mode,$sent_count,$class=""){
  743. global $_userinfo;
  744. global $_channal;
  745. global $PDO;
  746. global $_local;
  747. global $_local_arr;
  748. $output = "";
  749. $currParNo=$sent_data["paragraph"];
  750. $book = $sent_data["book"];
  751. if($display_mode=="sent"){
  752. $sent_style = "display:flex;";
  753. }
  754. else{
  755. $sent_style = "";
  756. }
  757. if(!empty($sent_data["parent"])){
  758. $reply_style = " sent_reply ";
  759. }
  760. else{
  761. $reply_style = "";
  762. }
  763. $tran_text = str_replace("[[","<term status='0'>",$sent_data["text"]);
  764. $tran_text = str_replace("]]","</term>",$tran_text);
  765. $output .= "<sent_trans style='{$sent_style}{$reply_style}' id='sent-tran-b{$book}-{$currParNo}-{$sent_data["begin"]}-{$sn}' class='sent_trans ' book='$book' para='$currParNo' begin='{$sent_data["begin"]}'>";
  766. if($display_mode=="sent"){
  767. $output .= "<span>";
  768. $output .= "<span style='display:inline-block;width:20px;font-size:18px;padding: 8px 12px;background-color:gray;color:white;border-radius: 99px;text-align: center;margin-right:0.5em;margin-top: 0.5em;'>";
  769. $name = $_userinfo->getName($sent_data["editor"]);
  770. $output .= mb_substr($name,0,2);
  771. $output .= "</span>";
  772. $output .= "</span>";
  773. }
  774. $output .= "<span>";
  775. $output .= "<span>";
  776. $output .= "<span class='sent_text {$class}' ";
  777. $output .= " sent_id='".$sent_data["id"]."'";
  778. $output .= " editor='".$sent_data["editor"]."'";
  779. $output .= " book='".$sent_data["book"]."'";
  780. $output .= " para='".$sent_data["paragraph"]."'";
  781. $output .= " begin='".$sent_data["begin"]."'";
  782. $output .= " end='".$sent_data["end"]."'";
  783. $output .= " lang='".$sent_data["language"]."'";
  784. $output .= " channal='".$sent_data["channal"]."'";
  785. $output .= " tag='".$sent_data["tag"]."'";
  786. $output .= " author='".$sent_data["author"]."'";
  787. $output .= " text='".$sent_data["text"]."'";
  788. $output .= ">";
  789. $output .= $tran_text;
  790. $output .= "</span>";
  791. if($display_mode=="sent"){
  792. if((isset($_GET["channal"]) || $_GET["view"]=="sent") ){
  793. if($sent_data["editor"] == $_COOKIE["userid"]){
  794. $output .= "<svg class='edit_icon';'><use xlink:href='../studio/svg/icon.svg#ic_mode_edit'></use></svg>";
  795. }
  796. }
  797. else{
  798. $output .= "<span class='sent_count'>$sent_count</span>";
  799. }
  800. }
  801. echo "</span>";
  802. if($_GET["view"]=="sent"){
  803. $channalInfo = $_channal->getChannal($sent_data["channal"]);
  804. $query="SELECT count(*) FROM \"sentence\" WHERE parent = ".$PDO->quote($sent_data["id"]);
  805. $edit_count = PDO_FetchOne($query);
  806. $output .= "<div style='font-size:80%;color:gray;margin-bottom:1em;'>$name · {$channalInfo["name"]}|";
  807. $output .= '<svg t="1600445373282" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2368" width="16" height="16"><path fill="silver" d="M854.00064 412.66688h-275.99872v-35.99872c48-102.00064 35.99872-227.99872 0-288-12.00128-18.00192-35.99872-35.99872-54.00064-35.99872s-35.99872 6.00064-35.99872 54.00064c0 96-6.00064 137.99936-24.00256 179.99872-12.00128 29.99808-77.99808 96-156.00128 120.00256v480c12.00128 6.00064 35.99872 24.00256 54.00064 29.99808 18.00192 12.00128 48 18.00192 60.00128 18.00192h306.00192c77.99808 0 108.00128-29.99808 108.00128-66.00192 0-18.00192 0-29.99808-18.00192-35.99872V796.672c41.99936 0 83.99872-12.00128 83.99872-48 0-29.99808-12.00128-35.99872-18.00192-35.99872v-35.99872h6.00064c24.00256 0 60.00128-35.99872 60.00128-60.00128 0-18.00192-6.00064-35.99872-18.00192-41.99936-6.00064-6.00064-24.00256-6.00064-24.00256-6.00064v-35.99872s12.00128 0 24.00256-12.00128c18.00192-12.00128 18.00192-42.00448 18.00192-42.00448v-12.00128c0-29.99808-48-54.00064-96-54.00064zM67.99872 478.6688l35.99872 408.00256c6.00064 24.00256 24.00256 48 48 48h83.99872c6.00064 0 12.00128-6.00064 18.00192-12.00128s12.00128-6.00064 18.00192-12.00128V412.66688H128c-35.99872 0-60.00128 35.99872-60.00128 66.00192z" p-id="2369"></path></svg>';
  808. $output .= '<span id="num_like">(0)|</span>';
  809. if($sent_data["editor"] == $_COOKIE["userid"]){
  810. $output .= "<span>{$_local_arr["gui"]["revise"]}</span>:";
  811. }
  812. else{
  813. $output .= "<edit>{$_local_arr["gui"]["revise"]}</edit>:";
  814. }
  815. $output .= "({$edit_count}) ";
  816. if($sent_data["editor"] != $_COOKIE["userid"]){
  817. $output .= "<span onclick='sent_apply()'>采纳</span>";
  818. }
  819. $output .="</div>";
  820. }
  821. echo "</span>";
  822. $output .= "</sent_trans>";
  823. if($_GET["view"]!="sent"){
  824. $output .= "<script>";
  825. if($display_mode=="sent"){
  826. $output .= "document.getElementById('sent-translate-b{$book}-{$currParNo}-{$sent_data["begin"]}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$sent_data["begin"]}-{$sn}'));";
  827. }
  828. else{
  829. $output .= "document.getElementById('par-translate-b{$book}-{$currParNo}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$sent_data["begin"]}-{$sn}'));";
  830. }
  831. $output .= "</script>";
  832. }
  833. return $output;
  834. }
  835. ?>
  836. <div>
  837. <a name="sim_doc"></a>
  838. <div>相似句子</div>
  839. <?php echo $strSimSent; ?>
  840. <div>相关段落</div>
  841. <ul>
  842. <?php
  843. //查找相关标题
  844. if(strtolower(mb_substr($par_title,mb_strlen($par_title,"UTF-8")-7,null,"UTF-8"))=="vaṇṇanā"){
  845. $searchToc = strtolower(mb_substr($par_title,0,-7,"UTF-8"));
  846. }
  847. else{
  848. $searchToc = strtolower(mb_substr($par_title,0,-1,"UTF-8"));
  849. }
  850. PDO_Connect("sqlite:"._FILE_DB_RESRES_INDEX_);
  851. $query = "select book, paragraph,title from 'index' where \"title\" like ".$PDO->quote($searchToc.'%')." limit 0,50";
  852. $Fetch = PDO_FetchAll($query);
  853. foreach ($Fetch as $key => $value) {
  854. echo "<div style='margin-bottom: 0.5em;'>";
  855. echo "<div><a href='reader.php?view=chapter&book={$value["book"]}&para={$value["paragraph"]}' target='_blank'> {$value["title"]} </a></div>";
  856. echo "<div>". _get_para_path($value["book"],$value["paragraph"])."</div>";
  857. echo "</div>";
  858. }
  859. ?>
  860. </ul>
  861. </div>
  862. </div><!--main_text_view end-->
  863. <div id="new_comm_shell" style="display:none;">
  864. <div id="new_comm_div">
  865. <textarea id="new_comm_text"></textarea>
  866. <button onclick="new_comm_submit()">提交</button><button onclick="new_comm_cancel()">取消</button>
  867. </div>
  868. </div>
  869. <div id="dighest_edit_div" class="full_screen_window">
  870. <div class="win_caption">
  871. <div><button onclick="dighest_edit_cancle()">取消</button></div>
  872. <div><button onclick="dighest_edit_submit()">提交</button></div>
  873. </div>
  874. <div id="dighest_edit_body" class="win_body">
  875. <div>
  876. 标题:<input id="dighest_edit_title" />
  877. </div>
  878. <div>
  879. 简介:<textarea id="dighest_edit_summary"></textarea>
  880. </div>
  881. <div>
  882. 标签:<input id="dighest_edit_taget" />
  883. </div>
  884. <div id="dighest_text_preview">
  885. </div>
  886. </div>
  887. </div>
  888. <div id="right_panal_toc" style="position: fixed;top:3em;width:17em;left: calc(100% - 17em);height:auto; min-height:30em;border-left: 1px solid gray; font-size: 80%;padding: 2em 0.5em;">
  889. <?php
  890. if($currLevel>=$tocMinLevel){
  891. echo $htmlToc2;
  892. }
  893. echo "<div>Channal</div>";
  894. echo "<div>";
  895. echo "<a href='../pcdl/reader.php?view={$_GET["view"]}";
  896. echo "&book=".$_GET["book"];
  897. echo "&para=".$_GET["para"];
  898. if(isset($_GET["begin"])){
  899. echo "&begin=".$_GET["begin"];
  900. }
  901. if(isset($_GET["end"])){
  902. echo "&end=".$_GET["end"];
  903. }
  904. echo "' >";
  905. echo "全部";
  906. echo "</a>";
  907. echo "</div>";
  908. foreach ($FetchChannal as $key => $value) {
  909. # code...
  910. echo "<div>";
  911. echo "<a href='../pcdl/reader.php?view={$_GET["view"]}";
  912. echo "&book=".$_GET["book"];
  913. echo "&para=".$_GET["para"];
  914. if(isset($_GET["begin"])){
  915. echo "&begin=".$_GET["begin"];
  916. }
  917. if(isset($_GET["end"])){
  918. echo "&end=".$_GET["end"];
  919. }
  920. if(isset($_GET["display"])){
  921. echo "&display=".$_GET["display"];
  922. }
  923. echo "&channal=".$value["channal"]."' >";
  924. $channalInfo = $_channal->getChannal($value["channal"]);
  925. if($channalInfo){
  926. echo $_userinfo->getName($channalInfo["owner"]);
  927. echo '/'.$channalInfo["name"];
  928. }
  929. echo "</a>";
  930. echo "</div>";
  931. }
  932. ?>
  933. </div>
  934. </div>
  935. <!-- 全屏 黑色背景 -->
  936. <div id="BV" class="blackscreen" onclick="setNaviVisibility()"></div>
  937. <!-- nav begin-->
  938. <div id="leftmenuinner" class="viewswitch_off">
  939. <div class="win_caption">
  940. <div><button id="left_menu_hide" onclick="setNaviVisibility()">返回</button></div>
  941. <div id="menubartoolbar_New">
  942. <ul class="common-tab">
  943. <li id="content_menu_li" class="common-tab_li_act" onclick="menuSelected_2(menu_toc,'content_menu_li')">目录</li>
  944. <li id="palicanon_menu_li" class="common-tab_li" onclick="menuSelected_2(menu_pali_cannon,'palicanon_menu_li')">批注</li>
  945. <li id="bookmark_menu_li" class="common-tab_li" onclick="menuSelected_2(menu_bookmark,'bookmark_menu_li')">书签</li>
  946. </ul>
  947. </div>
  948. </div>
  949. <div class='toc' id='leftmenuinnerinner' style="font-family: 'Noto Serif';">
  950. <!-- toc begin -->
  951. <div class="menu" id="menu_toc">
  952. <a name="_Content" ></a>
  953. <div id="toc_content"><?php echo $tocHtml; ?></div>
  954. </div>
  955. <!-- toc end -->
  956. <!-- comments begin -->
  957. <div class="menu" id="menu_comments">
  958. <div id="navi_comments_inner"></div>
  959. </div>
  960. <!-- comments end -->
  961. <!-- book mark begin -->
  962. <div class="menu" id="menu_bookmark" style="display:none;">
  963. <div>
  964. <input id="B_Bookmark_All" onclick="setBookmarkVisibility('all')" type="checkbox" style="width: 20px; height: 20px" />
  965. <input id="B_Bookmark_A" onclick="setBookmarkVisibility('bma','B_Bookmark_A')" type="checkbox" style="width: 20px; height: 20px" /><span class="bookmarkcolora , bookmarkcolorblock" >a</span>
  966. <input id="B_Bookmark_X" onclick="setBookmarkVisibility('bmx','B_Bookmark_X')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolorx , bookmarkcolorblock" >?</span>
  967. <input id="B_Bookmark_1" onclick="setBookmarkVisibility('bm1','B_Bookmark_1')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor1 , bookmarkcolorblock" >1</span>
  968. <input id="B_Bookmark_2" onclick="setBookmarkVisibility('bm2','B_Bookmark_2')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor2 , bookmarkcolorblock" >2</span>
  969. <input id="B_Bookmark_3" onclick="setBookmarkVisibility('bm3','B_Bookmark_3')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor3 , bookmarkcolorblock" >3</span>
  970. <input id="B_Bookmark_4" onclick="setBookmarkVisibility('bm4','B_Bookmark_4')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor4 , bookmarkcolorblock" >4</span>
  971. <input id="B_Bookmark_5" onclick="setBookmarkVisibility('bm5','B_Bookmark_5')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor5 , bookmarkcolorblock" >5</span>
  972. <input id="B_Bookmark_0" onclick="setBookmarkVisibility('bm0','B_Bookmark_0')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor0 , bookmarkcolorblock" >0</span>
  973. </div>
  974. <div id="navi_bookmark_inner"></div>
  975. </div>
  976. <!-- book mark end -->
  977. </div>
  978. </div>
  979. <!-- nav end -->
  980. </div>
  981. <div id="mean_menu" ></div>
  982. <div id="sent_modify_win">
  983. <div>
  984. <textarea id="sent_modify_text" style="display:block;width:100%;">
  985. </textarea>
  986. <button onclick="trans_sent_save()">Save</button>
  987. <button onclick="trans_sent_cancel()">Cancel</button>
  988. </div>
  989. </div>
  990. <script>
  991. $(".pali").mouseover(function(e){
  992. var targ
  993. if (!e) var e = window.event;
  994. if (e.target) targ = e.target;
  995. else if (e.srcElement) targ = e.srcElement;
  996. if (targ.nodeType == 3) // defeat Safari bug
  997. targ = targ.parentNode;
  998. var pali_word;
  999. pali_word=targ.innerHTML;
  1000. objCurrMouseOverPaliMean=targ.nextSibling;
  1001. $("#tool_bar_title").html(pali_word);
  1002. $("#mean_menu").html(getWordMeanMenu(pali_word));
  1003. targ.parentNode.appendChild(document.getElementById("mean_menu"));
  1004. });
  1005. $("para").mouseenter(function(e){
  1006. let book = $(this).attr("book");
  1007. let para = $(this).attr("para");
  1008. $("sent[book='"+book+"'][para='"+para+"']").css("background-color","#fefec1");
  1009. });
  1010. $("para").mouseleave(function(e){
  1011. let book = $(this).attr("book");
  1012. let para = $(this).attr("para");
  1013. $("sent[book='"+book+"'][para='"+para+"']").css("background-color","unset");
  1014. });
  1015. $("sent").click(function(e){
  1016. let book = $(this).attr("book");
  1017. let para = $(this).attr("para");
  1018. let begin = $(this).attr("begin");
  1019. let end = $(this).attr("end");
  1020. window.location.assign("reader.php?view=sent&book="+book+"&para="+para+"&begin="+begin+"&end="+end);
  1021. });
  1022. $("sent").mouseenter(function(e){
  1023. let book = $(this).attr("book");
  1024. let para = $(this).attr("para");
  1025. let begin = $(this).attr("begin");
  1026. $(this).css("background-color","#fefec1");
  1027. $("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
  1028. });
  1029. $("sent").mouseleave(function(e){
  1030. let book = $(this).attr("book");
  1031. let para = $(this).attr("para");
  1032. let begin = $(this).attr("begin");
  1033. $(this).css("background-color","unset");
  1034. $("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
  1035. });
  1036. $("sent_trans").mouseenter(function(e){
  1037. let book = $(this).attr("book");
  1038. let para = $(this).attr("para");
  1039. let begin = $(this).attr("begin");
  1040. $(this).css("background-color","#fefec1");
  1041. $("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
  1042. });
  1043. $("sent_trans").mouseleave(function(e){
  1044. let book = $(this).attr("book");
  1045. let para = $(this).attr("para");
  1046. let begin = $(this).attr("begin");
  1047. $(this).css("background-color","unset");
  1048. $("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
  1049. });
  1050. $(".sent_text").click(function(e){
  1051. let book = $(this).attr("book");
  1052. let para = $(this).attr("para");
  1053. let begin = $(this).attr("begin");
  1054. let end = $(this).attr("end");
  1055. let id = $(this).attr("sent_id");
  1056. window.location.assign("reader.php?view=sent&book="+book+"&para="+para+"&begin="+begin+"&end="+end+"&sent="+id);
  1057. });
  1058. $(".edit_icon").click(function(e){
  1059. let objSent = $(this).parent().children(".sent_text").first();
  1060. if(objSent){
  1061. let text = objSent.attr("text");
  1062. $("#sent_modify_text").val(text);
  1063. $("#sent_modify_text").attr("sent_id",objSent.attr("sent_id"));
  1064. $("#sent_modify_text").attr("editor",objSent.attr("editor"));
  1065. $("#sent_modify_text").attr("book",objSent.attr("book"));
  1066. $("#sent_modify_text").attr("para",objSent.attr("para"));
  1067. $("#sent_modify_text").attr("begin",objSent.attr("begin"));
  1068. $("#sent_modify_text").attr("end",objSent.attr("end"));
  1069. $("#sent_modify_text").attr("lang",objSent.attr("lang"));
  1070. $("#sent_modify_text").attr("tag",objSent.attr("tag"));
  1071. $(this).parent().append($("#sent_modify_win"));
  1072. $("#sent_modify_win").show();
  1073. }
  1074. });
  1075. $("edit").click(function(e){
  1076. let objSent = $(this).parent().parent().children(".sent_text").first();
  1077. if(objSent){
  1078. let text = objSent.attr("text");
  1079. $("#sent_modify_text").val(text);
  1080. $("#sent_modify_text").attr("sent_id",objSent.attr("sent_id"));
  1081. $("#sent_modify_text").attr("editor",objSent.attr("editor"));
  1082. $("#sent_modify_text").attr("book",objSent.attr("book"));
  1083. $("#sent_modify_text").attr("para",objSent.attr("para"));
  1084. $("#sent_modify_text").attr("begin",objSent.attr("begin"));
  1085. $("#sent_modify_text").attr("end",objSent.attr("end"));
  1086. $("#sent_modify_text").attr("lang",objSent.attr("lang"));
  1087. $("#sent_modify_text").attr("tag",objSent.attr("tag"));
  1088. $(this).parent().append($("#sent_modify_win"));
  1089. $("#sent_modify_win").show();
  1090. }
  1091. });
  1092. $("para").click(function(e){
  1093. let book = $(this).attr("book");
  1094. let para = $(this).attr("para");
  1095. let level = $(this).attr("level");
  1096. let view = "para";
  1097. if(level && level<100){
  1098. view = "chapter";
  1099. }
  1100. window.location.assign("reader.php?view="+view+"&book="+book+"&para="+para);
  1101. });
  1102. term_updata_translation();
  1103. var wordlist = new Array();
  1104. $("term").each(function(index,element){
  1105. wordlist.push($(this).attr("pali"));
  1106. }
  1107. );
  1108. function haha(){
  1109. var wordquery ="('" + wordlist.join("','")+"')";
  1110. $.post("../term/term.php",
  1111. {
  1112. op:"extract",
  1113. words:wordquery
  1114. },
  1115. function(data,status){
  1116. if(data.length>0){
  1117. try{
  1118. arrMyTerm = JSON.parse(data);
  1119. term_updata_translation();
  1120. }
  1121. catch(e){
  1122. console.error(e.error+" data:"+data);
  1123. }
  1124. }
  1125. });
  1126. }
  1127. </script>
  1128. </body>
  1129. </html>