Mercurial > hg > extraction-interface
annotate controllers/extractapp.php @ 89:e681d693240e extractapp
new: generated regex to SmartRegex
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 03 Jun 2015 16:54:09 +0200 |
parents | fb5049fc5dd7 |
children | 3e11a9c5a672 |
rev | line source |
---|---|
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1 <?php |
81 | 2 /* extractapp.php |
3 * This file is part of Extraction-interface. | |
4 * | |
5 * Extraction-interface is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation, either version 3 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * Extraction-interface is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>. | |
17 */ | |
18 | |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
19 /** |
81 | 20 * Extractapp class is extended from the BaseController class. |
21 * It sends commands to the ExtractappModel to process or update the ExtractappModel's state. | |
22 * It can also pass the commands or data (from ExtractappModel) to the associated view (files in views/Extractapp/), | |
23 * for example views/Extractapp/TaggingText.php , to change the view's presentation. | |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
24 * |
81 | 25 * There are five actions in Extractapp: tagging text, exporting a table, |
26 * editing the wordlist, editing the taglist, and configurating tags in one topic. | |
27 * Each action is one of the methods in Extractapp. | |
28 * | |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
29 */ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
30 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
31 class Extractapp extends BaseController { |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
32 |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
33 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
34 protected $viewmodel; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
35 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
36 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
37 public function __construct($action, $urlvalues, $postdata){ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
38 parent::__construct($action, $urlvalues, $postdata); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
39 $this->viewmodel = new ExtractappModel(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
40 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
41 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
42 protected function TaggingText() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
43 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
44 * TaggingText action in Extractapp handles the taging related actions, for example, |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
45 * tagging itself, saving tag results, loading and saving regular expression for tagging. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
46 * They are handled by 'func' variable in postdata, which could come from LGService or from extraction-interface application itself. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
47 * |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
48 * From LGService, the postdata contains essential information about the file/section of local gazetteers data. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
49 * This happens when user entering to extraction-interface the first time, or after s/he saved her/is tagging results to LGService. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
50 * (default one, SaveFullTextToLGService, SmartRegexLoad, SmartRegexSave case) |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
51 * |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
52 * From extraction-interface itself, it contains the information from previous page. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
53 * This happens when user choosing another topic in the extraction-interface, |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
54 * the page need to retrieve related information from database for the topic. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
55 * (ContinueTagging case) |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
56 */ |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
57 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
58 $viewmodel = $this->viewmodel; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
59 |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
60 if (isset($this->postdata['func'])) { |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
61 $func = $this->postdata['func']; |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
62 } else { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
63 $func = ""; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
64 } |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
65 switch ($func) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
66 case 'SaveFullText': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
67 $viewmodel->SaveFullText($this->postdata); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
68 $this->ReturnView($viewmodel->StartTagging(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
69 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
70 case 'SaveFullTextToLGService': |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
71 global $AT_LOCAL; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
72 if ($AT_LOCAL) { |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
73 $viewmodel->messages['info'] .= "SaveFullTextToLGService! (local test) "; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
74 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
75 $response = $viewmodel->SaveFullTextToLGService($this->postdata); |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
76 |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
77 } else { |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
78 |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
79 $viewmodel->messages['info'] .= "SaveFullTextToLGService! "; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
80 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
81 $response = $viewmodel->SaveFullTextToLGService($this->postdata); |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
82 $viewmodel->UpdateInfoResponsedFromLGService($response); // update file_id, branch_id, user_id |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
83 $viewmodel->SetTextFromFileId(); |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
84 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
85 $this->ReturnView($viewmodel->StartTagging(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
86 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
87 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
88 case 'SmartRegexLoad': |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
89 $viewmodel->LoadSmartRegex($this->postdata['topic_id']); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
90 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
91 case 'SmartRegexSave': |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
92 $viewmodel->SaveSmartRegex($this->postdata); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
93 break; |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
53
diff
changeset
|
94 case 'ReloadText': |
59
6e44605eb4f6
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
58
diff
changeset
|
95 $viewmodel->messages['info'] .= "Reload the latest text "; |
81 | 96 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
53
diff
changeset
|
97 $viewmodel->ReloadSetting(); // set file_id = current_fileId, current_fileId = 0 |
81 | 98 $viewmodel->SetTextFromFileId(); |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
53
diff
changeset
|
99 $this->ReturnView($viewmodel->StartTagging(), true); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
100 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
101 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
102 case 'ContinueTagging': |
59
6e44605eb4f6
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
58
diff
changeset
|
103 $viewmodel->messages['info'] .= "(Countinue tagging) "; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
104 if ($this->postdata['topic']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
105 $viewmodel->SetTopic($this->postdata['topic']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
106 } |
81 | 107 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
108 $this->ReturnView($viewmodel->StartTagging(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
109 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
110 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
111 |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
112 default: |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
113 // This is where the first time user visit extraction interface from LGService |
59
6e44605eb4f6
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
58
diff
changeset
|
114 $viewmodel->messages['info'] .= "Welcome to Extraction Interface. "; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
115 |
73 | 116 if (isset($this->postdata['fileId'])) { |
117 if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { | |
118 // --- Existing branch case --- | |
81 | 119 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
120 $viewmodel->SetBookMetadataBySectionId(); |
73 | 121 // get text by fileId, from LGService |
81 | 122 $viewmodel->SetTextFromFileId(); |
73 | 123 } |
53
f9594c240826
get/update text after saving, for xml file consistency
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
47
diff
changeset
|
124 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
125 } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) { |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
59
diff
changeset
|
126 // --- New branch case --- |
81 | 127 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
128 $viewmodel->SetBookMetadataBySectionId(); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
129 // get text by sectionId from LGService |
81 | 130 $viewmodel->SetTextFromSectionId(); |
53
f9594c240826
get/update text after saving, for xml file consistency
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
47
diff
changeset
|
131 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
132 } else if ($this->postdata['sectionId'] != 0) { |
81 | 133 $viewmodel->SetTextFromLocal($this->postdata['sectionId']); |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
134 $viewmodel->SetBookMetadataBySectionId(); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
135 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
136 } else if (is_numeric($this->urlvalues['id'])) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
137 // get text from local file system (for development stage only) |
81 | 138 $viewmodel->SetTextFromLocal($this->urlvalues['id']); |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
139 $viewmodel->SetBookMetadataBySectionId(); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
140 $this->ReturnView_localtest($viewmodel->StartTagging(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
141 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
142 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
143 } else { |
58
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
144 $viewmodel->messages['error'] .= "wrong url!!"; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
145 return; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
146 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
147 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
148 $this->ReturnView($viewmodel->StartTagging(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
149 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
150 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
151 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
152 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
153 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
154 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
155 |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
156 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
157 protected function ExportTable() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
158 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
159 * ExportTable action returns "./views/Extractapp/ExportTable.php" view. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
160 */ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
161 $viewmodel = $this->viewmodel; |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
162 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
163 if (isset($this->postdata['func'])) { |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
164 $func = $this->postdata['func']; |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
165 } else { |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
166 $func = ""; |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
167 } |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
168 switch ($func) { |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
169 case 'exportFromExtractionInterface': |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
170 $this->ReturnView($viewmodel->ExportTable($this->postdata, false), true); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
171 break; |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
172 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
173 default: // from file |
81 | 174 $viewmodel->SetInfoFromPreviousPage($this->postdata); |
175 $viewmodel->SetTextFromFileId(); | |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
176 $this->ReturnView($viewmodel->ExportTable($this->postdata, true), true); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
177 break; |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
178 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
179 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
180 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
181 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
182 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
183 protected function EditWordlist() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
184 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
185 * EditWordlist action returns "./views/Extractapp/EditWordlist.php" view, |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
186 * It adds or saves wordlist based on the 'func' variable in postdata. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
187 */ |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
188 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
189 $viewmodel = $this->viewmodel; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
190 if (isset($this->postdata['func'])) { |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
191 $func = $this->postdata['func']; |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
192 } else { |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
193 $func = ""; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
194 } |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
195 switch ($func) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
196 case 'AddNewList': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
197 $this->ReturnView($viewmodel->AddNewList($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
198 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
199 case 'SaveWordlist': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
200 $this->ReturnView($viewmodel->SaveWordlist($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
201 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
202 default: // EditWordlist |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
203 $this->ReturnView($viewmodel->EditWordlist(), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
204 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
205 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
206 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
207 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
208 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
209 protected function EditTaglist() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
210 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
211 * EditTaglist action returns "./views/Extractapp/EditTaglist.php" view. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
212 * It adds, saves or delete tag in the current topic. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
213 */ |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
214 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
215 $viewmodel = $this->viewmodel; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
216 if (isset($this->postdata['func'])) { |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
217 $func = $this->postdata['func']; |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
218 } else { |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
219 $func = ""; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
220 } |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
221 switch ($func) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
222 case 'NewTagElement': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
223 $this->ReturnView($viewmodel->NewTagElement($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
224 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
225 case 'SaveTagElement': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
226 $this->ReturnView($viewmodel->SaveTagElement($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
227 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
228 case 'DeleteTag': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
229 $this->ReturnView($viewmodel->DeleteTag($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
230 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
231 default: // EditTaglist |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
232 $this->ReturnView($viewmodel->EditTaglist($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
233 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
234 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
235 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
236 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
237 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
238 protected function ConfigTagsInTopic() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
239 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
240 * ConfigTagsInTopic action returns "./views/Extractapp/ConfigTagsInTopic.php" view. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
241 * It shows or updates the tags-in-topic relation. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
242 */ |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
74
diff
changeset
|
243 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
244 $viewmodel = $this->viewmodel; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
245 if (isset($this->postdata['func'])) { |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
246 $func = $this->postdata['func']; |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
247 } else { |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
248 $func = ""; |
71
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
249 } |
26d8c4c43d86
minor checking for variable/index in php
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
69
diff
changeset
|
250 switch ($func) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
251 case 'Update': |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
252 $viewmodel->UpdateTagsInTopic($this->postdata); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
253 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
254 default: |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
255 $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
256 break; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
257 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
258 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
259 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
260 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
261 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
262 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
263 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
264 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
265 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
266 ?> |