Mercurial > hg > extraction-interface
changeset 35:04736430d961 extractapp
config for localgazetteers-dev
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 06 Mar 2015 14:07:39 +0100 |
parents | ef5eda5d9cf8 |
children | e078e1500cc2 |
files | develop/classes/basemodel.php develop/config/config.php develop/views/Extractapp/taggingtext_.php develop/views/Extractapp/taggingtext_20150219.php |
diffstat | 4 files changed, 9 insertions(+), 1269 deletions(-) [+] |
line wrap: on
line diff
--- a/develop/classes/basemodel.php Thu Mar 05 15:41:11 2015 +0100 +++ b/develop/classes/basemodel.php Fri Mar 06 14:07:39 2015 +0100 @@ -4,12 +4,18 @@ // protected $database; protected $systemNAME, $topic; + protected $get_text_from_fileId_url = "http://localgazetteers-dev:8080/LGServer/rest/text/getFileText?fileId="; + protected $get_text_from_sectionId_url = "http://localgazetteers-dev:8080/LGServerrest/text/getSectionText?sectionId="; + protected $save_to_LGService_url = "http://localgazetteers-dev:8080/LGServer/rest/text/save"; + protected $save_new_to_LGService_url = "http://localgazetteers-dev:8080/LGServer/rest/text/saveNew"; + + /* // protected $lg_server_url = "http://141.14.239.226:8080/gazetteer-server/rest/text/"; protected $get_text_from_fileId_url = "http://141.14.239.226:8080/gazetteer-server/rest/text/getFileText?fileId="; protected $get_text_from_sectionId_url = "http://141.14.239.226:8080/gazetteer-server/rest/text/getSectionText?sectionId="; protected $save_to_LGService_url = "http://141.14.239.226:8080/gazetteer-server/rest/text/save"; protected $save_new_to_LGService_url = "http://141.14.239.226:8080/gazetteer-server/rest/text/saveNew"; - + */ public function __construct() {
--- a/develop/config/config.php Thu Mar 05 15:41:11 2015 +0100 +++ b/develop/config/config.php Fri Mar 06 14:07:39 2015 +0100 @@ -5,18 +5,8 @@ $mysql_database = "Gazetteers"; $mysql_server = "localhost"; $mysql_user = "root"; -$mysql_password = "root"; - +$mysql_password = "admin"; -// localgazetteers server -/* -$systemNAME = "interface"; -$mysql_database="Gazetteer"; -$mysql_server = "localhost"; -$mysql_user = "Gazetteer"; -$mysql_password = "3333"; -*/ - -$system_root_url = "http://localhost:1080/localmonographs/develop"; +$system_root_url = "http://localgazetteers-dev/extraction-interface/develop"; ?>
--- a/develop/views/Extractapp/taggingtext_.php Thu Mar 05 15:41:11 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,551 +0,0 @@ -<?php -// --- initialize config file and input text --- -$stringInput = $viewmodel['stringInput']; -$wordlistArray = $viewmodel['wordlistArray']; -$taglistArray = $viewmodel['taglistArray']; -$section_id = $viewmodel['section_id']; -$topiclistArray = $viewmodel['topiclistArray']; -$default_topic_id = $viewmodel['default_topic_id']; -$topic_tag = $viewmodel['topic_tag']; -$info = $viewmodel['info']; - -?> - -<html> -<head> -<title></title> - -<style> -dynasty -{ - color:red; -} -nianhao -{ - color:blue; -} -name -{ - color:orange; -} -#editable-area { - line-height:160%; - letter-spacing:1.5px; - font-size:21px; -} - - -<?php -// color on the tags -foreach ( $taglistArray as $taglistValue ) { - echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."\n}\n"; - - echo ".span_".$taglistValue[2]."\n{\nbackground-color:".$taglistValue[3]."\n}\n"; -} - -?> -</style> - - -</head> - -<body> - -<script type="text/javascript"> - - - -<?php -foreach ( $taglistArray as $taglistValue ) { - echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n"; - echo "\t".'if ( $(this).prop("tagName").toLowerCase() != "'.$taglistValue[2].'" ) return 0;'."\n"; - echo "\t".'if ( $("#editTextId").html() != "Edit the text" ) return 0;'."\n"; - echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n"; - echo "});\n"; -} -?> - -$(document).ready(function(){ - //run once - var el=$('#follow-scroll'); - var originalelpos=el.offset().top; // take it where it originally is on the page - - //run on scroll - $(window).scroll(function(){ - var el = $('#follow-scroll'); // important! (local) - var elpos = el.offset().top; // take current situation - var windowpos = $(window).scrollTop(); - var finaldestination = windowpos+originalelpos; - el.stop().animate({'top':finaldestination},500); - }); -}); -$(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(); - - if ( $("#editTextId").html() != "Edit the text" ) return 0; - - var selection = getSelected(); - range = getSelected().getRangeAt(0); - - container = document.createElement("div"); - container.appendChild(selection.getRangeAt(0).cloneContents()); - - if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) { - - var newdiv = document.createElement("div"); - 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'; - - //console.log(selection.getRangeAt(0).cloneContents()); - if ( container.innerHTML.indexOf( "br" ) != -1 ) { - var newselect = document.createElement("select"); - newselect.id = "TitletagType"; - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; - } - ?> - newdiv.appendChild(newselect); - - //matchValue = .match(); - myRegexp = new RegExp("〈(.*?)〉", "g") - matchValue = myRegexp.exec(String(selection)); - - if ( matchValue != null ) { - newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>"; - } else { - newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; - } - 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>"; - - var newselect = document.createElement("select"); - newselect.id = "RemoveTitletagType"; - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; - } - ?> - newdiv.appendChild(newselect); - - newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>"; - newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>"; - } else { - // for pop up window on edit-area for tag list - newdiv.innerHTML = "Tag: "+String(selection)+"<br>"; - - <?php - foreach ( $taglistArray as $taglistValue ) { - if ($taglistValue[2] == $topic_tag) { - 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; - } - } - ?> - - newdiv.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection)+"' )\">Tag As Title</button></br>"; - - <?php - - foreach ( $taglistArray as $taglistValue ) { - /* - if ( $taglistValue[2] == "person") { - 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"; - } else */ - 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"; - echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; - } else if ($taglistValue[2] == "office") { - echo "newdiv.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[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 { - echo "newdiv.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[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"; - } - - } - ?> - } - $('body').append(newdiv); - - $('#TitletagType').val(lastAddTag); - } - //e.stopPropagation(); -}); - - - -function replaceSmartRegex() { - saveUndoText(); - var startPage = $('#regexPageStart2').val(); - var endPage = $('#regexPageEnd2').val(); - - var el = document.getElementById("editable-area"); - var regexText=document.getElementById("regexText").value; - - <?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n"; - echo "\tregexText1 = preg_quote(regexText1);\n"; - echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n"; - echo "\tregexText = regexText.replace(new RegExp(regexText1, \"g\"), replaceText1);\n\n"; - } - ?> - - var replaceText=document.getElementById("replaceText").value; - var str="" + el.innerHTML; - - if ( startPage == "" ) { - alert( "Tagged "+str.match(new RegExp(regexText, "g")).length+" entities!" ); - el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText); - } else { - var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】"; - var partString = ""+str.match(new RegExp(regexText2, "g")); - alert(partString); - - alert( "Tagged "+partString.match(new RegExp(regexText, "g")).length+" entities!" ); - var resultString = partString.replace(new RegExp(regexText, "g"), replaceText); - - str="" + el.innerHTML; - el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString); - } - //document.styleSheets[0].addRule("tag001", "color:green;") -} - - -function smartRegexSave() { - var x; - var name=prompt("Please enter this Regex name",RegexLoadedName); - if (name!=null){ - $.ajax({ - type : 'POST', - url : '../../models/_extractapp_func.php', - async : false, - data : 'func=SmartRegexSave'+'&text='+encodeURIComponent($('#smartRegexShowDiv').html())+'&filename='+name - }).done(function(result) { - alert("Saved!"); - }); - } -} - -// === for config tags in topic === -function configTagsInTopic(section_id, topic_id) { - var form = document.createElement("form"); - - form.setAttribute("method", "post"); - //form.setAttribute("action", "exportTable.php"); - form.setAttribute("action", "../ConfigTagsInTopic/"+section_id); // hand to controller - form.setAttribute("target", "_blank"); - - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "topic"); - hiddenField.setAttribute("value", topic_id); - 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 saveTextToLGService_(section_id) { - var info = JSON.parse('<?php echo json_encode($info) ?>'); - - var el = document.getElementById("editable-area"); - $.ajax({ - url : './'+section_id, - async : false, - type : 'POST', - data : 'func=saveTextToLGService'+'&text='+el.innerHTML+'&filename='+section_id+'&file_id='+info['file_id']+'&=branch_id'+info['branch_id']+'&=user_id'+info['user_id'] - }).done(function(result) { - alert("Saved!"); - }); - - -} - - -function saveTextToLGService(section_id) { - - - /* - $.ajax({ - url : './'+section_id, - async : false, - type : 'POST', - data : 'func=SaveTextToLGService'+'&text='+encodeURIComponent(el.innerHTML) - }).done(function(result) { - alert("Saved!"); - }); - */ - var info = JSON.parse('<?php echo json_encode($info) ?>'); - - var form = document.createElement("form"); - form.setAttribute("method", "post"); - // form.setAttribute("action", "./"); // hand to controller - - form.setAttribute("action", "./"+section_id); // hand to controller - form.setAttribute("target", "_blank"); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "func"); - hiddenField.setAttribute("value", "SaveFullTextToLGService"); - form.appendChild(hiddenField); - - if (info) { - var hiddenField1 = document.createElement("input"); - hiddenField1.setAttribute("name", "file_id"); - hiddenField1.setAttribute("value", info['file_id']); - form.appendChild(hiddenField1); - - var hiddenField2 = document.createElement("input"); - hiddenField2.setAttribute("name", "branch_id"); - hiddenField2.setAttribute("value", info['branch_id']); - form.appendChild(hiddenField2); - - var hiddenField3 = document.createElement("input"); - hiddenField3.setAttribute("name", "user_id"); - hiddenField3.setAttribute("value", info['user_id']); - form.appendChild(hiddenField3); - - - - } - - var hiddenField4 = document.createElement("input"); - hiddenField4.setAttribute("name", "text"); - var el = document.getElementById("editable-area"); - //var text = encodeURIComponent(el.innerHTML); - var text = el.innerHTML; - hiddenField4.setAttribute("value", text); - form.appendChild(hiddenField4); - - - 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(section_id, 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"); - $('#load_topic_div').css("border", "1px solid black"); - $('#load_topic_div').css("background-color", "White"); - $('#load_topic_div').css("width", "200px"); - $('#load_topic_div').css("height", "50px"); - $('#load_topic_div').css("top", "20px"); - $('#load_topic_div').css("left", "-200px"); - - var topic_select = document.createElement("select"); - topic_select.id = "loadTopiclist"; - var selected_topic = t[0]; - topic_select.onchange = function(){ - - selected_topic = topic_select.options[topic_select.selectedIndex]; - console.log(selected_topic.text); - - var topic_id = selected_topic.value; - var topic_name = selected_topic.text; - - var form = document.createElement("form"); - form.setAttribute("method", "post"); - // form.setAttribute("action", "./"); // hand to controller - form.setAttribute("action", "./"+section_id); // hand to controller - form.setAttribute("target", "_self"); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "topic"); - hiddenField.setAttribute("value", topic_id); - form.appendChild(hiddenField); - 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); - - } - - if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { - document.body.appendChild(form); - form.submit(); - } else { - form.submit(); // works under IE and Chrome, but not FF - } - - - - }; - - - //Create and append the options - for (var i = 0; i < t.length; i++) { - console.log(t[i]['id']+","+t[i]['name']); - var option = document.createElement("option"); - option.value = t[i]['id']; - option.text = t[i]['name']; - if (option.value == default_topic_id) { - option.selected = true; - }; - topic_select.appendChild(option); - } - - $('#load_topic_div').append(topic_select); - - var newbutton = document.createElement("button"); - $(newbutton).html("Close"); - $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");"); - $('#load_topic_div').append(newbutton); - -} - - -$(document).on("change", '#smartRegexPopUpSelectWord', function (e) { - -<?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "if ( $('#smartRegexPopUpSelectWord').val() == \"".$wordlistValue[0]."\") {"; - echo "$('#smartRegexPopUpText').val(\"".$wordlistValue[2]."\");"; - echo "}"; - } -?> -}); - - -</script> - -<table width="1250" border="1"> - <tr> - <td width="980"> - <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div> - </td> - <td width="270" valign="top"> - <div id="follow-scroll" style="position:absolute; width: 220" width="220"> - <div id="load_regex_div" style="position: absolute; display: none"></div> - <div id="load_topic_div" style="position: absolute; display: none"></div> - <div id="smartRegexPopUpDiv" style="position: absolute; display: none"> - Name: <input id="smartRegexPopUpName"></input><br><br> - Word List: - <select id="smartRegexPopUpSelectWord"> - <option value="NULL" selected>無</option> - <?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n"; - } - ?> - </select> - <br> - OR (USE "|" TO SEPARATE WORDS):<br> - <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br> - Tag: - <select id="smartRegexPopUpSelectTag"> - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n"; - } - echo "<option value=\"title\">Title</option>\n"; - ?> - <option value="NOTAG">不標記</option> - </select><br> - <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" style="height: 30px; width: 50px">Add</button> - <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" style="height: 30px; width: 50px">Edit</button> - <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" style="height: 30px; width: 50px">Delete</button> - <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" style="height: 30px; width: 50px"><<</button> - <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" style="height: 30px; width: 50px">>></button> - <button onclick="replaceSmartClose()" style="height: 30px; width: 50px">Close</button> - </div> - <form action="javascript:void(0);"> - <button onclick="chooseTopic(<?php echo $section_id;?>, <?php echo $default_topic_id; ?>)">Choose Topic</button> - <button onclick="configTagsInTopic(<?php echo $section_id;?>, <?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Config Tag List for Topic</button></br> - <fieldset> - <legend>Replace By <i><b>Smart Regex</b></i>©:</legend> - <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="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br> - <button onclick="smartRegexSave()" style="height: 30px; width: 70px">Save</button> - <button onclick="smartRegexLoad(<?php echo $section_id;?>)" style="height: 30px; width: 70px">Load</button> - <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br> - </fieldset> - - <fieldset> - <legend>Tag by rule:</legend> - <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br> - <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br> - <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>--> - <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>--> - <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> - </fieldset> - - <fieldset> - <legend>Edit:</legend> - <button onclick="saveTextToLGService(<?php echo $section_id;?>)" style="height: 30px; width: 220px">Save to LGService</button></br> - - <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> - <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/<?php echo $section_id;?>')" style="height: 30px; width: 220px">Manage Word List</button></br> - <button onclick="window.open('../EditTaglist/<?php echo $section_id;?>')" style="height: 30px; width: 220px">Manage Tag List</button></br> - </fieldset> - - <fieldset> - <legend>Export:</legend> - Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br> - <button onclick="exportPage()" style="height: 30px; width: 220px">Export</button></br> - <button onclick="exportAll(<?php echo $section_id;?>,<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br> - </fieldset> - - <fieldset> - <legend>Replace By <i><b>Regex</b></i>:</legend> - Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br> - Regex: <input type="text" size="30" id="regexText"></br> - Replace: <input type="text" size="30" id="replaceText"><br> - <button onclick="replaceSmartRegex()">Replace!</button> - </fieldset> - </form> - </div> - </td> - </tr> -</table> -</body> - -</html>
--- a/develop/views/Extractapp/taggingtext_20150219.php Thu Mar 05 15:41:11 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,705 +0,0 @@ -<?php -// --- initialize config file and input text --- -$stringInput = $viewmodel['stringInput']; -$wordlistArray = $viewmodel['wordlistArray']; -$taglistArray = $viewmodel['taglistArray']; -$section_id = $viewmodel['section_id']; -$topiclistArray = $viewmodel['topiclistArray']; -$default_topic_id = $viewmodel['default_topic_id']; -$topic_tag = $viewmodel['topic_tag']; -$info = $viewmodel['info']; -$messages = $viewmodel['messages']; - - -?> - -<html> -<head> -<title></title> - -<style> -dynasty -{ - color:red; -} -nianhao -{ - color:blue; -} -name -{ - color:orange; -} -#editable-area { - line-height:160%; - letter-spacing:1.5px; - font-size:21px; -} - - -<?php -// color on the tags -foreach ( $taglistArray as $taglistValue ) { - echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."\n}\n"; - - echo ".span_".$taglistValue[2]."\n{\nbackground-color:".$taglistValue[3]."\n}\n"; -} - -?> -</style> - - -</head> - -<body> - -<script type="text/javascript"> - -// === This is only for developing on local machine ==== -var _GET = JSON.parse('<?php echo json_encode($_GET) ?>'); -if (_GET['id']) { - - var info = JSON.parse('<?php echo json_encode($info) ?>'); - var redirectUrl = "http://localhost:1080/localmonographs/develop/Extractapp/TaggingText"; - var section_id = info['section_id']; - - var form = $('<form action="' + redirectUrl + '" method="post">' + - '<input type="hidden" name="sectionId" value="'+section_id+'" />' + - '</form>'); - $('body').append(form); - $(form).submit(); -} -// ==== - - -<?php -foreach ( $taglistArray as $taglistValue ) { - echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n"; - echo "\t".'if ( $(this).prop("tagName").toLowerCase() != "'.$taglistValue[2].'" ) return 0;'."\n"; - echo "\t".'if ( $("#editTextId").html() != "Edit the text" ) return 0;'."\n"; - echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n"; - echo "});\n"; -} -?> - -$(document).ready(function(){ - //run once - var el=$('#follow-scroll'); - var originalelpos=el.offset().top; // take it where it originally is on the page - - //run on scroll - $(window).scroll(function(){ - var el = $('#follow-scroll'); // important! (local) - var elpos = el.offset().top; // take current situation - var windowpos = $(window).scrollTop(); - var finaldestination = windowpos+originalelpos; - el.stop().animate({'top':finaldestination},500); - }); -}); -$(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(); - - if ( $("#editTextId").html() != "Edit the text" ) return 0; - - var selection = getSelected(); - range = getSelected().getRangeAt(0); - - container = document.createElement("div"); - container.appendChild(selection.getRangeAt(0).cloneContents()); - - if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) { - - var newdiv = document.createElement("div"); - 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'; - - //console.log(selection.getRangeAt(0).cloneContents()); - if ( container.innerHTML.indexOf( "br" ) != -1 ) { - var newselect = document.createElement("select"); - newselect.id = "TitletagType"; - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; - } - ?> - newdiv.appendChild(newselect); - - //matchValue = .match(); - myRegexp = new RegExp("〈(.*?)〉", "g") - matchValue = myRegexp.exec(String(selection)); - - if ( matchValue != null ) { - newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>"; - } else { - newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; - } - 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>"; - - var newselect = document.createElement("select"); - newselect.id = "RemoveTitletagType"; - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; - } - ?> - newdiv.appendChild(newselect); - - newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>"; - newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>"; - } else { - // for pop up window on edit-area for tag list - newdiv.innerHTML = "Tag: "+String(selection)+"<br>"; - - <?php - foreach ( $taglistArray as $taglistValue ) { - if ($taglistValue[2] == $topic_tag) { - 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; - } - } - ?> - - newdiv.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection)+"' )\">Tag As Title</button></br>"; - - <?php - - foreach ( $taglistArray as $taglistValue ) { - /* - if ( $taglistValue[2] == "person") { - 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"; - } else */ - 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"; - echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; - } else if ($taglistValue[2] == "office") { - echo "newdiv.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[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 { - echo "newdiv.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[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"; - } - - } - ?> - } - $('body').append(newdiv); - - $('#TitletagType').val(lastAddTag); - } - //e.stopPropagation(); -}); - - - -function replaceSmartRegex() { - saveUndoText(); - var startPage = $('#regexPageStart2').val(); - var endPage = $('#regexPageEnd2').val(); - - var el = document.getElementById("editable-area"); - var regexText=document.getElementById("regexText").value; - - <?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n"; - echo "\tregexText1 = preg_quote(regexText1);\n"; - echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n"; - echo "\tregexText = regexText.replace(new RegExp(regexText1, \"g\"), replaceText1);\n\n"; - } - ?> - - var replaceText=document.getElementById("replaceText").value; - var str="" + el.innerHTML; - - if ( startPage == "" ) { - alert( "Tagged "+str.match(new RegExp(regexText, "g")).length+" entities!" ); - el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText); - } else { - var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】"; - var partString = ""+str.match(new RegExp(regexText2, "g")); - alert(partString); - - alert( "Tagged "+partString.match(new RegExp(regexText, "g")).length+" entities!" ); - var resultString = partString.replace(new RegExp(regexText, "g"), replaceText); - - str="" + el.innerHTML; - el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString); - } - //document.styleSheets[0].addRule("tag001", "color:green;") -} - - - -function saveTextToLGService() { - var info = JSON.parse('<?php echo json_encode($info) ?>'); - - - // if this is a new branch, ask for label - if (info['branch_id'] == 0) { - var label = prompt("Please enter your label for this new branch", "label for section "+info['section_id']); - while (label == null) { - label = prompt("Please enter your label for this new branch (not empty)", "label for section "+info['section_id']); - } - }; - - - var form = document.createElement("form"); - form.setAttribute("method", "post"); - form.setAttribute("action", "./TaggingText"); // hand to controller - - // form.setAttribute("action", "./"+info['section_id']); // hand to controller - form.setAttribute("target", "_self"); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "func"); - hiddenField.setAttribute("value", "SaveFullTextToLGService"); - form.appendChild(hiddenField); - - 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", "label"); - hiddenField.setAttribute("value", label); - 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"); - - //$('#load_topic_div').css("border", "1px solid black"); - //$('#load_topic_div').css("background-color", "White"); - //$('#load_topic_div').css("width", "200px"); - //$('#load_topic_div').css("height", "50px"); - //$('#load_topic_div').css("top", "20px"); - //$('#load_topic_div').css("left", "-200px"); - - var topic_select = document.createElement("select"); - topic_select.id = "loadTopiclist"; - var selected_topic = t[0]; - topic_select.onchange = function(){ - - - selected_topic = topic_select.options[topic_select.selectedIndex]; - console.log(selected_topic.text); - - var topic_id = selected_topic.value; - // var topic_name = selected_topic.text; - - - var form = document.createElement("form"); - form.setAttribute("method", "post"); - form.setAttribute("action", "./TaggingText"); // hand to controller - //form.setAttribute("action", "./"+section_id); // hand to controller - form.setAttribute("target", "_self"); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "topic"); - hiddenField.setAttribute("value", topic_id); - form.appendChild(hiddenField); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "func"); - hiddenField.setAttribute("value", "ContinueTagging"); - form.appendChild(hiddenField); - - _postForContineTagging(form); - - - }; - - - //Create and append the options - for (var i = 0; i < t.length; i++) { - console.log(t[i]['id']+","+t[i]['name']); - var option = document.createElement("option"); - option.value = t[i]['id']; - option.text = t[i]['name']; - if (option.value == default_topic_id) { - option.selected = true; - }; - topic_select.appendChild(option); - } - - $('#load_topic_div').append(topic_select); - - var newbutton = document.createElement("button"); - $(newbutton).html("Close"); - $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");"); - $('#load_topic_div').append(newbutton); - -} - -// --- for config tags in topic --- -function _postForContineTagging(form) { - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("name", "text"); - var el = document.getElementById("editable-area"); - var text = el.innerHTML; - hiddenField.setAttribute("value", text); - form.appendChild(hiddenField); - - var info = JSON.parse( '<?php echo json_encode($info) ?>'); - - if (info) { - // TODO: different field info array based on fileId(branchId) existing or not - 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); - - } - - 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 configTagsInTopic(topic_id) { - 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); - form.appendChild(hiddenField); - - _postForContineTagging(form); - -} - - - -$(document).on("change", '#smartRegexPopUpSelectWord', function (e) { - -<?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "if ( $('#smartRegexPopUpSelectWord').val() == \"".$wordlistValue[0]."\") {"; - echo "$('#smartRegexPopUpText').val(\"".$wordlistValue[2]."\");"; - echo "}"; - } -?> -}); - -$(function () { - - $('#example').popover({ - //selector: '.has-popover' - content: function () { - return; - }, - //template: output_content, - title: "Load Regex" - }); -}) - - - -// init for popover used in bootstrap -$(function () { - $('[data-toggle="popover"]').popover() -}) - -</script> - -<div class="container-fluid"> - <div class="row"> - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-10 col-lg-offset-1"> - <p class="bg-primary"> <?php echo $messages; ?> </p> - </div> - </div> - - <div class="row"> - <div id="editable-area" class="col-xs-8 col-sm-8 col-md-8 col-lg-7 col-lg-offset-1"><?php echo $stringInput; ?> - </div> - <div id="follow-scroll" class="col-xs-4 col-sm-4 col-md-4 col-lg-4"> - <nav class="bs-docs-sidebar hidden-print affix" style=""> - <ul class="nav bs-docs-sidenav"> - <li> - <div id="load_regex_div" style="position: absolute; display: none"></div> - - <div id="smartRegexPopUpDiv" style="position: absolute; display: none" - Name: <input id="smartRegexPopUpName"></input><br><br> - Word List: - <select id="smartRegexPopUpSelectWord"> - <option value="NULL" selected>無</option> - <?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n"; - } - ?> - </select> - <br> - OR (USE "|" TO SEPARATE WORDS):<br> - <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br> - Tag: - <select id="smartRegexPopUpSelectTag"> - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n"; - } - echo "<option value=\"title\">Title</option>\n"; - ?> - <option value="NOTAG">不標記</option> - </select><br> - <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" style="">Add</button> - <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" style="">Edit</button> - <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" style="">Delete</button> - <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" style=""><<</button> - <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" style="">>></button> - <button onclick="replaceSmartClose()" style="">Close</button> - </div> - - <form action="javascript:void(0);"> - - <h4 class="text-success"> Config Topic</h4> - <button onclick="chooseTopic(<?php echo $default_topic_id; ?>)" class="btn-">Choose Topic</button> - <div id="load_topic_div" style="display: none"></div> - <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" style="">Config Tags</button></br> - - <fieldset> - <legend><h4 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h4></legend> - <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="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br> - <button onclick="smartRegexSave()" style="height: 30px; width: 70px">Save</button> - <button onclick="smartRegexLoad()" style="height: 30px; width: 70px">Load</button> - <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br> - - <!-- - <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button> - --> - - </fieldset> - - <fieldset> - <legend><h4 class="text-success"> Tag by rule:</h4></legend> - <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br> - <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br> - <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>--> - <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>--> - <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> - </fieldset> - - <fieldset> - <legend><h4 class="text-success"> Edit:</h4></legend> - <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>--> - <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> - <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br> - </fieldset> - - <fieldset> - <legend><h4 class="text-success"> Export:</h4></legend> - Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br> - <button onclick="exportPage()" style="height: 30px; width: 220px">Export</button></br> - <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br> - </fieldset> - - <fieldset> - <legend><h4 class="text-success"> Replace By <i><b>Regex</b></i>: </h4></legend> - Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br> - Regex: <input type="text" size="30" id="regexText"></br> - Replace: <input type="text" size="30" id="replaceText"><br> - <button onclick="replaceSmartRegex()">Replace!</button> - </fieldset> - </form> - - </li> - </ul> - </nav> - - </div> - </div> - -</div> - - -<table width="1250" border="1"> - <tr> - <td width="980"> - <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div> - </td> - <td width="270" valign="top"> - <div id="follow-scroll" style="position:absolute; width: 220" width="220"> - <div id="load_regex_div" style="position: absolute; display: none"></div> - <div id="load_topic_div" style="position: absolute; display: none"></div> - <div id="smartRegexPopUpDiv" style="position: absolute; display: none"> - Name: <input id="smartRegexPopUpName"></input><br><br> - Word List: - <select id="smartRegexPopUpSelectWord"> - <option value="NULL" selected>無</option> - <?php - foreach ( $wordlistArray as $wordlistValue ) { - echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n"; - } - ?> - </select> - <br> - OR (USE "|" TO SEPARATE WORDS):<br> - <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br> - Tag: - <select id="smartRegexPopUpSelectTag"> - <?php - foreach ( $taglistArray as $taglistValue ) { - echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n"; - } - echo "<option value=\"title\">Title</option>\n"; - ?> - <option value="NOTAG">不標記</option> - </select><br> - <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" style="height: 30px; width: 50px">Add</button> - <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" style="height: 30px; width: 50px">Edit</button> - <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" style="height: 30px; width: 50px">Delete</button> - <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" style="height: 30px; width: 50px"><<</button> - <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" style="height: 30px; width: 50px">>></button> - <button onclick="replaceSmartClose()" style="height: 30px; width: 50px">Close</button> - </div> - <form action="javascript:void(0);"> - <button onclick="chooseTopic(<?php echo $default_topic_id; ?>)">Choose Topic</button> - <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Config Tag List for Topic</button></br> - <fieldset> - <legend>Replace By <i><b>Smart Regex</b></i>©:</legend> - <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="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br> - <button onclick="smartRegexSave()" style="height: 30px; width: 70px">Save</button> - <button onclick="smartRegexLoad()" style="height: 30px; width: 70px">Load</button> - <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br> - </fieldset> - - <fieldset> - <legend>Tag by rule:</legend> - <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br> - <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br> - <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>--> - <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>--> - <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> - </fieldset> - - <fieldset> - <legend>Edit:</legend> - <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>--> - <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> - <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br> - </fieldset> - - <fieldset> - <legend>Export:</legend> - Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br> - <button onclick="exportPage()" style="height: 30px; width: 220px">Export</button></br> - <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br> - </fieldset> - - <fieldset> - <legend>Replace By <i><b>Regex</b></i>:</legend> - Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br> - Regex: <input type="text" size="30" id="regexText"></br> - Replace: <input type="text" size="30" id="replaceText"><br> - <button onclick="replaceSmartRegex()">Replace!</button> - </fieldset> - </form> - </div> - </td> - </tr> -</table> - - - -</body> - -</html>