# HG changeset patch # User Zoe Hong # Date 1464168568 -7200 # Node ID 6ba742b712b01653e15179bc33d18da2aea26228 # Parent a264460c77cafa7b337b25fb5c0f040f1771644b new: use cookie in browser to trigger auto refresh page in LGServices diff -r a264460c77ca -r 6ba742b712b0 config/config.php --- a/config/config.php Wed May 04 15:22:11 2016 +0200 +++ b/config/config.php Wed May 25 11:29:28 2016 +0200 @@ -35,6 +35,8 @@ $mysql_server = "localhost"; $mysql_user = "root"; $mysql_password = "root"; + + $server_host = "http://localhost:1080/localgazetteers-dev/"; $lgserver_url = "http://localhost:8080/LGServices/"; } diff -r a264460c77ca -r 6ba742b712b0 models/extractapp.php --- a/models/extractapp.php Wed May 04 15:22:11 2016 +0200 +++ b/models/extractapp.php Wed May 25 11:29:28 2016 +0200 @@ -905,7 +905,7 @@ // for creationDate and lastChangeDate $date = date('Y-m-d H:i:s', time()); - $query1 = sprintf("INSERT INTO `Taglist` (`id`, `name`, `tag`, `color`, `creationDate`, `lastChangeDate`) VALUES (%s, %s, %s, %s, %s, %s)", + $query1 = sprintf("INSERT INTO Taglist (`id`, `name`, `tag`, `color`, `creationDate`, `lastChangeDate`) VALUES (%s, %s, %s, %s, %s, %s)", $this->GetSQLValueString($id, "int"), $this->GetSQLValueString($name, "text"), $this->GetSQLValueString($tag, "text"), @@ -915,7 +915,11 @@ //$this->GetSQLValueString($this->systemNAME, "text")); $result1 = mysql_query($query1); - + if (!$result1) { + //echo json_encode("error when insert into Taglist table"); + echo 0; + return; + } // add it to topic_tag_relation table $topic_id = $postdata['topic_id']; @@ -932,8 +936,10 @@ $result = mysql_query($query); if (!$result) { - echo json_encode("error when insert into TopicTagRelation table"); + echo 1; + //echo json_encode("error when insert into TopicTagRelation table"); } + } } diff -r a264460c77ca -r 6ba742b712b0 views/Extractapp/EditTaglist.php --- a/views/Extractapp/EditTaglist.php Wed May 04 15:22:11 2016 +0200 +++ b/views/Extractapp/EditTaglist.php Wed May 25 11:29:28 2016 +0200 @@ -64,7 +64,7 @@ console.log(".englishOnly"); - var englishAlphabetAndWhiteSpace =/[A-Za-z 0-9]/g; + var englishAlphabet =/[A-Za-z0-9]/g; var key = String.fromCharCode(event.which); @@ -76,9 +76,8 @@ // shift, ctr, alt: 16, 17, 18, 20 // cmd: 91 // -: 189 - - if (event.keyCode == 8 || event.keyCode == 9 || (event.keyCode >= 16 && event.keyCode <= 20) || event.keyCode == 27 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 91 || event.keyCode == 189 || englishAlphabetAndWhiteSpace.test(key)) { + if (event.keyCode == 8 || event.keyCode == 9 || (event.keyCode >= 16 && event.keyCode <= 20) || event.keyCode == 27 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 91 || event.keyCode == 189 || englishAlphabet.test(key)) { return true; } @@ -330,10 +329,16 @@ console.log("error when newTag"); }, success: function (e) { - alert("Saved!"); - - setCookie("Saved"); - //document.location.reload(true); + console.log(e); + if (e[0] == 0){ + alert("Saving error when create new tag. Check if the tag already exists."); + } else if (e[0] == 1) { + alert("Saving error when update tag topic relation. Please contact IT for support."); + } else { + alert("Saved!"); + setCookie("Saved"); + //document.location.reload(true); + } } }).done(function(result) { }); @@ -363,6 +368,7 @@ data : 'func=SaveTagElement'+'&id='+elid+'&name='+elname+'&tag='+eltag+'&color='+elcolor+'&topic_id='+topic_id, error: function (e) { console.log("error when saving Tag"); + alert("Saving failed. Please check if the tag already exists."); }, success: function (e) { alert("Saved!"); diff -r a264460c77ca -r 6ba742b712b0 views/Extractapp/TaggingText.php --- a/views/Extractapp/TaggingText.php Wed May 04 15:22:11 2016 +0200 +++ b/views/Extractapp/TaggingText.php Wed May 25 11:29:28 2016 +0200 @@ -1069,6 +1069,10 @@ _postForContineTagging(form); + // set Cookies to triger LGService to reload for the up-to-date version + var value = 1; + document.cookie = "saveTextToLGService=" + value + "; path=/LGServices/pages"; + console.log("complete saving to LGService"); }