public static function loadFixtures(TBGScope $scope)
 {
     $scheme = new TBGWorkflowScheme();
     $scheme->setScope($scope);
     $scheme->setName("Default workflow scheme");
     $scheme->setDescription("This is the default workflow scheme. It is used by all projects with no specific workflow scheme selected. This scheme cannot be edited or removed.");
     $scheme->save();
     TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, $scheme->getID(), 'core', $scope->getID());
 }
 protected static function _populateSchemes()
 {
     if (self::$_schemes === null) {
         self::$_schemes = array();
         if ($res = TBGWorkflowSchemesTable::getTable()->getAll()) {
             while ($row = $res->getNextRow()) {
                 $scheme = TBGContext::factory()->TBGWorkflowScheme($row->get(TBGWorkflowSchemesTable::ID), $row);
                 if (self::$_core_scheme === null) {
                     self::$_core_scheme = $scheme;
                 }
                 self::$_schemes[$row->get(TBGWorkflowSchemesTable::ID)] = $scheme;
             }
         }
     }
 }
 public function runConfigureWorkflowScheme(TBGRequest $request)
 {
     $this->workflow_scheme = null;
     $this->mode = $request->getParameter('mode', 'list');
     try {
         $this->workflow_scheme = TBGContext::factory()->TBGWorkflowScheme($request->getParameter('scheme_id'));
         $this->issuetypes = TBGIssuetype::getAll();
         if (TBGContext::getScope()->isCustomWorkflowsEnabled() && $this->mode == 'copy_scheme') {
             if ($new_name = $request->getParameter('new_name')) {
                 $new_scheme = new TBGWorkflowScheme();
                 $new_scheme->setName($new_name);
                 $new_scheme->save();
                 foreach ($this->issuetypes as $issuetype) {
                     if ($this->workflow_scheme->hasWorkflowAssociatedWithIssuetype($issuetype)) {
                         $new_scheme->associateIssuetypeWithWorkflow($issuetype, $this->workflow_scheme->getWorkflowForIssuetype($issuetype));
                     }
                 }
                 return $this->renderJSON(array('content' => $this->getTemplateHTML('configuration/workflowscheme', array('scheme' => $new_scheme))));
             } else {
                 $this->error = TBGContext::getI18n()->__('Please enter a valid name');
             }
         } elseif (TBGContext::getScope()->isCustomWorkflowsEnabled() && $this->mode == 'delete_scheme') {
             $this->workflow_scheme->delete();
             return $this->renderJSON(array('success' => true, 'message' => TBGContext::getI18n()->__('The workflow scheme was deleted')));
         } elseif (TBGContext::getScope()->isCustomWorkflowsEnabled() && $request->isMethod(TBGRequest::POST)) {
             foreach ($request->getParameter('workflow_id', array()) as $issuetype_id => $workflow_id) {
                 $issuetype = TBGContext::factory()->TBGIssuetype($issuetype_id);
                 if ($workflow_id) {
                     $workflow = TBGContext::factory()->TBGWorkflow($workflow_id);
                     $this->workflow_scheme->associateIssuetypeWithWorkflow($issuetype, $workflow);
                 } else {
                     $this->workflow_scheme->unassociateIssuetype($issuetype);
                 }
             }
             return $this->renderJSON(array('success' => true, 'message' => TBGContext::getI18n()->__('Workflow associations were updated')));
         }
     } 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 scheme does not exist');
         }
     }
 }
 /**
  * Create a new project and return it
  *
  * @param string $name
  * 
  * @return TBGProject
  */
 public function _preSave($is_new)
 {
     $project = self::getByKey($this->getKey());
     // TBGProjectsTable::getTable()->getByKey($this->getKey());
     if ($project instanceof TBGProject && $project->getID() != $this->getID()) {
         throw new InvalidArgumentException("A project with this key already exists");
     }
     if ($is_new) {
         $this->setIssuetypeScheme(TBGIssuetypeScheme::getCoreScheme());
         $this->setWorkflowScheme(TBGWorkflowScheme::getCoreScheme());
     }
 }
    if ($scheme == $project->getWorkflowScheme()) {
        continue;
    }
    ?>
						<option value="<?php 
    echo $scheme->getID();
    ?>
"><?php 
    echo $scheme->getName();
    ?>
</option>
					<?php 
}
?>
					<?php 
if (count(TBGWorkflowScheme::getAll()) < 2) {
    ?>
						<option disabled="disabled" value="0"><?php 
    echo __('No other workflows');
    ?>
</option>
					<?php 
}
?>
				</select></h3>
				<input class="button button-silver" type="submit" value="<?php 
echo __('Continue');
?>
">
			</form>
		</div>
示例#6
0
									<th><?php 
