public function runConfigureWorkflowSteps(TBGRequest $request) { $this->workflow = null; $this->mode = $request->getParameter('mode', 'list'); try { $this->workflow = TBGContext::factory()->TBGWorkflow($request->getParameter('workflow_id')); if ($this->mode == 'copy_workflow') { if ($new_name = $request->getParameter('new_name')) { $new_workflow = $this->workflow->copy($new_name); return $this->renderJSON(array('content' => $this->getTemplateHTML('configuration/workflow', array('workflow' => $new_workflow)), 'total_count' => TBGWorkflow::getCustomWorkflowsCount(), 'more_available' => TBGContext::getScope()->hasCustomWorkflowsAvailable())); } else { $this->error = TBGContext::getI18n()->__('Please enter a valid name'); } } elseif ($this->mode == 'delete_workflow') { $this->workflow->delete(); return $this->renderJSON(array('success' => true, 'message' => TBGContext::getI18n()->__('The workflow was deleted'), 'total_count' => TBGWorkflow::getCustomWorkflowsCount(), 'more_available' => TBGContext::getScope()->hasCustomWorkflowsAvailable())); } } catch (Exception $e) { if ($request->getRequestedFormat() == 'json') { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('success' => false, 'message' => TBGContext::getI18n()->__('An error occured'), 'error' => $e->getMessage())); } else { $this->error = TBGContext::getI18n()->__('This workflow does not exist'); } } }
public function hasCustomWorkflowsAvailable() { if ($this->isCustomWorkflowsEnabled()) { return $this->getMaxWorkflowsLimit() ? TBGWorkflow::getCustomWorkflowsCount() < $this->getMaxWorkflowsLimit() : true; } else { return false; } }
public function runConfigureWorkflowSteps(TBGRequest $request) { $this->workflow = null; $this->mode = $request->getParameter('mode', 'list'); try { $this->workflow = TBGContext::factory()->TBGWorkflow($request['workflow_id']); // $transition = new TBGWorkflowTransition(); // $step = TBGWorkflowStepsTable::getTable()->selectById(9); // $transition->setOutgoingStep($step); // $transition->setName('Initial transition'); // $transition->setWorkflow($this->workflow); // $transition->setScope(TBGContext::getScope()); // $transition->setDescription('This is the initial transition for issues using this workflow'); // $transition->save(); // $this->workflow->setInitialTransition($transition); // $this->workflow->save(); if ($this->mode == 'copy_workflow') { if ($new_name = $request['new_name']) { $new_workflow = $this->workflow->copy($new_name); return $this->renderJSON(array('content' => $this->getTemplateHTML('configuration/workflow', array('workflow' => $new_workflow)), 'total_count' => TBGWorkflow::getCustomWorkflowsCount(), 'more_available' => TBGContext::getScope()->hasCustomWorkflowsAvailable())); } else { $this->error = $this->getI18n()->__('Please enter a valid name'); } } elseif ($this->mode == 'delete_workflow') { $this->workflow->delete(); return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('The workflow was deleted'), 'total_count' => TBGWorkflow::getCustomWorkflowsCount(), 'more_available' => TBGContext::getScope()->hasCustomWorkflowsAvailable())); } } catch (Exception $e) { if ($request->getRequestedFormat() == 'json') { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('success' => false, 'message' => $this->getI18n()->__('An error occured'), 'error' => $e->getMessage())); } else { $this->error = $this->getI18n()->__('This workflow does not exist'); } } }
?> </div> <div class="content"> <?php echo __('Workflow lets you define the lifecycle of an issue. You can define steps, transitions and more, that makes an issue move through its defined lifecycle.'); ?> <?php echo __('You can read more about how the workflow in The Bug Genie works and is set up in %link_to_wiki_workflow%.', array('%link_to_wiki_workflow%' => link_tag(make_url('publish_article', array('article_name' => 'TheBugGenie:Workflow')), 'TheBugGenie:Workflow'))); ?> </div> <?php if (TBGContext::getScope()->getMaxWorkflowsLimit()) { ?> <div class="faded_out dark" style="margin: 12px 0;"> <?php echo __('This instance is currently using %num% of max %max% custom workflows', array('%num%' => '<b id="current_workflow_num_count">' . TBGWorkflow::getCustomWorkflowsCount() . '</b>', '%max%' => '<b>' . TBGContext::getScope()->getMaxWorkflowsLimit() . '</b>')); ?> </div> <?php } ?> <br style="clear: both;"> <div class="tab_menu" style="margin-top: 20px;"> <ul id="workflow_menu"> <li<?php if ($selected_tab == 'workflows') { ?> class="selected"<?php } ?> ><?php