Commit 21bfbb96c3482f85ad51e0b8e5cf4acb485aa99d
1 parent
9aebefe4
use "ui/dot" entry from config.ini.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6001 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
47 additions
and
33 deletions
config/config.ini
plugins/ktcore/admin/workflowsv2.php
| ... | ... | @@ -101,9 +101,12 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 101 | 101 | ); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - // FIXME actually detect this. | |
| 105 | - $this->HAVE_GRAPHVIZ = true; | |
| 106 | - | |
| 104 | + $this->HAVE_GRAPHVIZ = false; | |
| 105 | + $dotCommand = KTUtil::findCommand("ui/dot", 'dot'); | |
| 106 | + if (!empty($dotCommand)) { | |
| 107 | + $this->HAVE_GRAPHVIZ = true; | |
| 108 | + $this->dotCommand = $dotCommand; | |
| 109 | + } | |
| 107 | 110 | } |
| 108 | 111 | |
| 109 | 112 | function do_main() { |
| ... | ... | @@ -155,16 +158,18 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 155 | 158 | |
| 156 | 159 | // we want to "outsource" some of the analysis |
| 157 | 160 | |
| 158 | - $graph_data = $this->get_graph($this->oWorkflow); | |
| 159 | - if (!empty($graph_data['errors'])) { | |
| 160 | - foreach ($graph_data['errors'] as $error) { | |
| 161 | - $this->addErrorMessage($error); | |
| 161 | + if ($this->HAVE_GRAPHVIZ) { | |
| 162 | + $graph_data = $this->get_graph($this->oWorkflow); | |
| 163 | + if (!empty($graph_data['errors'])) { | |
| 164 | + foreach ($graph_data['errors'] as $error) { | |
| 165 | + $this->addErrorMessage($error); | |
| 166 | + } | |
| 162 | 167 | } |
| 163 | - } | |
| 164 | - | |
| 165 | - if (!empty($graph_data['info'])) { | |
| 166 | - foreach ($graph_data['info'] as $info) { | |
| 167 | - $this->addInfoMessage($info); | |
| 168 | + | |
| 169 | + if (!empty($graph_data['info'])) { | |
| 170 | + foreach ($graph_data['info'] as $info) { | |
| 171 | + $this->addInfoMessage($info); | |
| 172 | + } | |
| 168 | 173 | } |
| 169 | 174 | } |
| 170 | 175 | |
| ... | ... | @@ -288,18 +293,20 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 288 | 293 | $aTransitions = KTWorkflowTransition::getByWorkflow($this->oWorkflow); |
| 289 | 294 | |
| 290 | 295 | |
| 291 | - $graph_data = $this->get_graph($this->oWorkflow); | |
| 292 | - if (!empty($graph_data['errors'])) { | |
| 293 | - foreach ($graph_data['errors'] as $error) { | |
| 294 | - $this->addErrorMessage($error); | |
| 296 | + if ($this->HAVE_GRAPHVIZ) { | |
| 297 | + $graph_data = $this->get_graph($this->oWorkflow); | |
| 298 | + if (!empty($graph_data['errors'])) { | |
| 299 | + foreach ($graph_data['errors'] as $error) { | |
| 300 | + $this->addErrorMessage($error); | |
| 301 | + } | |
| 295 | 302 | } |
| 296 | - } | |
| 297 | - | |
| 298 | - if (!empty($graph_data['info'])) { | |
| 299 | - foreach ($graph_data['info'] as $info) { | |
| 300 | - $this->addInfoMessage($info); | |
| 303 | + | |
| 304 | + if (!empty($graph_data['info'])) { | |
| 305 | + foreach ($graph_data['info'] as $info) { | |
| 306 | + $this->addInfoMessage($info); | |
| 307 | + } | |
| 301 | 308 | } |
| 302 | - } | |
| 309 | + } | |
| 303 | 310 | |
| 304 | 311 | $oTemplate->setData(array( |
| 305 | 312 | 'context' => $this, |
| ... | ... | @@ -363,18 +370,20 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 363 | 370 | } |
| 364 | 371 | |
| 365 | 372 | |
| 366 | - $graph_data = $this->get_graph($this->oWorkflow); | |
| 367 | - if (!empty($graph_data['errors'])) { | |
| 368 | - foreach ($graph_data['errors'] as $error) { | |
| 369 | - $this->addErrorMessage($error); | |
| 373 | + if ($this->HAVE_GRAPHVIZ) { | |
| 374 | + $graph_data = $this->get_graph($this->oWorkflow); | |
| 375 | + if (!empty($graph_data['errors'])) { | |
| 376 | + foreach ($graph_data['errors'] as $error) { | |
| 377 | + $this->addErrorMessage($error); | |
| 378 | + } | |
| 370 | 379 | } |
| 371 | - } | |
| 372 | - | |
| 373 | - if (!empty($graph_data['info'])) { | |
| 374 | - foreach ($graph_data['info'] as $info) { | |
| 375 | - $this->addInfoMessage($info); | |
| 380 | + | |
| 381 | + if (!empty($graph_data['info'])) { | |
| 382 | + foreach ($graph_data['info'] as $info) { | |
| 383 | + $this->addInfoMessage($info); | |
| 384 | + } | |
| 376 | 385 | } |
| 377 | - } | |
| 386 | + } | |
| 378 | 387 | |
| 379 | 388 | $oTemplate->setData(array( |
| 380 | 389 | 'context' => $this, |
| ... | ... | @@ -2133,7 +2142,8 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 2133 | 2142 | 'fontname' => $fontname, |
| 2134 | 2143 | ); |
| 2135 | 2144 | |
| 2136 | - $graph = new Image_GraphViz(true, $opts); | |
| 2145 | + $graph = new Image_GraphViz(true, $opts); | |
| 2146 | + $graph->dotCommand = $this->dotCommand; | |
| 2137 | 2147 | |
| 2138 | 2148 | // we need all states & transitions |
| 2139 | 2149 | // FIXME do we want guards? |
| ... | ... | @@ -2287,6 +2297,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { |
| 2287 | 2297 | $sourceless_transitions[] = $oTransition->getHumanName(); |
| 2288 | 2298 | } |
| 2289 | 2299 | } |
| 2300 | + | |
| 2290 | 2301 | if (!empty($sourceless_transitions)) { |
| 2291 | 2302 | $errors[] = sprintf(_kt("Some transitions have no source states: %s"), implode(', ', $sourceless_transitions)); |
| 2292 | 2303 | } | ... | ... |