echo __('Name');
?>
</th>
									<th><?php 
echo __('ID');
?>
</th>
								</tr>
							</thead>
							<tbody>
						<?php 
foreach (TBGIssuetypeScheme::getAll() as $item) {
    echo '<tr><td>' . __('Issue type scheme') . '</td><td>' . $item->getName() . '</td><td>' . $item->getID() . '</td></tr>';
}
foreach (TBGWorkflowScheme::getAll() as $item) {
    echo '<tr><td>' . __('Workflow scheme') . '</td><td>' . $item->getName() . '</td><td>' . $item->getID() . '</td></tr>';
}
foreach (TBGProject::getAll() as $item) {
    echo '<tr><td>' . __('Project') . '</td><td>' . $item->getName() . '</td><td>' . $item->getID() . '</td></tr>';
    foreach (TBGMilestone::getAllByProjectID($item->getID()) as $item2) {
        echo '<tr><td>' . __('Milestone for project') . ' ' . $item->getID() . '</td><td>' . $item2->getName() . '</td><td>' . $item2->getID() . '</td></tr>';
    }
}
foreach (TBGReproducability::getAll() as $item) {
    echo '<tr><td>' . __('Reproducability') . '</td><td>' . $item->getName() . '</td><td>' . $item->getID() . '</td></tr>';
}
foreach (TBGSeverity::getAll() as $item) {
    echo '<tr><td>' . __('Severity') . '</td><td>' . $item->getName() . '</td><td>' . $item->getID() . '</td></tr>';
}
foreach (TBGCategory::getAll() as $item) {
示例#7
0
 protected function _upgradeFrom3dot1()
 {
     // Add classpath for existing old tables used for upgrade
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.1');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes');
     // Create new tables
     TBGDashboardViewsTable::getTable()->create();
     TBGOpenIdAccountsTable::getTable()->create();
     TBGProjectAssignedUsersTable::getTable()->create();
     TBGProjectAssignedTeamsTable::getTable()->create();
     TBGEditionAssignedUsersTable::getTable()->create();
     TBGEditionAssignedTeamsTable::getTable()->create();
     TBGComponentAssignedUsersTable::getTable()->create();
     TBGComponentAssignedTeamsTable::getTable()->create();
     TBGRolePermissionsTable::getTable()->create();
     TBGUserScopesTable::getTable()->create();
     // Upgrade existing tables
     TBGProjectsTable::getTable()->upgrade(TBGProjectsTable3dot1::getTable());
     TBGUsersTable::getTable()->upgrade(TBGUsersTable3dot1::getTable());
     TBGIssuesTable::getTable()->upgrade(TBGIssuesTable3dot1::getTable());
     TBGIssueTypesTable::getTable()->upgrade(TBGIssueTypesTable3dot1::getTable());
     TBGListTypesTable::getTable()->upgrade(TBGListTypesTable3dot1::getTable());
     TBGEditionsTable::getTable()->upgrade(TBGEditionsTable3dot1::getTable());
     TBGBuildsTable::getTable()->upgrade(TBGBuildsTable3dot1::getTable());
     TBGCommentsTable::getTable()->upgrade(TBGCommentsTable3dot1::getTable());
     TBGComponentsTable::getTable()->upgrade(TBGComponentsTable3dot1::getTable());
     TBGCustomFieldsTable::getTable()->upgrade(TBGCustomFieldsTable3dot1::getTable());
     TBGCustomFieldOptionsTable::getTable()->upgrade(TBGCustomFieldOptionsTable3dot1::getTable());
     TBGIssueCustomFieldsTable::getTable()->upgrade(TBGIssueCustomFieldsTable3dot1::getTable());
     // Create new module tables
     TBGIncomingEmailAccountTable::getTable()->create();
     // Add new indexes
     TBGArticlesTable::getTable()->createIndexes();
     TBGCommentsTable::getTable()->createIndexes();
     TBGIssueAffectsBuildTable::getTable()->createIndexes();
     TBGIssueAffectsComponentTable::getTable()->createIndexes();
     TBGIssueAffectsEditionTable::getTable()->createIndexes();
     TBGIssueFieldsTable::getTable()->createIndexes();
     TBGIssueFilesTable::getTable()->createIndexes();
     TBGIssuesTable::getTable()->createIndexes();
     TBGIssuetypeSchemesTable::getTable()->createIndexes();
     TBGPermissionsTable::getTable()->createIndexes();
     TBGProjectsTable::getTable()->createIndexes();
     TBGSettingsTable::getTable()->createIndexes();
     TBGTeamMembersTable::getTable()->createIndexes();
     TBGUserIssuesTable::getTable()->createIndexes();
     TBGUsersTable::getTable()->createIndexes();
     TBGUserScopesTable::getTable()->createIndexes();
     if (TBGContext::getRequest()->getParameter('fix_my_timestamps', false)) {
         $this->_fixTimestamps();
     }
     foreach (TBGScope::getAll() as $scope) {
         TBGRole::loadFixtures($scope);
         foreach (TBGDatatype::getTypes() as $type => $class) {
             TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
         }
         TBGContext::setPermission('page_confirm_scope_access', 0, 'core', 0, 0, 0, true, $scope->getID());
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOW, 'core', $scope->getID())) {
             $workflow_id = TBGWorkflowsTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOW, $workflow_id, 'core', $scope->getID());
             } else {
                 TBGWorkflow::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, 'core', $scope->getID())) {
             $workflow_scheme_id = TBGWorkflowSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, $workflow_scheme_id, 'core', $scope->getID());
             } else {
                 TBGWorkflowScheme::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, 'core', $scope->getID())) {
             $issuetype_scheme_id = TBGIssuetypeSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($issuetype_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, $issuetype_scheme_id, 'core', $scope->getID());
             } else {
                 TBGIssuetypeScheme::loadFixtures($scope);
             }
         }
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, 0, 'core', $scope->getID());
     }
     $linkstable = TBGLinksTable::getTable();
     $crit = $linkstable->getCriteria();
     $crit->addUpdate(TBGLinksTable::URL, 'http://issues.thebuggenie.com');
     $crit->addWhere(TBGLinksTable::URL, 'http://thebuggenie.com/thebuggenie');
     $crit->addOr(TBGLinksTable::URL, 'http://www.thebuggenie.com/thebuggenie');
     $linkstable->doUpdate($crit);
     $listtypestable = TBGListTypesTable::getTable();
     $crit = $listtypestable->getCriteria();
     $crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'role');
     $crit->addWhere(TBGListTypesTable::ITEMTYPE, 'projectrole');
     $listtypestable->doUpdate($crit);
     $crit = $listtypestable->getCriteria();
     $crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'priority');
     $crit->addWhere(TBGListTypesTable::ITEMTYPE, 'b2_prioritytypes');
     $listtypestable->doUpdate($crit);
     TBGWorkflowTransitionsTable::getTable()->upgradeFrom3dot1();
     TBGSettings::saveSetting(TBGSettings::SETTING_ICONSET, TBGSettings::get(TBGSettings::SETTING_THEME_NAME));
     TBGContext::setPermission('readarticle', 0, 'publish', 0, 0, 0, true);
     foreach (TBGProject::getAll() as $project) {
         TBGDashboardViewsTable::getTable()->setDefaultViews($project->getID(), TBGDashboardViewsTable::TYPE_PROJECT);
         if (!$project->getKey()) {
             $project->setName($project->getName());
         }
     }
     $this->upgrade_complete = true;
 }
}
?>
			</td>
		</tr>
		<tr>
			<td><label for="workflow_scheme"><?php 
