Mercurial > hg > extraction-interface
changeset 91:3e11a9c5a672 extractapp
new: explore table for using on LGMap
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 14 Sep 2015 14:37:29 +0200 |
parents | 94ad33739fa4 |
children | f5b0cd4f25b2 |
files | .DS_Store config/config.php controllers/extractapp.php models/extractapp.php views/Extractapp/ExportTable.php views/Extractapp/TaggingText.php |
diffstat | 6 files changed, 52 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/config/config.php Fri Jun 12 14:41:30 2015 +0200 +++ b/config/config.php Mon Sep 14 14:37:29 2015 +0200 @@ -22,7 +22,7 @@ $mysql_server = "localhost"; $mysql_user = "root"; $mysql_password = "admin"; - $server_host = "http://localgazetteers/"; + $server_host = "http://localgazetteers.mpiwg-berlin.mpg.de/"; $lgserver_url = $server_host."LGServices/"; } else {
--- a/controllers/extractapp.php Fri Jun 12 14:41:30 2015 +0200 +++ b/controllers/extractapp.php Mon Sep 14 14:37:29 2015 +0200 @@ -154,6 +154,25 @@ } + protected function ExportTabDelimited() { + /** + * ExportTable action returns "./views/Extractapp/ExportTabDelimited.php" view. + * ExportTabDelimited.php is using tab as delimiter. + */ + $viewmodel = $this->viewmodel; + + if (isset($this->postdata['fileId'])) { + $viewmodel->SetInfoFromPreviousPage($this->postdata); // fileId in postdata + + $viewmodel->SetTextFromFileId(); // this will also set section_id + $viewmodel->SetBookMetadataBySectionId(); + } + + $this->ReturnView($viewmodel->ExportTable($this->postdata, true), false); + + + } + protected function ExportTable() { /** * ExportTable action returns "./views/Extractapp/ExportTable.php" view. @@ -167,17 +186,27 @@ } switch ($func) { case 'exportFromExtractionInterface': + $viewmodel->SetInfoFromPreviousPage($this->postdata); + $this->ReturnView($viewmodel->ExportTable($this->postdata, false), true); break; default: // from file - $viewmodel->SetInfoFromPreviousPage($this->postdata); - $viewmodel->SetTextFromFileId(); - $this->ReturnView($viewmodel->ExportTable($this->postdata, true), true); + // exportFromLGServicesHtmlTable + if (isset($this->postdata['fileId'])) { + $viewmodel->SetInfoFromPreviousPage($this->postdata); // only fileId in postdata + + $viewmodel->SetTextFromFileId(); // this will also set section_id + $viewmodel->SetBookMetadataBySectionId(); + } + + $this->ReturnView($viewmodel->ExportTable($this->postdata, true), false); break; } + + } protected function EditWordlist() {
--- a/models/extractapp.php Fri Jun 12 14:41:30 2015 +0200 +++ b/models/extractapp.php Mon Sep 14 14:37:29 2015 +0200 @@ -294,11 +294,11 @@ $data['topic_name'] = $this->GetTopicName($topic_id); $data['topic_tag_ch'] = $this->GetTopicTagName($topic_id); - $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id, 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id, 'book_name'=>$this->book_name,'section_name'=>$this->section_name, 'period'=>$this->book_meta->period, - 'current_fileId'=>$this->current_fileId); + 'current_fileId'=>$this->current_fileId); + $this->messages['debug'] .= "[Debug] "; $this->messages['debug'] .= "file_id=".$this->file_id.", section_id=".$this->section_id; @@ -307,10 +307,11 @@ $this->messages['debug'] .= ", current_fileId=".$this->current_fileId."<br>"; $this->messages['info'] .= "[Info] book name: ".$this->book_name; + $this->messages['info'] .= ", period: ".$this->book_meta->period; $this->messages['info'] .= ", section id: ". $this->section_id; + $this->messages['info'] .= ", section name: ".$this->section_name; $this->messages['info'] .= ", branch id: ".$this->branch_id; $this->messages['info'] .= ", file id: ".$this->file_id; - $this->messages['info'] .= ", period: ".$this->book_meta->period; $this->messages['info'] .= "<br>"; @@ -726,7 +727,6 @@ } // === for export table === - public function ExportTable($postdata, $isFromFile) { if ($isFromFile) { $content = $this->lg_text; @@ -741,7 +741,6 @@ } else { $content = $postdata['content']; $topic = $postdata['topic']; - $section_id = $postdata['sectionId']; $sectionName = $postdata['sectionName']; $bookId = $postdata['bookId']; @@ -759,6 +758,8 @@ + $bookMeta = $this->book_meta; // just added + // data for view $data = array(); $data['outputTableArray'] = $outputTableArray; @@ -766,11 +767,11 @@ $data['section_id'] = $section_id; $data['bookName'] = $bookName; $data['sectionName'] = $sectionName; + $data['bookMeta'] = $bookMeta; return $data; } - // === for manage tag list === public function EditTaglist($_postdata) { /**
--- a/views/Extractapp/ExportTable.php Fri Jun 12 14:41:30 2015 +0200 +++ b/views/Extractapp/ExportTable.php Mon Sep 14 14:37:29 2015 +0200 @@ -27,6 +27,7 @@ $sectionid = $viewmodel['section_id']; $bookName = $viewmodel['bookName']; $sectionName = $viewmodel['sectionName']; +$bookMeta = $viewmodel['bookMeta']; ?> @@ -49,12 +50,18 @@ echo "<td>Section ID</td>"; echo "<td>方志</td>"; echo "<td>部</td>"; + echo "<td>方志地點</td>"; + echo "<td>經度(x)</td>"; // longitude + echo "<td>緯度(y)</td>"; // latitude } else { echo "<td>".$count++."</td>"; echo "<td>".$bookId."</td>"; echo "<td>".$sectionid."</td>"; echo "<td>".$bookName."</td>"; echo "<td>".$sectionName."</td>"; + echo "<td>".$bookMeta->place_name."</td>"; + echo "<td>".$bookMeta->x."</td>"; + echo "<td>".$bookMeta->y."</td>"; } if ( isset( $trValue["page"] ) ) { echo "<td>".$trValue["page"]."</td>";
--- a/views/Extractapp/TaggingText.php Fri Jun 12 14:41:30 2015 +0200 +++ b/views/Extractapp/TaggingText.php Mon Sep 14 14:37:29 2015 +0200 @@ -199,7 +199,6 @@ */ $(document).ready(function(){ - // --- for sidebar--- //run once var el=$('#follow-scroll'); @@ -436,6 +435,7 @@ form.appendChild(hiddenField2); var info = JSON.parse( '<?php echo json_encode($info) ?>'); + var book_meta = JSON.parse( '<?php echo json_encode($book_meta) ?>'); if (info) { var hiddenField = document.createElement("input"); @@ -923,7 +923,9 @@ <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button> </div> <div class="bg-info"> <?php echo $messages['info']; ?> </div> + <!-- <div class="bg-default"> <?php echo $messages['debug']; ?> </div> + --> </div> @@ -1019,12 +1021,12 @@ <button onclick="replaceSmartRunWithBr()" class="btn btn-default btn-block">Run(in new line)</button> <!-- <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between Group)</button></br> --> - <button onclick="replaceSmartRunSpace()" class="btn btn-default">Run(Allow space between block)</button></br> + <button onclick="replaceSmartRunSpace()" class="btn btn-default btn-block">Run(Allow space between block)</button></br> <button onclick="window.open('./EditWordlist')" class="btn btn-default btn-block">Edit WordList</button> <!-- developing...--> - <button onclick="genRegexWindowOpen()" id="gen_regex_window_open_id" class="btn btn-default">Open GenRegex(test)</button></br> + <button onclick="genRegexWindowOpen()" id="gen_regex_window_open_id" class="btn btn-default">Open GenRegex (test)</button></br> </div> </fieldset>