Mercurial > hg > extraction-interface
changeset 102:6ba742b712b0 extractapp
new: use cookie in browser to trigger auto refresh page in LGServices
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 25 May 2016 11:29:28 +0200 |
parents | a264460c77ca |
children | 2cc65ff46174 |
files | config/config.php models/extractapp.php views/Extractapp/EditTaglist.php views/Extractapp/TaggingText.php |
diffstat | 4 files changed, 28 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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/"; }
--- 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"); } + } }
--- 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!");
--- 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"); }