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