/** * The project dashboard * * @param TBGRequest $request */ public function runDashboard(TBGRequest $request) { $this->forward403unless($this->_checkProjectPageAccess('project_dashboard')); if ($request->isPost() && $request['setup_default_dashboard'] && $this->getUser()->canEditProjectDetails($this->selected_project)) { TBGDashboardViewsTable::getTable()->setDefaultViews($this->selected_project->getID(), TBGDashboardViewsTable::TYPE_PROJECT); $this->forward($this->getRouting()->generate('project_dashboard', array('project_key' => $this->selected_project->getKey()))); } $this->views = TBGDashboardView::getViews($this->selected_project->getID(), TBGDashboardViewsTable::TYPE_PROJECT); }
/** * Performs post-save actions on user objects * * This includes firing off events for modules to listen to (e.g. so * activation emails can be sent out), and setting up a default * dashboard for the new user. * * @param boolean $is_new Whether this is a new object or not (automatically passed to the function from B2DB) */ protected function _postSave($is_new) { if ($is_new) { // Set up a default dashboard for the user TBGDashboardViewsTable::getTable()->setDefaultViews($this->getID(), TBGDashboardViewsTable::TYPE_USER); $scope = TBGContext::factory()->TBGScope((int) TBGSettings::getDefaultScopeID()); $this->addScope($scope, false); $this->confirmScope($scope->getID()); if (!TBGContext::getScope()->isDefault()) { $scope = TBGContext::getScope(); $this->addScope($scope, false); $this->confirmScope($scope->getID()); } $event = TBGEvent::createNew('core', 'TBGUser::_postSave', $this); $event->trigger(); } if ($this->_group_id !== null) { TBGUserScopesTable::getTable()->updateUserScopeGroup($this->getID(), TBGContext::getScope()->getID(), $this->_group_id); } }
/** * Developer dashboard * * @param TBGRequest $request */ public function runDashboard(TBGRequest $request) { $this->forward403unless(!$this->getUser()->isThisGuest() && $this->getUser()->hasPageAccess('dashboard')); if (TBGSettings::isSingleProjectTracker()) { if (($projects = TBGProject::getAll()) && ($project = array_shift($projects))) { TBGContext::setCurrentProject($project); } } if ($request->isPost() && $request['setup_default_dashboard']) { TBGDashboardViewsTable::getTable()->setDefaultViews($this->getUser()->getID(), TBGDashboardViewsTable::TYPE_USER); $this->forward($this->getRouting()->generate('dashboard')); } $this->views = TBGDashboardView::getUserViews($this->getUser()->getID()); }
public static function setViews($tid, $target_type, $views) { TBGDashboardViewsTable::getTable()->clearViews($tid, $target_type); foreach ($views as $key => $view) { TBGDashboardViewsTable::getTable()->addView($tid, $target_type, $view); } }
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; }
protected function _postSave($is_new) { if ($is_new) { self::$_num_projects = null; self::$_projects = null; TBGDashboardViewsTable::getTable()->setDefaultViews($this->getID(), TBGDashboardViewsTable::TYPE_PROJECT); TBGContext::setPermission("canseeproject", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canseeprojecthierarchy", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canmanageproject", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("page_project_allpages_access", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canvoteforissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canlockandeditlockedissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("cancreateandeditissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("caneditissue", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("caneditissuecustomfields", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canaddextrainformationtoissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGContext::setPermission("canpostseeandeditallcomments", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true); TBGEvent::createNew('core', 'TBGProject::_postSave', $this)->trigger(); } if ($this->_dodelete) { TBGIssuesTable::getTable()->markIssuesDeletedByProjectID($this->getID()); $this->_dodelete = false; } }