annotate views/Extractapp/TaggingText.php @ 77:97c1e5102a22 extractapp

New: export table for a file from LGService
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 16 Apr 2015 14:53:22 +0200
parents c49192885290
children 960ba96efce1
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
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
2 /*! \file
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
3 * This is the view for TaggingText.
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
4 * It shows the extraction-interface application itself.
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
5 * It contains the tagging area and toolbox on the right side.
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
6 *
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
7 */
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
8
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 // --- initialize config file and input text ---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 $stringInput = $viewmodel['stringInput'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 $wordlistArray = $viewmodel['wordlistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
12 $taglistArray = $viewmodel['taglistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 $section_id = $viewmodel['section_id'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
14 $topiclistArray = $viewmodel['topiclistArray'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
15 $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
16 $topic_name = $viewmodel['topic_name']; // array of names
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
17 $topic_tag = $viewmodel['topic_tag'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 $info = $viewmodel['info'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
19 $messages = $viewmodel['messages'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
20
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
21 $taglist_infile = $viewmodel['taglist_infile'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
22 $book_meta = $viewmodel['book_meta'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
23
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
25
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
26
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
27 <html>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
28 <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
29 <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
30 <title>Extraction Interface</title>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
31
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
32 <style>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
33 dynasty
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
35 color:red;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
36 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 nianhao
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 color:blue;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
40 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
41 name
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
43 color:orange;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 #editable-area {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
46 line-height:160%;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 letter-spacing:1.5px;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 font-size:21px;
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 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
52 // color on the tags
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
53 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."\n}\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
55
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 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
57 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
58
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
59 ?>
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
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 </head>
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 <body>
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 <script type="text/javascript">
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 // not use this for now
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 function _showTagColor(up_to_date) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 var taglistArray = "";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 if (up_to_date) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
73 taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
75 taglistArray = JSON.parse('<?php echo json_encode($taglist_infile) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
76 }
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 for (var i = 0; i < taglistArray.length; i++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
80 var taglistValue = taglistArray[i];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
81
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
82 $(taglistValue[2]).css('color', taglistValue[3]);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
83 /*var element = document.querySelectorAll(taglistValue[2]);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
84 for (var j = 0; j < element.length; j++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
85 element[j].style.color = taglistValue[3];
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 }
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
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
91
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
92
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
93 function reloadText() {
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
94 /**
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
95 * Reload the text when there is a new version of this branch.
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
96 */
57
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
97 // 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
98 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
99 if (r != true) {
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
100 return;
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
101 }
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
102
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
103 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
104 form.setAttribute("method", "post");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
105 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
106 form.setAttribute("target", "_blank");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
107
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
108 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
109 hiddenField.setAttribute("name", "topic");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
110 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
111 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
112 form.appendChild(hiddenField);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
113
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
114 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
115 hiddenField.setAttribute("name", "func");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
116 hiddenField.setAttribute("value", "ReloadText");
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
117 form.appendChild(hiddenField);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
118
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
119 _postForContineTagging(form);
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
120
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
121 }
5cf9720a2e25 New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 54
diff changeset
122
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
123 function handleFileVersionConflict() {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
124 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
125 // 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
126 if (info['current_fileId'] != 0){
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
127 // -- 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
128 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
129 $('#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
130
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
131 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
132 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
133 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
134
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
135 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
136
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
137 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
138 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
139 echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
140 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
141 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
142 echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
143 echo "});\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
144 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
145 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
146
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
147 $(document).ready(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
148
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
149 // --- for sidebar---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
150 //run once
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
151 var el=$('#follow-scroll');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
152 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
153
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
154 //run on scroll
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
155 $(window).scroll(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
156 var el = $('#follow-scroll'); // important! (local)
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
157 var elpos = el.offset().top; // take current situation
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
158 var windowpos = $(window).scrollTop();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
159 var finaldestination = windowpos+originalelpos;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
160 //el.stop().animate({'top':finaldestination},500);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
161 el.stop().animate({'top':finaldestination},0);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
162 });
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
163 // ---
47
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 //--- for popups ---
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
166 //run once
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
167 var el=$('#popups');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
168 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
169
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
170 //run on scroll
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
171 $(window).scroll(function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
172 var el = $('#popups'); // important! (local)
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
173 var elpos = el.offset().top; // take current situation
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
174 var windowpos = $(window).scrollTop();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
175 var finaldestination = windowpos+originalelpos;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
176 //el.stop().animate({'top':finaldestination},500);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
177 el.stop().animate({'top':finaldestination},0);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
178 });
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
179 // ---
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
180
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
181
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
182 // === 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
183 var _GET = JSON.parse('<?php echo json_encode($_GET) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
184 if (_GET['id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
185 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
186 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
187 var section_id = info['section_id'];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
188
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
189 var form = $('<form action="' + redirectUrl + '" method="post">' +
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
190 '<input type="hidden" name="sectionId" value="'+section_id+'" />' +
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
191 '</form>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
192 $('body').append(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
193 $(form).submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
194 }
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
195 // --------
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
196
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
197 // --- handle file version conflict ---
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
198 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
199 // 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
200 if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
201 $( "#saveTextToLGService_id").text( "Create(Save) Branch to LGService" );
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
202
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
203 }
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
204 handleFileVersionConflict();
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
205
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
206 // --- handle taglist deprecation ---
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
207 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
208 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
209
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
210 if (taglist_infile == "") {
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
211 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
212 } else {
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
213 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
214 console.log(taglist_infile);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
215 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
216 console.log(taglistArray);
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
217
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
218 // 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
219 // showing taglist_infile and taglistArray
70
359f48d58cbc New: hover on regex elem
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 68
diff changeset
220 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
221
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
222 }
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
223
47
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 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
226
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
227 $(document).on("mouseup", '#editable-area', function (e) {
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
228
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
229 $('.questionMarkClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
230 $('.tagItemDivClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
231
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
232 if ( $("#editTextId").html() != "Edit the text" ) return 0;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
233 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
234
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
235 range = selection.getRangeAt(0);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
236
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
237 container = document.createElement("div");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
238 container.appendChild(selection.getRangeAt(0).cloneContents());
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
239
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
240 if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
241
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
242 var newdiv = document.createElement("div");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
243 newdiv.id = "tagItemDivId";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
244 newdiv.setAttribute("class", "tagItemDivClass");
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
245 newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px; z-index:4';
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
246
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
247
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
248 //console.log(selection.getRangeAt(0).cloneContents());
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
249 if ( container.innerHTML.indexOf( "br" ) != -1 ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
250 var newselect = document.createElement("select");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
251 newselect.id = "TitletagType";
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
252 //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
253
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
254 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
255 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
256 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
257 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
258 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
259 newdiv.appendChild(newselect);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
260
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
261 //matchValue = .match();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
262 myRegexp = new RegExp("〈(.*?)〉", "g")
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
263 matchValue = myRegexp.exec(String(selection));
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
264
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
265 if ( matchValue != null ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
266 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
267 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
268 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
269 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
270
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
271
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
272 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
273
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
274 /*
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
275 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
276 */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
277
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
278 var newselect = document.createElement("select");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
279 newselect.id = "RemoveTitletagType";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
280 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
281 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
282 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
283 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
284 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
285 newdiv.appendChild(newselect);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
286
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
287 newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
288 newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
289 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
290 // for pop up window on edit-area for tag list
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
291 newdiv.innerHTML = "Tag: "+String(selection)+"<br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
292
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
293 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
294 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
295
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
296 if ($taglistValue[2] == $topic_tag) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
297 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">[TopicTag]Tag as:".$taglistValue[1]."(necessary for this topic!)</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
298 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
299 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
300
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
301 /*
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
302 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
303 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
304 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
305 */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
306 break;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
307 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
308 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
309 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
310
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
311 newdiv.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection)+"' )\">Tag As Title</button></br>";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
312
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
313 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
314
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
315 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
316 /*
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
317 if ( $taglistValue[2] == "person") {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
318 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
319 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
320 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
321 } else */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
322 if ($taglistValue[2] == $topic_tag) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
323 // pass
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
324 } else if ($taglistValue[2] == "post_time") {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
325 echo "newdiv.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
326 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
327 } else if ($taglistValue[2] == "office") {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
328 echo "newdiv.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
329 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
330 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
331 echo "newdiv.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
332 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
333 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
334
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
335 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
336 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
337 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
338
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
339 //$('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
340 $('body').append(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
341
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
342 $('#TitletagType').val(lastAddTag);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
343
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
344 }
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
345
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
346 //e.stopPropagation();
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
347
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
348
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
349
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
350 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
351
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
352
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
353 // === for exporttable.php ===
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
354 function exportTable( range, container ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
355 //MsgBox("enter function");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
356 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
357 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
358 form.setAttribute("action", "./ExportTable");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
359 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
360
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
361 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
362 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
363 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
364 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
365
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
366 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
367 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
368 hiddenField.setAttribute("value", container.innerHTML);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
369 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
370
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
371 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
372 hiddenField.setAttribute("name", "sectionid");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
373 hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
374 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
375
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
376 var hiddenField2 = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
377 hiddenField2.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
378 hiddenField2.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
379 form.appendChild(hiddenField2);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
380
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
381 var info = JSON.parse( '<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
382
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
383 if (info) {
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
384 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
385 hiddenField.setAttribute("name", "bookId");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
386 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
387 form.appendChild(hiddenField);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
388
77
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
389 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
390 hiddenField.setAttribute("name", "bookName");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
391 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
392 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
393
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
394 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
395 hiddenField.setAttribute("name", "sectionName");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
396 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
397 form.appendChild(hiddenField);
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
398
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
399 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
400
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
401 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
402 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
403 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
404 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
405 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
406 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
407 }
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 function exportPage(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
410 var startPage = $('#exportPageStart').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
411 var endPage = $('#exportPageEnd').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
412
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
413 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
414 var str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
415
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
416 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
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 form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
419 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
420 form.setAttribute("action", "./ExportTable");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
421 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
422
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
423 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
424 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
425 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
426 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
427
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
428 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
429 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
430 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
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 hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
434 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
435 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
436 form.appendChild(hiddenField);
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 _postForContineTagging(form);
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
441 /*
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
442 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
443 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
444
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
445 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
446 hiddenField.setAttribute("name", "sectionId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
447 hiddenField.setAttribute("value", section_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
448 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
449
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
450 var info = JSON.parse( '<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
451
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
452 if (info) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
453 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
454 hiddenField.setAttribute("name", "bookId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
455 hiddenField.setAttribute("value", info['book_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
456 form.appendChild(hiddenField);
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 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
459 hiddenField.setAttribute("name", "bookName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
460 hiddenField.setAttribute("value", info['book_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
461 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
462
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
463 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
464 hiddenField.setAttribute("name", "sectionName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
465 hiddenField.setAttribute("value", info['section_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
466 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
467
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
468 };
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
471 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
472 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
473 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
474 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
475 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
476 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
477 */
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
478 }
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 function exportAll(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
481 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
482 var str= "" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
483 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
484 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
485 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
486 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
487
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
488 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
489 hiddenField.setAttribute("name", "func");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
490 hiddenField.setAttribute("value", "exportFromExtractionInterface");
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
491 form.appendChild(hiddenField);
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
492
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
493
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
494
97c1e5102a22 New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 76
diff changeset
495 var hiddenField = document.createElement("input");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
496 hiddenField.setAttribute("name", "content");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
497 hiddenField.setAttribute("value", str);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
498 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
499
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
500 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
501 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
502 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
503 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
504
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
505 _postForContineTagging(form);
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 }
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
510 function tagwithOnlytag( range, stringSelection, tag ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
511 saveUndoText();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
512 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
513 var topic_tag2 = topic_tag+"2";
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 range.deleteContents();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
516
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
517 if ( tag==topic_tag2) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
518 var newdiv = document.createElement(topic_tag);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
519 newdiv.innerHTML = stringSelection;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
520 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
521 var newdiv = document.createElement("br");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
522 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
523
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
524 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
525 var newdiv = document.createElement(tag);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
526 newdiv.innerHTML = stringSelection;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
527 range.insertNode(newdiv);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
528 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
529
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
530
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
531 $('.tagItemDivClass').remove();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
532 }
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 function replaceSmartRegex() {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
535 saveUndoText();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
536 var startPage = $('#regexPageStart2').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
537 var endPage = $('#regexPageEnd2').val();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
538
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
539 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
540 var regexText=document.getElementById("regexText").value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
541
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
542 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
543 foreach ( $wordlistArray as $wordlistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
544 echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
545 echo "\tregexText1 = preg_quote(regexText1);\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
546 echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
547 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
548 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
549 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
550
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
551 var replaceText=document.getElementById("replaceText").value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
552 var str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
553
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
554 if ( startPage == "" ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
555 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
556 el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
557 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
558 var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
559 var partString = ""+str.match(new RegExp(regexText2, "g"));
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
560 alert(partString);
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 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
563 var resultString = partString.replace(new RegExp(regexText, "g"), replaceText);
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 str="" + el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
566 el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
567 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
568 //document.styleSheets[0].addRule("tag001", "color:green;")
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
569 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
570
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
571 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
572 // 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
573 $('.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
574 $('.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
575
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
576 // -------------
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
577 var info = JSON.parse('<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
578 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
579
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
580 // if this is a new branch, ask for label
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
581 if (info['branch_id'] == 0) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
582 //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
583 var today = new Date();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
584 var dd = today.getDate();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
585 var mm = today.getMonth()+1; //January is 0!
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
586 var yyyy = today.getFullYear();
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 if(dd<10) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
589 dd='0'+dd
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 if(mm<10) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
592 mm='0'+mm
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
593 }
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
594 today = dd+'.'+mm+'.'+yyyy;
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
595 var label = prompt("Please enter your label for this new branch", today);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
596 while (label == null) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
597 alert("You haven't saved your editing.");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
598 return;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
599 // label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
600 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
601 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
602
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
603 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
604 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
605 form.setAttribute("action", "./TaggingText"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
606 form.setAttribute("target", "_self");
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 hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
609 hiddenField.setAttribute("name", "func");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
610 hiddenField.setAttribute("value", "SaveFullTextToLGService");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
611 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
612
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
613
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
614 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
615 hiddenField.setAttribute("name", "label");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
616 hiddenField.setAttribute("value", label);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
617 form.appendChild(hiddenField);
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 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
620 hiddenField.setAttribute("name", "topic_id");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
621 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
622 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
623
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
624 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
625
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
626 console.log("complete saving to LGService");
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 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
629
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
630 function chooseTopic(default_topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
631 var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' );
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
632 var info = JSON.parse('<?php echo json_encode($info) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
633
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
634
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
635 $('#load_topic_div').html("");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
636 $('#load_topic_div').css("display", "block");
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
637 /*
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
638 $('#load_topic_div').css("border", "1px solid black");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
639 $('#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
640 $('#load_topic_div').css("width", "200px");
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
641 $('#load_topic_div').css("height", "50px");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
642 $('#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
643 $('#load_topic_div').css("left", "-200px");
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
644 */
47
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 var topic_select = document.createElement("select");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
647 topic_select.id = "loadTopiclist";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
648 var selected_topic = t[0];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
649 topic_select.onchange = function(){
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
650
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
651 selected_topic = topic_select.options[topic_select.selectedIndex];
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
652 console.log(selected_topic.text);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
653
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
654 var topic_id = selected_topic.value;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
655
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
656 var form = document.createElement("form");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
657 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
658 form.setAttribute("action", "./TaggingText"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
659 form.setAttribute("target", "_self");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
660
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
661 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
662 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
663 hiddenField.setAttribute("value", topic_id);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
664 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
665
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
666 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
667 hiddenField.setAttribute("name", "func");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
668 hiddenField.setAttribute("value", "ContinueTagging");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
669 form.appendChild(hiddenField);
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 _postForContineTagging(form);
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 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
674
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
675
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
676 //Create and append the options
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
677 for (var i = 0; i < t.length; i++) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
678 var option = document.createElement("option");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
679 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
680 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
681 if (option.value == default_topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
682 option.selected = true;
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 topic_select.appendChild(option);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
685 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
686
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
687 $('#load_topic_div').append(topic_select);
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 newbutton = document.createElement("button");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
690 $(newbutton).html("Close");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
691 $(newbutton).addClass("btn btn-xs btn-default");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
692 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
693 $('#load_topic_div').append(newbutton);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
694
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
697 function _postForContineTagging(form) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
698 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
699 hiddenField.setAttribute("name", "text");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
700 var el = document.getElementById("editable-area");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
701 var text = el.innerHTML;
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
702 hiddenField.setAttribute("value", text);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
703 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
704
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
705 // pass taglist
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
706 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
707 hiddenField.setAttribute("name", "taglistArray");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
708 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
709 // 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
710
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
711 if (!taglistObj) {
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
712 // 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
713 taglistObj = JSON.parse('<?php echo json_encode($taglistArray) ?>');
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
714 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
715 taglistArray = JSON.stringify(taglistObj);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
716 hiddenField.setAttribute("value", taglistArray);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
717 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
718
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
719 // pass book_meta
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
720 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
721 hiddenField.setAttribute("name", "book_meta");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
722 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
723 book_metaArray = JSON.stringify(book_metaObj);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
724 hiddenField.setAttribute("value", book_metaArray);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
725 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
726
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 info = JSON.parse( '<?php echo json_encode($info) ?>');
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 if (info) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
731 if (info['file_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
732 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
733 hiddenField.setAttribute("name", "fileId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
734 hiddenField.setAttribute("value", info['file_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
735 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
736 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
737 if (info['branch_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
738 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
739 hiddenField.setAttribute("name", "branchId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
740 hiddenField.setAttribute("value", info['branch_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
741 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
742 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
743 if (info['user_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
744 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
745 hiddenField.setAttribute("name", "userId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
746 hiddenField.setAttribute("value", info['user_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
747 form.appendChild(hiddenField);
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 if (info['section_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
750 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
751 hiddenField.setAttribute("name", "sectionId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
752 hiddenField.setAttribute("value", info['section_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
753 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
754 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
755 if (info['book_id']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
756 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
757 hiddenField.setAttribute("name", "bookId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
758 hiddenField.setAttribute("value", info['book_id']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
759 form.appendChild(hiddenField);
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 if (info['section_name']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
762 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
763 hiddenField.setAttribute("name", "sectionName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
764 hiddenField.setAttribute("value", info['section_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
765 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
766 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
767 if (info['book_name']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
768 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
769 hiddenField.setAttribute("name", "bookName");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
770 hiddenField.setAttribute("value", info['book_name']);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
771 form.appendChild(hiddenField);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
772 };
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
773 if (info['current_fileId']) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
774 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
775 hiddenField.setAttribute("name", "currentFileId");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
776 hiddenField.setAttribute("value", info['current_fileId']);
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
780 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
781 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
782 document.body.appendChild(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
783 form.submit();
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
784 } else {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
785 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
786 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
787
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
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
790 function configTagsInTopic(topic_id) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
791 var form = document.createElement("form");
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 form.setAttribute("method", "post");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
794 form.setAttribute("action", "./ConfigTagsInTopic"); // hand to controller
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
795 form.setAttribute("target", "_blank");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
796
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
797 var hiddenField = document.createElement("input");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
798 hiddenField.setAttribute("name", "topic");
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
799 hiddenField.setAttribute("value", topic_id);
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 _postForContineTagging(form);
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
803
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 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
806
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
807 $(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
808 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
809
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
810 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
811 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
812 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
813 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
814 // 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
815 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
816 // 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
817 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
818 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
819
3395385476d1 bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 62
diff changeset
820 // 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
821 $('#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
822 }
3fb9e3884401 New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 61
diff changeset
823 }
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
824 });
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
825
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
826 </script>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
827
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
828 <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; ">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
829 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
830
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
831 <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
832 <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
833 <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
834 <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
835 </div>
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
836 <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
837 <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
838 </div>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
839
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
840 <table border="1" style="margin:10 30 30 30; width:100%; max-width:1270px">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
841 <tr>
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
842 <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
843 <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
844 </td>
67
3ada9334ebfc New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 66
diff changeset
845 <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
846 <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
847 <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
848 <div id="load_regex_div" class="popup-loadregex popup-frame"></div>
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
849 <div id="smartRegexPopUpDiv" class="popup-regex popup-frame">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
850 Name: <input id="smartRegexPopUpName"></input><br><br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
851 Word List:
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
852 <select id="smartRegexPopUpSelectWord">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
853 <option value="NULL" selected>無</option>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
854 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
855 foreach ( $wordlistArray as $wordlistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
856 echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
857 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
858 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
859 </select>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
860 <br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
861 OR (USE "|" TO SEPARATE WORDS):<br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
862 <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
863 Tag:
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
864 <select id="smartRegexPopUpSelectTag">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
865 <?php
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
866 foreach ( $taglistArray as $taglistValue ) {
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
867 echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
868 }
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
869 echo "<option value=\"title\">Title</option>\n";
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
870 ?>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
871 <option value="NOTAG">不標記</option>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
872 </select><br>
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
873 <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
874 <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
875 <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
876 <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
877 <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
878 <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
879 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
880 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
881
66
e71a437ae49f New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 65
diff changeset
882 <div id="follow-scroll">
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
883 <form action="javascript:void(0);">
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
884 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
885 <legend><h5 class="text-success"> Config Topic: </h5></legend>
65
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
886 <div> current topic is: <?php echo $topic_name['name_en']; ?> <br>
f9ae94a9b041 New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 63
diff changeset
887 (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>)
59
6e44605eb4f6 New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 58
diff changeset
888 <button onclick="chooseTopic(<?php echo $default_topic_id;?>)" class="btn btn-xs btn-default">Change</button>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
889 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
890 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Manage Tags in topic</button></br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
891 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
892
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
893 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
894 <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
895 <div id="smartRegexShowDiv"></div><br>
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
896 <button onclick="smartRegexNew()" style="height: 35px; width: 220px">Add Regex Group</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
897 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
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
898 <button onclick="replaceSmartRun()" style="height: 35px; width: 100px">Run</button>
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
899 <button onclick="replaceSmartRunWithBr()" style="height: 35px; width: 100px">Run(with Br)</button></br>
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
900 <button onclick="replaceSmartRunSpace()" style="height: 35px; width: 220px">Run(Allow space between Group)</button></br>
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
901 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Save</button>
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
902 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Load</button>
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
903 <button onclick="smartRegexEmpty()" style="height: 35px; width: 70px">Clear</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
904 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
905
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
906 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
907 <legend><h5 class="text-success"> Tag by rule:</h5></legend>
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
908 <button onclick="tagNameWithLastName()" style="height: 35px; width: 220px">Tag Word Begin With Surname</button></br>
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
909 <button onclick="tagNameWithLastName2()" style="height: 35px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
910 <!--<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
911 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
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
912 <button onclick="Undo()" style="height: 35px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
913 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
914
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
915 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
916 <legend><h5 class="text-success"> Edit:</h5></legend>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
917
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
918 <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 35px; width: 220px">Save to LGService</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
919
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
920 <!--<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
921 <!-- 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
922 <!--
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
923 <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
924 -->
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
925
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
926 <button onclick="editText()" id="editTextId" style="height: 35px; width: 220px">Edit the text</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
927 </br>
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
928 <button onclick="window.open('./EditWordlist')" style="height: 35px; width: 220px">Manage Word List</button></br>
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
929 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 220px">Manage Tag List</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
930 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
931
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
932 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
933 <legend><h5 class="text-success"> Export:</h5></legend>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
934 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br>
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
935 <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export</button></br>
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
936 <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export All</button></br>
47
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
937 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
938
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
939 <fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
940 <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
941 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
942 Regex: <input type="text" size="23" id="regexText"></br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
943 Replace: <input type="text" size="23" id="replaceText"><br>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
944 <button onclick="replaceSmartRegex()">Replace!</button>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
945 </fieldset>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
946 </form>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
947 </div>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
948 </td>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
949 </tr>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
950
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
951 </table>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
952
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
953
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
954
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
955
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
956 </body>
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
957
886f43b26ee2 move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
958 </html>