annotate views/Extractapp/TaggingText.php @ 87:fb5049fc5dd7 extractapp_dev

New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 02 Jun 2015 16:52:05 +0200
parents 0141df465205
children e681d693240e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 <?php
81
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
2 /*
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
3 * TaggingText.php
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
4 * This file is part of Extraction-interface.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
5 *
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
6 * Extraction-interface is free software: you can redistribute it and/or modify
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
7 * it under the terms of the GNU General Public License as published by
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
9 * (at your option) any later version.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
10 *
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
11 * Extraction-interface is distributed in the hope that it will be useful,
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
14 * GNU General Public License for more details.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
15 *
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
16 * You should have received a copy of the GNU General Public License
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
17 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
18 */
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
19
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
20 /*! \file
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
21 * This is the view for TaggingText.
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
22 * It shows the extraction-interface application itself.
81
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
23 * The input data for this view come from models/extractapp.php which is handled by controllers/extractapp.php.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
24 * Input data for example, are (1)text string (containing tags if there are any),
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
25 * (2)taglist for the current topic, (3)book and section information, etc.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
26 * The output data are passed to backend by controller to corresponding method in model/extractapp.php.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
27 * Output data is the tagged text string.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
28 *
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
29 * The user interface contains tagging area on the left side, and toolbox on the right side.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
30 * There are popup windows to assist the tagging task, for example RegEx-editors, tag-window, remove-tag-window, etc.
f1f849d31272 book_id as string
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
31 *
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
32 */
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
33
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 // --- initialize config file and input text ---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
35 $stringInput = $viewmodel['stringInput'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
36 $wordlistArray = $viewmodel['wordlistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 $taglistArray = $viewmodel['taglistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 $section_id = $viewmodel['section_id'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 $topiclistArray = $viewmodel['topiclistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
40 $default_topic_id = $viewmodel['default_topic_id'];
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
41 $topic_name = $viewmodel['topic_name']; // array of names
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 $topic_tag = $viewmodel['topic_tag'];
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
43 $topic_tag_ch = $viewmodel['topic_tag_ch'];
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 $info = $viewmodel['info'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 $messages = $viewmodel['messages'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
46
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 $taglist_infile = $viewmodel['taglist_infile'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 $book_meta = $viewmodel['book_meta'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
49
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
51
63
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
52
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
53 <html>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 <head>
63
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
55 <meta charset="UTF-8">
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
56 <title>Extraction Interface</title>
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
57 <meta http-equiv="no-cache">
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
58 <meta http-equiv="Expires" content="-1">
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
59 <meta http-equiv="Cache-Control" content="no-cache">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 <style>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
61 dynasty
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
63 color:red;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
64 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
65 nianhao
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
66 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
67 color:blue;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
68 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
69 name
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 color:orange;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
73 #editable-area {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 line-height:160%;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
75 letter-spacing:1.5px;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
76 font-size:21px;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
77 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
78
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
79 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
80 // color on the tags
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
81 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
82 echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."\n}\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
83
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
84 echo ".span_".$taglistValue[2]."\n{\nbackground-color:".$taglistValue[3]."\n}\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
85 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
86
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
87 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
88 </style>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
89
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
90
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
91 </head>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
92
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
93 <body>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
94
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
95 <script type="text/javascript">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
96
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
97 var cjst = window.cjst; // for pinyin from cjst.js
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
98
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
99 // not use this for now
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
100 function _showTagColor(up_to_date) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
101 var taglistArray = "";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
102 if (up_to_date) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
103 taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
104 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
105 taglistArray = JSON.parse('<?php echo json_encode($taglist_infile) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
106 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
107
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
108
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
109 for (var i = 0; i < taglistArray.length; i++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
110 var taglistValue = taglistArray[i];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
111
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
112 $(taglistValue[2]).css('color', taglistValue[3]);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
113 /*var element = document.querySelectorAll(taglistValue[2]);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
114 for (var j = 0; j < element.length; j++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
115 element[j].style.color = taglistValue[3];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
116 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
117 */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
118 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
119 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
120
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
121
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
122
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
123 function reloadText() {
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
124 /**
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
125 * Reload the text when there is a new version of this branch.
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
126 */
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
127 // confirm to reload
63
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
128 var r = confirm("Are you sure you want to load the latest version (in a new tab)?");
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
129 if (r != true) {
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
130 return;
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
131 }
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
132
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
133 var form = document.createElement("form");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
134 form.setAttribute("method", "post");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
135 form.setAttribute("action", "./TaggingText"); // hand to controller
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
136 form.setAttribute("target", "_blank");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
137
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
138 var hiddenField = document.createElement("input");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
139 hiddenField.setAttribute("name", "topic");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
140 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>');
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
141 hiddenField.setAttribute("value", topic_id);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
142 form.appendChild(hiddenField);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
143
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
144 var hiddenField = document.createElement("input");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
145 hiddenField.setAttribute("name", "func");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
146 hiddenField.setAttribute("value", "ReloadText");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
147 form.appendChild(hiddenField);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
148
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
149 _postForContineTagging(form);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
150
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
151 }
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
152
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
153 function handleFileVersionConflict() {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
154 var info = JSON.parse('<?php echo json_encode($info) ?>');
58
a11f9103b8db New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 57
diff changeset
155 // if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){
a11f9103b8db New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 57
diff changeset
156 if (info['current_fileId'] != 0){
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
157 // -- there might be conflicts between different version
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
158 alert("Your saving failed! Someone edited this file and saved before you.");
58
a11f9103b8db New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 57
diff changeset
159 $('#reloadTextButton').css("display", "block");
a11f9103b8db New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 57
diff changeset
160
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
161 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
162 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
163 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
164
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
165 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
166
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
167 // on click on tagged words, call removeTagNewDiv() for the popup window
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
168 // popup-window overlapping issue
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
169 var pop_remove_tag_window = true;
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
170 var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>');
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
171 for (var i = 0; i < taglistArray.length; i++) {
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
172 var taglistValue = taglistArray[i];
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
173
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
174 $(document).on("click", taglistValue[2], function (e) {
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
175 if ($("#editTextId").html() != "Edit the text") return 0;
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
176 var tagName = $(this).prop("tagName").toLowerCase();
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
177 /*
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
178 if ($(this).prop("tagName").toLowerCase() != taglistValue[2]) {
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
179 return 0;
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
180 }
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
181 */
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
182 // pop_remove_tag_window is a global variable which indicates if to show the remove-popup-window
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
183 if (pop_remove_tag_window) {
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
184 removeTagNewDiv( e, tagName , $(this));
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
185 };
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
186 });
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
187 };
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
188
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
189 /*
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
190 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
191 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
192 echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
193 echo "\t".'if ( $(this).prop("tagName").toLowerCase() != "'.$taglistValue[2].'" ) return 0;'."\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
194 echo "\t".'if ( $("#editTextId").html() != "Edit the text" ) return 0;'."\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
195 echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
196 echo "});\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
197 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
198 ?>
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
199 */
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
200
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
201 $(document).ready(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
202
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
203 // --- for sidebar---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
204 //run once
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
205 var el=$('#follow-scroll');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
206 var originalelpos=el.offset().top; // take it where it originally is on the page
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
207
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
208 //run on scroll
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
209 $(window).scroll(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
210 var el = $('#follow-scroll'); // important! (local)
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
211 var elpos = el.offset().top; // take current situation
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
212 var windowpos = $(window).scrollTop();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
213 var finaldestination = windowpos+originalelpos;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
214 //el.stop().animate({'top':finaldestination},500);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
215 el.stop().animate({'top':finaldestination},0);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
216 });
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
217 // ---
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
218
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
219
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
220 //--- for popups ---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
221 //run once
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
222 var el=$('#popups');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
223 var originalelpos=el.offset().top; // take it where it originally is on the page
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
224
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
225 //run on scroll
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
226 $(window).scroll(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
227 var el = $('#popups'); // important! (local)
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
228 var elpos = el.offset().top; // take current situation
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
229 var windowpos = $(window).scrollTop();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
230 var finaldestination = windowpos+originalelpos;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
231 //el.stop().animate({'top':finaldestination},500);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
232 el.stop().animate({'top':finaldestination},0);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
233 });
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
234 // ---
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
235
60
3239979f6673 New: 1.display messages(style) 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 59
diff changeset
236
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
237 // === This case only be possible for developing on local machine ====
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
238 var _GET = JSON.parse('<?php echo json_encode($_GET) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
239 if (_GET['id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
240 var info = JSON.parse('<?php echo json_encode($info) ?>');
49
b2c1fae5cf6a move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 47
diff changeset
241 var redirectUrl = "http://localhost:1080/localgazetteers-dev/extraction-interface/Extractapp/TaggingText";
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
242 var section_id = info['section_id'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
243
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
244 var form = $('<form action="' + redirectUrl + '" method="post">' +
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
245 '<input type="hidden" name="sectionId" value="'+section_id+'" />' +
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
246 '</form>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
247 $('body').append(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
248 $(form).submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
249 }
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
250 // --------
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
251
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
252 // --- handle file version conflict ---
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
253 var info = JSON.parse('<?php echo json_encode($info) ?>');
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
254 // the first time to this section. without branch_id and file_id
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
255 if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
256 $( "#save_text_to_LGService_id").text( "Create(Save) Branch to LGService" );
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
257
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
258 }
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
259 handleFileVersionConflict();
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
260
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
261 // --- handle taglist deprecation ---
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
262 var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>');
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
263 var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>');
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
264
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
265 if (taglist_infile == "") {
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
266 console.log("Debug: taglist_infile is empty which means taglist_infile is equal to taglist in db.");
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
267 } else {
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
268 console.log("Debug: taglist_infile length=" + taglist_infile.length);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
269 console.log(taglist_infile);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
270 console.log("Debug: taglistArray length=" + taglistArray.length);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
271 console.log(taglistArray);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
272
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
273 // TOOD: ask user to modify/decide tags
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
274 // showing taglist_infile and taglistArray
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
275 //alert("Warning: taglist is deprecated in the current file.");
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
276
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
277 }
72
6974309983d1 Bug fixed:1.remove tagging popup window on editable-area, 2.close/disable inputs and buttons, when entering edit-text mode.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 70
diff changeset
278
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
279
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
280 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
281
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
282 $(document).on("mouseup", '#editable-area', function (e) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
283 $('.questionMarkClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
284 $('.tagItemDivClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
285
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
286 if ( $("#editTextId").html() != "Edit the text" ) return 0;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
287 var selection = getSelected();
54
f9e7119339b2 bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 51
diff changeset
288
f9e7119339b2 bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 51
diff changeset
289 range = selection.getRangeAt(0);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
290
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
291 container = document.createElement("div");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
292 container.appendChild(selection.getRangeAt(0).cloneContents());
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
293
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
294 if(selection && (selection_plain = new String(selection).replace(/^\s+|\s+$/g,''))) {
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
295 try{
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
296 var newdiv = document.createElement("div");
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
297 //newdiv.id = "tagItemDivId";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
298 //newdiv.setAttribute("class", "tagItemDivClass");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
299 $(newdiv).id = "tagItemDivId";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
300 $(newdiv).addClass("tagItemDivClass");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
301 newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+';';
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
302 //console.log(selection.getRangeAt(0).cloneContents());
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
303 if ( container.innerHTML.indexOf( "br" ) != -1 ) {
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
304 // when selected words containing tags (i.e. has 'br' in the selected string),
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
305 // which means user want to apply Title / or tags all in once at each line
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
306 // This may not be the best checking solution, since 'br' also appears between not-tagged words
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
307
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
308 var newselect = document.createElement("select");
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
309 newselect.id = "TitletagType";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
310 //console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>'));
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
311
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
312 <?php
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
313 foreach ( $taglistArray as $taglistValue ) {
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
314 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
315 }
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
316 ?>
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
317 newdiv.appendChild(newselect);
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
318
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
319 //matchValue = .match();
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
320 myRegexp = new RegExp("〈(.*?)〉", "g")
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
321 matchValue = myRegexp.exec(String(selection));
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
322
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
323 if ( matchValue != null ) {
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
324 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
325 } else {
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
326 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>";
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
327 }
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
328 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
329
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
330 /*
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
331 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
332 */
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
333
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
334 var newselect = document.createElement("select");
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
335 newselect.id = "RemoveTitletagType";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
336 <?php
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
337 foreach ( $taglistArray as $taglistValue ) {
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
338 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
339 }
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
340 ?>
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
341 newdiv.appendChild(newselect);
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
342
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
343 newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
344 newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>";
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
345 } else {
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
346 // for pop up window on edit-area for tag list
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
347 // newdiv.innerHTML = "Tagging word: "+String(selection)+"<br>";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
348 var tagging_words = document.createElement("div");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
349 $(tagging_words).addClass("bg-info");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
350 $(tagging_words).text("Tagging words: " + String(selection_plain));
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
351
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
352 newdiv.appendChild(tagging_words);
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
353
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
354 var tagging_tags = document.createElement("div");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
355 $(tagging_tags).addClass("bg-white");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
356 $(tagging_tags).text("Tag as: ");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
357
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
358 tagging_tags.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection_plain)+"' )\">Title</button></br>";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
359
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
360 <?php
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
361 foreach ( $taglistArray as $taglistValue ) {
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
362 if ($taglistValue[2] == $topic_tag) {
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
363 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection_plain)+\"', '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
364 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(without new line)</button>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
365 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
366 break;
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
367 }
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
368 }
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
369 foreach ( $taglistArray as $taglistValue ) {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
370 if ($taglistValue[2] == $topic_tag) {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
371 // pass
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
372 } else if ($taglistValue[2] == "post_time") {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
373 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
374 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
375 } else if ($taglistValue[2] == "office") {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
376 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
377 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
378 } else {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
379 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
380 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
381 }
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
382 }
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
383 ?>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
384
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
385 newdiv.appendChild(tagging_tags);
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
386 // add selected words to generator regex
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
387 genRegexBySelection(newdiv, selection); // append button to newdiv and handle the selection words
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
388
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
389 }
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
390
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
391 //$('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
392 $('body').append(newdiv);
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
393 $('#TitletagType').val(lastAddTag);
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
394
79
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
395 // selected some words, so hide popping up remove-tag-window
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
396 pop_remove_tag_window = false; // questionMarkID
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
397 }
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
398 catch(err){
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
399 pop_remove_tag_window = true; // questionMarkID
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
400
e6e213b26454 Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 78
diff changeset
401 }
78
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
402 } else {
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
403 // without selecting any word, so pop up remove-tag-window
960ba96efce1 Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 77
diff changeset
404 pop_remove_tag_window = true;
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
405 }
54
f9e7119339b2 bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 51
diff changeset
406
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
407 //e.stopPropagation();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
408 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
409
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
410 // === for exporttable.php ===
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
411 function exportTable( range, container ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
412 //MsgBox("enter function");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
413 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
414 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
415 form.setAttribute("action", "./ExportTable");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
416 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
417
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
418 var hiddenField = document.createElement("input");
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
419 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
420 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
421 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
422
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
423 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
424 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
425 hiddenField.setAttribute("value", container.innerHTML);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
426 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
427
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
428 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
429 hiddenField.setAttribute("name", "sectionid");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
430 hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
431 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
432
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
433 var hiddenField2 = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
434 hiddenField2.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
435 hiddenField2.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
436 form.appendChild(hiddenField2);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
437
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
438 var info = JSON.parse( '<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
439
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
440 if (info) {
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
441 var hiddenField = document.createElement("input");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
442 hiddenField.setAttribute("name", "bookId");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
443 hiddenField.setAttribute("value", info['book_id']);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
444 form.appendChild(hiddenField);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
445
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
446 var hiddenField = document.createElement("input");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
447 hiddenField.setAttribute("name", "bookName");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
448 hiddenField.setAttribute("value", info['book_name']);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
449 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
450
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
451 var hiddenField = document.createElement("input");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
452 hiddenField.setAttribute("name", "sectionName");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
453 hiddenField.setAttribute("value", info['section_name']);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
454 form.appendChild(hiddenField);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
455
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
456 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
457
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
458 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
459 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
460 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
461 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
462 form.submit(); // works under IE and Chrome, but not FF
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
463 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
464 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
465
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
466 function exportPage(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
467 var startPage = $('#exportPageStart').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
468 var endPage = $('#exportPageEnd').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
469
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
470 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
471 var str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
472
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
473 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
474
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
475 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
476 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
477 form.setAttribute("action", "./ExportTable");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
478 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
479
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
480 var hiddenField = document.createElement("input");
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
481 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
482 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
483 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
484
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
485 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
486 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
487 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
488 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
489
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
490 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
491 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
492 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
493 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
494
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
495 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
496
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
497
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
498 /*
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
499 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
500 console.log("section_id: "+section_id+", topic_id: "+topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
501
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
502 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
503 hiddenField.setAttribute("name", "sectionId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
504 hiddenField.setAttribute("value", section_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
505 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
506
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
507 var info = JSON.parse( '<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
508
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
509 if (info) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
510 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
511 hiddenField.setAttribute("name", "bookId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
512 hiddenField.setAttribute("value", info['book_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
513 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
514
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
515 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
516 hiddenField.setAttribute("name", "bookName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
517 hiddenField.setAttribute("value", info['book_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
518 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
519
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
520 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
521 hiddenField.setAttribute("name", "sectionName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
522 hiddenField.setAttribute("value", info['section_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
523 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
524
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
525 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
526
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
527
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
528 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
529 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
530 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
531 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
532 form.submit(); // works under IE and Chrome, but not FF
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
533 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
534 */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
535 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
536
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
537 function exportAll(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
538 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
539 var str= "" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
540 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
541 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
542 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
543 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
544
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
545 var hiddenField = document.createElement("input");
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
546 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
547 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
548 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
549
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
550
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
551
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
552 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
553 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
554 hiddenField.setAttribute("value", str);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
555 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
556
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
557 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
558 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
559 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
560 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
561
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
562 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
563
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
564 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
565 // ===========
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
566
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
567 function tagwithOnlytag( range, stringSelection, tag ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
568 saveUndoText();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
569 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
570 var topic_tag2 = topic_tag+"2";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
571
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
572 range.deleteContents();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
573
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
574 if ( tag==topic_tag2) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
575 var newdiv = document.createElement(topic_tag);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
576 newdiv.innerHTML = stringSelection;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
577 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
578 var newdiv = document.createElement("br");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
579 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
580
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
581 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
582 var newdiv = document.createElement(tag);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
583 newdiv.innerHTML = stringSelection;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
584 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
585 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
586
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
587
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
588 $('.tagItemDivClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
589 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
590
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
591 function replaceSmartRegex() {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
592 saveUndoText();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
593 var startPage = $('#regexPageStart2').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
594 var endPage = $('#regexPageEnd2').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
595
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
596 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
597 var regexText=document.getElementById("regexText").value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
598
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
599 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
600 foreach ( $wordlistArray as $wordlistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
601 echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
602 echo "\tregexText1 = preg_quote(regexText1);\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
603 echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
604 echo "\tregexText = regexText.replace(new RegExp(regexText1, \"g\"), replaceText1);\n\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
605 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
606 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
607
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
608 var replaceText=document.getElementById("replaceText").value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
609 var str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
610
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
611 if ( startPage == "" ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
612 alert( "Tagged "+str.match(new RegExp(regexText, "g")).length+" entities!" );
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
613 el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
614 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
615 var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
616 var partString = ""+str.match(new RegExp(regexText2, "g"));
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
617 alert(partString);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
618
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
619 alert( "Tagged "+partString.match(new RegExp(regexText, "g")).length+" entities!" );
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
620 var resultString = partString.replace(new RegExp(regexText, "g"), replaceText);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
621
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
622 str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
623 el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
624 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
625 //document.styleSheets[0].addRule("tag001", "color:green;")
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
626 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
627
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
628 function saveTextToLGService() {
63
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
629 // clean editable-area
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
630 $('.questionMarkClass').remove();
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
631 $('.tagItemDivClass').remove();
72
6974309983d1 Bug fixed:1.remove tagging popup window on editable-area, 2.close/disable inputs and buttons, when entering edit-text mode.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 70
diff changeset
632
54
f9e7119339b2 bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 51
diff changeset
633 // -------------
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
634 var info = JSON.parse('<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
635 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
636
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
637 // if this is a new branch, ask for label
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
638 // if (info['branch_id'] == 0) {
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
639 if (info['branch_id'] == 0) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
640 //var label = prompt("Please enter your label for this new branch", "section"+info['section_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
641 var today = new Date();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
642 var dd = today.getDate();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
643 var mm = today.getMonth()+1; //January is 0!
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
644 var yyyy = today.getFullYear();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
645
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
646 if(dd<10) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
647 dd='0'+dd
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
648 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
649 if(mm<10) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
650 mm='0'+mm
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
651 }
54
f9e7119339b2 bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 51
diff changeset
652 today = dd+'.'+mm+'.'+yyyy;
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
653 var book_name = info['book_name'];
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
654 var section_name = info['section_name'];
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
655 var period = info['period'];
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
656
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
657 var default_label = "";
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
658 if (book_name == "" || section_name == "" || period == "") {
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
659 default_label = today;
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
660 } else {
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
661 default_label = book_name+"("+cjst.chineseToPinyin(book_name).join(' ')+")_"+period+ "_"+section_name
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
662 + "("+ cjst.chineseToPinyin(section_name).join(' ') + ")_" + today;
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
663 }
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
664
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
665
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
666 var label = prompt("Please enter your label for this new branch", default_label);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
667 while (label == null) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
668 alert("You haven't saved your editing.");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
669 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
670 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
671 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
672
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
673 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
674 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
675 form.setAttribute("action", "./TaggingText"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
676 form.setAttribute("target", "_self");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
677
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
678 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
679 hiddenField.setAttribute("name", "func");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
680 hiddenField.setAttribute("value", "SaveFullTextToLGService");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
681 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
682
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
683
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
684 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
685 hiddenField.setAttribute("name", "label");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
686 hiddenField.setAttribute("value", label);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
687 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
688
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
689 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
690 hiddenField.setAttribute("name", "topic_id");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
691 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
692 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
693
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
694 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
695
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
696 console.log("complete saving to LGService");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
697
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
698 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
699
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
700 function chooseTopic(default_topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
701 var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' );
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
702 var info = JSON.parse('<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
703
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
704 $('#load_topic_div').html("");
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
705 var popup_status = $('#load_topic_div').css("display");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
706 if (popup_status == "block") {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
707 $('#load_topic_div').css("display", "none");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
708 } else {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
709 $('#load_topic_div').css("display", "block");
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
710 }
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
711 /*
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
712 $('#load_topic_div').css("border", "1px solid black");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
713 $('#load_topic_div').css("background-color", "White");
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
714 $('#load_topic_div').css("width", "200px");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
715 $('#load_topic_div').css("height", "50px");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
716 $('#load_topic_div').css("top", "20px");
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
717 $('#load_topic_div').css("left", "-200px");
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
718 */
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
719
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
720 var topic_select = document.createElement("select");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
721 topic_select.id = "loadTopiclist";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
722 var selected_topic = t[0];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
723 topic_select.onchange = function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
724
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
725 selected_topic = topic_select.options[topic_select.selectedIndex];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
726 console.log(selected_topic.text);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
727
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
728 var topic_id = selected_topic.value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
729
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
730 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
731 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
732 form.setAttribute("action", "./TaggingText"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
733 form.setAttribute("target", "_self");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
734
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
735 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
736 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
737 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
738 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
739
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
740 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
741 hiddenField.setAttribute("name", "func");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
742 hiddenField.setAttribute("value", "ContinueTagging");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
743 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
744
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
745 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
746
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
747 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
748
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
749
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
750 //Create and append the options
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
751 for (var i = 0; i < t.length; i++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
752 var option = document.createElement("option");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
753 option.value = t[i]['id'];
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
754 option.text = t[i]['name_en']+" ("+t[i]['name_ch']+", "+t[i]['name_pinyin']+")";
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
755 if (option.value == default_topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
756 option.selected = true;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
757 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
758 topic_select.appendChild(option);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
759 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
760
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
761 $('#load_topic_div').append(topic_select);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
762
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
763 var newbutton = document.createElement("button");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
764 $(newbutton).html("Close");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
765 $(newbutton).addClass("btn btn-xs btn-default");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
766 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
767 $('#load_topic_div').append(newbutton);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
768
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
769 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
770
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
771 function _postForContineTagging(form) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
772 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
773 hiddenField.setAttribute("name", "text");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
774 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
775 var text = el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
776 hiddenField.setAttribute("value", text);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
777 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
778
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
779 // pass taglist
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
780 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
781 hiddenField.setAttribute("name", "taglistArray");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
782 var taglistObj = JSON.parse('<?php echo json_encode($taglist_infile) ?>');
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
783 // if taglist_infile == "" means the taglist in db is up-to-date, will use taglistArray to save to file
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
784
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
785 if (!taglistObj) {
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
786 // TODO: should pass the user-decided taglist to post['taglistArray']
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
787 taglistObj = JSON.parse('<?php echo json_encode($taglistArray) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
788 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
789 taglistArray = JSON.stringify(taglistObj);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
790 hiddenField.setAttribute("value", taglistArray);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
791 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
792
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
793 // pass book_meta
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
794 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
795 hiddenField.setAttribute("name", "book_meta");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
796 var book_metaObj = JSON.parse('<?php echo json_encode($book_meta) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
797 book_metaArray = JSON.stringify(book_metaObj);
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
798
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
799 hiddenField.setAttribute("value", book_metaArray);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
800 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
801
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
802
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
803 var info = JSON.parse( '<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
804
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
805 if (info) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
806 if (info['file_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
807 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
808 hiddenField.setAttribute("name", "fileId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
809 hiddenField.setAttribute("value", info['file_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
810 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
811 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
812 if (info['branch_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
813 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
814 hiddenField.setAttribute("name", "branchId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
815 hiddenField.setAttribute("value", info['branch_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
816 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
817 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
818 if (info['user_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
819 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
820 hiddenField.setAttribute("name", "userId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
821 hiddenField.setAttribute("value", info['user_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
822 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
823 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
824 if (info['section_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
825 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
826 hiddenField.setAttribute("name", "sectionId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
827 hiddenField.setAttribute("value", info['section_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
828 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
829 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
830 if (info['book_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
831 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
832 hiddenField.setAttribute("name", "bookId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
833 hiddenField.setAttribute("value", info['book_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
834 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
835 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
836 if (info['section_name']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
837 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
838 hiddenField.setAttribute("name", "sectionName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
839 hiddenField.setAttribute("value", info['section_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
840 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
841 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
842 if (info['book_name']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
843 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
844 hiddenField.setAttribute("name", "bookName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
845 hiddenField.setAttribute("value", info['book_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
846 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
847 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
848 if (info['current_fileId']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
849 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
850 hiddenField.setAttribute("name", "currentFileId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
851 hiddenField.setAttribute("value", info['current_fileId']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
852 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
853 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
854
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
855 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
856 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
857 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
858 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
859 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
860 form.submit(); // works under IE and Chrome, but not FF
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
861 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
862
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
863 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
864
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
865 function configTagsInTopic(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
866 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
867
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
868 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
869 form.setAttribute("action", "./ConfigTagsInTopic"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
870 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
871
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
872 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
873 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
874 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
875 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
876
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
877 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
878
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
879
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
880 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
881
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
882 $(document).on("change", '#smartRegexPopUpSelectWord', function (e) {
62
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
883 var wordlistArray = JSON.parse('<?php echo json_encode($wordlistArray) ?>');
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
884
62
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
885 for (var i = 0; i < wordlistArray.length; i++) {
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
886 var wordlistValue = wordlistArray[i]; // wordlistValue is array(id, name, listString)
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
887 if ($('#smartRegexPopUpSelectWord').val() == wordlistValue[0]) {
62
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
888 var textarea_text = $('#smartRegexPopUpText').val();
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
889 // insert selected wordlist into textarea at cursor position
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
890 var cursorPosition = $('#smartRegexPopUpText').prop("selectionStart");
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
891 // cut textarea_text by cursorPosition
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
892 var text_before_cursor = textarea_text.substring(0,cursorPosition);
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
893 var text_after_cursor = textarea_text.substring(cursorPosition, textarea_text.length);
63
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
894
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
895 // default length is 1, which means {1,1}
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
896 $('#smartRegexPopUpText').val( text_before_cursor+"["+wordlistValue[2]+"]{1,1}"+text_after_cursor);
62
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
897 }
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
898 }
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
899 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
900
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
901
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
902 </script>
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
903
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
904
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
905 <!--
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
906 <fieldset class="info-board">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
907 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#info_board">Information <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
908 <div id="info_board" class="collapse in">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
909 <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
910 <div class="bg-warning"> <?php echo $messages['warning']; ?>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
911 <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
912 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
913 <div class="bg-info"> <?php echo $messages['info']; ?> </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
914 <div class="bg-default"> <?php echo $messages['debug']; ?> </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
915 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
916 </fieldset>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
917
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
918 -->
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
919
62
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
920 <div class="info-board">
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
921 <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div>
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
922 <div class="bg-warning"> <?php echo $messages['warning']; ?>
76
c49192885290 Bug fixed: ambiguous tag occured at Editing-text mode
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 72
diff changeset
923 <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button>
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
924 </div>
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
925 <div class="bg-info"> <?php echo $messages['info']; ?> </div>
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
926 <div class="bg-default"> <?php echo $messages['debug']; ?> </div>
58
a11f9103b8db New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 57
diff changeset
927 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
928
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
929
86
0141df465205 New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 81
diff changeset
930 <table border="1" style="margin:10 30 30 30; width:100%; max-width:1270px; min-width:680px">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
931 <tr>
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
932 <td style="padding:0 5 0 5; margin: 0 5 0 5;">
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
933 <div id="editable-area" class="area" style="max-width:980px; min-width:400px"><?php echo $stringInput; ?></div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
934 </td>
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
935 <td valign="top" style="min-width:280px; padding:0 5 0 5; margin:0 5 0 5;">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
936 <div id="popups" style="position:absolute; width:300px; ">
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
937 <div id="load_topic_div" class="popup-topic popup-frame"></div>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
938 <div id="load_regex_div" class="popup-loadregex popup-frame"></div>
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
939 <div id="regex_generator" class="popup-regex popup-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
940 <h3>Gen Regex</h3>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
941 <div>Pattern 1:
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
942 <div id="regex_pattern1" class="bg-info"></div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
943 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
944 <div>Pattern 2:
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
945 <div id="regex_pattern2" class="bg-info"></div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
946 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
947 <div>Suggested Regex:
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
948 <div id="generated_regex" class="bg-success"></div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
949 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
950 <button onclick="genRegexWindowClose()" class="btn btn-default btn-xs">Close</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
951 <div id="regex_generator_error_msg" class="bg-white"></div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
952 </div>
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
953 <div id="smartRegexPopUpDiv" class="popup-regex popup-frame">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
954 Name: <input id="smartRegexPopUpName"></input><br><br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
955 Word List:
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
956 <select id="smartRegexPopUpSelectWord">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
957 <option value="NULL" selected>無</option>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
958 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
959 foreach ( $wordlistArray as $wordlistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
960 echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
961 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
962 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
963 </select>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
964 <br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
965 OR (USE "|" TO SEPARATE WORDS):<br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
966 <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
967 Tag:
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
968 <select id="smartRegexPopUpSelectTag">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
969 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
970 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
971 echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
972 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
973 echo "<option value=\"title\">Title</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
974 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
975 <option value="NOTAG">不標記</option>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
976 </select><br>
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
977 <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info">Add</button>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
978 <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success">Edit/Update</button>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
979 <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger">Delete</button>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
980 <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default"><<</button>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
981 <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default">>></button>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
982 <button onclick="replaceSmartClose()" class="btn btn-default" >Close</button>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
983 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
984 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
985
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
986 <div id="follow-scroll">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
987 <form action="javascript:void(0);">
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
988 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
989 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_topic"> Topic: <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
990 <div id="tool_topic" class="collapse in">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
991 <div> Current topic is: <br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
992 <?php echo $topic_name['name_en']; ?>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
993 (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>)
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
994 <button onclick="chooseTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-xs">Change</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
995 </div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
996 <div>The topic tag is: <?php echo $topic_tag_ch;?>(<?php echo $topic_tag;?>)</div>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
997 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" class="btn btn-default btn-block">Edit Tag List</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
998 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Select Existing Tags</button>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
999 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1000 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1001
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1002 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1003 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_regex"> Replace By <i><b>Smart Regex</b></i>©: <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1004
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1005 <div id="tool_regex" class="collapse in">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1006 <div id="smartRegexShowDiv"></div><br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1007 <!-- <button onclick="smartRegexNew()" class="btn-lg">Add Regex Group</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1008 -->
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1009 <button onclick="smartRegexNew()" id="smart_regex_new_id" class="btn btn-default btn-block">Search by Patterns (Smart Regex)</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1010
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1011 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" class="btn btn-default">Load</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1012 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" class="btn btn-default">Save</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1013 <button onclick="smartRegexEmpty()" class="btn btn-default">Clear</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1014
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1015
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1016 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1017 <button onclick="replaceSmartRun()" class="btn btn-default">Run</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1018 <button onclick="replaceSmartRunWithBr()" class="btn btn-default">Run(in new line)</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1019 <!-- <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between Group)</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1020 -->
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1021 <button onclick="replaceSmartRunSpace()" class="btn btn-default">Run(Allow space between block)</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1022 <button onclick="Undo()" class="btn btn-default btn-block" id="buttonUndo" disabled="true">Undo</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1023
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1024 <!-- developing...-->
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1025 <button onclick="genRegexWindowOpen()" id="gen_regex_window_open_id" class="btn btn-default">Open GenRegex(test)</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1026 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1027 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1028
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1029
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1030 <?php
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1031 if ($default_topic_id == 1) {
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1032 ?>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1033 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1034 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_rule"> Tag by rule: <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1035 <div id="tool_rule" class="collapse out">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1036 <button onclick="tagNameWithLastName()" class="btn btn-default">Tag Word Begin With Surname</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1037 <button onclick="tagNameWithLastName2()" class="btn btn-default btn-sm">Tag Word Begin With</button> <input type="text" size="2" id="surname">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1038 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1039 <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1040 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1041 </fieldset>
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1042
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1043 <?php }?>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1044
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1045 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1046 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_edit"> Edit: <span class="caret"></span></h5></legend>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1047 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1048 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage -->
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1049 <!--
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1050 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1051 -->
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1052 <div class="collapse out" id="tool_edit">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1053 <button onclick="editText()" id="editTextId" class="btn btn-default btn-block">Edit the text</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1054 <button onclick="window.open('./EditWordlist')" class="btn btn-default btn-block">Edit WordList</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1055 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1056 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1057
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1058 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1059 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_save"> Save and Export: <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1060 <div class="collapse in" id="tool_save">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1061 <button onclick="saveTextToLGService()" id="save_text_to_LGService_id" class="btn btn-default btn-block">Save to LGService</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1062 <button onclick="exportAll(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Export All</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1063 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1064 <button onclick="exportPage(<?php echo $default_topic_id;?>)" class="btn btn-default btn-sm">Export</button></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1065 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1066 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1067
87
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1068 <fieldset class="tool-frame">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1069 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_replace_by"> Replace By <i><b>Regex</b></i>: <span class="caret"></span></h5></legend>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1070 <div class="collapse out" id="tool_replace_by">
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1071 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1072 Regex: <input type="text" size="23" id="regexText"></br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1073 Replace: <input type="text" size="23" id="replaceText"><br>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1074 <button onclick="replaceSmartRegex()" class="btn btn-default btn-sm">Replace!</button>
fb5049fc5dd7 New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
1075 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1076 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1077 </form>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1078 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1079 </td>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1080 </tr>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1081
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1082 </table>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1083
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1084
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1085
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1086
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1087 </body>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1088
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1089 </html>