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
| @@ -101,6 +101,9 @@ condensedAdminUI = default | @@ -101,6 +101,9 @@ condensedAdminUI = default | ||
| 101 | ; fakeMimetype = false | 101 | ; fakeMimetype = false |
| 102 | fakeMimetype = default | 102 | fakeMimetype = default |
| 103 | 103 | ||
| 104 | +; "dot" command location | ||
| 105 | +dot = dot | ||
| 106 | + | ||
| 104 | [i18n] | 107 | [i18n] |
| 105 | ; Default language for the interface | 108 | ; Default language for the interface |
| 106 | defaultLanguage = en | 109 | defaultLanguage = en |
plugins/ktcore/admin/workflowsv2.php
| @@ -101,9 +101,12 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -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 | function do_main() { | 112 | function do_main() { |
| @@ -155,16 +158,18 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -155,16 +158,18 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | ||
| 155 | 158 | ||
| 156 | // we want to "outsource" some of the analysis | 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,18 +293,20 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | ||
| 288 | $aTransitions = KTWorkflowTransition::getByWorkflow($this->oWorkflow); | 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 | $oTemplate->setData(array( | 311 | $oTemplate->setData(array( |
| 305 | 'context' => $this, | 312 | 'context' => $this, |
| @@ -363,18 +370,20 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -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 | $oTemplate->setData(array( | 388 | $oTemplate->setData(array( |
| 380 | 'context' => $this, | 389 | 'context' => $this, |
| @@ -2133,7 +2142,8 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -2133,7 +2142,8 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | ||
| 2133 | 'fontname' => $fontname, | 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 | // we need all states & transitions | 2148 | // we need all states & transitions |
| 2139 | // FIXME do we want guards? | 2149 | // FIXME do we want guards? |
| @@ -2287,6 +2297,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -2287,6 +2297,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | ||
| 2287 | $sourceless_transitions[] = $oTransition->getHumanName(); | 2297 | $sourceless_transitions[] = $oTransition->getHumanName(); |
| 2288 | } | 2298 | } |
| 2289 | } | 2299 | } |
| 2300 | + | ||
| 2290 | if (!empty($sourceless_transitions)) { | 2301 | if (!empty($sourceless_transitions)) { |
| 2291 | $errors[] = sprintf(_kt("Some transitions have no source states: %s"), implode(', ', $sourceless_transitions)); | 2302 | $errors[] = sprintf(_kt("Some transitions have no source states: %s"), implode(', ', $sourceless_transitions)); |
| 2292 | } | 2303 | } |