Mercurial > hg > extraction-interface
comparison develop/views/Extractapp/TaggingText.php @ 46:b3ca5d2b4d3f extractapp
bug fix: edit and save regex. But a jquery issue in Chrome
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 16 Mar 2015 15:49:39 +0100 |
parents | c245d54eab9f |
children |
comparison
equal
deleted
inserted
replaced
45:3d6b8fb7335d | 46:b3ca5d2b4d3f |
---|---|
214 var form = $('<form action="' + redirectUrl + '" method="post">' + | 214 var form = $('<form action="' + redirectUrl + '" method="post">' + |
215 '<input type="hidden" name="sectionId" value="'+section_id+'" />' + | 215 '<input type="hidden" name="sectionId" value="'+section_id+'" />' + |
216 '</form>'); | 216 '</form>'); |
217 $('body').append(form); | 217 $('body').append(form); |
218 $(form).submit(); | 218 $(form).submit(); |
219 } else { | 219 } |
220 | |
221 | |
220 // --- TODO: check if taglist in file is up-to-date --- | 222 // --- TODO: check if taglist in file is up-to-date --- |
221 /* | 223 /* |
222 var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); | 224 var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); |
223 if (taglist_infile != "") { | 225 if (taglist_infile != "") { |
224 // TODO: pop up to ask if load the latest taglist | 226 // TODO: pop up to ask if load the latest taglist |
235 } | 237 } |
236 //_showTagColor(retVal); | 238 //_showTagColor(retVal); |
237 <?php $taglist_infile = ""; ?> | 239 <?php $taglist_infile = ""; ?> |
238 } | 240 } |
239 */ | 241 */ |
240 } | 242 |
241 | 243 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
244 | |
245 // the first time to this section. without branch_id and file_id | |
246 if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file | |
247 $( "#saveTextToLGService_id").text( "Create(Save) Branch to LGService" ); | |
248 | |
249 } | |
242 | 250 |
243 | 251 |
244 handleFileVersionConflict(); | 252 handleFileVersionConflict(); |
245 | 253 |
246 | |
247 | 254 |
248 /* | 255 /* |
249 | 256 // Popup choosing topic if first time to this section. without branch_id |
250 // Popup choosing topic if first time to this section. without branchId | 257 if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file |
251 if (info['file_id'] == 0) { // or info['branchId'] == 0, means new file | |
252 // ask to choose topic | 258 // ask to choose topic |
253 $.ajax({ | 259 $.ajax({ |
254 | 260 |
255 }); | 261 }); |
256 var popup = document.getElementById('popup-window'); | 262 var popup = document.getElementById('popup-window'); |
257 | 263 |
258 // alert('choose topic!'); | 264 // alert('choose topic!'); |
259 } | 265 } |
260 */ | 266 */ |
267 | |
268 | |
261 | 269 |
262 }); | 270 }); |
263 $(document).on("click", "name", function (e) { | 271 $(document).on("click", "name", function (e) { |
264 | 272 |
265 if ( $("#editTextId").html() != "Edit the text" ) return 0; | 273 if ( $("#editTextId").html() != "Edit the text" ) return 0; |
660 } | 668 } |
661 | 669 |
662 | 670 |
663 | 671 |
664 function saveTextToLGService() { | 672 function saveTextToLGService() { |
673 | |
665 var info = JSON.parse('<?php echo json_encode($info) ?>'); | 674 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
666 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); | 675 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); |
667 | 676 |
668 // if this is a new branch, ask for label | 677 // if this is a new branch, ask for label |
669 if (info['branch_id'] == 0) { | 678 if (info['branch_id'] == 0) { |
670 var cnt = 0; | 679 //var label = prompt("Please enter your label for this new branch", "section"+info['section_id']); |
671 var label = prompt("Please enter your label for this new branch", "section"+info['section_id']); | 680 var today = new Date(); |
672 while (label == null && cnt <= 3) { | 681 var dd = today.getDate(); |
673 cnt ++; | 682 var mm = today.getMonth()+1; //January is 0! |
674 label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); | 683 var yyyy = today.getFullYear(); |
684 | |
685 if(dd<10) { | |
686 dd='0'+dd | |
687 } | |
688 if(mm<10) { | |
689 mm='0'+mm | |
690 } | |
691 today = dd+'/'+mm+'/'+yyyy; | |
692 var label = prompt("Please enter your label for this new branch", today); | |
693 while (label == null) { | |
694 alert("You haven't saved your editing."); | |
695 return; | |
696 // label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); | |
675 } | 697 } |
676 }; | 698 }; |
677 | 699 |
678 | |
679 | |
680 var form = document.createElement("form"); | 700 var form = document.createElement("form"); |
681 form.setAttribute("method", "post"); | 701 form.setAttribute("method", "post"); |
682 form.setAttribute("action", "./TaggingText"); // hand to controller | 702 form.setAttribute("action", "./TaggingText"); // hand to controller |
683 form.setAttribute("target", "_self"); | 703 form.setAttribute("target", "_self"); |
684 | 704 |
996 echo "<option value=\"title\">Title</option>\n"; | 1016 echo "<option value=\"title\">Title</option>\n"; |
997 ?> | 1017 ?> |
998 <option value="NOTAG">不標記</option> | 1018 <option value="NOTAG">不標記</option> |
999 </select><br> | 1019 </select><br> |
1000 <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info" style="">Add</button> | 1020 <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info" style="">Add</button> |
1001 <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success" style="">Edit</button> | 1021 <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success" style="">Edit/Update</button> |
1002 <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger" style="">Delete</button> | 1022 <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger" style="">Delete</button> |
1003 <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default" style=""><<</button> | 1023 <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default" style=""><<</button> |
1004 <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default" style="">>></button> | 1024 <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default" style="">>></button> |
1005 <button onclick="replaceSmartClose()" class="btn btn-default" style="">Close</button> | 1025 <button onclick="replaceSmartClose()" class="btn btn-default" style="">Close</button> |
1006 </div> | 1026 </div> |
1041 <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> | 1061 <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button> |
1042 </fieldset> | 1062 </fieldset> |
1043 | 1063 |
1044 <fieldset> | 1064 <fieldset> |
1045 <legend><h5 class="text-success"> Edit:</h5></legend> | 1065 <legend><h5 class="text-success"> Edit:</h5></legend> |
1046 <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br> | 1066 |
1067 <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 30px; width: 220px">Save to LGService</button></br> | |
1047 | 1068 |
1048 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> | 1069 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> |
1049 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage --> | 1070 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage --> |
1050 <!-- | 1071 <!-- |
1051 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br> | 1072 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br> |