annotate develop/views/Extractapp/TaggingText.php @ 39:8347776a44fc extractapp

embedded topic, taglist,book metadata in file
author Zoe Hong <zhong@mpiwg-berlin.mpg.de
date Sun, 08 Mar 2015 22:28:21 +0100
parents e078e1500cc2
children 2e938dc046db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
2 // --- initialize config file and input text ---
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 $stringInput = $viewmodel['stringInput'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 $wordlistArray = $viewmodel['wordlistArray'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
5 $taglistArray = $viewmodel['taglistArray'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
6 $section_id = $viewmodel['section_id'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 $topiclistArray = $viewmodel['topiclistArray'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
8 $default_topic_id = $viewmodel['default_topic_id'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 $topic_name = $viewmodel['topic_name'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 $topic_tag = $viewmodel['topic_tag'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 $info = $viewmodel['info'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
12 $messages = $viewmodel['messages'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
13
39
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
14 $taglist_infile = $viewmodel['taglist_infile'];
36
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
15
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
17
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 <html>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
19 <head>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 <title></title>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
21
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
22 <style>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
23 dynasty
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
25 color:red;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
26 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
27 nianhao
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
28 {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
29 color:blue;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
30 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
31 name
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
32 {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
33 color:orange;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
35 #editable-area {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
36 line-height:160%;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 letter-spacing:1.5px;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 font-size:21px;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
40
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
41
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
43 // color on the tags
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."\n}\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
46
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 echo ".span_".$taglistValue[2]."\n{\nbackground-color:".$taglistValue[3]."\n}\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
49
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
51 </style>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
52
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
53
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 </head>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
55
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 <body>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
57
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
58 <script type="text/javascript">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
59
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 // === This is only for developing on local machine ====
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
61 var _GET = JSON.parse('<?php echo json_encode($_GET) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 if (_GET['id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
63
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
64 var info = JSON.parse('<?php echo json_encode($info) ?>');
39
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
65 var redirectUrl = "http://localhost:1080/extraction-interface/develop/Extractapp/TaggingText";
36
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
66 var section_id = info['section_id'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
67
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
68 var form = $('<form action="' + redirectUrl + '" method="post">' +
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
69 '<input type="hidden" name="sectionId" value="'+section_id+'" />' +
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 '</form>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 $('body').append(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 $(form).submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
73 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 // ====
39
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
75 // --- check if taglist in file is up-to-date ---
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
76 var check_taglist = JSON.parse('<?php echo json_encode($taglist_infile) ?>');
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
77 if (check_taglist) {
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
78 // TODO: pop up to ask if load the latest taglist
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
79 var retVal = confirm("The tag list in the file is not up-to-date. \nDo you want to load file with new tag list?");
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
80 if( retVal == true ){
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
81 <?php $$taglistArray = $taglist_infile; ?>
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
82 alert("Load with new tag list.");
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
83 }else{
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
84 alert("You are using the old version of tag list.");
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
85 }
8347776a44fc embedded topic, taglist,book metadata in file
Zoe Hong <zhong@mpiwg-berlin.mpg.de
parents: 36
diff changeset
86 }
36
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
87
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
88
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
89
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
90 // TODO: Popup to proceeding the saving situations
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
91 function handleFileVersionConflict() {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
92 var info = JSON.parse('<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
93 console.log("currentFileId="+info['current_fileId']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
94
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
95 if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
96 // -- there might be conflicts between different version
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
97 var retVal = confirm('There were something happened/someone editing in the between of time.\nDo you want to force saving? (There might be conflicts between two versions.)');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
98 if( retVal == true ){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
99 // TODO: force saving with currentFileId
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
100 alert("You do the force saving!");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
101 //saveTextToLGService();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
102
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
103 }else{
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
104 var loadLastest = confirm("Do you want to reload for the lastest version? (Your current editing will lost.)");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
105
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
106 console.log("loadLastest="+loadLastest);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
107 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
108 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
109 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
110 form.setAttribute("action", "./TaggingText"); // hand to controller
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
111 form.setAttribute("target", "_blank");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
112
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
113 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
114
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
115 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
116 hiddenField.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
117 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
118 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
119
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
120 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
121 hiddenField.setAttribute("name", "func");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
122 hiddenField.setAttribute("value", "Reload"); // reload
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
123 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
124
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
125 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
126
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
127 alert("You will reload the latest version.");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
128 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
129 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
130 if (loadLastest == true) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
131 // TODO: reload page with the currentFileId
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
132 console.log('loadLastest is true');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
133 $.ajax({
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
134 type : 'POST',
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
135 url : './TaggingText',
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
136 async : false,
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
137 data : 'func=Reload',
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
138 success: function (result) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
139 //var lastest_editing = jQuery.parseJSON(result);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
140 console.log("lastest_editing string:"+result);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
141 // change text to the new one
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
142 //var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
143 //el.innerHTML = lastest_editing;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
144 //alert("Reload the page!");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
145 },
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
146 error: function (result) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
147 alert("Reload Fails!");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
148 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
149 }).done(function(result) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
150 // reload page
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
151 //document.location.reload(true);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
152
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
153 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
154
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
155 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
156 alert("Just a reminder, there is a new version for this branch.");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
157 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
158 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
159
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
160 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
161 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
162 return;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
163
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
164 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
165
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
166 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
167 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
168 echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
169 echo "\t".'if ( $(this).prop("tagName").toLowerCase() != "'.$taglistValue[2].'" ) return 0;'."\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
170 echo "\t".'if ( $("#editTextId").html() != "Edit the text" ) return 0;'."\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
171 echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
172 echo "});\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
173 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
174 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
175
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
176 $(document).ready(function(){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
177
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
178 // --- for sidebar---
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
179 //run once
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
180 var el=$('#follow-scroll');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
181 var originalelpos=el.offset().top; // take it where it originally is on the page
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
182
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
183
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
184 //run on scroll
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
185 $(window).scroll(function(){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
186 var el = $('#follow-scroll'); // important! (local)
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
187 var elpos = el.offset().top; // take current situation
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
188 var windowpos = $(window).scrollTop();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
189 var finaldestination = windowpos+originalelpos;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
190 //el.stop().animate({'top':finaldestination},500);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
191 el.stop().animate({'top':finaldestination},0);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
192 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
193
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
194 //--- for popups ---
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
195 //run once
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
196 var el=$('#popups');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
197 var originalelpos=el.offset().top; // take it where it originally is on the page
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
198
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
199 //run on scroll
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
200 $(window).scroll(function(){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
201 var el = $('#popups'); // important! (local)
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
202 var elpos = el.offset().top; // take current situation
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
203 var windowpos = $(window).scrollTop();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
204 var finaldestination = windowpos+originalelpos;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
205 //el.stop().animate({'top':finaldestination},500);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
206 el.stop().animate({'top':finaldestination},0);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
207 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
208
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
209
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
210
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
211 handleFileVersionConflict();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
212
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
213
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
214
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
215 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
216
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
217 // Popup choosing topic if first time to this section. without branchId
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
218 if (info['file_id'] == 0) { // or info['branchId'] == 0, means new file
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
219 // ask to choose topic
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
220 $.ajax({
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
221
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
222 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
223 var popup = document.getElementById('popup-window');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
224
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
225 // alert('choose topic!');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
226 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
227 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
228
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
229 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
230 $(document).on("click", "name", function (e) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
231
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
232 if ( $("#editTextId").html() != "Edit the text" ) return 0;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
233 if ( $(this).prop("tagName").toLowerCase() != "name" ) return 0;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
234
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
235 removeTagNewDiv( e, "name", $(this) );
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
236 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
237
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
238 $(document).on("mouseup", '#editable-area', function (e) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
239 $('.questionMarkClass').remove();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
240 $('.tagItemDivClass').remove();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
241
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
242 if ( $("#editTextId").html() != "Edit the text" ) return 0;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
243 var selection = getSelected();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
244 range = getSelected().getRangeAt(0);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
245
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
246 container = document.createElement("div");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
247 container.appendChild(selection.getRangeAt(0).cloneContents());
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
248
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
249 if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
250
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
251 var newdiv = document.createElement("div");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
252 newdiv.id = "tagItemDivId";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
253 newdiv.setAttribute("class", "tagItemDivClass");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
254 newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px';
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
255
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
256 newdiv.style.backgroundColor = "white";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
257 newdiv.style.zIndex = 2;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
258
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
259 //console.log(selection.getRangeAt(0).cloneContents());
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
260 if ( container.innerHTML.indexOf( "br" ) != -1 ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
261 var newselect = document.createElement("select");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
262 newselect.id = "TitletagType";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
263 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
264 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
265 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
266 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
267 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
268 newdiv.appendChild(newselect);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
269
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
270 //matchValue = .match();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
271 myRegexp = new RegExp("〈(.*?)〉", "g")
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
272 matchValue = myRegexp.exec(String(selection));
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
273
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
274 if ( matchValue != null ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
275 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
276 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
277 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
278 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
279
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
280 console.log(" container innerHTML: "+ container.innerHTML );
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
281
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
282 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
283
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
284 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
285 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
286 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
287
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
288 var newselect = document.createElement("select");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
289 newselect.id = "RemoveTitletagType";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
290 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
291 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
292 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
293 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
294 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
295 newdiv.appendChild(newselect);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
296
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
297 newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
298 newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
299 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
300 // for pop up window on edit-area for tag list
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
301 newdiv.innerHTML = "Tag: "+String(selection)+"<br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
302
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
303 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
304 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
305
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
306 if ($taglistValue[2] == $topic_tag) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
307 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";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
308 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
309 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
310
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
311 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
312 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
313 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
314 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
315 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
316 break;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
317 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
318 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
319 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
320
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
321 newdiv.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection)+"' )\">Tag As Title</button></br>";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
322
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
323 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
324
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
325 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
326 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
327 if ( $taglistValue[2] == "person") {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
328 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
329 echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
330 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
331 } else */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
332 if ($taglistValue[2] == $topic_tag) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
333 // pass
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
334 } else if ($taglistValue[2] == "post_time") {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
335 echo "newdiv.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
336 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
337 } else if ($taglistValue[2] == "office") {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
338 echo "newdiv.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
339 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
340 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
341 echo "newdiv.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
342 echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
343 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
344
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
345 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
346 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
347 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
348
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
349 //$('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
350 $('body').append(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
351
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
352 $('#TitletagType').val(lastAddTag);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
353
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
354 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
355 //e.stopPropagation();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
356 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
357
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
358
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
359 // === for exporttable.php ===
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
360 function exportTable( range, container ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
361 //MsgBox("enter function");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
362 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
363 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
364 form.setAttribute("action", "./ExportTable");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
365 form.setAttribute("target", "_blank");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
366
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
367 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
368 hiddenField.setAttribute("name", "content");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
369 hiddenField.setAttribute("value", container.innerHTML);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
370 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
371
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
372 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
373 hiddenField.setAttribute("name", "sectionid");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
374 hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
375 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
376
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
377 var hiddenField2 = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
378 hiddenField2.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
379 hiddenField2.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
380 form.appendChild(hiddenField2);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
381
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
382 var info = JSON.parse( '<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
383
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
384 if (info) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
385 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
386 hiddenField.setAttribute("name", "bookId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
387 hiddenField.setAttribute("value", info['book_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
388 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
389
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
390 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
391 hiddenField.setAttribute("name", "bookName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
392 hiddenField.setAttribute("value", info['book_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
393 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
394
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
395 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
396 hiddenField.setAttribute("name", "sectionName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
397 hiddenField.setAttribute("value", info['section_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
398 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
399
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
400 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
401
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
402 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
403 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
404 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
405 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
406 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
407 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
408 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
409
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
410 function exportPage(topic_id) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
411 var startPage = $('#exportPageStart').val();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
412 var endPage = $('#exportPageEnd').val();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
413
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
414 var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
415 var str="" + el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
416
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
417 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
418
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
419 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
420 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
421 form.setAttribute("action", "./ExportTable");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
422 form.setAttribute("target", "_blank");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
423
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
424 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
425 hiddenField.setAttribute("name", "content");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
426 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
427 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
428
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
429 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
430 hiddenField.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
431 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
432 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
433
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
434 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
435
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
436
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
437 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
438 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
439 console.log("section_id: "+section_id+", topic_id: "+topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
440
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
441 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
442 hiddenField.setAttribute("name", "sectionId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
443 hiddenField.setAttribute("value", section_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
444 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
445
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
446 var info = JSON.parse( '<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
447
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
448 if (info) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
449 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
450 hiddenField.setAttribute("name", "bookId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
451 hiddenField.setAttribute("value", info['book_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
452 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
453
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
454 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
455 hiddenField.setAttribute("name", "bookName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
456 hiddenField.setAttribute("value", info['book_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
457 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
458
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
459 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
460 hiddenField.setAttribute("name", "sectionName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
461 hiddenField.setAttribute("value", info['section_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
462 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
463
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
464 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
465
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
466
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
467 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
468 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
469 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
470 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
471 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
472 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
473 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
474 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
475
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
476
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
477
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
478
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
479 function exportAll(topic_id) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
480 var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
481 var str= "" + el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
482 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
483 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
484 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
485 form.setAttribute("target", "_blank");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
486
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
487 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
488 hiddenField.setAttribute("name", "content");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
489 hiddenField.setAttribute("value", str);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
490 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
491
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
492 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
493 hiddenField.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
494 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
495 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
496
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
497 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
498 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
499 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
500 console.log("section_id: "+section_id+", topic_id: "+topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
501
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
502 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
503 hiddenField.setAttribute("name", "sectionId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
504 hiddenField.setAttribute("value", section_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
505 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
506
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
507 var info = JSON.parse( '<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
508
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
509 if (info) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
510 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
511 hiddenField.setAttribute("name", "bookId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
512 hiddenField.setAttribute("value", info['book_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
513 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
514
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
515 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
516 hiddenField.setAttribute("name", "bookName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
517 hiddenField.setAttribute("value", info['book_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
518 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
519
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
520 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
521 hiddenField.setAttribute("name", "sectionName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
522 hiddenField.setAttribute("value", info['section_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
523 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
524
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
525 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
526
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
527
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
528 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
529 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
530 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
531 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
532 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
533 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
534 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
535
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
536 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
537 // ===========
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
538
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
539
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
540 function tagwithOnlytag( range, stringSelection, tag ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
541 saveUndoText();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
542 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
543 var topic_tag2 = topic_tag+"2";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
544
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
545 range.deleteContents();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
546
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
547
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
548 if ( tag==topic_tag2) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
549 var newdiv = document.createElement(topic_tag);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
550 newdiv.innerHTML = stringSelection;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
551 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
552 var newdiv = document.createElement("br");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
553 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
554
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
555 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
556 var newdiv = document.createElement(tag);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
557 newdiv.innerHTML = stringSelection;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
558 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
559 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
560
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
561 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
562 if ( tag=="person2") {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
563 var newdiv = document.createElement("person");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
564 newdiv.innerHTML = stringSelection;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
565 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
566 var newdiv = document.createElement("br");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
567 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
568 } else if (tag=="object2") {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
569 var newdiv = document.createElement("object");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
570 newdiv.innerHTML = stringSelection;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
571 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
572 var newdiv = document.createElement("br");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
573 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
574
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
575 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
576 var newdiv = document.createElement(tag);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
577 newdiv.innerHTML = stringSelection;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
578 range.insertNode(newdiv);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
579 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
580 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
581
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
582 $('.tagItemDivClass').remove();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
583 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
584
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
585
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
586
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
587
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
588 function replaceSmartRegex() {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
589 saveUndoText();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
590 var startPage = $('#regexPageStart2').val();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
591 var endPage = $('#regexPageEnd2').val();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
592
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
593 var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
594 var regexText=document.getElementById("regexText").value;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
595
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
596 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
597 foreach ( $wordlistArray as $wordlistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
598 echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
599 echo "\tregexText1 = preg_quote(regexText1);\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
600 echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
601 echo "\tregexText = regexText.replace(new RegExp(regexText1, \"g\"), replaceText1);\n\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
602 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
603 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
604
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
605 var replaceText=document.getElementById("replaceText").value;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
606 var str="" + el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
607
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
608 if ( startPage == "" ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
609 alert( "Tagged "+str.match(new RegExp(regexText, "g")).length+" entities!" );
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
610 el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
611 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
612 var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
613 var partString = ""+str.match(new RegExp(regexText2, "g"));
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
614 alert(partString);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
615
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
616 alert( "Tagged "+partString.match(new RegExp(regexText, "g")).length+" entities!" );
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
617 var resultString = partString.replace(new RegExp(regexText, "g"), replaceText);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
618
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
619 str="" + el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
620 el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
621 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
622 //document.styleSheets[0].addRule("tag001", "color:green;")
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
623 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
624
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
625
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
626
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
627 function saveTextToLGService() {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
628 var info = JSON.parse('<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
629 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
630
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
631 // if this is a new branch, ask for label
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
632 if (info['branch_id'] == 0) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
633 var cnt = 0;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
634 var label = prompt("Please enter your label for this new branch", "section"+info['section_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
635 while (label == null && cnt <= 3) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
636 cnt ++;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
637 label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
638 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
639 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
640
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
641
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
642
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
643 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
644 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
645 form.setAttribute("action", "./TaggingText"); // hand to controller
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
646 form.setAttribute("target", "_self");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
647
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
648 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
649 hiddenField.setAttribute("name", "func");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
650 hiddenField.setAttribute("value", "SaveFullTextToLGService");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
651 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
652
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
653
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
654 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
655 hiddenField.setAttribute("name", "label");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
656 hiddenField.setAttribute("value", label);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
657 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
658
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
659 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
660 hiddenField.setAttribute("name", "topic_id");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
661 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
662 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
663
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
664 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
665
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
666 console.log("complete saving to LGService");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
667
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
668
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
669 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
670
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
671 if (info) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
672 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
673 hiddenField.setAttribute("name", "fileId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
674 hiddenField.setAttribute("value", info['file_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
675 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
676 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
677 hiddenField.setAttribute("name", "branchId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
678 hiddenField.setAttribute("value", info['branch_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
679 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
680 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
681 hiddenField.setAttribute("name", "userId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
682 hiddenField.setAttribute("value", info['user_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
683 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
684 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
685 hiddenField.setAttribute("name", "sectionId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
686 hiddenField.setAttribute("value", info['section_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
687 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
688
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
689 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
690 hiddenField.setAttribute("name", "bookId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
691 hiddenField.setAttribute("value", info['book_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
692 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
693 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
694 hiddenField.setAttribute("name", "sectionName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
695 hiddenField.setAttribute("value", info['section_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
696 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
697 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
698 hiddenField.setAttribute("name", "bookName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
699 hiddenField.setAttribute("value", info['book_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
700 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
701
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
702 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
703
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
704 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
705 hiddenField.setAttribute("name", "text");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
706 var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
707 //var text = encodeURIComponent(el.innerHTML);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
708 var text = el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
709 hiddenField.setAttribute("value", text);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
710 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
711
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
712 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
713 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
714 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
715 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
716 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
717 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
718 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
719 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
720
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
721
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
722
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
723 function chooseTopic(default_topic_id) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
724 var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' );
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
725 var info = JSON.parse('<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
726
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
727 $('#load_topic_div').html("");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
728 $('#load_topic_div').css("display", "block");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
729
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
730 $('#load_topic_div').css("border", "1px solid black");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
731 $('#load_topic_div').css("background-color", "White");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
732 $('#load_topic_div').css("width", "150px");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
733 $('#load_topic_div').css("height", "50px");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
734 $('#load_topic_div').css("top", "20px");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
735 $('#load_topic_div').css("left", "-150px");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
736
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
737
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
738 var topic_select = document.createElement("select");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
739 topic_select.id = "loadTopiclist";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
740 var selected_topic = t[0];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
741 topic_select.onchange = function(){
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
742
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
743 selected_topic = topic_select.options[topic_select.selectedIndex];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
744 console.log(selected_topic.text);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
745
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
746 var topic_id = selected_topic.value;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
747
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
748 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
749 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
750 form.setAttribute("action", "./TaggingText"); // hand to controller
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
751 form.setAttribute("target", "_self");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
752
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
753 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
754 hiddenField.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
755 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
756 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
757
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
758 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
759 hiddenField.setAttribute("name", "func");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
760 hiddenField.setAttribute("value", "ContinueTagging");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
761 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
762
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
763 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
764
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
765 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
766
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
767
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
768 //Create and append the options
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
769 for (var i = 0; i < t.length; i++) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
770 console.log(t[i]['id']+","+t[i]['name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
771 var option = document.createElement("option");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
772 option.value = t[i]['id'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
773 option.text = t[i]['name'];
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
774 if (option.value == default_topic_id) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
775 option.selected = true;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
776 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
777 topic_select.appendChild(option);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
778 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
779
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
780 $('#load_topic_div').append(topic_select);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
781
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
782 var newbutton = document.createElement("button");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
783 $(newbutton).html("Close");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
784 $(newbutton).addClass("btn btn-xs btn-default");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
785 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
786 $('#load_topic_div').append(newbutton);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
787
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
788 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
789
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
790 // --- for config tags in topic ---
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
791 function _postForContineTagging(form) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
792 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
793 hiddenField.setAttribute("name", "text");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
794 var el = document.getElementById("editable-area");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
795 var text = el.innerHTML;
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
796 hiddenField.setAttribute("value", text);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
797 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
798
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
799 var info = JSON.parse( '<?php echo json_encode($info) ?>');
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
800
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
801 if (info) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
802 // TODO: different field info array based on fileId(branchId) existing or not
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
803 if (info['file_id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
804 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
805 hiddenField.setAttribute("name", "fileId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
806 hiddenField.setAttribute("value", info['file_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
807 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
808 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
809 if (info['branch_id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
810 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
811 hiddenField.setAttribute("name", "branchId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
812 hiddenField.setAttribute("value", info['branch_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
813 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
814 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
815 if (info['user_id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
816 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
817 hiddenField.setAttribute("name", "userId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
818 hiddenField.setAttribute("value", info['user_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
819 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
820 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
821 if (info['section_id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
822 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
823 hiddenField.setAttribute("name", "sectionId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
824 hiddenField.setAttribute("value", info['section_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
825 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
826 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
827 if (info['book_id']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
828 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
829 hiddenField.setAttribute("name", "bookId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
830 hiddenField.setAttribute("value", info['book_id']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
831 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
832 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
833 if (info['section_name']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
834 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
835 hiddenField.setAttribute("name", "sectionName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
836 hiddenField.setAttribute("value", info['section_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
837 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
838 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
839 if (info['book_name']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
840 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
841 hiddenField.setAttribute("name", "bookName");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
842 hiddenField.setAttribute("value", info['book_name']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
843 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
844 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
845 if (info['current_fileId']) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
846 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
847 hiddenField.setAttribute("name", "currentFileId");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
848 hiddenField.setAttribute("value", info['current_fileId']);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
849 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
850 };
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
851
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
852 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
853 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
854 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
855 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
856 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
857 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
858 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
859
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
860 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
861
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
862 function configTagsInTopic(topic_id) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
863 var form = document.createElement("form");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
864
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
865 form.setAttribute("method", "post");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
866 form.setAttribute("action", "./ConfigTagsInTopic"); // hand to controller
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
867 form.setAttribute("target", "_blank");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
868
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
869 var hiddenField = document.createElement("input");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
870 hiddenField.setAttribute("name", "topic");
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
871 hiddenField.setAttribute("value", topic_id);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
872 form.appendChild(hiddenField);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
873
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
874 _postForContineTagging(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
875
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
876 /*
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
877 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
878 document.body.appendChild(form);
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
879 form.submit();
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
880 } else {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
881 form.submit(); // works under IE and Chrome, but not FF
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
882 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
883 */
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
884
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
885 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
886
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
887
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
888
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
889 $(document).on("change", '#smartRegexPopUpSelectWord', function (e) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
890
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
891 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
892 foreach ( $wordlistArray as $wordlistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
893 echo "if ( $('#smartRegexPopUpSelectWord').val() == \"".$wordlistValue[0]."\") {";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
894 echo "$('#smartRegexPopUpText').val(\"".$wordlistValue[2]."\");";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
895 echo "}";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
896 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
897 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
898 });
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
899
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
900
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
901
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
902 </script>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
903
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
904 <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; ">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
905 </div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
906
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
907
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
908 <p class="bg-info" style="margin:10 30 10 30; max-width:1250"> <?php echo $messages; ?> </p>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
909
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
910 <table width="1270" border="1" style="margin:10 30 10 30;">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
911 <tr>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
912 <td width="980" style="padding:0 5 0 5; margin: 0 5 0 5;">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
913 <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
914 </td>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
915 <td width="290" valign="top">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
916 <div id="popups" style="position:absolute; width:300px; ">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
917 <div id="load_topic_div" style="position: absolute; display: none; z-index:2"></div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
918 <div id="load_regex_div" style="position: absolute; display: none; z-index:2;"></div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
919 <div id="smartRegexPopUpDiv" style="position: absolute; display: none; z-index:2">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
920 Name: <input id="smartRegexPopUpName"></input><br><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
921 Word List:
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
922 <select id="smartRegexPopUpSelectWord">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
923 <option value="NULL" selected>無</option>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
924 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
925 foreach ( $wordlistArray as $wordlistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
926 echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
927 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
928 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
929 </select>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
930 <br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
931 OR (USE "|" TO SEPARATE WORDS):<br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
932 <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
933 Tag:
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
934 <select id="smartRegexPopUpSelectTag">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
935 <?php
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
936 foreach ( $taglistArray as $taglistValue ) {
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
937 echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
938 }
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
939 echo "<option value=\"title\">Title</option>\n";
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
940 ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
941 <option value="NOTAG">不標記</option>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
942 </select><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
943 <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info" style="">Add</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
944 <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success" style="">Edit</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
945 <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger" style="">Delete</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
946 <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default" style=""><<</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
947 <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default" style="">>></button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
948 <button onclick="replaceSmartClose()" class="btn btn-default" style="">Close</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
949 </div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
950 </div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
951
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
952 <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 15 5; max-width:270px">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
953 <form action="javascript:void(0);">
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
954 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
955 <legend><h5 class="text-success"> Config Topic: </h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
956 <div> current topic is <?php echo $topic_name; ?>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
957 <button onclick="chooseTopic(<?php echo $default_topic_id; ?>)" class="btn btn-xs btn-default">Change</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
958 </div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
959 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Manage Tags in topic</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
960 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
961
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
962 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
963 <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
964 <div id="smartRegexShowDiv"></div><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
965 <button onclick="smartRegexNew()" style="height: 30px; width: 220px">Add Regex Group</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
966 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
967 <button onclick="replaceSmartRun()" style="height: 30px; width: 100px">Run</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
968 <button onclick="replaceSmartRunWithBr()" style="height: 30px; width: 100px">Run(with Br)</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
969 <button onclick="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
970 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Save</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
971 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Load</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
972 <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
973 <!--
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
974 <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
975 -->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
976 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
977
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
978 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
979 <legend><h5 class="text-success"> Tag by rule:</h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
980 <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
981 <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
982 <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
983 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
984 <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
985 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
986
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
987 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
988 <legend><h5 class="text-success"> Edit:</h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
989 <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
990
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
991 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
992 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage -->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
993 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
994 <button onclick="editText()" id="editTextId" style="height: 30px; width: 220px">Edit the text</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
995 </br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
996 <button onclick="window.open('./EditWordlist')" style="height: 30px; width: 220px">Manage Word List</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
997 <!--
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
998 <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
999 -->
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1000 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 220px">Manage Tag List</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1001 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1002
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1003 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1004 <legend><h5 class="text-success"> Export:</h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1005 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1006 <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1007 <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1008 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1009
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1010 <fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1011 <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1012 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1013 Regex: <input type="text" size="23" id="regexText"></br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1014 Replace: <input type="text" size="23" id="replaceText"><br>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1015 <button onclick="replaceSmartRegex()">Replace!</button>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1016 </fieldset>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1017 </form>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1018 </div>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1019 </td>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1020 </tr>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1021
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1022 </table>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1023
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1024
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1025
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1026
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1027 </body>
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1028
e078e1500cc2 config for localgazetteers-dev
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1029 </html>