echo __('Workflow scheme');
?>
</label></td>
			<td>
				<?php 
if ($access_level == TBGSettings::ACCESS_FULL) {
    ?>
					<select name="workflow_scheme" id="workflow_scheme">
						<?php 
    foreach (TBGWorkflowScheme::getAll() as $workflow_scheme) {
        ?>
							<option value=<?php 
        echo $workflow_scheme->getID();
        if ($project->getWorkflowScheme()->getID() == $workflow_scheme->getID()) {
            ?>
 selected<?php 
        }
        ?>
><?php 
        echo $workflow_scheme->getName();
        ?>
</option>
						<?php 
    }
    ?>
示例#9
0
 public function loadFixtures()
 {
     // Load initial settings
     TBGSettingsTable::getTable()->loadFixtures($this);
     TBGSettings::loadSettings();
     // Load group, users and permissions fixtures
     TBGGroup::loadFixtures($this);
     // Load initial teams
     TBGTeam::loadFixtures($this);
     // Set up user states, like "available", "away", etc
     TBGUserstate::loadFixtures($this);
     // Set up data types
     list($b_id, $f_id, $e_id, $t_id, $u_id, $i_id) = TBGIssuetype::loadFixtures($this);
     $scheme = TBGIssuetypeScheme::loadFixtures($this);
     TBGIssueFieldsTable::getTable()->loadFixtures($this, $scheme, $b_id, $f_id, $e_id, $t_id, $u_id, $i_id);
     TBGDatatype::loadFixtures($this);
     // Set up workflows
     TBGWorkflow::loadFixtures($this);
     TBGWorkflowScheme::loadFixtures($this);
     TBGWorkflowIssuetypeTable::getTable()->loadFixtures($this);
     // Set up left menu links
     TBGLinksTable::getTable()->loadFixtures($this);
 }