Commit e6e5b2592cd178bbe5ba1587ff73211bd76e30f5
1 parent
18d4a11e
Exists in
master
and in
111 other branches
Add kill plot request
Showing
4 changed files
with
81 additions
and
14 deletions
Show diff stats
js/app/models/ExecutableNode.js
php/classes/AmdaAction.php
... | ... | @@ -899,20 +899,13 @@ class AmdaAction { |
899 | 899 | } |
900 | 900 | |
901 | 901 | /* |
902 | - * kill plot process by tabID | |
902 | + * kill plot process | |
903 | 903 | */ |
904 | 904 | |
905 | - public function killPlotRequest($obj) | |
906 | - { | |
907 | - $objectMgr = new RequestMgr('request'); | |
908 | - if (count($obj->tabId) > 1) | |
909 | - { | |
910 | - return $objectMgr->killMultiPlot($obj->tabId); | |
911 | - } | |
912 | - else | |
913 | - { | |
914 | - return $objectMgr->killPlot($obj->tabId); | |
915 | - } | |
905 | + public function killPlotRequest() | |
906 | + { | |
907 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
908 | + return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS); | |
916 | 909 | } |
917 | 910 | |
918 | 911 | /* | ... | ... |
php/classes/RequestMgr.php
... | ... | @@ -168,7 +168,78 @@ class RequestMgr extends AmdaObjectMgr { |
168 | 168 | } |
169 | 169 | |
170 | 170 | |
171 | - | |
171 | + /* | |
172 | + * Change NAME in JSON resource | |
173 | + */ | |
174 | + protected function renameInResource($name, $id) { | |
175 | + | |
176 | + $obj = json_decode(file_get_contents(USERREQDIR.$id)); | |
177 | + $obj->name = $name; | |
178 | + | |
179 | + $file = fopen(USERREQDIR.$id, 'w'); | |
180 | + fwrite($file, json_encode($obj)); | |
181 | + fclose($file); | |
182 | + } | |
183 | + | |
184 | + | |
185 | + /* | |
186 | + * Make new request/condition resource file (JSON!!) and add it to content file | |
187 | + * ATTENTION : it is not DD parameter!!! | |
188 | + */ | |
189 | + protected function createParameter($p) | |
190 | + { | |
191 | + if ($this -> objectExistsByName($p->name)) { | |
192 | + $p->id = $this->getObjectIdByName($p->name); | |
193 | + $this -> deleteObject($p); | |
194 | + } | |
195 | + $this->id = $this->setId(); | |
196 | + if (!$this->id) return array('error' => ID_CREATION_ERROR); | |
197 | + | |
198 | + //if alias exists, replace alias name by parameter name | |
199 | + if (file_exists(USERWSDIR.'Alias.xml')) { | |
200 | + if ($this->type == 'condition') { | |
201 | + $p->expression = $this->resetAlias($p->expression); | |
202 | + $info = $p->expression; | |
203 | + } | |
204 | + else if ($this->type == 'request') { | |
205 | + $info = ''; | |
206 | + for ($i=0; $i < count($p->children); $i++) { | |
207 | + for ($j=0; $j < count($p->children[$i]->children); $j++) { | |
208 | + $p->children[$i]->children[$j]->name = $this->resetAlias($p->children[$i]->children[$j]->name); | |
209 | + $info = $info.' '.$p->children[$i]->children[$j]->name; | |
210 | + } | |
211 | + } | |
212 | + } | |
213 | + } | |
214 | + | |
215 | + $this->descFileName = USERREQDIR.$this->id; | |
216 | + $p->id = $this->id; | |
217 | + // save request as json | |
218 | + $file = fopen($this->descFileName, 'w'); | |
219 | + fwrite($file, json_encode($p)); | |
220 | + fclose($file); | |
221 | + | |
222 | + $this -> addToContent($p, $folder); | |
223 | + | |
224 | + return array('id' => $this->id, 'info' => $info); | |
225 | + } | |
226 | + | |
227 | + /* | |
228 | + * Delete request/condition JSON file | |
229 | + */ | |
230 | + protected function deleteParameter($id){ | |
231 | + | |
232 | + if (file_exists(USERREQDIR.$id)) | |
233 | + unlink(USERREQDIR.$id); | |
234 | + } | |
235 | + | |
236 | + /* | |
237 | + * TODO Check file JSON objects differ in names only | |
238 | + */ | |
239 | + protected function renameOnly($p) { | |
240 | + | |
241 | + return false; | |
242 | + } | |
172 | 243 | |
173 | 244 | |
174 | 245 | } | ... | ... |