Mercurial > hg > extraction-interface
diff 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 |
line wrap: on
line diff
--- a/develop/views/Extractapp/TaggingText.php Fri Mar 13 14:47:23 2015 +0100 +++ b/develop/views/Extractapp/TaggingText.php Mon Mar 16 15:49:39 2015 +0100 @@ -216,7 +216,9 @@ '</form>'); $('body').append(form); $(form).submit(); - } else { + } + + // --- TODO: check if taglist in file is up-to-date --- /* var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); @@ -237,18 +239,22 @@ <?php $taglist_infile = ""; ?> } */ + + var info = JSON.parse('<?php echo json_encode($info) ?>'); + + // the first time to this section. without branch_id and file_id + if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file + $( "#saveTextToLGService_id").text( "Create(Save) Branch to LGService" ); + } - handleFileVersionConflict(); - /* - - // Popup choosing topic if first time to this section. without branchId - if (info['file_id'] == 0) { // or info['branchId'] == 0, means new file + // Popup choosing topic if first time to this section. without branch_id + if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file // ask to choose topic $.ajax({ @@ -258,6 +264,8 @@ // alert('choose topic!'); } */ + + }); $(document).on("click", "name", function (e) { @@ -662,21 +670,33 @@ function saveTextToLGService() { + var info = JSON.parse('<?php echo json_encode($info) ?>'); var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); // if this is a new branch, ask for label if (info['branch_id'] == 0) { - var cnt = 0; - var label = prompt("Please enter your label for this new branch", "section"+info['section_id']); - while (label == null && cnt <= 3) { - cnt ++; - label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); + //var label = prompt("Please enter your label for this new branch", "section"+info['section_id']); + var today = new Date(); + var dd = today.getDate(); + var mm = today.getMonth()+1; //January is 0! + var yyyy = today.getFullYear(); + + if(dd<10) { + dd='0'+dd + } + if(mm<10) { + mm='0'+mm + } + today = dd+'/'+mm+'/'+yyyy; + var label = prompt("Please enter your label for this new branch", today); + while (label == null) { + alert("You haven't saved your editing."); + return; + // label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); } }; - - var form = document.createElement("form"); form.setAttribute("method", "post"); form.setAttribute("action", "./TaggingText"); // hand to controller @@ -998,7 +1018,7 @@ <option value="NOTAG">不標記</option> </select><br> <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info" style="">Add</button> - <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success" style="">Edit</button> + <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success" style="">Edit/Update</button> <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger" style="">Delete</button> <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default" style=""><<</button> <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default" style="">>></button> @@ -1043,7 +1063,8 @@ <fieldset> <legend><h5 class="text-success"> Edit:</h5></legend> - <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br> + + <button onclick="saveTextToLGService()" id="saveTextToLGService_id" 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 -->