comparison develop/views/Extractapp/taggingtext.php @ 27:4a29bccb6c59

modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 03 Mar 2015 11:47:41 +0100
parents 579f03f8bee5
children e6e9bdc4f256
comparison
equal deleted inserted replaced
26:579f03f8bee5 27:4a29bccb6c59
356 var hiddenField = document.createElement("input"); 356 var hiddenField = document.createElement("input");
357 hiddenField.setAttribute("name", "topic"); 357 hiddenField.setAttribute("name", "topic");
358 hiddenField.setAttribute("value", topic_id); 358 hiddenField.setAttribute("value", topic_id);
359 form.appendChild(hiddenField); 359 form.appendChild(hiddenField);
360 360
361 _postForContineTagging(form);
362
363
364 /*
361 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>'); 365 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
362 console.log("section_id: "+section_id+", topic_id: "+topic_id); 366 console.log("section_id: "+section_id+", topic_id: "+topic_id);
363 367
364 var hiddenField = document.createElement("input"); 368 var hiddenField = document.createElement("input");
365 hiddenField.setAttribute("name", "sectionId"); 369 hiddenField.setAttribute("name", "sectionId");
391 document.body.appendChild(form); 395 document.body.appendChild(form);
392 form.submit(); 396 form.submit();
393 } else { 397 } else {
394 form.submit(); // works under IE and Chrome, but not FF 398 form.submit(); // works under IE and Chrome, but not FF
395 } 399 }
400 */
396 } 401 }
397 402
398 403
399 404
400 405
401 function exportAll(topic_id) { 406 function exportAll(topic_id) {
402 var el = document.getElementById("editable-area"); 407 var el = document.getElementById("editable-area");
403 var str= "" + el.innerHTML; 408 var str= "" + el.innerHTML;
404 var form = document.createElement("form"); 409 var form = document.createElement("form");
405 form.setAttribute("method", "post"); 410 form.setAttribute("method", "post");
406 //form.setAttribute("action", "exportTable.php");
407 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller 411 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
408 form.setAttribute("target", "_blank"); 412 form.setAttribute("target", "_blank");
409 413
410 var hiddenField = document.createElement("input"); 414 var hiddenField = document.createElement("input");
411 hiddenField.setAttribute("name", "content"); 415 hiddenField.setAttribute("name", "content");
415 var hiddenField = document.createElement("input"); 419 var hiddenField = document.createElement("input");
416 hiddenField.setAttribute("name", "topic"); 420 hiddenField.setAttribute("name", "topic");
417 hiddenField.setAttribute("value", topic_id); 421 hiddenField.setAttribute("value", topic_id);
418 form.appendChild(hiddenField); 422 form.appendChild(hiddenField);
419 423
424 _postForContineTagging(form);
425
426
427 /*
420 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>'); 428 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
421 console.log("section_id: "+section_id+", topic_id: "+topic_id); 429 console.log("section_id: "+section_id+", topic_id: "+topic_id);
422 430
423 var hiddenField = document.createElement("input"); 431 var hiddenField = document.createElement("input");
424 hiddenField.setAttribute("name", "sectionId"); 432 hiddenField.setAttribute("name", "sectionId");
442 hiddenField.setAttribute("name", "sectionName"); 450 hiddenField.setAttribute("name", "sectionName");
443 hiddenField.setAttribute("value", info['section_name']); 451 hiddenField.setAttribute("value", info['section_name']);
444 form.appendChild(hiddenField); 452 form.appendChild(hiddenField);
445 453
446 }; 454 };
455
447 456
448 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 457 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
449 document.body.appendChild(form); 458 document.body.appendChild(form);
450 form.submit(); 459 form.submit();
451 } else { 460 } else {
452 form.submit(); // works under IE and Chrome, but not FF 461 form.submit(); // works under IE and Chrome, but not FF
453 } 462 }
454 463 */
455 464
456 } 465 }
457 // =========== 466 // ===========
458 467
459 468
560 569
561 570
562 var form = document.createElement("form"); 571 var form = document.createElement("form");
563 form.setAttribute("method", "post"); 572 form.setAttribute("method", "post");
564 form.setAttribute("action", "./TaggingText"); // hand to controller 573 form.setAttribute("action", "./TaggingText"); // hand to controller
565
566 // form.setAttribute("action", "./"+info['section_id']); // hand to controller
567 form.setAttribute("target", "_self"); 574 form.setAttribute("target", "_self");
568 575
569 var hiddenField = document.createElement("input"); 576 var hiddenField = document.createElement("input");
570 hiddenField.setAttribute("name", "func"); 577 hiddenField.setAttribute("name", "func");
571 hiddenField.setAttribute("value", "SaveFullTextToLGService"); 578 hiddenField.setAttribute("value", "SaveFullTextToLGService");
572 form.appendChild(hiddenField); 579 form.appendChild(hiddenField);
573 580
581
582 var hiddenField = document.createElement("input");
583 hiddenField.setAttribute("name", "label");
584 hiddenField.setAttribute("value", label);
585 form.appendChild(hiddenField);
586
587 var hiddenField = document.createElement("input");
588 hiddenField.setAttribute("name", "topic_id");
589 hiddenField.setAttribute("value", topic_id);
590 form.appendChild(hiddenField);
591
592 _postForContineTagging(form);
593
594 /*
574 if (info) { 595 if (info) {
575 var hiddenField = document.createElement("input"); 596 var hiddenField = document.createElement("input");
576 hiddenField.setAttribute("name", "fileId"); 597 hiddenField.setAttribute("name", "fileId");
577 hiddenField.setAttribute("value", info['file_id']); 598 hiddenField.setAttribute("value", info['file_id']);
578 form.appendChild(hiddenField); 599 form.appendChild(hiddenField);
600 var hiddenField = document.createElement("input"); 621 var hiddenField = document.createElement("input");
601 hiddenField.setAttribute("name", "bookName"); 622 hiddenField.setAttribute("name", "bookName");
602 hiddenField.setAttribute("value", info['book_name']); 623 hiddenField.setAttribute("value", info['book_name']);
603 form.appendChild(hiddenField); 624 form.appendChild(hiddenField);
604 625
605 626 }
606 } 627
607 var hiddenField = document.createElement("input");
608 hiddenField.setAttribute("name", "label");
609 hiddenField.setAttribute("value", label);
610 form.appendChild(hiddenField);
611
612 var hiddenField = document.createElement("input"); 628 var hiddenField = document.createElement("input");
613 hiddenField.setAttribute("name", "text"); 629 hiddenField.setAttribute("name", "text");
614 var el = document.getElementById("editable-area"); 630 var el = document.getElementById("editable-area");
615 //var text = encodeURIComponent(el.innerHTML); 631 //var text = encodeURIComponent(el.innerHTML);
616 var text = el.innerHTML; 632 var text = el.innerHTML;
617 hiddenField.setAttribute("value", text); 633 hiddenField.setAttribute("value", text);
618 form.appendChild(hiddenField); 634 form.appendChild(hiddenField);
619 635
620 var hiddenField = document.createElement("input");
621 hiddenField.setAttribute("name", "topic_id");
622 hiddenField.setAttribute("value", topic_id);
623 form.appendChild(hiddenField);
624
625
626
627
628 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 636 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
629 document.body.appendChild(form); 637 document.body.appendChild(form);
630 form.submit(); 638 form.submit();
631 } else { 639 } else {
632 form.submit(); // works under IE and Chrome, but not FF 640 form.submit(); // works under IE and Chrome, but not FF
633 } 641 }
634 642 */
635 } 643 }
636 644
637 645
638 646
639 function chooseTopic(default_topic_id) { 647 function chooseTopic(default_topic_id) {