Mercurial > hg > extraction-interface
diff views/Extractapp/TaggingText.php @ 63:3395385476d1 extractapp
bug fixed: popup tag window is closed automatically when saving text file
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 01 Apr 2015 15:10:35 +0200 |
parents | 3fb9e3884401 |
children | f9ae94a9b041 |
line wrap: on
line diff
--- a/views/Extractapp/TaggingText.php Tue Mar 31 14:55:58 2015 +0200 +++ b/views/Extractapp/TaggingText.php Wed Apr 01 15:10:35 2015 +0200 @@ -16,9 +16,11 @@ ?> + <html> <head> -<title></title> + <meta charset="UTF-8"> + <title>Extraction Interface</title> <style> dynasty @@ -81,7 +83,7 @@ function reloadText() { // confirm to reload - var r = confirm("Your editing will be discarded. Are you sure you want to reload?"); + var r = confirm("Are you sure you want to load the latest version (in a new tab)?"); if (r != true) { return; } @@ -89,7 +91,6 @@ var form = document.createElement("form"); form.setAttribute("method", "post"); form.setAttribute("action", "./TaggingText"); // hand to controller - //form.setAttribute("target", "_self"); form.setAttribute("target", "_blank"); var hiddenField = document.createElement("input"); @@ -167,7 +168,6 @@ }); - // --- handle old version taglist --- var _GET = JSON.parse('<?php echo json_encode($_GET) ?>'); if (_GET['id']) { // === This case should only be possible for developing on local machine ==== @@ -183,6 +183,7 @@ } + // --- handle old version taglist --- // --- TODO: check if taglist in file is up-to-date --- /* var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); @@ -216,15 +217,9 @@ }); -$(document).on("click", "name", function (e) { - - if ( $("#editTextId").html() != "Edit the text" ) return 0; - if ( $(this).prop("tagName").toLowerCase() != "name" ) return 0; - - removeTagNewDiv( e, "name", $(this) ); -}); $(document).on("mouseup", '#editable-area', function (e) { + $('.questionMarkClass').remove(); $('.tagItemDivClass').remove(); @@ -244,7 +239,7 @@ newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px'; newdiv.style.backgroundColor = "white"; - newdiv.style.zIndex = 2; + newdiv.style.zIndex = "3"; //console.log(selection.getRangeAt(0).cloneContents()); if ( container.innerHTML.indexOf( "br" ) != -1 ) { @@ -608,7 +603,10 @@ } function saveTextToLGService() { - + // clean editable-area + $('.questionMarkClass').remove(); + $('.tagItemDivClass').remove(); + // ------------- var info = JSON.parse('<?php echo json_encode($info) ?>'); var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); @@ -661,63 +659,13 @@ console.log("complete saving to LGService"); - - /* - - if (info) { - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "fileId"); - hiddenField.setAttribute("value", info['file_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "branchId"); - hiddenField.setAttribute("value", info['branch_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "userId"); - hiddenField.setAttribute("value", info['user_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "sectionId"); - hiddenField.setAttribute("value", info['section_id']); - form.appendChild(hiddenField); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "bookId"); - hiddenField.setAttribute("value", info['book_id']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "sectionName"); - hiddenField.setAttribute("value", info['section_name']); - form.appendChild(hiddenField); - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "bookName"); - hiddenField.setAttribute("value", info['book_name']); - form.appendChild(hiddenField); - - } - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "text"); - var el = document.getElementById("editable-area"); - //var text = encodeURIComponent(el.innerHTML); - var text = el.innerHTML; - hiddenField.setAttribute("value", text); - form.appendChild(hiddenField); - - if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { - document.body.appendChild(form); - form.submit(); - } else { - form.submit(); // works under IE and Chrome, but not FF - } - */ } function chooseTopic(default_topic_id) { var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' ); var info = JSON.parse('<?php echo json_encode($info) ?>'); + $('#load_topic_div').html(""); $('#load_topic_div').css("display", "block"); @@ -901,19 +849,12 @@ // cut textarea_text by cursorPosition var text_before_cursor = textarea_text.substring(0,cursorPosition); var text_after_cursor = textarea_text.substring(cursorPosition, textarea_text.length); - $('#smartRegexPopUpText').val( text_before_cursor+" ["+wordlistValue[2]+"] "+text_after_cursor); + + // default length is 1, which means {1,1} + $('#smartRegexPopUpText').val( text_before_cursor+"["+wordlistValue[2]+"]{1,1}"+text_after_cursor); } } -/* -<?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "if ( $('#smartRegexPopUpSelectWord').val() == \"".$wordlistValue[0]."\") {"; - echo "$('#smartRegexPopUpText').val(\"".$wordlistValue[2]."\");"; - echo "}"; - } -?> -*/ }); @@ -923,11 +864,8 @@ <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; "> </div> -<!-- -<div class="info-board" style="margin:10 30 10 30;max-width:1270;height:70px;overflow:scroll;overflow-x:hidden;"> ---> <div class="info-board"> - <p class="bg-danger"> <?php echo $messages['error']; ?> </p> + <p class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></p> <p class="bg-warning"> <?php echo $messages['warning']; ?> <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Load Latest Version</button> </p>