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

New: export table for a file from LGService
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 16 Apr 2015 14:53:22 +0200
parents c49192885290
children 960ba96efce1
comparison
equal deleted inserted replaced
76:c49192885290 77:97c1e5102a22
1 <?php 1 <?php
2 /*! \file
3 * This is the view for TaggingText.
4 * It shows the extraction-interface application itself.
5 * It contains the tagging area and toolbox on the right side.
6 *
7 */
8
2 // --- initialize config file and input text --- 9 // --- initialize config file and input text ---
3 $stringInput = $viewmodel['stringInput']; 10 $stringInput = $viewmodel['stringInput'];
4 $wordlistArray = $viewmodel['wordlistArray']; 11 $wordlistArray = $viewmodel['wordlistArray'];
5 $taglistArray = $viewmodel['taglistArray']; 12 $taglistArray = $viewmodel['taglistArray'];
6 $section_id = $viewmodel['section_id']; 13 $section_id = $viewmodel['section_id'];
79 } 86 }
80 */ 87 */
81 } 88 }
82 } 89 }
83 90
91
92
84 function reloadText() { 93 function reloadText() {
94 /**
95 * Reload the text when there is a new version of this branch.
96 */
85 // confirm to reload 97 // confirm to reload
86 var r = confirm("Are you sure you want to load the latest version (in a new tab)?"); 98 var r = confirm("Are you sure you want to load the latest version (in a new tab)?");
87 if (r != true) { 99 if (r != true) {
88 return; 100 return;
89 } 101 }
345 form.setAttribute("method", "post"); 357 form.setAttribute("method", "post");
346 form.setAttribute("action", "./ExportTable"); 358 form.setAttribute("action", "./ExportTable");
347 form.setAttribute("target", "_blank"); 359 form.setAttribute("target", "_blank");
348 360
349 var hiddenField = document.createElement("input"); 361 var hiddenField = document.createElement("input");
362 hiddenField.setAttribute("name", "func");
363 hiddenField.setAttribute("value", "exportFromExtractionInterface");
364 form.appendChild(hiddenField);
365
366 var hiddenField = document.createElement("input");
350 hiddenField.setAttribute("name", "content"); 367 hiddenField.setAttribute("name", "content");
351 hiddenField.setAttribute("value", container.innerHTML); 368 hiddenField.setAttribute("value", container.innerHTML);
352 form.appendChild(hiddenField); 369 form.appendChild(hiddenField);
353 370
354 var hiddenField = document.createElement("input"); 371 var hiddenField = document.createElement("input");
359 var hiddenField2 = document.createElement("input"); 376 var hiddenField2 = document.createElement("input");
360 hiddenField2.setAttribute("name", "topic"); 377 hiddenField2.setAttribute("name", "topic");
361 hiddenField2.setAttribute("value", topic_id); 378 hiddenField2.setAttribute("value", topic_id);
362 form.appendChild(hiddenField2); 379 form.appendChild(hiddenField2);
363 380
364 var info = JSON.parse( '<?php echo json_encode($info) ?>');
365
366 if (info) {
367 var hiddenField = document.createElement("input");
368 hiddenField.setAttribute("name", "bookId");
369 hiddenField.setAttribute("value", info['book_id']);
370 form.appendChild(hiddenField);
371
372 var hiddenField = document.createElement("input");
373 hiddenField.setAttribute("name", "bookName");
374 hiddenField.setAttribute("value", info['book_name']);
375 form.appendChild(hiddenField);
376
377 var hiddenField = document.createElement("input");
378 hiddenField.setAttribute("name", "sectionName");
379 hiddenField.setAttribute("value", info['section_name']);
380 form.appendChild(hiddenField);
381
382 };
383
384 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
385 document.body.appendChild(form);
386 form.submit();
387 } else {
388 form.submit(); // works under IE and Chrome, but not FF
389 }
390 }
391
392 function exportPage(topic_id) {
393 var startPage = $('#exportPageStart').val();
394 var endPage = $('#exportPageEnd').val();
395
396 var el = document.getElementById("editable-area");
397 var str="" + el.innerHTML;
398
399 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
400
401 var form = document.createElement("form");
402 form.setAttribute("method", "post");
403 form.setAttribute("action", "./ExportTable");
404 form.setAttribute("target", "_blank");
405
406 var hiddenField = document.createElement("input");
407 hiddenField.setAttribute("name", "content");
408 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
409 form.appendChild(hiddenField);
410
411 var hiddenField = document.createElement("input");
412 hiddenField.setAttribute("name", "topic");
413 hiddenField.setAttribute("value", topic_id);
414 form.appendChild(hiddenField);
415
416 _postForContineTagging(form);
417
418
419 /*
420 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
421 console.log("section_id: "+section_id+", topic_id: "+topic_id);
422
423 var hiddenField = document.createElement("input");
424 hiddenField.setAttribute("name", "sectionId");
425 hiddenField.setAttribute("value", section_id);
426 form.appendChild(hiddenField);
427
428 var info = JSON.parse( '<?php echo json_encode($info) ?>'); 381 var info = JSON.parse( '<?php echo json_encode($info) ?>');
429 382
430 if (info) { 383 if (info) {
431 var hiddenField = document.createElement("input"); 384 var hiddenField = document.createElement("input");
432 hiddenField.setAttribute("name", "bookId"); 385 hiddenField.setAttribute("name", "bookId");
443 hiddenField.setAttribute("value", info['section_name']); 396 hiddenField.setAttribute("value", info['section_name']);
444 form.appendChild(hiddenField); 397 form.appendChild(hiddenField);
445 398
446 }; 399 };
447 400
401 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
402 document.body.appendChild(form);
403 form.submit();
404 } else {
405 form.submit(); // works under IE and Chrome, but not FF
406 }
407 }
408
409 function exportPage(topic_id) {
410 var startPage = $('#exportPageStart').val();
411 var endPage = $('#exportPageEnd').val();
412
413 var el = document.getElementById("editable-area");
414 var str="" + el.innerHTML;
415
416 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
417
418 var form = document.createElement("form");
419 form.setAttribute("method", "post");
420 form.setAttribute("action", "./ExportTable");
421 form.setAttribute("target", "_blank");
422
423 var hiddenField = document.createElement("input");
424 hiddenField.setAttribute("name", "func");
425 hiddenField.setAttribute("value", "exportFromExtractionInterface");
426 form.appendChild(hiddenField);
427
428 var hiddenField = document.createElement("input");
429 hiddenField.setAttribute("name", "content");
430 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
431 form.appendChild(hiddenField);
432
433 var hiddenField = document.createElement("input");
434 hiddenField.setAttribute("name", "topic");
435 hiddenField.setAttribute("value", topic_id);
436 form.appendChild(hiddenField);
437
438 _postForContineTagging(form);
439
440
441 /*
442 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
443 console.log("section_id: "+section_id+", topic_id: "+topic_id);
444
445 var hiddenField = document.createElement("input");
446 hiddenField.setAttribute("name", "sectionId");
447 hiddenField.setAttribute("value", section_id);
448 form.appendChild(hiddenField);
449
450 var info = JSON.parse( '<?php echo json_encode($info) ?>');
451
452 if (info) {
453 var hiddenField = document.createElement("input");
454 hiddenField.setAttribute("name", "bookId");
455 hiddenField.setAttribute("value", info['book_id']);
456 form.appendChild(hiddenField);
457
458 var hiddenField = document.createElement("input");
459 hiddenField.setAttribute("name", "bookName");
460 hiddenField.setAttribute("value", info['book_name']);
461 form.appendChild(hiddenField);
462
463 var hiddenField = document.createElement("input");
464 hiddenField.setAttribute("name", "sectionName");
465 hiddenField.setAttribute("value", info['section_name']);
466 form.appendChild(hiddenField);
467
468 };
469
448 470
449 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 471 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
450 document.body.appendChild(form); 472 document.body.appendChild(form);
451 form.submit(); 473 form.submit();
452 } else { 474 } else {
461 var form = document.createElement("form"); 483 var form = document.createElement("form");
462 form.setAttribute("method", "post"); 484 form.setAttribute("method", "post");
463 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller 485 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
464 form.setAttribute("target", "_blank"); 486 form.setAttribute("target", "_blank");
465 487
488 var hiddenField = document.createElement("input");
489 hiddenField.setAttribute("name", "func");
490 hiddenField.setAttribute("value", "exportFromExtractionInterface");
491 form.appendChild(hiddenField);
492
493
494
466 var hiddenField = document.createElement("input"); 495 var hiddenField = document.createElement("input");
467 hiddenField.setAttribute("name", "content"); 496 hiddenField.setAttribute("name", "content");
468 hiddenField.setAttribute("value", str); 497 hiddenField.setAttribute("value", str);
469 form.appendChild(hiddenField); 498 form.appendChild(hiddenField);
470 499