comparison views/Extractapp/TaggingText.php @ 58:a11f9103b8db extractapp

New: 1.display messages 2.handle saving conflict:up-to-date or reload text
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 31 Mar 2015 10:59:52 +0200
parents 5cf9720a2e25
children 6e44605eb4f6
comparison
equal deleted inserted replaced
57:5cf9720a2e25 58:a11f9103b8db
105 105
106 _postForContineTagging(form); 106 _postForContineTagging(form);
107 107
108 } 108 }
109 109
110 // TODO: Popup to proceeding the saving situations
111 function handleFileVersionConflict() { 110 function handleFileVersionConflict() {
112 var info = JSON.parse('<?php echo json_encode($info) ?>'); 111 var info = JSON.parse('<?php echo json_encode($info) ?>');
113 console.log("currentFileId="+info['current_fileId']); 112 console.log("currentFileId="+info['current_fileId']);
114 113
115 if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){ 114 // if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){
115 if (info['current_fileId'] != 0){
116 // -- there might be conflicts between different version 116 // -- there might be conflicts between different version
117 alert("Your saving failed! Someone edited this file and saved before you."); 117 alert("Your saving failed! Someone edited this file and saved before you.");
118 $('#reloadTextButton').css("display", "block");
119
118 return; 120 return;
119 } 121 }
120 return; 122 return;
121 123
122 } 124 }
792 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");"); 794 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");");
793 $('#load_topic_div').append(newbutton); 795 $('#load_topic_div').append(newbutton);
794 796
795 } 797 }
796 798
797 // --- for config tags in topic ---
798 function _postForContineTagging(form) { 799 function _postForContineTagging(form) {
799 var hiddenField = document.createElement("input"); 800 var hiddenField = document.createElement("input");
800 hiddenField.setAttribute("name", "text"); 801 hiddenField.setAttribute("name", "text");
801 var el = document.getElementById("editable-area"); 802 var el = document.getElementById("editable-area");
802 var text = el.innerHTML; 803 var text = el.innerHTML;
928 929
929 <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; "> 930 <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; ">
930 </div> 931 </div>
931 932
932 933
933 <p class="bg-info" style="margin:10 30 10 30; max-width:1250"> <?php echo $messages; ?> </p> 934 <div style="margin:10 30 10 30; max-width:1250">
935 <p class="bg-info" style=""> <?php echo $messages['info']; ?> </p>
936 <p class="bg-warning" style=""> <?php echo $messages['warning']; ?> </p>
937 <p class="bg-danger" style=""> <?php echo $messages['error']; ?> </p>
938 <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Reload</button>
939
940 <p class="bg-default" style=""> <?php echo $messages['debug']; ?> </p>
941 </div>
934 942
935 <table width="1270" border="1" style="margin:10 30 10 30;"> 943 <table width="1270" border="1" style="margin:10 30 10 30;">
936 <tr> 944 <tr>
937 <td width="980" style="padding:0 5 0 5; margin: 0 5 0 5;"> 945 <td width="980" style="padding:0 5 0 5; margin: 0 5 0 5;">
938 <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div> 946 <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div>
975 </div> 983 </div>
976 984
977 <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 15 5; max-width:270px"> 985 <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 15 5; max-width:270px">
978 <form action="javascript:void(0);"> 986 <form action="javascript:void(0);">
979 <fieldset> 987 <fieldset>
980 <button onclick="reloadText(<?php echo $default_topic_id; ?>)">Reload</button>
981 </fieldset>
982 <fieldset>
983 <legend><h5 class="text-success"> Config Topic: </h5></legend> 988 <legend><h5 class="text-success"> Config Topic: </h5></legend>
984 <div> current topic is <?php echo $topic_name; ?> 989 <div> current topic is <?php echo $topic_name; ?>
985 <button onclick="chooseTopic()" class="btn btn-xs btn-default">Change</button> 990 <button onclick="chooseTopic()" class="btn btn-xs btn-default">Change</button>
986 </div> 991 </div>
987 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Manage Tags in topic</button></br> 992 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Manage Tags in topic</button></br>
988 </fieldset> 993 </fieldset>
989 994
990 <fieldset> 995 <fieldset>
991 <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend> 996 <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
992 <div id="smartRegexShowDiv"></div><br> 997 <div id="smartRegexShowDiv"></div><br>
993 <button onclick="smartRegexNew()" style="height: 30px; width: 220px">Add Regex Group</button></br> 998 <button onclick="smartRegexNew()" style="height: 35px; width: 220px">Add Regex Group</button></br>
994 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br> 999 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
995 <button onclick="replaceSmartRun()" style="height: 30px; width: 100px">Run</button> 1000 <button onclick="replaceSmartRun()" style="height: 35px; width: 100px">Run</button>
996 <button onclick="replaceSmartRunWithBr()" style="height: 30px; width: 100px">Run(with Br)</button></br> 1001 <button onclick="replaceSmartRunWithBr()" style="height: 35px; width: 100px">Run(with Br)</button></br>
997 <button onclick="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br> 1002 <button onclick="replaceSmartRunSpace()" style="height: 35px; width: 220px">Run(Allow space between Group)</button></br>
998 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Save</button> 1003 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Save</button>
999 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Load</button> 1004 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Load</button>
1000 <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br> 1005 <button onclick="smartRegexEmpty()" style="height: 35px; width: 70px">Clear</button></br>
1001 <!-- 1006 <!--
1002 <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button> 1007 <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button>
1003 --> 1008 -->
1004 </fieldset> 1009 </fieldset>
1005 1010
1006 <fieldset> 1011 <fieldset>
1007 <legend><h5 class="text-success"> Tag by rule:</h5></legend> 1012 <legend><h5 class="text-success"> Tag by rule:</h5></legend>
1008 <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br> 1013 <button onclick="tagNameWithLastName()" style="height: 35px; width: 220px">Tag Word Begin With Surname</button></br>
1009 <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br> 1014 <button onclick="tagNameWithLastName2()" style="height: 35px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
1010 <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>--> 1015 <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
1011 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>--> 1016 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
1012 <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> 1017 <button onclick="Undo()" style="height: 35px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
1013 </fieldset> 1018 </fieldset>
1014 1019
1015 <fieldset> 1020 <fieldset>
1016 <legend><h5 class="text-success"> Edit:</h5></legend> 1021 <legend><h5 class="text-success"> Edit:</h5></legend>
1017 1022
1018 <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 30px; width: 220px">Save to LGService</button></br> 1023 <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 35px; width: 220px">Save to LGService</button></br>
1019 1024
1020 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> 1025 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
1021 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage --> 1026 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage -->
1022 <!-- 1027 <!--
1023 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br> 1028 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
1024 --> 1029 -->
1025 1030
1026 <button onclick="editText()" id="editTextId" style="height: 30px; width: 220px">Edit the text</button></br> 1031 <button onclick="editText()" id="editTextId" style="height: 35px; width: 220px">Edit the text</button></br>
1027 </br> 1032 </br>
1028 <button onclick="window.open('./EditWordlist')" style="height: 30px; width: 220px">Manage Word List</button></br> 1033 <button onclick="window.open('./EditWordlist')" style="height: 35px; width: 220px">Manage Word List</button></br>
1029 <!-- 1034 <!--
1030 <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br> 1035 <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br>
1031 --> 1036 -->
1032 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 220px">Manage Tag List</button></br> 1037 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 220px">Manage Tag List</button></br>
1033 </fieldset> 1038 </fieldset>
1034 1039
1035 <fieldset> 1040 <fieldset>
1036 <legend><h5 class="text-success"> Export:</h5></legend> 1041 <legend><h5 class="text-success"> Export:</h5></legend>
1037 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br> 1042 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br>
1038 <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export</button></br> 1043 <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export</button></br>
1039 <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br> 1044 <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export All</button></br>
1040 </fieldset> 1045 </fieldset>
1041 1046
1042 <fieldset> 1047 <fieldset>
1043 <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend> 1048 <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
1044 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br> 1049 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>