Mercurial > hg > extraction-interface
diff develop/views/Extractapp/taggingtext.php @ 24:b55f5d3564c4
add some regular expressions and wordlist for topic ??
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 27 Feb 2015 16:35:59 +0100 |
parents | a879f6b9d166 |
children | 4b6d2d7e706e |
line wrap: on
line diff
--- a/develop/views/Extractapp/taggingtext.php Wed Feb 25 10:59:45 2015 +0100 +++ b/develop/views/Extractapp/taggingtext.php Fri Feb 27 16:35:59 2015 +0100 @@ -147,7 +147,6 @@ $('.tagItemDivClass').remove(); if ( $("#editTextId").html() != "Edit the text" ) return 0; - var selection = getSelected(); range = getSelected().getRangeAt(0); @@ -160,6 +159,7 @@ newdiv.id = "tagItemDivId"; newdiv.setAttribute("class", "tagItemDivClass"); 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; @@ -183,6 +183,9 @@ } else { newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; } + + console.log(" container innerHTML: "+ container.innerHTML ); + newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>"; newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>"; @@ -204,11 +207,18 @@ <?php foreach ( $taglistArray as $taglistValue ) { + if ($taglistValue[2] == $topic_tag) { - echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\" class='btn btn-xs btn-primary'>[TopicTag]Tag as:".$taglistValue[1]."(necessary for this topic!)</button>\";\n"; + 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"; echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n"; echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; - break; + + /* + echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n"; + echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n"; + echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; + */ + break; } } ?> @@ -224,7 +234,7 @@ echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n"; echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; } else */ - if ($taglistValue[2] == $topic_tag) { + if ($taglistValue[2] == $topic_tag) { // pass } else if ($taglistValue[2] == "post_time") { echo "newdiv.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n"; @@ -241,10 +251,11 @@ ?> } - $('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id + //$('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id $('body').append(newdiv); $('#TitletagType').val(lastAddTag); + } //e.stopPropagation(); }); @@ -322,6 +333,9 @@ } } + + + function exportAll(topic_id) { var el = document.getElementById("editable-area"); var str= "" + el.innerHTML; @@ -360,6 +374,55 @@ } // =========== + +function tagwithOnlytag( range, stringSelection, tag ) { + saveUndoText(); + var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); + var topic_tag2 = topic_tag+"2"; + + range.deleteContents(); + + + if ( tag==topic_tag2) { + var newdiv = document.createElement(topic_tag); + newdiv.innerHTML = stringSelection; + range.insertNode(newdiv); + var newdiv = document.createElement("br"); + range.insertNode(newdiv); + + } else { + var newdiv = document.createElement(tag); + newdiv.innerHTML = stringSelection; + range.insertNode(newdiv); + } + + /* + if ( tag=="person2") { + var newdiv = document.createElement("person"); + newdiv.innerHTML = stringSelection; + range.insertNode(newdiv); + var newdiv = document.createElement("br"); + range.insertNode(newdiv); + } else if (tag=="object2") { + var newdiv = document.createElement("object"); + newdiv.innerHTML = stringSelection; + range.insertNode(newdiv); + var newdiv = document.createElement("br"); + range.insertNode(newdiv); + + } else { + var newdiv = document.createElement(tag); + newdiv.innerHTML = stringSelection; + range.insertNode(newdiv); + } + */ + + $('.tagItemDivClass').remove(); +} + + + + function replaceSmartRegex() { saveUndoText(); var startPage = $('#regexPageStart2').val(); @@ -586,11 +649,9 @@ var form = document.createElement("form"); form.setAttribute("method", "post"); - //form.setAttribute("action", "exportTable.php"); form.setAttribute("action", "./ConfigTagsInTopic"); // hand to controller form.setAttribute("target", "_blank"); - var hiddenField = document.createElement("input"); hiddenField.setAttribute("name", "topic"); hiddenField.setAttribute("value", topic_id); @@ -616,9 +677,8 @@ </script> - -<div id="popup-window" style="display: none; background-color:white; height:300px; width:300px; margin:200 0 0 200;position:fixed; z-index:2"> +<div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; "> </div> @@ -666,7 +726,7 @@ </div> </div> - <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 5 5; max-width:270px"> + <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 15 5; max-width:270px"> <form action="javascript:void(0);"> <fieldset> <legend><h5 class="text-success"> Config Topic: </h5></legend> @@ -681,7 +741,8 @@ <div id="smartRegexShowDiv"></div><br> <button onclick="smartRegexNew()" style="height: 30px; width: 220px">Add Regex Group</button></br> Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br> - <button onclick="replaceSmartRun()" style="height: 30px; width: 220px">Run</button></br> + <button onclick="replaceSmartRun()" style="height: 30px; width: 100px">Run</button> + <button onclick="replaceSmartRunWithBr()" style="height: 30px; width: 100px">Run(with Br)</button></br> <button onclick="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br> <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Save</button> <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Load</button> @@ -705,9 +766,8 @@ <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br> <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> - <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage + <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage --> <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br> - --> <button onclick="editText()" id="editTextId" style="height: 30px; width: 220px">Edit the text</button></br> </br> <button onclick="window.open('./EditWordlist')" style="height: 30px; width: 220px">Manage Word List</button></br>