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); TBGWorkflowSchemesTable::getTable()->loadFixtures($this); TBGWorkflowIssuetypeTable::getTable()->loadFixtures($this); // Set up left menu links TBGLinksTable::getTable()->loadFixtures($this); }
public function getMenuItems($target_id = 0) { return TBGLinksTable::getTable()->getLinks('wiki', $target_id); }
public function runSaveMenuOrder(TBGRequest $request) { $target_type = $request['target_type']; $target_id = $request['target_id']; TBGLinksTable::getTable()->saveLinkOrder($request[$target_type . '_' . $target_id . '_links']); if ($target_type == 'main_menu') { TBGCache::delete(TBGCache::KEY_MAIN_MENU_LINKS); TBGCache::fileDelete(TBGCache::KEY_MAIN_MENU_LINKS); } return $this->renderJSON('ok'); }
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; }
/** * Returns all the links on the frontpage * * @return array */ public static function getMainLinks() { if (!($links = TBGCache::get(TBGCache::KEY_MAIN_MENU_LINKS))) { $links = TBGLinksTable::getTable()->getMainLinks(); if (!self::isInstallmode()) { TBGCache::add(TBGCache::KEY_MAIN_MENU_LINKS, $links); } } return $links; }
/** * Attach a link to the issue * * @param string $url The url of the link * @param string $description[optional] a description */ public function attachLink($url, $description = null) { $link_id = TBGLinksTable::getTable()->addLinkToIssue($this->getID(), $url, $description); return $link_id; }
public function runRemoveLink(TBGRequest $request) { if ($request->getParameter('link_id') != 0) { TBGLinksTable::getTable()->removeByTargetTypeTargetIDandLinkID($request->getParameter('target_type'), $request->getParameter('target_id'), $request->getParameter('link_id')); return $this->renderJSON(array('failed' => false, 'message' => TBGContext::getI18n()->__('Link removed!'))); } return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('You have to provide a valid link id'))); }