Mercurial > hg > extraction-interface
diff controllers/extractapp.php @ 95:9a29e9d28ece extractapp
new: create new topic
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 11 Nov 2015 14:12:55 +0100 |
parents | b0cecc104639 |
children | ce7e933b18b0 |
line wrap: on
line diff
--- a/controllers/extractapp.php Mon Nov 09 12:00:24 2015 +0100 +++ b/controllers/extractapp.php Wed Nov 11 14:12:55 2015 +0100 @@ -101,13 +101,28 @@ case 'ContinueTagging': $viewmodel->messages['info'] .= "(Countinue tagging) "; - if ($this->postdata['topic']) { - $viewmodel->SetTopic($this->postdata['topic']); - } - $viewmodel->SetInfoFromPreviousPage($this->postdata); + $viewmodel->SetInfoFromPreviousPage($this->postdata); + $viewmodel->SetTextFromFileId(); // get text by fileId, from LGService + $viewmodel->SetTopic($this->postdata['topic']); + $this->ReturnView($viewmodel->StartTagging(), true); break; + case 'CreateNewTopic': + $result = $viewmodel->CreateNewTopic($this->postdata); + if ($result == "error") { + $viewmodel->messages['error'] .= "Fail to create the new topic <br> "; + } else { + // then act like ContinueTagging + $viewmodel->messages['info'] .= "Created a new topic <br>"; + $viewmodel->SetInfoFromPreviousPage($result); + $viewmodel->SetTextFromFileId(); // get text by fileId, from LGService + $viewmodel->SetTopic($result['topic']); + + } + $this->ReturnView($viewmodel->StartTagging(), true); + + break; default: // This is where the first time user visit extraction interface from LGService @@ -280,13 +295,20 @@ case 'Update': $viewmodel->UpdateTagsInTopic($this->postdata); break; + /* case 'CreateNewTopic': - $this->ReturnView($viewmodel->CreateNewTopic($this->postdata), true); + $result = $viewmodel->CreateNewTopic($this->postdata); + if ($result == "error") { + echo "Fail to create the new topic. Please contact us."; + } else { + $this->ReturnView($viewmodel->ConfigTagsInTopic($result), true); + } break; + */ default: $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true); break; - } + } }